Multi Purpose PWM Supply 12V DC 10A

Michael 2727

Senior Member
Picaxeâ„¢ powered, 12V DC, 10 Amp, Pulse Width Modulation supply.

By Michael Jeffery

A simple method to control PWM Duty using an ADC input and a Potentiometer for adjustment.
Note: the PWM frequency used here is 4000Hz, 4KHz at (0% to 102% Duty).
If you need a higher frequency you will have to use the PWMOUT Calculator, now
included in the tools of the picaxe Program Editor software.

The design here can be used for resistive loads, incandescent lights, LED banks, heater elements etc.
This will also work well for many DC motors, relays and coils but a Back EMF protection diode must
also be included across the PWM Load Terminals, with the polarity (--->|---) pointing toward +POS.
( mainly for any Inductive Loads but should be included as good practice anyway )

Analogue Input / ADC Control -
A 10K Wire Wound linear Potentiometer directly across the supply rails and,
a 2K2 Ohm resistor to the picaxe analogue input (ADC) via the Potentiometer
wiper are used in this example.
(This is not the standard ADC input configuration so follow the instructions carefully)
You can use the standard configuration e.g. Potentiometer to +POS, Resistor to -NEG, and the junction of the two to the ADC input but you won't get linear control, even with a linear pot.
Although the resolution of the READADC10 command is 0 to 1023. This project only needs the values of 0 to 1000. The reason is to avoid having to use complicated math divisions to get an accurate Duty Cycle / Voltage Output and to provide a precise display reading easily.
As it stands the code produces very accurate Duty increments.
( The actual ADC readings produced are 0 to 1023, anything above 1000 = 100% Duty, "ON Full". )
Code:
CODE Start -
Main:
readadc10 1,w1
pause 10
pwmout 2, 249, w1
goto Main
CODE End -
You could use any value Potentiometer between 1k to 50K and get the same result.
Remembering the lower this resistance value the more supply current is drawn through it.
Important -
The input resistor from the pot wiper to ADC input will only allow 2.2 mA to flow in the
event of incorrect programming, which may allow the INPUT Pin to become an OUTPUT Pin.
So resistance values of 1K to 50K could be used here.
I used the 10K Wire Wound Pot as it should offer better stability/repeatability than a carbon track pot.
WARNING: Do not use this configuration for rail voltages above 5V on the input.
Another voltage divider resistor is needed from the input rails above 5V. ( Not shown above )

After searching the Picaxeâ„¢ Forum I also came across a posting by ( bobrayner )
who uses an almost identical code, done back in Nov 2003, Picaxe Archive 2.
here is the link to Bob's notes also - http://www.picaxeforum.co.uk/showthread.php?t=642

If you need PWMOUT frequencies Lower than the Baseline 4KHz you could check out
the Scooter Project by (HamRadioAddict ) where he Pokes the register to pre-scale the PWMOUT. http://www.picaxeforum.co.uk/showthread.php?t=7722

Adding a Digital Display -
You can add a neat Digital Display (e.g. 0 to 99) to display the PWM Duty % very
easily using any 2 spare picaxe outputs and an a 7 - Seg LED display module.
I used a spare Axe 0 Stat display module, 2 digit, I have plenty of them ~ ;o).
The program code below was set up for a Picaxeâ„¢ 08M and a modified Axe 0 Stat display.
Any 7-Segment Display that only needs a Reset and Count pulse inputs can be used.

The PWMOUT uses Pin2 / Leg5 as this is the only pin available for PWMOUT use (08M chips).
Pin0 / Leg7 is used as the Display RESET pulse.
Pin1 / Leg6 is used as the Display COUNT pulse.
IRF540 MOSFET data sheet - http://www.irf.com/product-info/datasheets/data/irf540n.pdf

Code:
Code Start -
symbol pulse = b3

Main:
readadc10 4,w0
pause 10
pwmout 2, 249, w0
pause 15
b4 = w0/10
pause 15
high 0
low 0
for pulse = 1 to b4
high 1
low 1
next pulse
pause 1000
goto Main
Code End -
Here is another version of the code for an LED 7-Seg Display.
The basic circuit for the Display I used can be found in this thread.
http://www.picaxeforum.co.uk/showthread.php?t=7764
A switch to + POS is needed on Pin3 input, and a 10K Pulldown
resistor to -NEG. ( not shown in the .GIF )

When first turned ON this code will countdown from 10 to 0 Zero and display the current PWM Duty in %.
If the Switch is pressed ( Leg4 / Pin3 - Input used here ) the routine will jump to PWM Output mode.
Adjusting the pot will increase or decrease the PWM Duty %, the Duty % will also be displayed.
If the Switch / Button is pressed again the code will return to the countdown (Standby) mode.

Code:
Code Start -
symbol pulse = b0

Main:
'debug w1       
pause 20
pwmout 2, 0, 0
low 2             
pause 20
count 3, 180, b1
pause 20
if b1 > 0 then start
pause 10
if b5 = 0 then readycount
dec b5
high 0
low 0
for pulse = 0 to b5
high 1
low 1
next pulse
count 3, 180, b1
pause 15
if b1 > 0 then start
goto Main
readycount:
high 0
low 0
pause 300
if b1 > 0 then start
readadc10 4,w1
pause 15
b4 = w1/10
high 0
low 0
for pulse = 1 to b4
high 1
low 1
next pulse
pause 800
if b1 > 0 then start
b5= 10
goto Main:
start:
b0 = 0
readadc10 4,w1
pause 500
pwmout 2, 249, w1
pause 15
b4 = w1/10
pause 15
b1 = 0
high 0
low 0
for pulse = 1 to b4
high 1
low 1
next pulse
pause 500
button 3,0,160,100,b1,0,Main 
goto start
goto Main
Code End -
Some History -

