Running a system on batteries

Running a system on batteries

As long as your expectations are in line with the laws of physics, it is not a problem to build a battery-powered system with Yoctopuce devices. We have already covered this topic a few times on this blog, but this week we will provide some theory and see how we can compute the life time of a system based on the battery size, how to build a self-powered system, what are the pitfalls to avoid...

There are two ways to run our devices on battery. The simplest way is to use the built-in data logger. The second way, a bit more expensive but more efficient, is to add a YoctoHub-Wireless.

The built-in data logger

Yoctopuce sensors are USB devices, but they don't require a real USB connection to run. It is possible to configure them to start recording measures into the built-in data logger as soon as they are powered - either from a USB port, a transformer or a USB battery.

Yoctopuce sensors also run without USB communication
Yoctopuce sensors also run without USB communication

Note that there is a price to pay for the simplicity of this solution: as Yoctopuce sensors don't include a real time clock (RTC), the timestamp of recorded data starts always on January 1st, 1970 if the data logger is empty, or from the day following the last data found in the data logger if there is already something recorded. Also, the internal clock of a Yoctopuce sensor is not very accurate when not connected to a computer or a YoctoHub (expect an error of 1% to 2%).

Use with a YoctoHub-wireless

Adding a YoctoHub-Wireless-SR or a YoctoHub-Wireless-g to a battery-powered system has several advantages in addition to adding network connectivity. Indeed, these hubs include a real time clock which makes it possible to keep track of time, even when not powered. They automatically transmit time to all Yoctopuce sensors connected, so all measures have a proper timestamp.

Moreover, the YoctoHub can be sent into deep sleep mode, and wake up automatically according to a predefined schedule. While the hub is in deep sleep mode, all connected devices are fully shut down, and only the real time clock is powered. This brings the system consumption down to about 15µA, which is basically nothing. So, if your system does not need more than a measure every few minutes, this is an excellent way to dramatically reduce the average power consumption.

Regardless of the selected option, the criteria to consider for a proper sizing of the power supply remain the same. There are two parameters to take into account: the supply voltage, and the current consumption.

Supply Voltage

As Yoctopuce devices are USB compliant, they are designed to run from USB voltage, which is 5V. However, many sensors rely only on components running on 3.3V, so the first thing that happen in the device is a voltage reduction to 3.3V. This is the case for instance with the Yocto-Meteo, the Yocto-Temperature, all version of the Yocto-Light etc. This means that all these devices can very well run from three 1.5V batteries connected in series, even if the total is only 4.5V. Here is the voltage per cell for most common battery types, from which you can create multiple values:

TechnologyRechargeable ?Voltage per cell
Lead batteryyes2.1V
NiCd batteryyes1.2V
NiMh batteryyes1.2V
Lithium polymer batteryyes3.6V
Alkaline batteryno1.5V
Lithium coin batteryno3V

Take care not to trust the reference voltage blindly: the voltage of a battery varies depending on its use. This is obvious in particular for disposable batteries, of which voltage decreases progressively. To take this into account, you should aim for more than the 3.3V minimum. But be careful not to overshoot 5.5V, as it could damage your device.

Voltage converters

If you look for more flexibility on the battery voltage, you can add an electric component to adapt it to 5V. There are two kinds of voltage converters:

Linear regulators (LDO)

A LDO is a tiny component that can reduce voltage. The excess voltage is dissipated into heat and lost. Therefore, this technology is mostly used for low current applications. For instance, this is what is used to reduce voltage from 5V to 3.3V in Yoctopuce sensors.

DC/DC converters

A DC/DC converter can reduce or rise voltage. Unlike a LDO, the voltage is converted into current, and the electric energy is more or less preserved. In theory, if you had 10V at 1A as input, you could convert it into 5V at 2A. In real life, the DC/DC converter consumes a bit of energy for itself, and a another bit is lost in heat during the conversion. A DC/DC converter with 80-90% efficiency is already a good converter. A DC/DC converter is also more bulky than a LDO. Therefore, it is mainly used when more power is needed.

The LDO used by all Yoctopuce devices, next to the DC/DC converted used to produce 24V in the Yocto-4-20mA-Rx
The LDO used by all Yoctopuce devices, next to the DC/DC converted used to produce 24V in the Yocto-4-20mA-Rx

Current consumption

The current consumption is not the same for all devices. Being designed as USB devices, the current consumption was not a focal point of their design. The simplest sensors use about 25mA, other devices may in some cases need up to 500mA. The good news is that all Yoctopuce devices can tell you in real time how much current they need. You can find this information for instance using the VirtualHub interface:

