I have a nano clone that i've programmed and want to power externally, i do this by applying a 5V rail from an SMPS to the 5V pin. Sometimes i plug in the usb to program it but that's not often and shouldn't be an issue.
My problem is that when i use the external power supply, the code doesn't seen to run - or the bootloader isn't jumping to the user code, i can actually see i'm not getting those few initial LED blinks to signify the bootloader running.
The regulator is an oki-78sr-5 that takes a 24V down to 5V. Also connected to the arduino is an HC-SR04 ultrasound distance sensor and DM556 microstepper driver (and four momentary push buttonts).
Used a UA7805C, same behaviour. doesn't go to user code.
When i use just a usb to power the board, blink will work, when i plug in the 5V PSU as well the code stalls. (not sure if this helps)
Interestingly, this behaviour isn't true when i add the external 5V to Vin, however is still doesn't go to user code when it's just being powered from the 5V via Vin
EDIT: odd thing is, when i use a bench power supply to put 24V to the input of the 7805, it all works. i will probe the input on the original psu which is an expensive 24V brick.
Believe it or not i'm a high paid electronics technician, I specialise in SMT assembly. i just had 0 time for this little side project so slapped on some gross wires on the top without removing the headers. it's disgusting. i don't recommend it and it's probably the cause of the problem. My advice to anyone reading is, don't rush.
Well the good news is it works now as it should with a different arduino, a minor improvement with the soldering too (this is what happens when you don't use flux)
orbitronics:
may i ask, in this setup, would the external 5V be better connected to the pin '5V' or Vin?
"Vin" is mostly useless.
The on-board regulator has negligible heat-sinking, so if you try to draw any substantial current - 100 mA or so - whether from multiple I/O (20 mA apiece) or the "5V" pin, it is likely to overheat and (hopefully reversibly) shut down.
If you provide 5 V to "Vin" then with the drop-out voltage of the regulator, you will get substantially less on the actual 5 V rail; it may operate depending on conditions.
Some clones as you have there are reported to have the regualtor die at or abouve 12 V on "Vin".
The on-board regulator has negligible heat-sinking, so if you try to draw any substantial current - 100 mA or so - whether from multiple I/O (20 mA apiece) or the "5V" pin, it is likely to overheat and (hopefully reversibly) shut down.
If you provide 5 V to "Vin" then with the drop-out voltage of the regulator, you will get substantially less on the actual 5 V rail; it may operate depending on conditions.
Some clones as you have there are reported to have the regualtor die at or abouve 12 V on "Vin".
You're right, the regulator was dropping Vcc to 4V when going through Vin. I haven't had a good look at the schematic yet but i was concerned powering the board via '5V' would bypass the FET / circuit that controls the USB/Vin switch.
orbitronics:
I was concerned powering the board via '5V' would bypass the FET / circuit that controls the USB/Vin switch.
Which is exactly what you absolutely want it to do. The "5V" pin is the actual power line for the microcontroller (and the USB interface chip) and that is exactly where you want the power to go with nothing in the way.
But you specify a Nano. The problem with feeding power back into the USB port of a PC applies only to the UNO (or Mega, Leonardo), there is absolutely no such problem with the Nano. (The Nano has no FET circuit. Instead, there is a diode voltage drop if you do feed 5 V via the USB port! )