Friday 15 August 2014

Switches and LIGHTS!!


I know this post comes rather soon after the first one, but its because I've been tinkering away with some PIC chips (the 18F4550) and the Microchip Pic kit 3.  I know this doesn't sound like its remotely related to railroads or model making, but I've finished up my first year in electrical/electronic engineering at uni, and so I wanted to keep up my very basic knowledge of C Programming throughout the summer.  Also, this is directly related to the layout as I'll hopefully be using microcontrollers to drive the servos that move the switches - (or "turnouts/points" for fellow brits!).  Maybe also do some sort of lighting sequences...?  I won't go into the details here, but I will provide a link to the youtube vids I've been using where this guy explains in great detail how to configure the chip, set up the timer modules etc to do this sort of thing.  Anyway, here's what my first bit of programming did:





yeah, a bunch of LEDs flash.  Not very exciting but still something.  Specially as this was done in software; if I want to change anything, say on a soldered up board, I don't have to de-solder and change any hardware, i can just change a few things in my program in MPLAB X, build the program and then write the file onto the chip with the pic kit3.

This used delay functions to make the leds blink...but what if you want each led blinking at slightly different times?  No problem, do a bunch of calculations and use the 4 timer modules:





Again, not very exciting...but still!  Come on!

And just today...I've managed to get a servo moving!! (1ms pulse one way and 2ms the other way)



Anyway, so thats the electronics stuff out of the way, i can now show the slight progress I've made on the auto factory:

Also i just got an accurail open auto rack kit from the states, might well start building it soon:



and here's another addition to my growing collection of locos, a CSX ac4400 (only £60!!)


I might keep it he way it is possibly repaint it in Canadian Pacific colours. We'll see.

God bless and happy modelling!!


P.S:  here's the link to the youtube channel I've been using as a guide for these microcontroller projects.  The guy's teaching is excellent: (note a basic knowledge of the C programming language is recommended before starting)

https://www.youtube.com/channel/UCxAnMtjN08ryThpgYTBmILg

No comments:

Post a Comment