Another fantastic video, great pacing, great slides, and very clear VO. You have become my ‘Go to’ channel’ First time I have seen most of these tips, REALLY useful
Delays in general are a bad idea but that's how Arduino is set up. However, if you use light sleep on at least the 8266, you actually need to have some delay in there for the power savings.
my experience: a sensor on ESP32 that measures temp, hum. lux and its battery: 1- connecting to WiFi (static IP): anything between 2-5s, sometimes more than 10s 2- getting time from NTP server: anything between 20ms-5s, sometimes not need for connecting so just ms, sometimes connection failed so timeout 3- SHT31 sensor: max 50ms 4- TSL lux sensor: 0.4s (max accuracy) 5- ADC with 5000 iterations: 0.4s 6- MQTT publish: < 0.5s now with regards to your advice: 1- measuring voltage BEFORE wifi is connected shows different values as ESP without wifi connected is consuming much less current - so now the question is: more precise voltage measurement (when working) or less power consumption but "wrong" value - measure before wifi connected? I opt for measuring real voltage when wifi is ON 2- 200kOhm is way too much for ADC on ESP32 - your multimeter will show good results but ADC on ESP will show much lower value - again: precision vs consumption 3- my sensor takes from wake up to go to sleep anything between 3-10s, average is 5s, 90% of that time is wifi connect. Anyway, when wifi does not connect within 10s it is forced to go to sleep. Same for MQTT failures. 4- reducing serial.print - I would go even another approach: for debugging turn on serial.print - for working turn off completely - recent video on another channel showed how to with 1 command anyway, thank you for your video and advice
Oe of the best tutorials on this I have seen, not surprising, al, your vids are awesome. My I ask, is there a simple way to check the effects of these changes? Can I for instance, run the project for a day/week then measure something with a multimeter, make the changes, and re measure after the same time period? If so, do I measure the remaining battery voltage? Sorry for such a beginner question, but being such a newbie, is why I love your tutorials so much.
Yes that’s the best way of measuring the effect of changes, measure the voltage with a multimeter implement the change then wait the same time and measure again. The problem is to be really sure you need to start with the same battery voltage each time as the discharge characteristics of a battery are not linear. But you’ve got the idea on how to see the effect of changes.
@@G6EJD thank you very much sir, I really appreciate you taking the tine to get back to me personally. I understand-ish, the programming, but the electronics are a dark magic.
It depends on the load attached and the pin state before the change is made. Say the pin was driving a load then it would be a function of the load impedance but could be in the mA range. Moving to an input places the pin into a high impedance state and so also prevents current flow (sink) into the device. It really does make a difference if your trying to get best possible power consumption from the device.
hi, ive googled, but didnt find, maybe u know, how fast can you go in and out of sleep to save power? lets say i do a bluetooth scan every 2 seconds, can i sleep for 1.5seconds? would that help save batterypower?
Mark, could use RF but the availability of robust protocols for RF modules (other than LoRa) is low thereby making their use questionable. They work just not as reliably as most people want.
laurent, ULP has to be programmed in machine code and what you propose is feasible so yes and there are some basic examples around. It may be possible to write the logic in C and assign the code to one of the cores (ULP) whole the other core sleeps, I have not tried that concept and don’t know if the constructs are available to do it.
If you don’t need a programmed wake up voltage you could use a simple voltage divider that uses a gpio pin to wake up the main cpu or use a low power op-amp as a comparator and interrupt source for a gpio pin and with a variable resistor would allow a setting.
Hello Dave, i´m very grateful for your tips. :-) I am a ESP newbie….is that possible that you give us a complete sketch example? In my current project I am desperate to get to the Wi - fi interface. Unfortunately I have no strategy for Wi - fi auto reconnect. Thanks for your input Guido
quito96, the WiFi will already automatically reconnect for you if it looses a connection, the WiFi on /off functions are on screen and widely available but I’ll see what I can do, so you mean just WiFi on / off and connection improvements. If you look in my github at the epaper weather station v13 code you will see a function in there for WiFi off and a robust WiFi connection function, you just need to include copies of those in your sketch then call them.
Yes, I did think of including that but in practice I’ve found it makes. Dry little difference over on instructables I did some tests and found it gained just a few mS, but it does depend on your wireless network and access point, mine are very fast and I can detect no difference.
Nice lecture. Only one remark about time saving in println(). The calculations for 115200 are wrong 😑. Only about 10 time faster. And not about 1000 times.
@@G6EJD i had develop motorcycle anti theft (vibration sensor) with neo 6m gps using esp32 embedded with sim800l (ttgo call) powered with 20000mah battery pack, the problem is i failed to use sleep mode and my system can only operate for 17hours(active mode all the way), i really dont understand how to use the sleep mode for my system, may i email you my coding? Pls sir i need guidance, im working alone and i had no one who can help me with this problem
@@wandaniel4596 Yes please do and I'll have a look for you. I'll add sleep too. contact me at g6ejd.dynu.com then contact. I should advise you that it's hard to make the GPS sleep not that you want it to so it knows where it is. A 20A/Hr battery should last at least 5-days or more, so something is drawing a lot of power, if your getting 17-hours from a fully charged pack then your circuit is drawing ~1.2A and that's the problem, not the sleeping.
@G6EJD Great tips. I was a bit playing around with deep sleep and your tips regarding serial output crossed my mind when I saw the bootloader output. I thought it was quite wasteful to dump all that output every time it came out of deep sleep. So disabling might make sense: the behavior is described here: github.com/espressif/arduino-esp32/issues/642. thanks again for sharing your expertise
J C, yes it’s just wasted time printing to the serial monitor so disabling it by simply not initialising the serial (omit serial.begin() ) saves power!
Another fantastic video, great pacing, great slides, and very clear VO. You have become my ‘Go to’ channel’ First time I have seen most of these tips, REALLY useful
Very good video! You mentioned several things I did not know like switching GPIO only to output when needed. Thank you ☺️
I keep coming back. Explained so well!
Excellent help! Succinct and easy to implement.
Once again, valid and well received advice. 🏴👍
I never thought about serial, Thank YOU!
Every little helps😊
Dave , many thanks for the tips - conserving power always a problem.
..straight to the point, I love it, brilliant! :)
Really nice low power check list. Everything is there!
Extremely useful tips!!! Thank you so much!
Very useful indeed!
Love the Channel. Congrats
Thank you for the high quality tutorial video..
Much nice and helpful information!
Delays in general are a bad idea but that's how Arduino is set up. However, if you use light sleep on at least the 8266, you actually need to have some delay in there for the power savings.
Very nice tips. - many thanks for sharing.
Good ideas, nicely done
my experience: a sensor on ESP32 that measures temp, hum. lux and its battery:
1- connecting to WiFi (static IP): anything between 2-5s, sometimes more than 10s
2- getting time from NTP server: anything between 20ms-5s, sometimes not need for connecting so just ms, sometimes connection failed so timeout
3- SHT31 sensor: max 50ms
4- TSL lux sensor: 0.4s (max accuracy)
5- ADC with 5000 iterations: 0.4s
6- MQTT publish: < 0.5s
now with regards to your advice:
1- measuring voltage BEFORE wifi is connected shows different values as ESP without wifi connected is consuming much less current - so now the question is: more precise voltage measurement (when working) or less power consumption but "wrong" value - measure before wifi connected? I opt for measuring real voltage when wifi is ON
2- 200kOhm is way too much for ADC on ESP32 - your multimeter will show good results but ADC on ESP will show much lower value - again: precision vs consumption
3- my sensor takes from wake up to go to sleep anything between 3-10s, average is 5s, 90% of that time is wifi connect. Anyway, when wifi does not connect within 10s it is forced to go to sleep. Same for MQTT failures.
4- reducing serial.print - I would go even another approach: for debugging turn on serial.print - for working turn off completely - recent video on another channel showed how to with 1 command
anyway, thank you for your video and advice
for everything else,... there's mastercard
Oe of the best tutorials on this I have seen, not surprising, al, your vids are awesome.
My I ask, is there a simple way to check the effects of these changes?
Can I for instance, run the project for a day/week then measure something with a multimeter, make the changes, and re measure after the same time period?
If so, do I measure the remaining battery voltage?
Sorry for such a beginner question, but being such a newbie, is why I love your tutorials so much.
Yes that’s the best way of measuring the effect of changes, measure the voltage with a multimeter implement the change then wait the same time and measure again. The problem is to be really sure you need to start with the same battery voltage each time as the discharge characteristics of a battery are not linear. But you’ve got the idea on how to see the effect of changes.
@@G6EJD thank you very much sir, I really appreciate you taking the tine to get back to me personally. I understand-ish, the programming, but the electronics are a dark magic.
Thanks, David. Very useful tips. How much current is saved by changing a pin from an output to an input?
Cheers!
It depends on the load attached and the pin state before the change is made. Say the pin was driving a load then it would be a function of the load impedance but could be in the mA range. Moving to an input places the pin into a high impedance state and so also prevents current flow (sink) into the device. It really does make a difference if your trying to get best possible power consumption from the device.
@@G6EJD thanks!
That's some good info 👍
Exactly what I was looking for my project, (automated chicken coop door)
hi, ive googled, but didnt find, maybe u know, how fast can you go in and out of sleep to save power?
lets say i do a bluetooth scan every 2 seconds, can i sleep for 1.5seconds? would that help save batterypower?
great - thank you for this advices
Thanks
Thank You
great Sir
nice tips. thanks. what about rater use RF instead of WiFi
Mark, could use RF but the availability of robust protocols for RF modules (other than LoRa) is low thereby making their use questionable. They work just not as reliably as most people want.
Thank you sir
Clear as usual.
I'm looking for a wakeup based on ADC value, it seems possible with ULP, did anybody use this ?
laurent, ULP has to be programmed in machine code and what you propose is feasible so yes and there are some basic examples around. It may be possible to write the logic in C and assign the code to one of the cores (ULP) whole the other core sleeps, I have not tried that concept and don’t know if the constructs are available to do it.
If you don’t need a programmed wake up voltage you could use a simple voltage divider that uses a gpio pin to wake up the main cpu or use a low power op-amp as a comparator and interrupt source for a gpio pin and with a variable resistor would allow a setting.
@@G6EJD using only esp32 ADC is not mandatory but I feel this much more elegant
Hello Dave, i´m very grateful for your tips. :-) I am a ESP newbie….is that possible that you give us a complete sketch example? In my current project I am desperate to get to the Wi - fi interface. Unfortunately I have no strategy for Wi - fi auto reconnect. Thanks for your input Guido
quito96, the WiFi will already automatically reconnect for you if it looses a connection, the WiFi on /off functions are on screen and widely available but I’ll see what I can do, so you mean just WiFi on / off and connection improvements. If you look in my github at the epaper weather station v13 code you will see a function in there for WiFi off and a robust WiFi connection function, you just need to include copies of those in your sketch then call them.
@@G6EJD I appreciate you for the tip and thank you for sharing your knowledge
Do you have it running now?
WiFi can be a little tricky but once you have some decent functions you’ll find its quite reliable.
@@G6EJD not yet, i´am check your epaper ino file and later i must include it in my sketch…
Thank you, very usefull.:)
Awesome
You can also specify the ip address immediately, and not receive dynamically.
Yes, I did think of including that but in practice I’ve found it makes. Dry little difference over on instructables I did some tests and found it gained just a few mS, but it does depend on your wireless network and access point, mine are very fast and I can detect no difference.
Nice lecture. Only one remark about time saving in println(). The calculations for 115200 are wrong 😑. Only about 10 time faster. And not about 1000 times.
Also do not Serial.begin() at all if on battery, if you dont need it
tablatronix, yes sometimes we overlook the obvious! Thanks.
it is very hard for me since im working with gps anti theft alarm system, pls david i really need help
Ok, what help do you need?
@@G6EJD i had develop motorcycle anti theft (vibration sensor) with neo 6m gps using esp32 embedded with sim800l (ttgo call) powered with 20000mah battery pack, the problem is i failed to use sleep mode and my system can only operate for 17hours(active mode all the way), i really dont understand how to use the sleep mode for my system, may i email you my coding? Pls sir i need guidance, im working alone and i had no one who can help me with this problem
@@wandaniel4596 Yes please do and I'll have a look for you. I'll add sleep too. contact me at g6ejd.dynu.com then contact. I should advise you that it's hard to make the GPS sleep not that you want it to so it knows where it is. A 20A/Hr battery should last at least 5-days or more, so something is drawing a lot of power, if your getting 17-hours from a fully charged pack then your circuit is drawing ~1.2A and that's the problem, not the sleeping.
@@G6EJD for the gps i add a relay, the gps is switch ON when needed only, ok sir i email you the coding, thank you sir
@@G6EJD sir i cannot find your email address through email, can you email me first? wandaniel94@gmail.com
Serial.begin(1500000); work on esp32
Слава Загайнов Maximum baud = 921600
@G6EJD Great tips. I was a bit playing around with deep sleep and your tips regarding serial output crossed my mind when I saw the bootloader output. I thought it was quite wasteful to dump all that output every time it came out of deep sleep. So disabling might make sense: the behavior is described here: github.com/espressif/arduino-esp32/issues/642. thanks again for sharing your expertise
J C, yes it’s just wasted time printing to the serial monitor so disabling it by simply not initialising the serial (omit serial.begin() ) saves power!