Go Down

Topic: PWM current leaking (Read 740 times) previous topic - next topic


I am currently playing around with driving transistors and controlling current with an arduino.

I just use an analogWrite to the pin connected to the base (through a 1k resistor) of a BC547B NPN transistor.... but never mind the transistors for now....

I have noticed that even when I write a value of 0 (0% duty cycle) I am getting ~ 600 uA through my resistor. I measure this by simply plugging a 1k resistor into the pin assigned for analogWrite then measuring the current with my multimeter going to ground.

Other measurements do not make much sense either. When I set the duty cycle to 100%, I only get 1.2 mA through a 1k resistor. By my calcs I should be getting around 5 mA

Also, and this may be normal, but the atmega328p gets pretty warm (maybe 50-60 *C) when plugged into my USB port for a while.

I measured the 5 volt port and it is supplying 4.6 volts, my 3.3v port is right on target (again while plugged into USB).

Ok so a lot of info here but my primary concern is this 600 uA coming out of my PWM port with a 0% duty cycle write. It is not cool because it pushes my first stage transistor into an active mode which pushes my second stage transistor into an active mode and they both get really darn hot until I write about 30% duty cycle - where they are both in saturation.... strange.

Last note - I have let the magic white smoke out of a lot of things that were on and around this poor arduino uno - so the obvious solution would be to purchase a new board and just assume this one is damaged, but I wanted to get some feedback about this leaking current - if that is normal I may have to dust off the PICkit.... ugh....


If you have smoked stuff attached to the board I would think it would be safe to assume that this particular board is no longer representitive...

Which board is it? Can you get hold of a programmed chip and replace yours?


Jan 25, 2013, 03:51 pm Last Edit: Jan 25, 2013, 03:54 pm by chemnut220 Reason: 1
Uh another thing I just noticed that I should have done first...

other pins do this:

pin 3 gives 40 uA @ 0%,  4.5mA @ 100%

pin 5: 35 uA @ 0% , 4.35 mA @ 100%

pin 6: 37 uA @ 0%, 4.33 mA @ 100%

pin 9: 83 uA @ 0% 4.17mA @ 100%

pin 10: 500 uA @ 0%, 1.31 mA @ 100%

pin11: nothing...

pin13: 100 uA@ 0%, 4.15 mA @100%

Edit: again, all tests were done throught a 1k resistor


I have smoked things that were attached to pins on this board - but to my knowledge, I have not smoked things on the board... but who knows - maybe I have...

I can look into getting another chip I suppose

it is the arduino uno


Also, and this may be normal, but the atmega328p gets pretty warm (maybe 50-60 *C) when plugged into my USB port for a while.

If it gets that warm without driving any loads its definitely toast.  Might be in latch-up mode - remove everything
from all the pins and power cycle.  If it still gets hot its dead.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]


Ok - I think that the chip was toast - no biggie... I bought a new board and ordered a few 328p chips from digi (the new board because idk what else is damaged on my current one, and if it is not damaged - to program the new chips via ISP if/when I fry them again).

So now I wanted to get into another question I had regarding my transistors. My specific project is a series hybrid gasoline/electric UAV/RC plane

Here is a thread in another forum detailing the project if you are interested: http://fpvlab.com/forums/showthread.php?11355-The-flying-Prius

The arduino uno actually manages the IC engine's throttle for the onboard generator (spins a brushless motor connected to a 3-phase rectifier - voltage is filtered through huge caps and sent to an ESC which drives another electric motor which will fly the plane) using Bretts PID library (thanks for that btw....)

I have batteries in the aircraft for backup/on-demand vibration-free operation, and all power lines are a 1-way street (I am using high current diodes to prevent battery charging directly from the generator).

The transistor stuff is all about trying control charge current going into the battery. I want to keep it simple - and it was suggested that I use the IC engine to control charge current - and while possible - I think is improbable due to real-world limitations.

My idea was to have the rectified generator voltage go through a logic-level FET (http://www.digikey.com/product-detail/en/RSY160P05TL/RSY160P05TLTR-ND/2075693) and into the battery. I want to hook the gate of the FET DIRECTLY to a PWM port of the ardu (thats why I was playing with cheap transistors just to refresh my mind about the electronics class I took 6 years ago as an undergrad...).

In practice (for now) - I do not care about constant current... I just want to set the PWM duty cycle so that when the battery is fully drained - it will not see more than 5 amps of charge current. I understand that as the battery fills, the duty cycle would have to be adjusted to keep current constant, and I have some ideas on how to do that... but for now I don't care.

All I am wondering is the following: @ ~500 Hz switching frequency, is 20-40 mA coming from the ardu into the gate of my FET is going to be sufficient to avoid huge switching losses at a load of 5 amps (I will tune this with a current sensor)? Or should I still use some kind of driver despite the FET being logic level?
If this matters at all - generator voltage is currently "maintained" at around 24.5 volts and will be charging a 6-cell lipo (obviously not fully charging).

Go Up