I built a PWM supply some 10 years ago, it was an NE555 based circuit.
The original unit used a Dick Smith M-2175 multitap (12V at 10A) transformer.
I was using this to drive a 12V DC Mig Welder, geared wire feed motor, not for
welding but to slowly drive an automated welding jig I had constructed.
This setup worked fairly well though the motor did squeal fairly loudly at various settings.

So time for a revamp.
I stripped out the old circuit board, used the original Transformer, 30A Bridge Rectifier,
8000µF 75V Filter Capacitor and the original galvanized metal case.

Added a combination 12VDC and 5VDC Regulator (1 Amp) and the Axe 0 Stat (08M driven)
controller/display board. The IRF540 MOSFET was mounted on its own Heatsink/PCB.
I also included a large 3A IN5408 Diode across the PWM output terminals.
This Diode will prevent any motor back EMF damaging the MOSFET, if motors are used.

NOTE: The output of the (PWM) MOSFET, is Low Side, Open Drain.
Which means the 12VDC +POS is always ON (Active) and the -NEG or 0V side is
switched ON and OFF by the PWM. ( the -NEG or 0V is NOT "Earthed" to the chassis Earth
in this instance. )
( In fact none of the internal DC voltages are "earthed" to the enclosure case.)
The case and transformer is earthed to the 240V AC wall plug.

The results were excellent -

I have since tested a few motors e.g. 12VDC automotive types, even a 7.2V Cordless drill.
The motors run very quietly compared to the old NE555 design, just a faint tone is heard.
I also tested the unit on a 12V 20W Halogen and 12V 100W Spotlight, nothing much
happens until around 5% Duty but then full brightness control from 0% to 100% was achieved.
When testing the Motors nothing much happens until around 10% Duty, then total speed
control was available. The motor torque is fairly good from around 20% Duty onwards.
If the control Potentiometer is set to 100% and above ( e.g. 102, 103, displayed as 02%, 03%)
the PWM Output will become 12V DC "ON full".

I was able to get near perfect results when using an indexed Potentiometer Knob
calibrated 0 to 10. The PWM output range is 0% to 102% duty. ( above 100% = Full ON )
( Index 1 = 10% duty, 2 = 20% duty, 3 = 30% duty, etc.)

With the Duty % displayed ( 3rd code listing ) in Standby mode it will be much easier
now to setup the required Duty Cycle before activating the output.

There are several possible uses the PWM Supply could be used for, with the ability
to control the Duty Cycle from 0% to 100% accurately I think it will become an indispensable tool.
Not much happens with any device under around 10% to 15% Duty. You will probably find the
most useful range will be in the 20% to 80% for most devices.

On another note, while testing various 12V DC automotive type motors.
( I actually had a front and rear windshield wiper motors from a car both running at once )
I checked the Diode across the PWM output to see if it was getting hot.
The suggested 1N5408 diode used does get slightly warm between
around 25% to 35% Duty, it is hardly noticeable at most other settings.

This proves two things, the diode is doing its job correctly and the 3 Amp rating is good enough.
I would suggest that 1N4XXX series diodes (1 Amp ) should only be used with very small motors.
If using higher PWM Frequencies for the output a Heavy Duty, High Speed, TO-220 package
diode should be used, these types are commonly used in 110V/240V to DC Switch Mode Supplies.
The IRF540 MOSFET also runs only just warm. It has a reasonable heatsink.

I guess there is no excuse now for me not to make that (Styro Foam) Hot Wire cutter
or for that matter the Plastic Bag Maker/Sealer I needed a while back.

I will add any interesting developments as they occur.
Good Luck.

The pictures below are nothing special, just an idea of how it turned out so far.
The case front panel needs a tidy up, remembering it once was another design, the original enclosure was used.

Other useful links -
Brushed DC Motor Fundamentals - http://ww1.microchip.com/downloads/en/AppNotes/00905a.pdf
Potentiometer linearity - http://www.maxim-ic.com/appnotes.cfm/appnote_number/838

By Michael Jeffery, Mar 2007 © Copyright.
3,500 characters deleted from original text due to the 10,000 character limit here.
E-mail: michael.jeffery(at)porepunkahps.vic.edu.au
Picaxe is a Trade Mark of Rev-Ed Ltd - http://www.rev-ed.co.uk/picaxe
 

Attachments

kevrus

New Member
nice project, well worth remembering for any pwm use. just wondering why the motors squeeled with the 555, was the output frequency set much lower than the 08m?
 

Michael 2727

Senior Member
I can't remember the exact 555 circuit I used, (was prolly found on the net)
I don't think it was a true PWM at a fixed frequency, from memory I think
the frequency also shifted as the duty changed.
I do remember it drove me crazy if used for long periods, I used it to move
then rotate a workpiece in an automated welding jig.

A few weeks ago I tested some Nichrome Wire, for use in Hot Wire cutting.
The supply worked very well. The wire was bought as a replacement (old-
-style) Electric Jug Element ,0.3mm Dia, around 2.0 Ohms/Foot/250mm.
You need to unwind the coiled element off the ceramic holder then thread
the coil onto a 2mm Dia rod/wire. That makes it easier to unravel the wire
without ending up with a useless brids-nest of scrap wire.
The replacement elements are around $5.00 AUD.
 
Top