Hi,
I have a project where i need to log the output voltage of a dc motor controller when driving a load. The output voltage varies to a maximum of 25v and the output voltage polarity is switched periodically (by the motor controller).
Since the Arduino cannot read negative voltages my plan was to use a small bridge rectifier with a voltage divider on the output as i only need to log the absolute voltage not its polarity. However when testing the bridge rectifier when connected to the output of the DC controller (with load attached), the output from the rectifier was always the same as the supply (12 volt battery) minus the rectifier volt drop even when the output voltage to the load itself was varied. I dont understand how this can be, the output from the rectifier should be the same as that from motor controller output minus the volt drop.
Could it be something to do with the internal switching of the DC controller? It is quite a high power unit, maximum 55v @ 40A continuous. Or could it be back emf from the load being conducted by the non-conducting diodes in the bridge rectifier? Would a simple diode across the motor cure this?
I will check with a purely restive load to see if the same thing happens.
A digital motor driver (H-bridge) switches between zero and full voltage, never to a voltage in between. If you control the driver by analogWrite() then the effective voltage is proportional to the duty cycle you select.
The voltage only changes with load if the power supply is not capable of supplying the current required by the load. At 40A current capacity this power supply is not going to sag. That is why you always see the 12V.
If you want to measure the current, which will vary with load, you want to put a small resistor, say 0.1 Ohm, in series with the motor and measure the voltage across that. You might have to add a bit of smoothing, like a capacitor to ground on the analogue output to get the avrage value of a PWM signal.
I am currently reading the current using a current sensor (ACS711) that is linked to the input of the DC motor speed controller and this seems fairly accurate.
Since the output from the Dc motor speed controller is PWM and its polarity is switched periodically i have taken the PWM output and passed it through a bridge rectifier for the purpose of reading a positive voltage using the ADC of the Arduino.
At this point i have tried using a low pass filter but this did not work very well. It was a simple rc filter with a 3.3nF cap and 2.5kohm resister, with the voltage divider after this or would it have been better to have the voltage divider before the filter.
Would using pulsein() have been better option or is there another option to read the correct voltage.
Depending on the frequency of the PWM that capacitor looks a bit on the low side. I would be inclined to use a bigger one and start with 0.1uF.
Yes it is but the problem I would see is synchronising the voltage reading with the high part of the PWM cycle. Otherwise the readings will look random.
No that only gives the period of one half of the PWM waveform. Something that is not much use to you.
Can you provide a schematic so I can understand where these different voltages are coming from? A 12V battery that provides 40A continuous would be an interesting item.