• Welcome to 009 Society Members Forum.

Another new PWM controller

Started by Hugh Norwood, June 24, 2013, 09:50

Previous topic - Next topic

Hugh Norwood

Following a conversation with Richard off list, I invested in a picAXE microcontroller and came up with the following working circuit.


OK I know it looks complicated, but in essence there are only 3 important parts - the microcontroller, a rotary encoder, and the power MOSFET that drives the motor. The picAXE provides a PWM signal which is controlled by turning the rotary encoder, which is a device that has two switches in it that turn on and off in sequence as the shaft is rotated. From the pulses produced, the microcontroller works out if the shaft is rotating clockwise (to increase speed) or anti-clockwise (to decrease speed)

The STOP push switch makes the microcontroller stop the output dead.

Advantages? Well, it's completely programmable, so can be adapted to suit the situation it's used in. For example, in this unit, I have programmed the PWM for a 50 microsecond repetition rate (20kHz) and initially set the duty cycle to change in 1 microsecond steps. I found this was too small a step and I am about to reprogram it.

Hugh Norwood
Angst-Lesspork

Hugh Norwood

I appear to have fallen into the trap of jargonism.

I should have mentioned that PWM stands for Pulse-Width Modulation.
It is a method of sending signals - either information or for control, where the repetition rate of the pulses in the signal is a constant, and the information is carried in the (variable) width of the pulses.

(As opposed to Pulse-Position Modulation, where the pulses are uniform in length but vary in their distance apart).



Hugh Norwood
Angst-Lesspork

petersmith1942

think I would have been happier just thinking it was jargon. Sorry Hugh but I would be more interested in the effect it would likely have on train operating and, if good, the prospects of getting such a thing
Peter Smith

Graeme Dunbar

Well in that case all that one needs to know is that electronics relies on magic smoke. This is self evident because when the magic smoke escapes the thing stops working!  :D

Graeme Dunbar - 4441

gallopingalice

And your next project is to use a bigger picaxe to drive servos on your klax transmitter using stored messages or text from a keyboard.
Anon

Hugh Norwood

Hugh Norwood
Angst-Lesspork

invercloy

Feedback controller article coming in the next issue of the News :)
Tom
Hebridean Light Railway Company - My layout blog

Allscales

I like it! So much simpler than the old Velleman kit I picked in '97 and still haven't built!

Send it off to MERG, I'm sure they'll publish it!

Where can you get the Rotary encoders and the picAxe?

Cheers,

Friso
COO: Die Engadin Bahn

Hugh Norwood

Hi,
For the picAxe see www.picaxe.com
I got the encoder from farnells (Other electronics suppliers are available!)

The 009 NEWS has an article describing both PWM controllers...

Good luck!
Hugh Norwood
Angst-Lesspork

Hugh Norwood

#9
Following requests, I have posted the BASIC code for the picAXE on my web site.
http://hnorwood.co.uk/files/pwm2b.htm
Good luck!

{edit} the difference between the two MOSFETS in the NEWS article is that the ~FP version is fully insulated and does not require an insulating kit to mount it (the tab is encapsulated in plastic)
Hugh Norwood
Angst-Lesspork