Sleepy Pi FAQ

The Sleepy PI 2 FAQ can be found here.

Power

What Are My Options to Power The Sleepy Pi?

The Sleepy Pi is very flexible about power and can take power from many sources. However, to get the lowest power consumption you need to be aware of a couple of things:

  • 5V power should go to the USB connector on the Sleepy Pi. NOT the USB power on the Raspberry Pi OR the Power Jack on the Sleepy Pi
  • 5.5V – 17V should go into the Power Jack on the Sleepy Pi

If you put 5V into the Power Jack it will most likely work, BUT the regulator will work flat-out to ferry the 5V from the input straight to the output and not be able to go into a low power mode. Thus, you’ll find that the “Sleep” current is much higher than expected (10-20mA) whereas it should be 500uA or below.

Back to Top

Can I Use a 5V USB Rechargeable Battery?

Yes, There seem to be a lot of these coming onto the market, typically used to recharge your mobile phone or tablet whilst on the go.

Plug these into the USB power socket on the Sleepy Pi (NOT the Raspberry Pi) which will pipe the power straight through the regulator giving you the lowest possible power consumption. Don’t use the power jack as that is meant for voltages above 5V.

However be aware that some of these batteries have a minimum current draw; typically 50mA which they use to work out whether they are charging anything or not. If they think there’s no load, then they will switch off. When running the Sleepy Pi with the Raspberry Pi asleep, the current draw will be well below this threshold and they will switch off, which means no power to the system and it will never wake.

Back to Top

Can I Measure the Battery Voltage?

Yes, the main supply input is fed into an analogue input (ADC6) of the Arduino or A6 using the analogRead function. Ok that’s the short answer, the longer one is below:

The voltage from the battery arrives at the A6 pin via a voltage divider: 1M and 56k resistors which reduces the measured voltage to the range of the Arduino. You can either use the reduced value directly (save code space) or actually convert it into a voltage by compensating for the potential divider. For example, relating the count to the voltage (backwards) is:

With a 10 bit ADC converter and 3v3 reference, the resolution is 3.22mV

With a 12V supply the current through the divider will be:

12 / 1,056,000 = 11.4uV

The voltage at ADC 6 will be around 11.4uV x 56k = 0.636V which gives a count of around: 0.636 / 3.22 = 197

To do the actual ADC measurement in arduino code, you could do something like this:

Back to Top

What Is The Power Consumption When The Raspberry Pi Is Switched Off?

When the Raspberry Pi is switched off and the Arduino is in a low power sleep, it consumes around 500uA for a 12V input.

You will find that most bench multimeters are not able to measurement currents this low accurately. If you are into your low power, I recommend getting hold of one of Dave Jones’s uCurrent boxes which will turn your multimeter into a super accurate, low current measuring device.

Back to Top

How Long Will My Battery Last?

This will depend on how often you power up the Raspberry Pi and for how long. For best battery life optimise the boot time and shutdown the Raspberry as soon as you can.

Back to Top

How Much Power Can I Draw From The Expansion Power?

The Sleepy Pi has 3 switched power outputs. These share power with the Raspberry Pi and Sleepy Pi circuitry, but can supply to the outside world:

  • V+ (input from Power Jack) – 500mA
  • 5V – 500mA
  • 3V3 – 50mA

For the V+ and the 5V you can draw up to 500mA from either but not together i.e. the total draw shouldn’t exceed 500mA.

Note: The expansion power is separately switched from the Raspberry Pi power. Therefore, when you power up the Raspberry Pi you can choose if and when, to power up the expansion power. Similarly, you can leave the expansion powered when the Raspberry Pi is powered down.

Back to Top

How Do I Switch On The Expansion Power?

The expansion power is normally off and needs to be switched on in software. The command:

will switch the power on and “false” will switch it off.

Back to Top

What Is The Power Jumper For?

The power jumper is mainly used when developing Arduino code in the Raspberry Pi and uploading the code to the Sleepy Pi. Because the Arduino controls power to the Raspberry Pi, if you reset it, which occurs when you upload code, the Pi will be instantly powered off. Which is a bit of a chicken and egg situation! Adding in the power jumper forces the power to the Pi regardless of what the Arduino is doing and allows you to upload code.

Back to Top

Can I Power From A Solar Panel?

There are a number of ways to do this, and all need 3 additional things:

  • Solar Panel (less than 17V)
  • Charge Controller
  • Battery

One way, is to use a setup commonly used for either camping or sailing. These can be found quite cheaply on eBay or similar and consist of e.g 10W solar panel intended for 12v use, 12V lead acid battery and 12V solar charge controller. Connect the output of the controller to the Vin input of the Sleepy Pi.

Back to Top

Operation

Does The Raspberry Pi Have A Sleep Mode?

No, the Raspberry Pi does not have any power management capabilities. It is in effect always on, even when you command the system to “halt”. This is one of the reasons why the Sleepy Pi was created, to allow a virtual low power mode to be realised on the Raspberry Pi.

Back to Top

How Does The Sleepy Pi Boot Up The Raspberry Pi?

The Sleepy Pi controls the power to the Raspberry Pi via a switch. When it “decides” that the Raspberry Pi is needed it will switch on the power to the Raspberry Pi and wait for it to boot.

There are various ways that you can set-up the Sleepy Pi to switch on the Raspberry Pi. These could be:

  • At a timed interval
  • via a switch
  • An event on a digital I/O pin
  • A measured analogue value crossing a threshold

Back to Top

How Does The Sleepy Pi Shutdown The Raspberry Pi?

