NPN collector output inverted voltage, how fix it?

Hi,

I am a electronic begginer and I would like to know is there is another solution to this problem:

I have to drive a dc motor with a NPN power transistor through a PWM signal from arduino.

Base is connected to arduino pwm output.

Emitter to ground (the same ground that arduino)

Collector to Negative of dc motor

And positive of dc motor to Vcc 5v

Problem: I need to measure the average voltage between Negative and Positive of DC Motor using a typical 3 wires digital voltmeter from Aliexpress, like the image attached.

Case 1: If I connect negative terminal of this voltmeter to negative common ground, positive to Vcc and yellow wire to positive DC motor I measure always 5v, because positive DC motor is connected to Vcc.

Case 2: If I connect negative terminal of this voltmeter to negative dc motor, positive to Vcc and yellow wire to positive DC motor I can measure the "correct" average supposed voltage but the problem is that this voltmeter needs 5 volts to work properly, under 5v the display blinks and shutoff randomly and until the PWM duty cycle isn't 100% the voltmeter is blinking.

Case 3: If I connect negative terminal of this voltmeter to negative common ground, positive to Vcc and yellow wire to negative DC motor the voltmeter does not blink (always is feeded with 5v) and I can measure a voltage but it's like inverted. When duty cycle increase the speed of the motor increase but this voltage decrease.

I have found this solution: in Case 3 I could attach, after the NPN, one PNP with emitter to Vcc, collector to positive Motor and base to NPN collector output, and negative motor to common ground.

This solution works, I can read the average voltage tapping the yellow wire in positive DC motor terminal, but I would like to know if there is another way to do that without using any PNP transistor and without modify source code.

Thank you.

Captura.JPG

Captura.JPG

You are not using the meter correctly, connect + to power supply + (3.5 ~ 40V), - to power supply -, test circuit with 3rd wire.

Case 3: If I connect negative terminal of this voltmeter to negative common ground, positive to Vcc and yellow wire to negative DC motor the voltmeter does not blink (always is feeded with 5v) and I can measure a voltage but it's like inverted. When duty cycle increase the speed of the motor increase but this voltage decrease.

That is correct, you are measuring the voltage across the transistor, the higher the voltage across the motor, the lower it is across the transistor and vice versa. Add the 2 together, they should sum to the supply voltage. For instance if power supply is 5V and you measure 1V at the motor -, that's 5 - 1 = 4V across the motor and the remaining 1V across the transistor.

JCA34F:
You are not using the meter correctly, connect + to power supply + (3.5 ~ 40V), - to power supply -, test circuit with 3rd wire.That is correct, you are measuring the voltage across the transistor, the higher the voltage across the motor, the lower it is across the transistor and vice versa. Add the 2 together, they should sum to the supply voltage. For instance if power supply is 5V and you measure 1V at the motor -, that's 5 - 1 = 4V across the motor and the remaining 1V across the transistor.

Thank you for your answer. How could add the 2 together to the yellow wire? I have tried this but all circuit shutdown due to mix + and - . Sorry I am newbie...

Based on that image: you can only use it to measure the voltage in reference to ground. Not between two arbitrary points (like what you'd do with your multimeter).

Then there's the added problem that you add PWM in the mix, in case of an NPN transistor the voltage across that transistor is either ~0.3V (when switched on - I assume your transistor is a regular NPN that's driven hard enough to be in saturation), or the motor supply voltage (when the transistor is off). That may very well cause the sensor to go haywire, not knowing what to display.

Chances are your needs (use that specific sensor for this specific job) do not align with reality.

wvmarle:
Based on that image: you can only use it to measure the voltage in reference to ground. Not between two arbitrary points (like what you'd do with your multimeter).

Then there's the added problem that you add PWM in the mix, in case of an NPN transistor the voltage across that transistor is either ~0.3V (when switched on - I assume your transistor is a regular NPN that's driven hard enough to be in saturation), or the motor supply voltage (when the transistor is off). That may very well cause the sensor to go haywire, not knowing what to display.

Chances are your needs (use that specific sensor for this specific job) do not align with reality.

Yes I know...but I can't find a digital voltmeter with four wires, two for independent power supply and two for the measured voltage...
I can't believe that no one has had this problem because I can't find anything help...no matter how much I google ...

With the DVM power and the Arduino sharing a common reference (GND) what you propose cannot be done with the "DVM" powered by the same source as the Arduino.
If the Arduino was running battery-powered then you could.

An Arduino can directly measure differential voltages - as long as both voltages are within the power rails (normally 0-5V). The latter can be achieved using voltage dividers.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.