Maker Pro
Maker Pro

PWM from raspberry pi to control charging of a 12 V Battery, possible?

Hi there,

I just got a raspberry pi and was wondering if it is possible to use its PWM output to control current flow to a 12 V Battery (with an IGBT). My idea is to use a 300 W windmill, a simple AC/DC converter, a IGBT, and the battery at the other side.

If voltage is above 13.8V, I reduce the current via PWM to fully charge the battery and disconnect the windmill as soon as the battery is fully charged.

The windmill has a build in over voltage security system, so I think it can be ok to just disconnect the windmill.

From the raspberry pi part, I think it's not a problem to read analog voltage and use PWM. My question is related to how can I connect the Pi to an IGbT and which circuit I need for that.

Almost certainly, but I don't know what sort of PWM speeds you can attain

with a rasberry pi, so I can't comment on how practical it may be.

In IGBT is a poor choice in a circuit that's working on voltages around

12V. Even 120V is low for an IGBT to be a good choice. MOSFETs are

generally better than IGBTs up to around 500-ish volts, IGBTs are

generally better above 1000-ish volts, and in between it's a toss up.

What do you propose to use for your AD/DC converter?

You need to do a lot of studying.

From your quote of 13.8V, I assume that you want to charge a lead acid

battery. These batteries have a specific charging profile that you need

to hold to if you want to keep them happy. Basically, you hold the

current below some maximum that's determined by either the battery or

your circuit, then you hold the voltage below some maximum that's

determined by the battery, the temperature, and how long you're going to

hold the battery on charge.

Google "float charging lead-acid batteries".

Exactly how you connect the switching element (IGBT or MOSFET) to the

battery and how you drive its gate depends a lot on things that you

haven't stated.

Why not just go buy a charge controller that matches your windmill?


Tim Wescott

Control system and signal processing consulting

Hi Tim,

thank you for your reply. I have made a very primitive diagram, see here:

The idea is the following: I'm not interested in doing some fancy charging for the battery, I know that the battery will suffer a bit because of this,but it does not matter.

I think it will be enough to rectify the power and send it into a battery directly, and only switch off if voltage is too high. I guess most of the time the battery will be below 13.8V, so the switch will be closed, and any wind that comes flows directly into the battery. I could even put a condensator after the AC/DC converter to minimize the impact of opening and closingto the generator, but I guess it will handle it well (wind can also changevery abruptly, and the generator has a protection for overvlotage included)

Yes, of course I could buy a charger for 100 u$ and that's it, but my idea is to use the pi to monitor the battery, and controll other things as well.And this is the first part. I also intend to build a better algorithm in the future.