NOTE: The Sleepy PI 2 FAQ can be found here.
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:
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.
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.
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:
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.
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.
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:
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.
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.
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.
There are a number of ways to do this, and all need 3 additional things:
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.
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.
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:
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.
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.
The speed of boot is dependent on many factors. These include:
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.
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.
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.
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.
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.
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.
The Sleepy Pi uses the following Raspberry Pi GPIO lines:
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.
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.
The RTC uses a CR1632 coin cell. Due to legal restrictions with shipping Lithium batteries, this is not supplied with 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…)
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:
From the menu select “Advanced Options” and then “A7 i2c” and click “Yes”to enabling the interface.
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.
Your email address will not be published. Required fields are marked *