Go Down

Topic: Arduino reading 5v signal (Read 133 times) previous topic - next topic

zejdkoco1

Jul 17, 2017, 09:31 pm Last Edit: Jul 17, 2017, 10:04 pm by zejdkoco1
Hello, I have a question about wiring the arduino for a project i have, I just want to be sure before potentially destroying my board (Im new to this).
I have an Arduino Nano and it will be powered by the mini USB (from PC). I want it to read the voltage of another device's USB port (to see if it is powered or not), so basically I want to know if it receives 5v or not.

First question is about the wiring, I presume i would wire the positive to a pin and the negative of the signal wire to the GND of the arduino. Is this correct?Is this even safe?

Second, I'm not sure whether to use an analog pin or digital pin as input since I only care about it having voltage or not (the measurement is not required).

Third, would I need to connect a resistor in series with the 5v signal wire to limit current?

Thanks in advance for your help, and sorry If I'm asking banal questions but I just want to make sure.

DVDdoug

#1
Jul 17, 2017, 09:44 pm Last Edit: Jul 17, 2017, 09:45 pm by DVDdoug
Quote
First question is about the wiring, I presume i would wire the positive to a pin and the negative of the signal wire to the GND of the arduino. Is this correct?Is this even safe?
USB has two data wires, +5V, and ground.    Connect the grounds together and connect the switched USB's 5V to an Arduino input pin.

Quote
Second, I'm not sure whether to use an analog pin or digital pin as input since I only care about it having voltage or not (the measurement is not required).]
Digital.  5v (nominal) is a digital '1' or 'high' and 0V or ground (nominal) is digital '0' or 'low'.

Quote
Third, would I need to connect a resistor in series with the 5v signal wire to limit current?
No.  The Arduino's inputs are very high impedance.     (There are protection diodes, and if you exceed +5V,  actually if you exceed Vcc, or if you apply a negative voltage you can get "excessive current".)

zejdkoco1

Ok, thank you very much for the quick answer.

Go Up