picaxepic 1 2013 east coast large scale train show dave bodnar march 22, 2013 york, pa electronics,...

98
1 PICAXE PIC 2013 East Coast 2013 East Coast Large Scale Train Show Large Scale Train Show Dave Bodnar Dave Bodnar March 22, 2013 March 22, 2013 York, PA York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets, Tips, Tricks & More! What’s New? This presentation is available on-line at: www.trainelectronics.c om or www.davebodnar.com Revised 03-22-2013

Upload: sophia-mcgarry

Post on 26-Mar-2015

220 views

Category:

Documents


6 download

TRANSCRIPT

Page 1: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

11

PICAXE PIC

2013 East Coast2013 East CoastLarge Scale Train ShowLarge Scale Train Show

Dave BodnarDave Bodnar

March 22, 2013March 22, 2013

York, PAYork, PA

Electronics, Microcontrollers & Trains

Electronic Gizmos, Gadgets, Tips, Tricks & More!

What’s New?This presentation isavailable on-line at:

www.trainelectronics.com or www.davebodnar.com

Revised 03-22-2013

Page 2: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

22

PICAXE PIC

ObjectivesObjectives• 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!

Page 3: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

33

PICAXE PIC

Topics to be CoveredTopics 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

Page 4: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

99

PICAXE PIC

PICAXE BasicsPICAXE 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”

Page 5: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

1010

PICAXE PIC

Garden Railways Garden Railways PICAXE ArticlePICAXE Article

April 2013 Issuepages 54-59

Contains a detailed introduction to the PICAXE and several projects

Page 6: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

1111

PICAXE PIC

Garden RailwaysGarden RailwaysPICAXE ArticlePICAXE Article

Shows how to build:• Single LED

Lighthouse• Single LED Mars

Light• Morse Code Beacon

All using the same circuit

Page 7: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

1212

PICAXE PIC

PICAXE - What You NeedPICAXE - What You Need1. Computer with

serial port or …

USB to serial adapter or …

USB programming cable

2. Windows computer running free PICAXE software (Mac & Linux, too)

3. Power source– 3 @ AA cells = 4.5 volts

Page 8: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

1313

PICAXE PIC

TipTip

USB to Serial Adapter

Spark Fun sells PICAXE cable – part # PGM-08312 for about $26.00

Or

Spark Fun’s USB to Serial – part # PGM-09260 for about $15.00

Details on use at www.trainelectronics.com

Page 9: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

1414

PICAXE PIC

TipTip

USB to Serial Adapter #2

Modern Device sells a similar board for about $14.00

Details on use at www.trainelectronics.com

Page 10: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

1515

PICAXE PIC

Garden RailwaysGarden RailwaysPICAXE ArticlePICAXE Article

Single LED Lighthouse

#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

brightness=255-loopie

pwmout c.2, brightness,loopie

pause Dlay

next loopie

pause 2000 'pause a bit with LED off

goto start 'do it again!

Page 11: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

1616

PICAXE PIC

Garden RailwaysGarden RailwaysPICAXE ArticlePICAXE Article

Single LED Mars light

#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

brightness=255-loopie

pwmout c.2, brightness,loopie

sertxd (#loopie, " ")

pause Dlay

next 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

brightness=255-loopie

pwmout c.2, brightness, loopie

pause Dlay

next loopie

for loopie = 255 to 0 step -1 'repeat above backwards

brightness=255-loopie

pwmout c.2, brightness,loopie

pause Dlay

next loopie

return

Page 12: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

1717

PICAXE PIC

Garden RailwaysGarden RailwaysPICAXE ArticlePICAXE Article

Morse Codebeacon

Page 13: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

1818

PICAXE PIC

Garden RailwaysGarden RailwaysPICAXE ArticlePICAXE Article

More to come…

Page 14: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

1919

PICAXE PIC

New PICAXE ChipNew 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

Page 15: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

2020

PICAXE PIC

New PICAXE ProjectNew 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!

Page 16: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

2121

PICAXE PIC

PICAXE Speed ControllerPICAXE 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

Page 17: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

2222

PICAXE PIC

Speed ControllerSpeed Controller

• Parts:– PICAXE 18M2 or 18M2+– Single chip “H-Bridge”– IR Receiver chip– 18+ volt power supply

Page 18: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

2323

PICAXE PIC

Speed ControllerSpeed 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

Page 19: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

2424

PICAXE PIC

Speed ControllerSpeed 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!)

Page 20: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

2525

PICAXE PIC

How Do We Control the Controller?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

Page 21: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

2626

PICAXE PIC

IR Control Built into PICAXEIR Control Built into PICAXE

• PICAXE program to display IR codesSymbol IRSense = b.2 'pin 8