The VirtualHub shows the current consumption of each device
The VirtualHub shows the current consumption of each device

Be aware that the devices may not have a constant current consumption: for instance, a Yocto-PowerRelay uses about 25mA in state A and about 65mA in state B. The Yocto-CO2 uses about 45mA but a current peak of 200mA appears every other second, when the sensor takes a measure.

Battery capacity

The capacity of a battery is generally provided in Ah or mAh (1Ah=1000mAh). For instance, a battery rated as 3Ah can deliver 3A during one hour, or 1.5A during two hours, or 6A during half an hour. So if you want to power a Yocto-Meteo, which uses 25mA, with a 5V battery rated for 1000mAh, your system will last about

1000mAh / 25mA = 40h

Be aware that the max Amps that a battery can provide at a given time depends on the battery technology, and not directly on the battery capacity.

The capacity of rechargeable batteries is well specified, and is generally printed on the battery itself. However, this is seldom true for disposable batteries. You sometimes find indicative values on the manufacturer web site, or on Wikipedia, but you must also remember that the total capacity of disposable batteries depend on the load: if you draw too much current, a disposable battery provides less energy in total than expected. Here are some figures about common batteries:

Technology and sizeIEC nameTyp. capacity
Alkaline AAALR031200mAh
Alkaline AALR62700mAh
Alkaline CLR148000mAh
Alkaline DLR2012000mAh
Lithium button cellCR2032225mAh
Alkaline SR44SR1154170mAh

USB batteries

Nowadays, the most convenient and most widespread 5V batteries are the so-colled USB battery packs. You can find them in all shops selling smart phones and tablets. These batteries offer one or more USB connector to power any USB device, and can usually be recharged using a simple USB charger. Some USB battery packs show impressive capacity: several dozen Ah. Be careful however, there are some traps.

USB battery packs: all kinds of sizes and shapes
USB battery packs: all kinds of sizes and shapes

Battery shutdown mode

USB battery packs have been designed to recharge mobile phones and tablets. Many of them have a built-in system to fully shutdown the power output when they detect that there is no more significative power consumption. This prevents the battery to self-discharge when not in use, but it makes such batteries unusable in conjunction with the YoctoHub-Wireless-g/SR deep sleep mode: soon after the YoctoHub goes to deep sleep, the battery performs a complete shut down, and the hub is unable to wake up again.

Real capacity

Most USB battery packs are built using a single lithium cell, which provides 3.6V, and a DC/DC converter to transform it into 5V. It happens often that the manufacturers advertise on the product the capacity of the lithium cell, without taking into account the DC/DC converter. So when you buy a 5000mAh battery pack, most of the time, you only receive in real life:

5000mAh * (3.6V / 5V) * 90 % = 3240 mAh.

Solar power

If you put numbers together, running a Yoctopuce sensor for several months on battery is challenging. If you count 25mA, without using the deep sleep mode, to run during 3 months, you need

3 months * 30 days * 24h * 25mA = 54000 mAh

This is a pretty big battery... However you can now find some solar panels directly fitted with a USB power output, that you can connect to your USB battery pack to recharge it automatically as soon as there is some sun.

A USB battery pack recharged by a solar panel
A USB battery pack recharged by a solar panel

When combined with the deep sleep mode of the YoctoHub-Wireless-g/SR, this solution makes it possible to easily build solar-powered systems with a very low average consumption and that can run indefinitely on a very reasonable solar panel. Make sure however that the battery you choose can simultaneously deliver power and be recharged.


One more thing. Lithium batteries have a bad reputation of taking fire when mishandled: shortcuts, overheating, mechanical stress, ... For this reason, there are strict rules on transportation of these batteries. Any package that includes a lithium battery must at least be declared as such. There are severe limitations on airborne transport.

Packages that include a lithium battery must be declared as such
Packages that include a lithium battery must be declared as such

Even if you don't expect to ship your lithium-powered system, before selecting where you install it, take a second to think about what would happen in case the battery would ignite.

Add a comment 2 comments
Back to blog

1 - RB Monday,november 30,2015 11H22

Would you ever consider making a charge controller with the ability to monitor I/O (Solar, Wind, Battery, Load etc?)


2 - martinm (Yocto-Team)Monday,november 30,2015 11H54

We just had a big discussion about this... :-) We haven't decided anything yet, but we might end up with a Yocto-battery-management device. We have a preference for LiFePO4 technology since it's safer than lipo. If you have you any idea/suggestion about it, don't hesitate to contact support to discuss about it :-)

Yoctopuce, get your stuff connected.