Hello All,
Here a code to build an easy remote with 2 buttons (press and long press functions). I would like some suggestion to make it low consumption because attached with a 9V battery.
Serial port is included only for debugging, will be removed on the remote.
EEPROM part is not used, you can ignore it.
If you are using say a Uno which consumes 50mA when doing nothing, then there is no point in optimising the code. If you move to a barebones ATMEGA328P (or similar) then look at nick Gammon's power saving article and maybe use the buttons to trigger an interrupt so the device can sleep if not doing anything.
6v6gt:
If you are using say a Uno which consumes 50mA when doing nothing, then there is no point in optimising the code. If you move to a barebones ATMEGA328P (or similar) then look at nick Gammon's power saving article and maybe use the buttons to trigger an interrupt so the device can sleep if not doing anything. Gammon Forum : Electronics : Microprocessors : Power saving techniques for microprocessors
Yes,
I use a ATMEGA328P and the link is very interessant, thank you.
I think is the chapter "Detecting key presses on a keypad whilst asleep"
Someone know how much time will be the battery consummed with this hardware and software?
Between the input and ground and the output and ground. See the data sheet for the exact manafacaturer of this chip you are using for the values to use.
IgorRF:
Yes,
I use a ATMEGA328P and the link is very interessant, thank you.
I think is the chapter "Detecting key presses on a keypad whilst asleep"
Someone know how much time will be the battery consummed with this hardware and software?
Thank you
If you organise the sketch so that the device can sleep most of the time and can switch off the power to the peripheral devices (I see relics of a radio device in your code) and move to a lower voltage battery which does not need a regulator ( < 5.5 volts ) the consumption goes down to the micro amp level and the battery could last years. It just depends what the device is doing when it is not sleeping and how long those awake periods are.
You can estimate the power consumption as it is with an ammeter.
6v6gt:
If you organise the sketch so that the device can sleep most of the time and can switch off the power to the peripheral devices (I see relics of a radio device in your code) and move to a lower voltage battery which does not need a regulator ( < 5.5 volts ) the consumption goes down to the micro amp level and the battery could last years. It just depends what the device is doing when it is not sleeping and how long those awake periods are.
You can estimate the power consumption as it is with an ammeter.
Yes, that's my goal. Is a scoreboard of my volleyball team, I would like to use it on our tournament. The scoreboard is a receiver RF, then I have 2 remote to pilot points and time.
Is like a TV remote with 2 button.. But with RF.
Anyone has an example of code with interrupt and sleeping functions ready to use? there are 3 main points that is heavy:
IgorRF:
Thank you, now I don't have the board because is in delivery. Yet I have only a arduino uno r3. When I will get, I will try.
You can do everything with the Uno and do all your development on it including testing sleep mode etc. You will simply not be able to benefit from the power savings.
I implemented the logical of sleeping. When a interrupt (button) is fired, it wake up the board, it fix a timeout after 5 second and go to sleep mode when is reached. It seem to be very stable.
6v6gt:
If you organise the sketch so that the device can sleep most of the time and can switch off the power to the peripheral devices (I see relics of a radio device in your code) and move to a lower voltage battery which does not need a regulator ( < 5.5 volts ) the consumption goes down to the micro amp level and the battery could last years. It just depends what the device is doing when it is not sleeping and how long those awake periods are.
You can estimate the power consumption as it is with an ammeter.
Thank you, I changed my code and now it manage the sleeping mode.
If I understood correctly if I link a battery 18650, instead of a 9V, I will arrive at 3.7V (enough for arduino nano).
Can I link directly to arduino without the component LM7805 (that convert 9V to 5V)?
After that I will remove the regulator from the board and the led connection.