I have a strange problem i hope you can help me with?
It seems that my arduino Nano (clone) is being powered through the analog pin A2
I have a simple robot base with 4 of the yellow TT motors wich i drive with a TB6612fng motordriver. there is also an encoder wheel with a cheap 3 pin IR sensor. and powered with a powerbank.
When i do some checking of the code i wrote i disconnect the powerbank from the 5V pin of the arduino when i use the USB for uploading the code and read the serial monitor.
But when i forgot to replace the 5V pin connection from the powerbank (USB disconnected) for a test and switch on the powerbank, the arduino starts and runs the program…
I have tested this with a different arduino and only the powerbank and IR sensor connected and Arduino starts up. when i diconnect the 5V from the IR sensor Arduino stops working.
I assume this is a bad thing, but i’m not shure how i can prevent this?
This is part of the logic on the I/O pins. Note the two protection diodes on the left connected to power and ground. You are right - you are powering the circuit from the protection diode to power and it is a very bad idea. These diodes are ment for protection from small transients and not power.
The name is “Ghost powering” and it can be destructive. Power the controller before powering anythings else. The proper way is via Vin or, if it’s allowed, via the 5 volt pin.
Don’t expect the controller to run/work without power.
I understand that it’s not the proper way to power the arduino and it is also not what i ment to hapen. I am planning to power the arduino with the 5V pin when the circuit is complete
Will powering up the arduino before the rest of the ciruit prevent this from hapening? Or do i need to add some more parts to prevent this?
If you power your nano through usb (either from power bank or computer), you don't need to worry about this. Encoder you can power from arduino 5V pin.
When i finish my project i would like to power everything from 1 powerbank.
So, if i get this right, i should do the following to prevent damaging the arduino:
5V from powerbank to usb connector of the arduino and to the motordriver modules, and all the sensors from the 5V pin? Should be the correct way to power everything?
I am using 2 encoders, 2 motordrivers TB6612fng (Vm from powerbank and vcc from 5V pin) and 1 MPU6050. 5V pin should be able to handle this right?
Nano has a reverse polarity protection diode between VUSB and 5V buss that drops about 0.3V, so, with 5V on the USB socket, Vcc at the 5V pin will only be about 4.7V but still works OK (usually).
I was hoping that using the 5V pin would be ok to use because my Arduino Nano’s have a usb-mini port on them and i only have 2 usb-mini cables available. Guess i need to order a few extra for my future projects.