009 Society Members Forum

Modelling => Electrics and Control => Topic started by: Hugh Norwood on June 24, 2013, 09:50

Title: Another new PWM controller
Post by: Hugh Norwood on June 24, 2013, 09:50
Following a conversation with Richard off list, I invested in a picAXE microcontroller and came up with the following working circuit.
(https://forum.009society.com/proxy.php?request=http%3A%2F%2Fwww.hnorwood.co.uk%2Ffiles%2Fimages%2Fpicaxe_pwm.gif&hash=3a185731901313d5edf35e14bd37f435e6bdde44)

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.

Title: Re: Another new PWM controller
Post by: Hugh Norwood on July 12, 2013, 09:27
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).



Title: Re: Another new PWM controller
Post by: petersmith1942 on July 12, 2013, 22:49
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
Title: Re: Another new PWM controller
Post by: Graeme Dunbar on July 13, 2013, 11:43
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

Title: Re: Another new PWM controller
Post by: gallopingalice on December 10, 2013, 22:22
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
Title: Re: Another new PWM controller
Post by: Hugh Norwood on December 12, 2013, 10:05
Ah, you noticed...
Title: Re: Another new PWM controller
Post by: invercloy on January 02, 2014, 23:08
Feedback controller article coming in the next issue of the News :)
Title: Re: Another new PWM controller
Post by: Allscales on February 19, 2014, 20:01
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
Title: Re: Another new PWM controller
Post by: Hugh Norwood on February 20, 2014, 11:38
Hi,
For the picAxe see www.picaxe.com (http://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!
Title: Re: Another new PWM controller
Post by: Hugh Norwood on June 30, 2014, 19:40
Following requests, I have posted the BASIC code for the picAXE on my web site.
http://hnorwood.co.uk/files/pwm2b.htm (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)