# unexplained uC voltage reading question

#### russpatterson

Joined Feb 1, 2010
353
Hello, I'm having an issue with this circuit. When I have the load disconnected and read the voltage with the uC, everything checks out fine. The uC gets the same voltage reading as my meter. However, when I start up the pwm (around 90%) to turn on the load (in this case a 12V halogen lamp that draws about 2.9A) then I get a significantly lower voltage reading on the uC than what I see on my meter.

E.g. when load is off my meter reads 12.3V and the uC gets 12.2V. I'm not totally comfortable with that discrepancy but it's close.

When the load is connected (well connected 90% of the time via the uC's pwm) then I get voltage readings of 12.2V on my meter but 11.4V on the uC.

I really don't have an explanation. There is some voltage fluctuation going on at the battery when the MOSFET switches. I've seen this before and I average out the readings on the uC so the voltage spikes should get averaged out. (see the attached scope pic).

I even stored the last 16 ADC register values and saw the low voltage reading consistently. So that rules out the voltage spikes.

I should add that R10 is not installed and just jumpered. Also BATT_V_BOARD is the node between R10 and C3 (connected to the 7805, 5V regulator input)

Any ideas as to why I might be seeing the readings on the uC that don't jive with my meter?

Schematic and scope pic attached.

#### Attachments

• 55.3 KB Views: 38
• 130.4 KB Views: 32
Last edited:

#### SgtWookie

Joined Jul 17, 2007
22,210
Russ,
Please Edit your post, and remove the links to the embedded images; they are simply much too large. Just add a note that the attachments are large.

They are so big that it makes reading the text difficult.

Your schematic is very neat, but it is so chopped up that it's difficult to determine where a signal might come in, and where it might go out. It's a bunch of little pieces of individually labelled wire, and one would have to read the text on everything and connect them together in order to try to figure it out.

I have no idea where you are reading the voltage from with either the uC or your meter.

Last edited:

#### russpatterson

Joined Feb 1, 2010
353
Thanks for the reply and good points on the schematic. It would be nice to have some schematic software that let you click on a block and zoom in on the actual schematic for just that block. That way you could show all the blocks connected. I'm sure there are professional packages out there that allow that.

I think your point on the location of the measurements is on the money. I am measuring the battery voltage with the meter right on the battery terminals. I am reading the voltage with the uC via the block labeled 'Battery Voltage Sensor'.

I connect the battery to the controller (the circuit in the schematic) with a 6' length 16 guage wire. I connect the load (12V, 2.9A halogen bulb) via 6' of 22 guage wire.

So I must be seeing a voltage drop with the 2.9 Amps moving across some resistance. The 16 guage wire should be fine. I think it's on my board. I have a narrow trace (0.03") instead of the intended (0.085") from the fuse to the terminals. An oversight on this version. That must be why the uC is reading that voltage only when the load is connected.

Does that sound right?

#### SgtWookie

Joined Jul 17, 2007
22,210
6' of AWG-16 copper wire will have ~0.0241 Ohms resistance; with 2.9A current, there will be a ~70mV drop across the wire.

6' of AWG-22 copper wire will have ~0.0969 Ohms resistance; with 2.9A current, there will be a 177.3mV drop across that wire.

That's about 247.4mV you didn't account for previously.

If there is any distance between two points and a current flowing between the two points, there WILL be a difference in the voltage; even if it's a small difference.

Since you didn't mention the length of the trace nor the oz of the copper on the board, resistance of the trace won't be possible to calculate.

Note also that HOW you connected your wires to the board will also figure in to the total resistance. 63/37 solder has roughly 5 times the resistance as copper. Solid has roughly 21 times the resistance of copper. This is why you want your wires and leads to be in contact with the traces when you solder them.

#### russpatterson

Joined Feb 1, 2010
353
The skinny trace in question is 1oz. copper and about 3/4" long. I'll try putting some wire in parallel with it and see if the issue gets resolved.

To connect the wires to the board I have pads (like a giant via, that goes through the board) and solder 6" lengths of 16 guage wire to them. Then I wire nut those 6" wires to the 6' transmission wires.

#### SgtWookie

Joined Jul 17, 2007
22,210
A 30 mil trace 0.75" long of 1oz copper will be around 12m Ohms (0.012 Ohms) at room temp (23°C) giving a 34.8mV drop @ 2.9A. If the temp goes up 30°C to 53°C, resistance will be ~13.5m Ohms giving a 39.15mV drop.

#### russpatterson

Joined Feb 1, 2010
353
That still doesn't account for the ~700mV drop I'm seeing. 70 mV for the 16 guage wire and 35mV for the trace. It must be some other flaky connection or solder joint that is resistive.

#### SgtWookie

Joined Jul 17, 2007
22,210
If you are using PWM or cycling the MOSFET on and off, you may be seeing a loss due to reactance in the wiring. 12 feet of straight wire 50 mils in diameter would be ~6.3uH. If there were bends in the wire, the inductance would be much higher.

#### nsaspook

Joined Aug 27, 2009
7,181
A lot of digital meters read peak or rms peaked voltages on DC signals with pwm modulation. The ADC in the controller is reading the average voltage.

#### russpatterson

Joined Feb 1, 2010
353
@Sgt, would the reactance in the wire account for 500mV?

@nsa, From the scope pic the battery peak voltage is over 15V. I'm reading 12.2V on the meter.

#### nsaspook

Joined Aug 27, 2009
7,181
@nsa, From the scope pic the battery peak voltage is over 15V. I'm reading 12.2V on the meter.
Is it a true RMS meter? If so the meter is correct if it's internal sampling function/filter can handle the PWM frequency.

#### russpatterson

Joined Feb 1, 2010
353