Arduino Uno reading analog voltages from Motor controlled by N-Channel MOSFET

Hi Folks,

I’ve attached a rough schematic of what I did on a breadboard. I am trying to figure out how to sense the “voltage” output of my PWM controlled Motor.

I am driving a low amperage 5V motor with an Arduino using analogWrite commands to tell it to speed up and slow down over Arduino pin 5. Using an N-Channel MOSFET, it is chopping up the ground of the motor. I also used a rectifier diode to prevent fly-back.

Now, if I measure with a volt-meter between TP1 and TP2, I will see something like 3.8V-ish. But if I measure between hard ground and TP2, I will see 5V. So, if I put a trace or wire from TP2 to any of the Arduino’s analog pins, I will probably see “255” or 5V too, but I want it to see the 3.8V value, not the 5V. How do I do that?

Thanks,
Erik

Subtract the voltage @TP1 from supply voltage (TP2). Remember though, the voltage @TP1 is PWM, so it won't read correctly until the "chop" is filtered out. Also your schematic shows motor drawing current from the Arduino's 5V terminal, that will pull the voltage down so you can't assume 5V, and could damage your Arduino. Better to power the motor from an external supply.

Hi there,

I didn't realize there was a positive voltage value to read there at TP1. Thanks! However, now I have another question.

I did change out the voltage to a positive 5V power supply that isn't coming from the Arduino, as you mentioned. If I measure the voltages from GND to TP2, I see 5V on my volt-meter and between GND and TP1, I see 1.8V on my volt-meter (I am using a Fluke 112). However, when reading the voltage for TP2 on the Arduino on A0, I get 1023, or 5V, however, on TP1 on the Arduino on A1, I get 1023 about a third of the time and 0 about two thirds of the time.

I know that's the PWM, and the chop you were referring to. How to I remove the chop? I tried using a capacitor of .22uF, and then I began to see more 0's than 1023's and my volt meter was reading 1.1V instead of 1.8V between TP1 and GND. I added a 4700uF, and I see only 0's. So, I don't think a capacitor is the answer for filtering the chop. Is there any other better options?

Thanks, Erik