Hey, I need to read the voltage that is being sent to a dc motor by an external piece of hardware.
Essentially, I want to tap into the positive/negative wires that connect the motor and the third party circuit board and use the Arduino to measure the voltage that is being sent to that motor from the third party board. I do know that this board sends voltage between a range of 9V DC - 100V DC to the motor.
I have very little experience with electrical engineering so please keep that in mind with your explanation.
I need someone to please provide an explanation on how I can create a circuit and code that would allow me to calculate the voltage using the Arduino. I currently have no code or circuit in place. Thanks in advance!
A voltage divider using 82k and 4.3k will "convert" 9-100V to about 0.45-4.98V which you can read on any of the analogue pins. This combination is pretty high series resistance to the source so you can get away with using 1/4W resistors which are fairly cheap too.
board sends voltage between a range of 9V DC - 100V DC to the motor.
I have very little experience with electrical engineering so please keep that in mind with your explanation.
That could be dangerous to you and the Arduino, especially when you're connecting to an unknown circuit... Anything about 50V is considered dangerous.
Do you have a multimeter?
Is there a ground for that DC voltage?
If there's a ground and the voltage is measured with reference to ground, it can be done. Connect the Arduino's ground to the "unknown" circuit's ground, and then measure the voltage through a [u]voltage divider[/u] (2 resistors). The maximum voltage to the Arduino is +5, so you'll need about a 1:20 voltage divider. (Choose resistors that sum to about 100K or more.)
Note that connecting the Arduino's ground to a point in the unknown circuit that's not grounded could result in damage to the Arduino or the other circuit or even smoke & fire!
I believe I understand that the resistor is reducing the voltage to a voltage that I can read with the arduino. How that is calculated I do not understand. However, the voltage divider I supplied in the link above indicates < 25VDC which would make me think that the maximum voltage I can run through this divider is 24.99 volts. Is this correct? I need to run up to 100 VDC through this voltage divider/sensor and then read the voltage on the 5v analog pin on the arduino board.
Well I hadn't see that link when I said that. Now I understand what you are not understanding.
I can't believe that someone is selling two resistors on a board for $1.34, what a rip off. The cost of those resistors are less than $0.001 each.
That is not rated for 25V at all, you can use any voltage you like on it. What that board has is two resistors that cut 25V down to 5V. It would also cut 12.5V down to 2.5V. So in that respect the vendor is telling you it will give you 5V out for 25V in. This is not a rating, it is an operating condition.
I need to run up to 100 VDC through this voltage divider/sensor and then read the voltage on the 5v analog pin on the arduino board.
so you need a different ratio of resistors. This is quite easy to calculate. Lets say the bottom resistor is 10K, to have 5V across 10K you need 5/10000 = 0.0005 A or 0.5mA through it.
If you have 100V, to get 0.5mA to flow you need a resistor of 100/0.0005 = 200,000 ohms or 200K. You already have 10K in the bottom resistor so your top resistor is 200 - 10 = 190K
You buy the resistors, or buy that board if you must and replace the resistors.
Resistors do have a voltage rating, its based on the problem of leakage/tracking and corona discharge
between the terminals. Tiny SMT resistors may well be specified as 25V max if they have sharp edges
a fraction of a mm apart.
For potentially lethal voltages like 100V you should be careful to understand the risks and take good
precautions (ie assume any one component will fail short-circuit). So string 2 resistors in series for the
high voltage leg of the divider, extra voltage handling, extra safety (people do drop screws into cases,
insects do walk across circuit boards, neither should be life threatening!)
Keep the impedance high to reduce heating and power wastage ((1M+1M)/100k dividier will divide
by 21 and take a few mW of power - just add a 100nF cap across the lower leg of the divider to make
it low impedance for accurate analogRead() - though the bandwidth is limited to a few dozen Hz)
I really appreciate all of the comments. I majored in computer science so I'm unfortunately oblivious to some of the electrical engineering terms that are being used.
The device I am tying into is a treadmill controller board and the running motor. I need to read that voltage that the treadmill controller board is putting out to the running motor.
I know my circuit that I attached is incorrect on all levels, but this is just a visualization of what I have imagined in my mind!
It would be very helpful if someone could draw a circuit for reading the voltage along with the resistors because I don't yet understand where the resistors should be placed in the circuit and the size resistor I actually need. Thanks!
see appended cicuit. The capacitor is there because a brushed motor generates a fair bit of noise, and is also probably driven by a PWM circuit - the cap smooths out these variations and gives you an average.