Download presentation
Presentation is loading. Please wait.
1
2013 East Coast Large Scale Train Show
Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets, Tips, Tricks & More! What’s New? Dave Bodnar March 22, 2013 York, PA This presentation is available on-line at: or Revised
2
Objectives Demonstrate various devices & projects that utilize microcontroller operation … … and some that do not! (Hopefully) Excite you with the possibilities and enable you to begin experimenting and enhancing your railroad!
3
Topics to be Covered PICAXE review – What is it? Why use it? How do we use it? New PICAXE chip A NEW PICAXE project A NEW LED lighting project Revolution /w Sound Overview Lots of Animation ideas Easy Uncoupling with Revo or Small Remote Tips, Tricks, Tools New & improved gizmos & gadgets
4
Hypothesis 1 We all have an interest in how things work and many of us have enough knowledge of basic electronics to know that something can be done… we just need a bit of help putting all of the parts together to make it happen! Programming (batch files, macros, rules)
5
Hypothesis 2 Batteries & power supplies Track wiring & motors
We Already Know About & Have Experience With: Batteries & power supplies Track wiring & motors AC, DC, voltage, amperage & resistance LEDs & incandescent bulbs Series & parallel circuits Switches, relays & transistors Simple Programming
6
Hypothesis 3 Inexpensive microcontrollers allow us to leverage the basic electronics and programming knowledge that we have so that we can do some amazing (and personally satisfying) things! Pass around PICAXE chips – now or later
7
Highly Recommended: PICAXE
Designed in the UK for use in schools SUPERB support Free manuals, tutorials and software Active & helpful forums PICAXE manuals are super Several Books available on Amazon – Search for PICAXE YouTube videos & Instructables Pass around a few chips * show book #1 ok
8
PICAXE Best choice in terms of: Capability Ease of use Cost Support
Many PICAXE articles at Large Scale Online &
9
PICAXE Basics Not spending much time on a PICAXE introduction this year You can view my introductory PICAXE seminars on YouTube davebodnar.com or trainelectronics.com Under Presentations Or search YouTube for “Bodnar PICAXE” board & batteries – soldered version – programmed and ready to show to the audience #2 ok
10
Garden Railways PICAXE Article
April 2013 Issue pages 54-59 Contains a detailed introduction to the PICAXE and several projects
11
Garden Railways PICAXE Article
Shows how to build: Single LED Lighthouse Single LED Mars Light Morse Code Beacon All using the same circuit
12
PICAXE - What You Need Computer with
serial port or … USB to serial adapter or … USB programming cable Windows computer running free PICAXE software (Mac & Linux, too) Power source AA cells = 4.5 volts Show cables (mouse, USB & DB-9) #5 ok PHANDERSON.COM has solderless development kit for around $20.00 (+/- depending on cable / psupply) Show & pass around programming cable – can also be made from DB9 (from Hosfelt) and old computer wires – if Internet available go to PICAXE.com and/or PHAnderson.com
13
Tip USB to Serial Adapter
Spark Fun sells PICAXE cable – part # PGM for about $26.00 Or Spark Fun’s USB to Serial – part # PGM for about $15.00 Details on use at Show cables (mouse, USB & DB-9) #5 ok PHANDERSON.COM has solderless development kit for around $20.00 (+/- depending on cable / psupply) Show & pass around programming cable – can also be made from DB9 (from Hosfelt) and old computer wires – if Internet available go to PICAXE.com and/or PHAnderson.com
14
Tip USB to Serial Adapter #2
Modern Device sells a similar board for about $14.00 Details on use at Show cables (mouse, USB & DB-9) #5 ok PHANDERSON.COM has solderless development kit for around $20.00 (+/- depending on cable / psupply) Show & pass around programming cable – can also be made from DB9 (from Hosfelt) and old computer wires – if Internet available go to PICAXE.com and/or PHAnderson.com
15
Garden Railways PICAXE Article
#NO_DATA 'speeds up programming #Picaxe 08M2 'identify the chip SETFREQ m32 'speed it up to 32 MHz SYMBOL Loopie = b2 'label variable b2 as Loopie SYMBOL Brightness = b1 'label b1 as Brightness SYMBOL Dlay = 150 'set constant Dlay to 150 Start: For Loopie = 0 to 100 step 1 '100 steps from off to bright brightness=255-loopie pwmout c.2, brightness, loopie 'use PWM to brighten the LED pause Dlay 'pause a bit next loopie 'get the next item in for/next pwmout c.2, 255,1023:pause 1000 'flash to full bright briefly for loopie = 100 to 0 step -1 'repeat above backwards pwmout c.2, brightness,loopie pause Dlay next loopie pause 'pause a bit with LED off goto start 'do it again! Single LED Lighthouse
16
Garden Railways PICAXE Article
#NO_DATA 'speeds up programming #Picaxe 08M2 'identify the chip SETFREQ m32 'speed it up to 32 MHz SYMBOL Loopie = b2 'label variable b2 as Loopie SYMBOL Brightness = b1 'label b1 as Brightness SYMBOL Dlay = 2 'set constant Dlay to 2 Start: Gosub ShortFlash 'do the shorter flash routine Gosub LongFlash 'do the longer flash routine GOTO Start: 'repeat ShortFlash: 'a label For Loopie = 0 to 100 step 1 '100 steps from off to bright brightness=255-loopie pwmout c.2, brightness, loopie 'light the LED pause Dlay next loopie for loopie = 100 to 0 step -1 'repeat above backwards pwmout c.2, brightness,loopie sertxd (#loopie, " ") return 'return to the point where the routine was called LongFlash: 'do the longer flash For Loopie = 0 to 255 step 1 '255 steps from off to bright pwmout c.2, brightness, loopie for loopie = 255 to 0 step -1 'repeat above backwards return Garden Railways PICAXE Article Single LED Mars light
17
Garden Railways PICAXE Article
Morse Code beacon
18
Garden Railways PICAXE Article
More to come…
19
New PICAXE Chip Prior seminars focused on the PICAXE 08M - 8 pins – about $3.00 each A new 18 pin chip, the PICAXE 18M2 -about $5.00 and has much more capability Faster 15 pins for input & output Much more memory Low voltage operation (as low as 2 volts!) Built in timer & multitasking
20
New PICAXE Project This new project is to create a completely solid state track side or on-board speed controller… …that has a really cool trick up its sleeve… …that can be modified to supply up to 12 amps of power!
21
PICAXE Speed Controller
Objectives: Controls DC track power: speed & direction Manages smooth acceleration / deceleration Never changes direction when power is on Controlled by inexpensive television IR remote control Can handle several amps
22
Speed Controller Parts: PICAXE 18M2 or 18M2+ Single chip “H-Bridge”
IR Receiver chip 18+ volt power supply
23
Speed Controller Many older circuits used a relay to reverse direction and a transistor to control speed This circuit uses a single L298N to do both jobs
24
Speed Controller The first version of the controller operates a simple track side layout using the IR remote control It can be used as a basic speed / direction controller …or it can be programmed to change direction based on time (easy point-to-point controller!)
25
How Do We Control the Controller?
Speed and other settings can be modified with a simple TV remote control Set min & max speed Set rate of deceleration Set time to wait at ends on point-to-point & IR sensor
26
IR Control Built into PICAXE
PICAXE program to display IR codes Symbol IRSense = b.2 'pin 8 Symbol InfraRED = b12 #TERMINAL 4800 IRTEST: Irin [50, IRTEST],IrSense, InfraRED SERTXD("InfraRED Code = ",#InfraRED,13,10) GOTO IRTEST
27
LED Test Routine Symbol Direction1 = b.5 'pin 11
Symbol IRSense = b.2 'pin 8 Symbol LEDBlue = c.7 'pin 16 Symbol LEDAmber = c.6 'pin 15 Symbol Motor = b.3 'pin 9 LEDTest: HIGH LEDAmber:PAUSE 500 HIGH LEDBlue:PAUSE 500 HIGH Motor:PAUSE 500 LOW IRSense:PAUSE 500 HIGH Direction1:PAUSE 500 HIGH Direction2:PAUSE 500 LOW LEDAmber LOW LEDBlue LOW Direction1 LOW Direction2 HIGH IRSense LOW Motor PAUSE 1000 GOTO LEDTest
28
Motor Control Routine Revers: toggle relay SERTXD("@Revers",13,10)
GOSUB decel SERTXD("Pausing 1000 millisecods",13,10) PAUSE 1000 TOGGLE direction1:TOGGLE direction2 GOSUB accel RETURN Accel: FOR loopie0= MinSpeed TO SetSpeed STEP 5 SERTXD(#loopie0," ") PWMDUTY motor,loopie0 ; set pwm duty PAUSE adrate NEXT loopie0 SERTXD(13,10) Decel: FOR loopie0= SetSpeed TO MinSpeed STEP -5 PWMDUTY motor, loopie0 SYMBOL Direction1 = b.0 'pin 6 SYMBOL Direction2 = b.1 'pin 7 SYMBOL Motor = b.3 'pin 9 SYMBOL Loop = b27 SYMBOL ADRate = b16 SYMBOL MinSpeed = w3 SYMBOL Loopie0 = W1 SYMBOL SetSpeed = w2 Symbol Relay = c.0 'pin 17 SetSpeed=0 PWMOUT motor,50,500 '150 ; set PWM duty HIGH Direction1:LOW Direction2 PWMDUTY motor, SetSpeed setspeed=200 ADRate=100 GOSUB Accel Cruise: SERTXD("Pausing 5000 millisecods",13,10) PAUSE 5000 GOSUB revers GOTO Cruise
29
Control Options Remote Control Buttons Channel UP - Increase speed
Channel DOWN - Decrease speed Volume UP - Change direction to forward (if not already going forward) Volume DOWN - Change direction to backwards (if not already going backwards) MENU - stop the train remembering the current speed - press MENU again to restart at the same speed and in the same direction
30
Additional Control Options
Press the RETURN button to change settings Change Maximum Speed Change Minimum Speed Change Run Time Change Acceleration / Deceleration rate
31
Point-to-Point Setup OPTIONAL: Reset RETURN / V-Chip / EXIT
Set Min speed then hit MUTE Set Max speed Set run time - RETURN / 3 / three digit time in seconds POWER to set deceleration point
32
Train Recorder The newest version automatically records (at a rate of 50 recordings per second) a train’s movements so that you can play them back over & over A rather unusual but very cool thing to do! Makes station-stops and complex routes a snap!
33
Train Recorder Additional Components:
A memory chip to store activity (can store up to 20 minutes of train movements!) A potentiometer to control speed & direction Optional: A relay to control a “stop block” that keeps things in “sync”
34
More POWER! The L298N supplies up to 3 amps with a heat sink
This is enough for most of us but not all! There is an easy add-on that can handle 12 amps continuously and peaks of up to 30 amps! Voltage can be as high as 24 volts
35
Other Uses The same controller can be used to automate and control anything that has a DC motor Animations circus rides cranes, trucks, cars inclines trams
36
I was blind and now I see…
Volt / Ohm Meters are right up there with indoor plumbing. Less than $10.00 Sometimes free Use two to give both volts & amps See Trainelectronics.com for details Show engine demo with Cree LED in front – need batteries for this, too #13 SHOW Individual Cree LEDs, too
37
Animation Animation adds fun and excitement to your layout
Moving things is easy with the PICAXE as it knows how to talk to model airplane servos
38
Servos A servo is made up of a small motor and set of gears
A string of control pulses precisely position the servo’s arm They are commonly used to operate control surfaces on model planes, boats and cars
39
Animation By sending precisely timed pulses the PICAXE can set the servo’s arm to a specific position and hold it there.
40
Servos The PICAXE can talk directly to a servo SYMBOL Temp = b0
SYMBOL ServoPin = c.2 ‘pin 5 Start: FOR Temp = 225 TO 75 Step -1 sertxd (#temp," ") SERVO ServoPin, Temp PAUSE 15 NEXT Temp sertxd (13,10) FOR Temp=75 TO 225 Step 1 GOTO Start:
41
Animation Only three wires go to the servo
Two for power and 1 for control pulses The SERVO command is built into the PICAXE
42
Servo Examples Elephant
43
Servo Examples Outhouse
44
Servo Examples Water Spout
45
Servo Examples Prairie Dogs
46
Servo Recorder For more complex servo movements the train recorder has been modified to operate one or two servos Ideal for dual axis searchlight dual servo bear animation
47
Servo Examples Scanning Spotlight Uses bright LED And two Servos
48
Servo Examples Bears Two servos on large bear One each on others
49
Servo Examples Eggliner eyes blink and move
50
Servo Examples Children’s Hospital Searchlight
Rotates back & forth via servo Only works when train is running and lights are down
51
Servos Come in Many Sizes
Standard 9 gram 4.3 gram 1.5 gram
52
Servos Coupler control Servos can easily uncouple cars
Uses a simple PICAXE controller and some type of radio control RC can be Revolution receiver Can be an inexpensive keychain transmitter & its small receiver
53
Servos with the Revolution Auxiliary Port
Revolution users who want to operate live steam or boats need to be able to operate servos A custom interface allows you to use the six auxiliary buttons to move two servos
54
Where do project ideas come from?
I recently received an from a garden railroader who wanted to illuminate his passenger cars with battery powered LEDs After some discussion and experimentation a solution was designed that provides us with many options for using and powering LED lighting
55
LED Coach Lights Design called for battery operation and enough lights to illuminate g-scale coaches using only 3 to 5 volts First units were built on popsicle sticks to get layout and spacing right All of the LEDs are wired in parallel to keep operating voltage down Adding parallel resistors increases brightness & decreases run time 100 ohm resistors Resistance (ohms) mA to LEDs Hours /w 2000 mAh cells one 100 20 two 50 40 three 33.3 60 four 25 80 five 90
56
LED Coach Lights Lights can be turned on and off by a latching reed switch Pass a magnet over one end of the reed switch and the LEDs go on Pass it over the other end and they go off The reed switch can be placed against the top of the car so nothing is seen and no holes are drilled in the car
57
LED Coach Lights Brightness and power consumption can be controlled by a resistor wired in series with the LEDs (these resistors are 100 Ω)
58
LED Coach Lights A custom circuit board was designed
And sent off for manufacture
59
LED Coach Lights The circuit board Is about 13” long can accommodate
up to 25 LEDs a latching reed switch current limiting resistor
60
LED Coach Lights Power Options
A power board was added that accommodates track power – DC or DCC Bridge rectifier – gives consistent polarity Voltage regulator- gives consistent 5 volts Capacitors – no flicker on dirty track
61
LED Coach Lights with Super Caps!
Super Caps can keep lights going for minutes after the power is removed
62
LED Coach Lights with DCC Power
The circuit was modified to put groups of LEDs in series to accommodate higher voltages such as from DCC The power supply board was modified as well
63
Tip – Inexpensive RC Relays
Keychain transmitter and SPDT relay for less than $7.00
64
Crossing Signal Controller (Ditch Lights, too!)
This project grew out of a question posed on an on-line forum that I moderate “I'm looking for a simple & cheap LED flashing circuit. For a single LED, and for alternating flashing LED's. An "onboard" circuit, possibly to operate off of 5vdc.” After some discussion I decided to build one … … and one thing led to another…
65
Crossing Signal Controller
000 Flash on/off every 1/2 second as long as power is on - triggers & pots are not used 001 1 Flash on/off at a rate determined by Pot #1 as long as power is on - triggers are not used 010 2 Flash on/off at a rate determined by Pot #1 as long as Trigger 1 is on 011 3 Flash on/off at a rate determined by Pot #1 - starts when Trigger 1 or 2 is hit, stops when the other Trigger is hit 100 4 Flash on/off at a rate determined by Pot #1 - starts when Trigger 1 or Trigger 2 is hit, stops after a time determined by Pot #2 101 5 Ditch lights at a rate determined by Pot #1 as long as Trigger 1 is on 110 6 Ditch lights at a rate determined by Pot #1 - starts when Trigger 1 or two is hit, stops when the other Trigger is hit 111 7 Ditch lights at a rate determined by Pot #1 - starts when Trigger 1 or Trigger 2 is hit, stops after a time determined by Pot #2
66
Crossing Signal Controller
Modification for ditch light operation Trigger 1 = both LEDs full on Trigger goes into ditch light bright / dim Both Triggers off = both LEDs full off Length of ditch light operation set by pot
67
Tip - Connectors We are always looking for ways to connect electrical devices together For low current use: Deal Extreme item # 15234 $2.78 for 10 pair including shipping! Pass connectors around
68
Tip – Connectors Connectors:
High current for track and battery connections: Deal Extreme item # 10788 $5.70 for 10 pair including shipping! Pass connectors around
69
Tip – Connectors 4mm Bullet Connectors:
High current for track and battery connections: Search eBay for “4mm bullet” Shown here before adding heat shrink tubing Pass connectors around
70
Tip – Connectors 3.5mm Bullet Connectors:
High current for track and battery connections: Search eBay for “3.5mm bullet” Nice between cars Pass connectors around
71
Tip – Connectors 2mm Bullet Connectors:
High current for track and battery connections: Search eBay for “2mm bullet” Thinner & longer than the others Pass connectors around
72
Tip – Connectors 3 wire Servo Cables have lots of uses
Can be used as is for 3 conductors or back-to-back for 6 conductors
73
Revolution with Sound The Revolution receiver now comes with sound
Generic Diesel Generic Steam More sounds are planned
74
Revolution with Sound The kit includes Receiver NonPlug&Play board
Smoke controller Trigger, link & speaker cables
75
Revolution with Sound
76
Revolution with Sound The receiver is just a bit higher than its predecessor There are four connections at the bottom of the board
77
Revolution with Sound TRIG – trigger for whistle, bell or chuff
G-FEDCBA – auxiliary output SET – link to transmitter SPEAKER
78
Revolution with Sound The basic hookup is shown here
79
Revolution with Sound Setup and linking is identical to that of the original with one exception The first funtion key (#1 on keypad) must be set to LATCH, not MOMENTARY
80
Revolution with Sound Sounds are controlled by the keypad #1 on/off
#2 bell #3 whistle #7 vol max #8 vol mid #9 vol min
81
Revolution with Sound External triggers (TRIG) can be activated by a reed switch and magnet On the diesel unit #1 controls the whistle and #2 controls the bell On the steam #1 is the whistle while #2 can be used for chuff If a pulse is not detected on #2 then chuff is tied to speed
82
Revolution with Sound Speakers work better with a baffle
They can be added to factory speakers, too
83
Revolution with Sound Pros...
Cost for a remote control receiver & sound is very reasonable Compact size Plug-n-Play on many locomotives Simple operation with the existing transmitter (no upgrade needed) More than ample volume for outside use Smoke board included Two trigger inputs that can be used for chuff and other sounds Software upgradeable
84
Revolution with Sound & Cons...
Whistle sound is fixed at three long blasts Sound quality could be better Lowest volume setting may still be too loud Diesel volume settings are quite a bit higher than those of the steam unit Only "generic" steam and diesel sounds available at this time Minimal documentation
85
Revolution with Sound & Suggestions
Change to a volume scheme where button 7 increases the volume in small increments, button 8 goes immediately to the middle volume and button 9 decreases the volume in small increments Allow end users to add additional sounds and modify existing sounds with a computer interface & software Make the small plugs for speaker, linking, triggers and auxiliary outputs available for purchase Change the whistle on both the diesel and steam units to a crossing signal (two longs, short, long) Change the bell sound so that it latches or only rings as long as the button is pressed. That is, press the button on the transmitter once to have it start and again to stop it if the button is set to latch. If it is set to momentary the bell would only ring when the button is held down.
86
Tip – Connectors Multi pin cables with sockets
Great for connecting cars to one another, tenders to locos, etc
87
Tip – Connectors For the Revolution receiver
7 pin for auxiliary interface 3 pin for chuff, bell, whistle triggers 2 pin for speaker
88
Tip – Tiny Motor Gear head motor a bit larger than a penny
Surprisingly high torque item # Less than $6.00 shipped Ideal for many animations
89
Tip – Dubro Collars Ideal for connecting to motor shafts & to join piano wire for servos
90
Mars Light The new version uses the eight pin connector / cable to join the 7 LEDs to the circuit board Makes installation much easier
91
Tip – Tiny Volt Meter Powered from voltage being measured – 4 to 30 volts Approx 1” x ½” x ½” Search eBay for: “Ultra Mini size LED Volt Meter” $ $2.00 shipping Pass connectors around
92
Tip – Tiny Volt Meter Makes a nice track voltage tester
Use a 10 watt / 12 volt bulb as a load Pass connectors around
93
Tip - Adhesive Great for quick temporary or permanent connections
Similar to the “goo” on the back of a new credit card I use it in place of hot melt glue DOTS brand Michaels (don’t forget the 40% off coupon!) Pass connectors around
94
Tip – CA Accelerator Most of us have used cyanoacrylic glue (super glue) But have you also used CA accelerator which dries CA in seconds? Pass connectors around
95
Tip - Soldering A good iron makes you a better solderer! $46.95
MPJA.com Item #ZD 929C $46.95 Digital temperature readout Replacement handle assembly $6.95 Show Relay Board
96
Tip - Soldering A clean tip makes all the difference. $6.03
Item 34154 $6.03 Show Relay Board
97
Tip – Measure Grade Digital Gauges from Micro-Mark and… Harbor Freight
98
Tip Plumber’s Putty to hold for Soldering
I find Plumber’s Putty to be ideal for holding parts while I solder them Easy to remove and reasonably inert
99
Tip Meter with Buzzer to test Continuity
A meter with an audible continuity tester is worth its weight in gold! Least expensive one that I use is from Harbor Freight – part # 37772 or part # (a bit more $$ but has “auto-off”)
100
Tip Salvage Magnets from old Hard Drives
Virtually all computer hard drives have strong (rare earth) magnets in them Remove case & carefully remove platters and other parts that are in the way Caution: some platters are GLASS! Fragile and easily converted to SHARP pieces!
101
Tip Testing LEDs Just about any LED can be tested with a 3 volt lithium battery 2032, 2025, etc Touch the anode (longer wire) to the + side of the battery Touch the cathode (wire by notch in LED) to the - side White LEDs are OK for long use at 3+ volts, Red, Green, Amber are not
102
Tip Rubber Bands to Join Track
Free from most bike shops! Cut bicycle tubes into loops to join track for club or other temporary layouts Road bike tubes work best Paper cutter is a plus
103
Tip - MPJA Power Supply Excellent tool for testing circuits
Also works well for testing locomotive and other train related devices Dual meters (volts / amps) provide very valuable information
104
Relays with the Revolution Auxiliary Port
The Revolution’s auxiliary port can control up to six devices It is primarily designed for sound and smoke unit activation but can also be used for relays and other devices
105
Relays with the Revolution Auxiliary Port
Details at Trainelectronics.com
106
Animation
107
It’s more fun to make it yourself than to buy it ready to go!
Remember: "I am always doing that which I cannot do, in order that I may learn how to do it." Pablo Picasso About 1:21 to end
108
Your Ideas? Questions? 2:10
109
About 1:21 to end
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.