The Sleepy Pi has two handshake lines available over the Raspberry Pi GPIO: 24 & 25. These can be used to co-ordinate a safe shutdown of the Operating System (OS) i.e. Raspbian. Once the Sleepy Pi has detected that the OS is no longer running it will physically cut the power from the Raspberry Pi and go into a low power mode.

Back to Top

Will The Sleepy Pi Corrupt My SD Card When Cutting The Power?

No, if the handshake lines are used correctly, they ensure that the Operating System is in a safe state before cutting the power. This avoids power-loss SD card corruption.

Back to Top

How Fast Will The Raspberry Pi Boot-up Each Time?

The speed of boot is dependent on many factors. These include:

  • Operating System, i.e. Raspbian, Bare metal etc
  • Boot media, i.e. SD card, USB stick etc
  • SD Card speed i.e. Class 10 or Class 4

As an example a plain vanilla Raspbian install running off a typical SD card will boot up in around 30 seconds.

There is an interesting series of articles in The MagPi magazine issues 15 and 20 entitled “Baking your own Raspberry Pi filling”. This describes a way of building your own linux image with only the parts you need. Boot times are slated to be region of 5 – 10 seconds.

This thread on the Raspberry Pi forums also contains some interesting information about how to optimise the boot process.

Back to Top

Software

Can I Program The Arduino On The Sleepy Pi With My Own Code?

Yes, the Arduino processor (ATMEGA328P) is totally uncommitted and is available for use with your own code. There is a Sleepy Pi Arduino library that allows your code easy access to standard Sleepy Pi functions. Check the Sleepy Pi Github page for the latest code and examples.

Back to Top

Can The Sleepy Pi Run Standalone?

Yes, the Sleepy Pi can run as a standalone, power optimised, Arduino style board. You can program the Arduino with either a direct link to a host computer, or you can temporarily connect it to a Raspberry pi.

Back to Top

Can You Talk to the Real-Time Clock (RTC) From The Raspberry Pi?

Yes, you can talk to the Real-time clock from both the Raspberry Pi and the Arduino. The RTC on the Sleepy Pi uses the Linux driver for the DS1374. See this page for more details.

Back to Top

Hardware

What Are The Pinouts Of The Expansion Headers?

The pinouts can be found here. Note that the Arduino on the Sleepy Pi is 3v3 the same as the GPIO on the Raspberry Pi. Do not connect 5V I/O to these pins.

Back to Top

What Voltage are the Sleepy Pi pins?

The Arduino on the Sleepy Pi is 3v3 the same as the GPIO on the Raspberry Pi. Do not connect 5V I/O to these pins.

Back to Top

Which RPi GPIO Pins Does The Sleepy Pi Use?

The Sleepy Pi uses the following Raspberry Pi GPIO lines:

  • GPIO 2: i2c-SDA – i2c bus available for communication with RTC and Arduino
  • GPIO 3: i2c-SCL – i2c bus available for communication with RTC and Arduino
  • GPIO 14: Serial RXD – used for programming the Arduino
  • GPIO 15: Serial TXD – used for programming the Arduino
  • GPIO 22: Arduino Reset line – used for programming
  • GPIO 24: General purpose / Handshake
  • GPIO 25: General purpose / Handshake
  • GPIO 23: RTC Alarm – Active low RTC alarm output

Most of these lines are not exclusively for use with the Sleepy Pi and can be used for other things if required. The only one that cannot is GPIO 22 which will reset the Arduino.

Back to Top

Can Sleepy Pi Be Used With Other Raspberry Pi Expansion Boards?

Yes, but you need to check compatibility in terms of which GPIO pins are used. The Sleepy Pi incorporates a stacking header on the Raspberry Pi GPIO which can be used with, for example, a PiRack and other expansion boards.

Back to Top

Which Battery Does the Real-Time Clock (RTC) Use?

The RTC uses a CR1632 coin cell. Due to legal restrictions with shipping Lithium batteries, this is not supplied with the Sleepy Pi.

Back to Top

Do I Need the Real-Time Clock Battery (RTC) Before I Run the Sleepy Pi?

No. The RTC battery will keep the time if you disconnect the main power supply from the board, but if you keep your main power supply to connected after you have set the clock, then the main supply will keep the clock running even when the Sleepy Pi is asleep and the Raspberry Pi powered down. In these circumstances you don’t need the battery backup.

(In fact, if you don’t use the RTC and don’t configure it you can shave a few 100uA’s off your power bill…)

Back to Top

Troubleshooting

I Can’t Seem to Access the Real-Time Clock From the Raspberry Pi

If you are trying to access the Real-Time Clock from the Raspberry Pi and you get an error such as:

Error: Could not open file /dev/i2c-1' or /dev/i2c/1′: No such file or directory

then it might be that you haven’t enabled the i2c bus from the Raspi-config utility.

From a Terminal type:

sudo raspi-config

From the menu select “Advanced Options” and then “A7 i2c” and click “Yes”to enabling the interface.

Back to Top

The Raspberry Pi Boots up Once and Doesn’t Boot Again

You can often see this when running one of the examples such as WakeUpPiOnAlarm. The culprit is generally the Raspberry Pi and not the Sleepy Pi. As the Raspberry Pi has access to the RTC, it can sometimes talk to the RTC at boot and reset the RTC, hence you don’t get the subsequent boots.

You can check this by running the Sleepy Pi standalone off the Raspberry Pi and setting the wake time to something like 10 seconds. You should see the LED’s flash every 10 seconds.

Another way to check is to install a fresh copy of Raspbian with no configuration and it shouldn’t mess with the clock.

The solution is to root out any code that might be taking to the clock.

Back to Top

Site design & build by FUB Software