I am building a project that I breadboarded and debugged using a Uno. All of the initial work was done using the USB connection to my computer to power the Uno board. When I got it working, I built a smaller version using a Nano. My finished product is intended to run from a 9V battery, which is connected to the Vin pin through a toggle switch. The task of the project is to monitor the LANC commands passing between a LANC video camera controller and a video camera and to trigger a separate digital recorder to start and stop recording at the same time the camera is commanded. Now to my problem:
When powered using the USB connection, my finished project works as intended, although I discovered this only by accident as I was trying to debug. When powered by the 9V battery, the project works partially - it lights an LED when it detects that it is reading the LANC commands properly, but it fails to detect the start and stop commands and to produce the intended output (that is, to light a second LED and to momentarily toggle a digital output pin high to trigger the external recorder). I suspected poor soldering (as this is my first project requiring soldering anything smaller than half-inch copper pipe!) and have diligently checked all connections both visually and with a meter, looking particularly for improper connections to the 9V line. Needless to say, I found no obvious problems.
I know that you cannot debug my project over the internet, but any suggestions as to what you would look for if you encountered this behavior would be very greatly appreciated. My own conclusions so far are that this cannot be a software problem and must be either a fault in my building of the circuit, or some mis-understood (by me) difference in the operation of a Nano when powered by 5V through the USB port or by 9V through the Vin pin.
Thanks in advance,
How much current are you drawing from the battery (or USB)? It would also be good to measure Vin and the 5v node while powered by the battery. This will help to determine if the 9v has enough current capability to power the project.
9v are notorious for their very low current capacity.
My concerns would be power and Crystal speed. Crystal is fine, power should be ok assuming you’re not trying to use too much current.
You should be fine unless you’re powering more than about 50mA with the 3.3v line. And if you are, that 9v battery isn’t going to last long anyway.
Thanks to you both for your thoughts. I can measure current draw when powered by the 9V, but I haven’t figured out how to do that when powered by the USB, as the Nano is now soldered down to the board. When using the 9V, I draw about 24 mA briefly during power-up, then it settles to about 22 mA. When the code detects sync to the LANC data stream and lights the first LED, the power consumption goes up to just over 30mA. When powered by the 9V at idle, I measure just under 8V at Vin and very slightly under 5V at the 5V pin. These number don’t change by an amount detectable by my meter when I operate the LANC controller to generate the start/stop commands, but then the second LED doesn’t light, either. You’ve given my goods leads to follow up on, as I didn’t know that 9V batteries might not be a good choice for this design. I have the option of drawing 5V power from the LANC bus, which would come from the camera, as this is what the LANC controller does. I haven’t tried that because I can’t find specs on how much current the LANC circuit in the camera can safely source.
Update: replacing the 9V battery with a 9V wallwart rated to be able to produce 800mA produces exactly the same operational failure (or partial success). So, although my design may not be wise (or long-lived) to rely on a 9V battery, the current capacity of a 9V battery doesn't seem to be the key issue.
Sorry to keep replying to my own thread, but I just tried the same wallwart set to produce 6v instead of 9v. The project works perfectly under these conditions! Does this suggest that I may have damaged the on-board regulator? Or?
Does this suggest that I may have damaged the on-board regulator? Or?
The on-board regulator may be going into thermal shutdown. 9v - 5v = 4v. 4v * 30mA = 120mW. While 6v - 5v = 1v * 30mA = 30mW.
Now, should it be going into thermal shutdown at such low power? Probably not. However it could explain what you are seeing.
Thanks, James. That explanation does seem to fit the facts! I think that I'm going to try to run this project on 4AAs and see if that works.
If you use rechargeable batteries, their cell voltage is only 1.2V. 4 * 1.2V = 4.8V
Rechargeable batteries have less current capacity than alkaline, but at ~4.8V you won't need to go through the lossy regulator.