Monitoring battery voltage with an arduino nano

Thread Starter

AlbertHall

Joined Jun 4, 2014
12,640
This circuit is now built on a PCB and it works fine (except for the nano). The measured leakage when turned off is just 11.3uA which is very acceptable.

The nano I have is a clone and needs the old bootloader. This has the problem that when power is applied it is several seconds before the setup code is executed so I have ordered an official nano which should fix that problem.
 

MrAl

Joined Jun 17, 2014
13,761
This circuit is now built on a PCB and it works fine (except for the nano). The measured leakage when turned off is just 11.3uA which is very acceptable.

The nano I have is a clone and needs the old bootloader. This has the problem that when power is applied it is several seconds before the setup code is executed so I have ordered an official nano which should fix that problem.
If you get a ISP programmer you can burn a new bootloader. Look on the web for more details.
Some ISP programmers are not very expensive less than $10 USD and you can also use it to program the Nano in the usual way but without the Nano being connected to the USB port.
There is just one warning though, when you go to plug the cable for the programmer into the 6 pin connector on the Nano you MUST make sure the pins from the programmer end up going to the same pins on the Nano. This may mean breaking out the Ohm meter just to be absolutely sure. The reason for this is because some cables are 'twisted' meaning that the connector that connects to the Nano may have to go in with the ribbon pointing out from the Nano board and with other cables the ribbon would have to point in toward the board. If this is not observed it could blow the Nano board.
It's a shame this problem comes up. It's because there is apparently no standard for the connector orientation on the Nano side even though there is on the programmer board side. The programmer board has a notch so you can only plug the connector in one way, but the Nano has no notch so it could be connected with an orientation that is 180 degrees from what it should be, which puts +5 and GND on the wrong pins on the Nano.
Since many Nano's do not have their pins identified as on the programmer, you have to look up the pinout of the 6 pin programming connector on the Nano so you can identify the number 1 pin. What i do is mark the ground pin on the connector and on the Nano.
Once you establish which orientation you need on the Nano you never have to do this again as long as you write it down or mark the connector and Nano or some other way to get it the same next time too.
It is funny that somewhere, sometime, somebody decided to make the programming cables with a twist in the ribbon. You can tell by examining the cable end connectors though. You lay the ribbon cable down perfectly flat with at least one connector pointing UP, then if both connectors are pointing UP (pins visible from above the cable) then it is not twisted, if one of the connectors points down and one points up, then it's a twisted cable.
The non twisted cable connector to the Nano goes onto the Nano with the ribbon cable pointing away from the Nano board.
The twisted cable connector to the Nano goes on the Nano with the ribbon cable pointing in toward the Nano board.
Although this sounds like a big pain in the butt it's worth having one of those programmers. You can program bootloaders as well as do normal programming with it using the Arduino IDE.

I have one Nano that has a bad flash memory byte (one or more bytes) where the bootloader is loaded. Luckily it can still be programmed with the programmer board.
The simplest programmer board i think is the USBtinyISP but there are many others.
 

BobaMosfet

Joined Jul 1, 2009
2,211
I missed it somewhere- how much is the charger inputting? What is you rmain (non-battery) source V? How much current does your circuit draw, or will draw? These things must be understood for an intelligent answer.

Disregard, you've already built it ;)
 

Thread Starter

AlbertHall

Joined Jun 4, 2014
12,640
The main power source is the battery. The charger is a TP4056 module with the DW01 protection and that seems to work just fine. The working current draw I did measure but I have forgotten the answer. It will be the arduino and LCD backlight mainly with occasioanl extra current for the HC12 transceiver - so quite modest.
 

Thread Starter

AlbertHall

Joined Jun 4, 2014
12,640
I received the new nano this morning and I have used it to rewrite the bootloader on the nano with the delay and the delay has gone :)
 
Top