Directory of RSS feeds

RSS feeds in the directory: 374

Added today: 0

Added yesterday: 0

Hi-Tech / Hardware

The device MySensors battery-powered 23.07.2019 at 08:20

This music will be eternal if I replace batteries ©

This opus is dedicated to my research on nutrition Autonomous wireless devices within the smart home system MySensors/MajorDoMo.

at First I was Li...

or Rather lithium-ion and lithium-polymer batteries.

for a Long time these batteries from old gadgets have been accumulating in the drawer. I thought — here it is, a universal power supply for all small microcontrollers. Moreover, voltage 3.3-4.2 V is perfect for the AVR, and all sorts of ESP and STM. For reliability you can put a LDO stabilizer of necessary capacity and have a stable 3.3 for MK and the periphery.

But as it turns out, all is not well.

the Batteries needed to charge. For this it was necessary to make them removable, or add to your device charging module, which in turn gave additional cost, space, and the charging holes in the housing. And it is not always convenient to recharge your device, for example, a weather sensor outside. Lithium batteries (as well as most power sources) are not suitable for operation at subzero temperatures. The weather sensor attached to the window, the winter cold the battery sat immediately. During continuous operation if time does not track the battery voltage, it is possible to discharge it "zero", i.e. below the permissible value that is guaranteed to kill him. So we need a means of protection from overdischarge. A variety of sizes and battery capacity is significantly limited repeatability of the devices in the same buildings. Yes, and the stocks of the old batteries ,quickly came to an end — a result of the need to buy somewhere new. And, as it turned out, the cost of such power sources was not a penny and added a minium $2 to the cost of each device (and taking into account fees and charge more). Moreover, savings from perezarazhenie was not, as most standalone controllers consume very little power and can work for months without recharging.

and other NiMH AA/AAA rechargeable batteries was even worse. They need to recharged in a special charger, they had had a "memory effect" and a low voltage (1.2-1.3), and with series connection because of the difference in the internal resistance of one of the batteries could be discharged more than others, which in turn led to its deterioration.

And again Li ...

Now round compact lithium batteries 3.0 V, in favor of which I decided to abandon the capricious and expensive batteries.

CR2032 Batteries are used in a huge number Woow computers, electric meters and other devices with RTC, watches, calculators and various toys. With small size and low price they have a 3.0 V voltage, is sufficient for MK and decent for its size capacity 200-250mA/h.

But it's a problem. In the case. what is constant current so the batteries only 0.4 A. If the load higher current, the battery voltage will fall, although then may partially or fully recover. Model Mysensor controller in sleep mode consumes a few microamperes. But the mode of transmission — already about 15-20mA. The new version of the MySensors library, cause the device to send a lot of packages — ping, greeting, presentation, search gateway or router which results in long, sometimes several seconds, the radio. At a voltage of about 2V cheap Chinese NRF24L01 begin to fail, sometimes even it is impossible to get them to sleep sleep() from MySensors.

In the result, on the fresh battery, like all works, but as discharge increased problems with communication, the radio begins to "flood" the air, increasing thus more battery drain. In the end, the voltage is reduced to the fact that all the device does not go into sleep mode and then turns cyclic rebooting until the battery will not sit down at all.

depending on the manufacturer and the "freshness" of the battery, the device can work from a couple of days to a month. If you buy cheap batteries on aliexpress — if not the lottery. A little makes a transition to higher capacity CR2450 and CR2477, but they long to give a current more than 0.5 mA can't.

for a while, I experimented with boost converters that allow to the last crumbs of the energy of the battery to maintain normal operating voltage for MK, but they had a small, but still nonzero quiescent current that reduced the total service life.

the Fingers — toe

it is Time to calm down and adopt "best" Chinese experience, to have all your devices from three AAA (batteries not included). But decided to look for a solution with at least two 1.5 volt batteries .

Stopped this scheme with increasing stabilizer NCP1400:

Two series-connected alkaline AAA batteries provide originally 2.7-3.1 by the end of the productive period by reducing the voltage to 2V

When NCP1400 is disabled (low level on control input), the battery immediately comes to MK through the coil L1 and the Schottky diode D1 with a minimum voltage drop of about 0.1 V. If the control input receives the high level that starts the NCP1400 stabilizer and gives the MC a voltage of 3.3 V for total battery voltage from 0.8 V to 3.1 V.

the Algorithm works like this: the Main controller is PowerDownMode, all the peripherals, including the NRF24 is also disabled or in low power mode. MK goes from sleep mode by an interrupt from timer or external interrupt (for example, switches termination switch), measure the voltage to ground VCC (built-in AVR function controllers). If the voltage is greater than 3V (or other voltage sufficient for stable operation of the periphery), the NCP1400 is not started and all the processing is done at this voltage until the next sleep cycle. If voltage is below 3V, then start the NCP1400 stabilizer, set the 3.3 V power supply, runs all the regular device processing including sending data via NRF24 Further, if the voltage above 1.7 V (enough voltage for output MK from sleep mode), the NCP1400 is disabled until the next Wake cycle. If the voltage is less than 1.7, the NCP1400 is not disabled until you restart the controller or to reduce the supply voltage below 0.8 V (voltage of the work NCP1400) Sketch of the algorithm:

#define MY_DEBUG


#define MY_RF24_CE_PIN 9

#define MY_RF24_CS_PIN 10

#define MY_RF24_POWER_PIN 8

#define MY_RADIO_NRF24


#define PIN_NCP1400 2

#define CHILD_ID_VCC 0

MyMessage msgVcc(CHILD_ID_VCC, V_VOLTAGE);

bool low_power = false;

int readVcc();

void before(){




void presentation(){

sendSketchInfo("NCP1400 test", "1.0");



void loop(){

int vcc = 1000;

if( low_power == false ){

vcc = readVcc();

digitalWrite(PIN_NCP1400,HIGH); //turn on the stabilizer NRF1400


if( vcc < 1700 )low_power = true; //goes into the always-on stabilizer NRF1400

send(msgVcc.set(vcc)); //Send the value of VCC

if( low_power == false )digitalWrite(PIN_NCP1400,LOW); //turn Off the stabilizer NRF1400

sleep( 300000 ); //goes into the low consumption for 5 minutes



* Read the voltage on the VCC controller


int readVcc() {

long result;

// Read 1.1 V reference against AVcc

ADMUX = _BV(REFS0) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1);

delay(2); // Wait for Vref to settle

ADCSRA |= _BV(ADSC); // Convert

while (bit_is_set(ADCSRA,ADSC));

result = ADCL;

result |= ADCH

Other feed items

Create your device class to MajorDoMo 27.06.2019 at 05:24

Universal watchdog timer ATtiny13 04.04.2019 at 16:58

Connect soil moisture sensors to MajorDoMo 26.01.2019 at 07:01