Symbol InfraRED = b12

#TERMINAL 4800

IRTEST:

Irin [50, IRTEST],IrSense, InfraRED

SERTXD("InfraRED Code = ",#InfraRED,13,10)

GOTO IRTEST

Page 22: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

2828

PICAXE PIC

Motor Control RoutineMotor Control RoutineSYMBOL Direction1 = b.0 'pin 6SYMBOL Direction2 = b.1 'pin 7SYMBOL Motor = b.3 'pin 9SYMBOL Loop1 = b27SYMBOL ADRate = b16SYMBOL MinSpeed = w3SYMBOL Loopie0 = W1SYMBOL SetSpeed = w2Symbol Relay = c.0 'pin 17SetSpeed=0PWMOUT motor,50,500 '150 ; set PWM dutyHIGH Direction1:LOW Direction2PWMDUTY motor, SetSpeed

setspeed=200ADRate=100

GOSUB Accel

Cruise:SERTXD("Pausing 5000 millisecods",13,10)PAUSE 5000GOSUB reversGOTO Cruise

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:SERTXD("@Accel",13,10)FOR loopie0= MinSpeed TO SetSpeed STEP 5SERTXD(#loopie0," ")PWMDUTY motor,loopie0 ; set pwm dutyPAUSE adrateNEXT loopie0SERTXD(13,10)RETURN

Decel:SERTXD("@Decel",13,10)FOR loopie0= SetSpeed TO MinSpeed STEP -5SERTXD(#loopie0," ")PWMDUTY motor, loopie0PAUSE adrateNEXT loopie0SERTXD(13,10)RETURN

Page 23: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

2929

PICAXE PIC

Control OptionsControl 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

Page 24: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

3030

PICAXE PIC

Additional Control OptionsAdditional Control Options

– Press the RETURN button to change settings1. Change Maximum Speed

2. Change Minimum Speed

3. Change Run Time

4. Change Acceleration / Deceleration rate

Page 25: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

3131

PICAXE PIC

Point-to-Point SetupPoint-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

Page 26: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

3232

PICAXE PIC

Train RecorderTrain 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!

Page 27: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

3333

PICAXE PIC

Train RecorderTrain 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”

Page 28: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

3434

PICAXE PIC

More POWER!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

Page 29: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

3535

PICAXE PIC

Other UsesOther 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

Page 30: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

3737

PICAXE PIC

AnimationAnimation

• 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

Page 31: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

3838

PICAXE PIC

ServosServos

• 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

Page 32: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

3939

PICAXE PIC

AnimationAnimation• By sending precisely timed pulses the

PICAXE can set the servo’s arm to a specific position and hold it there.

Page 33: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

4040

PICAXE PIC

ServosServosThe PICAXE can talk directly to a servo

SYMBOL Temp = b0SYMBOL ServoPin = c.2 ‘pin 5

Start:FOR Temp = 225 TO 75 Step -1 sertxd (#temp," ") SERVO ServoPin, Temp PAUSE 15NEXT Temp sertxd (13,10)FOR Temp=75 TO 225 Step 1 sertxd (#temp," ") SERVO ServoPin, Temp PAUSE 15NEXT Temp sertxd (13,10)GOTO Start:

Page 34: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

4141

PICAXE PIC

AnimationAnimation• Only three wires go to the servo

– Two for power and 1 for control pulses– The SERVO command is built into the

PICAXE

Page 35: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

4242

PICAXE PIC

Servo ExamplesServo Examples

• Elephant

Page 36: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

4343

PICAXE PIC

Servo ExamplesServo Examples

• Outhouse

Page 37: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

4444

PICAXE PIC

Servo ExamplesServo Examples

• Water Spout

Page 38: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

4545

PICAXE PIC

Servo ExamplesServo Examples• Prairie Dogs

Page 39: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

4646

PICAXE PIC

Servo RecorderServo 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

Page 40: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

4747

PICAXE PIC

Servo ExamplesServo Examples

• Scanning Spotlight

• Uses brightLED

• And twoServos

Page 41: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

4848

PICAXE PIC

Servo ExamplesServo Examples

• Bears– Two servos on large

bear– One each on others

Page 42: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

4949

PICAXE PIC

Servo ExamplesServo Examples

• Eggliner– eyes blink– and move

Page 43: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

5050

PICAXE PIC

Servo ExamplesServo Examples• Children’s Hospital Searchlight

– Rotates back & forth via servo– Only works when train is running and lights

are down

Page 44: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

5151

PICAXE PIC

Servos Come in Many SizesServos Come in Many Sizes

• Standard

• 9 gram

• 4.3 gram

• 1.5 gram

Page 45: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

5252

PICAXE PIC

ServosServos

• 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

Page 46: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

5353

PICAXE PIC

Servos with the Revolution Servos with the Revolution Auxiliary PortAuxiliary 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

Page 47: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

5454

PICAXE PIC

Where do project ideas come from?Where do project ideas come from?

• I recently received an email 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

Page 48: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

5555

PICAXE PIC

LED Coach LightsLED 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 LEDsHours /w 2000 mAh cells

one 100 20 100

two 50 40 50

three 33.3 60 33.3

four 25 80 25

five 20 90 20

Page 49: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

5656

PICAXE PIC

LED Coach LightsLED 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

Page 50: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

5858

PICAXE PIC

LED Coach LightsLED Coach Lights

• A custom circuit board was designed

• And sent off for manufacture

Page 51: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

5959

PICAXE PIC

LED Coach LightsLED Coach Lights• The circuit board

– Is about 13” long

– can accommodate • up to 25 LEDs• a latching reed switch• current limiting resistor

Page 52: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

6060

PICAXE PIC

LED Coach Lights Power OptionsLED 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

Page 53: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

6161

PICAXE PIC

LED Coach Lights with Super Caps!LED Coach Lights with Super Caps!

• Super Caps can keep lights going for minutes after the power is removed

Page 54: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

6262

PICAXE PIC

LED Coach Lights with DCC PowerLED 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

Page 55: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

6363

PICAXE PIC

Tip – Inexpensive RC RelaysTip – Inexpensive RC Relays

• Keychain transmitter and SPDT relay for less than $7.00

• http://www.tmart.com/12V-10A-Single-Channel-Wireless-Remote-Control-Switch-200M_p125577.html

Page 56: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

6464

PICAXE PIC

Crossing Signal ControllerCrossing Signal Controller(Ditch Lights, too!)(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…

Page 57: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

6565

PICAXE PIC

Crossing Signal Controller Crossing Signal Controller

000 0Flash on/off every 1/2 second as long as power is on - triggers &

pots are not used

001 1Flash 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 3Flash 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 4Flash 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 6Ditch lights at a rate determined by Pot #1 - starts when Trigger 1 or

two is hit, stops when the other Trigger is hit

111 7Ditch 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

Page 58: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

6666

PICAXE PIC

Crossing Signal ControllerCrossing Signal Controller

• Modification for ditch light operation– Trigger 1 = both LEDs full on– Trigger 1 + 2 goes into ditch light bright / dim– Both Triggers off = both LEDs full off– Length of ditch light operation set by pot

Page 59: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

6767

PICAXE PIC

Tip - ConnectorsTip - 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 includingshipping!

Page 60: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

6868

PICAXE PIC

Tip – ConnectorsTip – Connectors

• Connectors:– High current for

track and batteryconnections:

• Deal Extreme item # 10788

• $5.70 for 10pair includingshipping!

Page 61: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

6969

PICAXE PIC

Tip – ConnectorsTip – Connectors

• 4mm Bullet Connectors:– High current for track and battery connections:

• Search eBay for “4mm bullet”• Shown here before adding heat shrink tubing

Page 62: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

7070

PICAXE PIC

Tip – ConnectorsTip – Connectors

• 3.5mm Bullet Connectors:– High current for track and battery connections:

• Search eBay for “3.5mm bullet”• Nice between cars

Page 63: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

7171

PICAXE PIC

Tip – ConnectorsTip – Connectors

• 2mm Bullet Connectors:– High current for

track and battery connections:

• Search eBay for “2mm bullet”

• Thinner & longer than the others

Page 64: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

7272

PICAXE PIC

Tip – ConnectorsTip – Connectors

• 3 wire Servo Cables have lots of uses

• Can be used as is for 3 conductors or back-to-back for 6 conductors

Page 65: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

7373

PICAXE PIC

Revolution with SoundRevolution with Sound

• The Revolution receiver now comes with sound– Generic Diesel – Generic Steam– More sounds are planned

Page 66: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

7474

PICAXE PIC

Revolution with SoundRevolution with Sound

• The kit includes– Receiver– NonPlug&Play board– Smoke controller– Trigger, link & speaker cables

Page 67: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

7575

PICAXE PIC

Revolution with SoundRevolution with Sound

Page 68: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

7676

PICAXE PIC

Revolution with SoundRevolution with Sound

• The receiver is just a bit higher than its predecessor

• There are four connections at the bottom of the board

Page 69: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

7777

PICAXE PIC

Revolution with SoundRevolution with Sound• TRIG – trigger for whistle, bell or chuff

• G-FEDCBA – auxiliary output

• SET – link to transmitter

• SPEAKER

Page 70: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

7878

PICAXE PIC

Revolution with SoundRevolution with Sound

• The basic hookup is shown here

Page 71: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

7979

PICAXE PIC

Revolution with SoundRevolution 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

Page 72: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

8080

PICAXE PIC

Revolution with SoundRevolution with Sound• Sounds are controlled by the keypad

• #1 on/off

• #2 bell

• #3 whistle

• #7 vol max

• #8 vol mid

• #9 vol min

Page 73: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

8181

PICAXE PIC

Revolution with SoundRevolution 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

Page 74: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

8282

PICAXE PIC

Revolution with SoundRevolution with Sound• Speakers work better with a baffle

• They can be added to factory speakers, too

Page 75: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

8383

PICAXE PIC

Revolution with SoundRevolution with SoundPros...• 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

Page 76: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

8484

PICAXE PIC

Revolution with SoundRevolution 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

Page 77: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

8585

PICAXE PIC

Revolution with SoundRevolution 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.

Page 78: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

8686

PICAXE PIC

Tip – ConnectorsTip – Connectors

• Multi pin cables with sockets

• Great for connecting cars to one another, tenders to locos, etc

Page 79: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

8787

PICAXE PIC

Tip – ConnectorsTip – Connectors

• For the Revolution receiver– 7 pin for auxiliary interface– 3 pin for chuff, bell, whistle triggers– 2 pin for speaker

– http://www.trainelectronics.com/ART5700TrainEngineerRevolution/Connectors/index.htm

Page 80: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

8888

PICAXE PIC

Tip – Tiny MotorTip – Tiny Motor• Gear head motor a bit larger than a penny

• Surprisingly high torque

• http://www.suntekstore.com item # 14002627

• Less than $6.00 shipped

• Ideal for many animations

Page 81: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

8989

PICAXE PIC

Tip – Dubro CollarsTip – Dubro Collars

• Ideal for connecting to motor shafts & to join piano wire for servos

• http://shop.dubro.com/c/aircraft_collars

Page 82: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

9090

PICAXE PIC

Mars LightMars Light

• The new version uses the eight pin connector / cable to join the 7 LEDs to the circuit board

• Makes installation much easier

Page 83: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

9191

PICAXE PIC

Tip – Tiny Volt MeterTip – 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”

• $6.99 + $2.00 shipping

Page 84: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

9292

PICAXE PIC

Tip – Tiny Volt MeterTip – Tiny Volt Meter

• Makes a nice track voltage tester

• Use a 10 watt / 12 volt bulb as a load

Page 85: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

9393

PICAXE PIC

Tip - AdhesiveTip - 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!)

Page 86: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

9595

PICAXE PIC

Tip - SolderingTip - Soldering• A good iron makes you a better solderer!

– MPJA.com

– Item #ZD 929C – $46.95– Digital

temperature readout

– Replacement handle assembly $6.95

Page 87: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

9696

PICAXE PIC

Tip - SolderingTip - Soldering• A clean tip makes all the difference.• http://www.dealextreme.com

• Item 34154 • $6.03

Page 88: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

9898

PICAXE PIC

TipTipPlumber’s Putty to hold for SolderingPlumber’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

Page 89: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

100100

PICAXE PIC

TipTipSalvage Magnets from old Hard DrivesSalvage 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!

Page 90: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

101101

PICAXE PIC

TipTipTesting LEDsTesting 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

Page 91: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

102102

PICAXE PIC

TipTipRubber Bands to Join TrackRubber Bands to Join Track

• Cut bicycle tubes into loops to join track for club or other temporary layouts

• Road bike tubes work best

• Paper cutter is a plus

Free from most bike shops!

Page 92: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

103103

PICAXE PIC

Tip - MPJA Power SupplyTip - 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

Page 93: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

104104

PICAXE PIC

Relays with the Revolution Auxiliary Relays with the Revolution Auxiliary PortPort

• 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

Page 94: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

105105

PICAXE PIC

Relays with the Revolution Auxiliary Relays with the Revolution Auxiliary PortPort

• Details at Trainelectronics.com

Page 95: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

106106

PICAXE PIC

AnimationAnimation

Page 96: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

107107

PICAXE PIC

It’s more fun to make it yourself than to buy it ready to go!

"I am always doing that which I "I am always doing that which I cannot do, in order that I may cannot do, in order that I may learn how to do it."learn how to do it."Pablo PicassoPablo Picasso

Remember:

Page 97: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

108108

PICAXE PIC

Your Ideas?Your Ideas?

• Questions?

Page 98: PICAXEPIC 1 2013 East Coast Large Scale Train Show Dave Bodnar March 22, 2013 York, PA Electronics, Microcontrollers & Trains Electronic Gizmos, Gadgets,

109109

PICAXE PIC