Negative and Positive Analog


In my project, I am using an Uno to read the signal from a windmill attached to a hobby DC motor. The trick is that I want to measure the voltage regardless of the direction of the direction of spin of the motor. The voltage generated is between 0 & (+/-) 600 mV. Is there a way of doing this directly on the analog pins of the Uno?


There is not enough real information to provide an accurate answer..
What is missing is the minimum and maximum output voltage from your generator (motor).
What are the limits of the wind speed and the corresponding output of the device at those speeds?.
The output voltage of your device is inaccurate or the measurement method is wrong as most small permanent magnet motors are capable of much more output, typically between 2 to 6 volts at maximum revolution speed.
A permanent magnet motor is essentially a generator of some real power...
Older motors with field coils would show a response similar to what you posted due to residual field coil magnetization...


The windmill is part of a science fair project for my son and needless to say it is not very efficient (made from plastic and Lego parts). I haven't measured the rpm but it can't be more than 400 - 500. The generated voltage is 0 at rest of course and around 600 mV at maximum windmill rotation (using a house fan as an wind source). I showed him how to measure the voltage on the Arduino A0 pin but often he reverses the twist of the blade causing the windmill to spin in opposite direction and generating -ve voltage. That's why it would be great to measure +ve and -ve voltage.

Not sure if this provides sufficient info Doc?


That's why it would be great to measure +ve and -ve voltage.

Probably would be, but negative voltages will destroy the Arduino.

An op-amp could be used to offset the voltage, and scale it at the same time, so that the +600mV becomes 5V, -600mv becomes 0, and 0 mV becomes 2.5V.

Thanks, I will try that.

I would put the motor's output voltage through a bridge rectifier ( four diodes ) and smooth the output with a capacitor. That assumes you don't need the direction information.

Thanks all.

Grumpy-Mike: with only 1Vpp coming out of the DC generator (-500mV to 500 mV), would that overcome the voltage drop on the diodes of the bridge rectifier? I found this non-inverting amplifier circuit (Non-Inverting Op-Amp Level Shifter - Daycounter) but need to change the gain. Do you think this will work?


I'll make a few assumptions:

  1. What you have is a DC motor generator.
  2. The generator's signal is similar to fullwave rectified positive voltage in the forward direction
  3. The generator's signal is similar to fullwave rectified negative voltage in the reverse direction
  4. The signal range forward is 0 to +500 mV.
  5. The max signal reverse is 0 to -500 mV.

Perhaps a circuit like this will allow voltage measurement in either direction of the windmill. Here, the voltage should be at 2.5V with no wind, 3.0V at max. forward direction, 2.0V at max. reverse direction of the DC motor. This circuit would retain direction information. 10-bit ADC should vary by ±100 (512 for no wind, 612 max fwd, 412 max rev).

A "DC" motor generator as you correctly described... Puts out DC and the capacitor doesn't unfortunately pass DC current...
The rest of it depends on the dc resistance of the motor... So the bias divider should be scaled closer to the motor dc resistance...
Perhaps 1K rather than 10K?, for a starting point as the project was not described as a low power solution..
I would start at 1K and possibly reduce value of the two series resistors for best scale...
100 ohms total is only .05 A...
The "Sweet Point" is where the load matches the source... For maximum power transfer..


Docedison, I'm still not sure what the signal would look like - rectified sine or filtered DC or anything in between. I agree it should be considered DC in any case. It would seem that eliminating R3 and replacing C1 with the 1K series resistor might also work.

If the motor resistance is considered, this would offset the signal and decrease its deviation a bit. An op-amp could scale and condition the signal if required.

Most small inexpensive DC motors have a split commutator with 2 sections per winding on the armature... So a common 6 coil armature will have 12 separate sections... Identical to a generator and 2 brushes to contact only one 'pair' of windings at a time.. Still identical to a generator...
The primary difference is the field source.. In a DC generator the field is generally a winding that is used to regulate the generator output by varying the field magnetic strength.. (poor but close enough).
However dc motors of the type mentioned always have a permanent magnet to supply the magnetic field that the armature field is repelled from..
Thus the armature is always in the right position to produce dc.. While it will pulsate especially at low speeds it will always be DC of a polarity directed by the rotational direction. The pulsation is why most all good quality wind speed sensors that use generators.. Typically a three phase slip ring armature to produce ac and then a precision rectifier like Runaway Pancake referred to in his most useful link.
However it should be possible for a simple science fair project to adequately demonstrate the concept without all that complication.
As I said originally.. The output voltage seemed really wrong to me.. I should have stressed to the OP that the motor polarity was of prime importance and that perhaps a 1K resistor in series and a 1 uF capacitor [from the input to ground] might be of real use to both filter and protect the Arduino input chosen as the analog input pin... Thus avoiding PaulS's valid comment...
I did stuff like that for nearly 30 years with both analog and digital/processor controlled telemetry..
It is my opinion that the initial data provided by the OP is flawed and that for a reasonable rotational speed range the dc motor should be fine as a proof of concept...
However I have been wrong many times before... Particularly when "Shooting From The Hip" as I did.
I think the worst thing that might happen is the generator (motor) might well be greater than Vcc/2..
The fix for that is to place the fan blade used to turn the motor shaft in the right orientation to produce a positive voltage on the red wire and to carefully instruct his son to always connect it and point it one way.
Red to a simple low pass filter similar to the one mentioned above and the black wire to ground...
It might well be served to use an Op-Amp to scale the voltage via a variable input or feedback resistor..
But I doubt that the son would really profit from this level of complexity...
Particularly if he can't remember to always respect the input polarity requirements.
This is a learning experience for both father and son...
And I kind of envy him so I tried to keep it as simple as possible so that both could learn, one step at a time.
Unfortunately I don't own a small DC motor to try it with before "Shooting From The Hip" as I did...

[missed detail]

Basically, you need to offset the motor to 2.5V, then load the motor down so it never has more than +-2.5V across it.

Like the attached image, select RL so no more than 2.5V is generated across the motor at the fastest possible speed.

If you want to check the reference, connect A1 to the junction of the two 10k resistors and measure that, then that is your zero speed reference point.

If you find too much pulsation of the DC voltage, you might add a 10uF capacitor at A0, to the right of the 1k resistor.

Absolutely brilliant, thank you polymorph it works perfectly...

Glad to hear it.