1 / 128

2014 Amherst Railroad Hobby Show

2014 Amherst Railroad Hobby Show. Dave Bodnar January 23, 2014 Amherst, MA. This presentation is available on-line at: www.trainelectronics.com or www.davebodnar.com. Revised 01-20-14. Objectives. Demonstrate various devices & projects that utilize microcontroller operation …

marc
Download Presentation

2014 Amherst Railroad Hobby Show

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 2014 Amherst RailroadHobby Show Dave Bodnar January 23, 2014 Amherst, MA This presentation isavailable on-line at:www.trainelectronics.com or www.davebodnar.com Revised 01-20-14

  2. Objectives • Demonstrate various devices & projects that utilize microcontroller operation … • … and lots of tips & tricks and other things that do not! • (Hopefully) Excite you with the possibilities and enable you to begin experimenting and enhancing your railroad!

  3. Topics to be CoveredPart 1 • PICAXE overview – What is it? Why use it? How do we use it? • Build & program a number of PICAXE projects • Explore a sprinkling of Tips, Tricks, Tools and new & improved gizmos & gadgets

  4. Topics to be CoveredPart 2 • Animations & other PICAXE based projects • …More Tips, Tricks, Tools • …More new & improved gizmos & gadgets

  5. Working 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!

  6. Working Hypothesis 2 We already know about & have experience with many of these things: • Batteries & power supplies • Track wiring & motors • AC, DC, voltage, amperage & resistance • LEDs & incandescent bulbs • Series & parallel circuits • Switches, relays & transistors • Simple Programming

  7. Working 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!

  8. PICAXE • What can it do? • Intelligently control & automate many aspects of operating your railroad • Operate lights, motors, animations and other electrically powered devices

  9. PICAXE • Best choice in terms of: • Capability • Ease of use • Size • Cost • Support • dave@davebodnar.com • Many PICAXE articles www.trainelectronics.com • Several Books available on Amazon – Search for PICAXE

  10. PICAXE - What You Need • Windows computer with serial port or … USB to serial adapter or … USB programming cable • Windows computer running free PICAXE software • Power source • 3 @ AA cells = 4.5 volts • Note:AxePad software is available for Mac & Linux computers – fewer features than PC software

  11. Tip 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-09260for about $15.00 Details on use at www.trainelectronics.com

  12. Tip • Peter Anderson (PHAnderson.com) has PICAXE chips & accessories • Amazon & eBay – search for PICAXE • SparkFun.com

  13. First Project:Flashing Crossing Lights • Design objectives: • Alternately flash two red LEDs • Operate from battery power • Alter timing and other characteristics from software

  14. First Project:Flashing Crossing Lights • Then we will modify the circuit to: • Start from a button push • Do other “flashing” things by making minor changes in hardware & software

  15. Tip - Testing LEDs White LEDs are OK for long use at 3+ volts, Red, Green, Amber are not A great use for old watch batteries! • 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

  16. LED Information • LED Related Articles: • A Simple Constant Brightness LED • LEDs 101 - Introduction & Overview • LEDs 102 - Using them Onboard Trains • LEDs 103 - Turning them On and Off • LEDs 104 - A Better Constant Brightness Circuit for LEDs

  17. Flashing Crossing Lights Parts: Cost: Less than $10.00

  18. Flashing Crossing Lights Software: free from www.picaxe.com

  19. Flashing Crossing Lights Our wiring plan is in the form of a schematic - a drawings of what we need to build and how it is wired together Remember: Don’t use a 9 volt battery or 4 fresh 1.5 volt AA cells! 5.5 volts maximum!

  20. Not sure about…??? • A resistor’s value… • Or a battery’s voltage… • Or if a wire is broken… • There is a tool for that!

  21. 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

  22. 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” • $5.99 (or less) + $0.00 shipping

  23. Tip – Step Down Voltage Converter • Suntekstore.com • < $8 shipped – some times on sale for less • http://www.suntekstore.com/goods-14007039-adjustable_step-down_dc-dc_power_module_with_voltmeter_display.html • Up to 2 amps without heat sink • Includes digital meter! • Adjust voltage withscrewdriver

  24. Tip – Step Down Voltage Converter • Can easily be modified to use a larger potentiometer • Inexpensive speed control for a small layout

  25. Flashing Crossing Lights Radio Shack board # 276-002 $15.00

  26. Flashing Crossing Lights

  27. Flashing Crossing Lights Program 1: Notes: • “start” is just a label telling the “goto” where to go • the program remains in the chip’s memory until it is manually erased or overwritten. high 1 ‘turn on LED 1 - pin out1 low 2 ‘turn off LED 2 - pin out2 start: pause 500 ‘wait ½ second toggle 1 ‘switch LED 1 on pin out1 toggle 2 ‘switch LED 2 on pin out2 goto start: ‘do it again

  28. Flashing Crossing Lights Program 2: modified to flash for 10 seconds and turn off for 10 seconds start: high 1 ‘turn on LED 1 low 2 ‘turn off LED 2 For b0=1 to 20 ‘repeat 20 times pause 500 ‘wait ½ second toggle 1 ‘switch LED 1 toggle 2 ‘switch LED 2 next b0 ‘back to loop low 1 ‘turn LED 1 off low 2 ‘turn LED 2 off pause 10000 ‘stay here 10 seconds goto start: ‘do it again

  29. Flashing Crossing Lights • Program simulation is built in! • You can write and test programs without any hardware… • Give it a try tonight!

  30. Flashing Crossing Lights Hardware modification for button or reed switch activation:

  31. Flashing Crossing Lights Program 3: modified to flash 5 seconds on each button push start: low 1 ‘turn off LED 1 low 2 ‘turn off LED 2 if pin3 = 1 then start: ‘if switch off go to top flash: high 1 ‘LED 1 on low 2 ‘LED 2 off for b0= 1 to 10 ‘do this 10 times pause 500 ‘wait ½ second toggle 1:toggle 2 ‘switch lights next b0 ‘do next of 5 loops goto start: ‘start from very top

  32. Two Sensors for Crossing • Add a second sensor so that the light goes on when it passes one sensor… • And goes off when it hits the other sensor. Sensor 2 Sensor 1

  33. Flashing Crossing Lights Program 4: modified to flash when one switch is hit and stop after a 2nd switch is hit Either of the two switches can be hit first & it will only stop after the other switch is hit. PauseBeforeStart:'prevents detecting slow button push low 1 : low 2 ‘turn off both LEDs pause 1000 'pause 1 second CheckButtons: b1=0:b2=0 if pin3 = 1 and pin4 = 1 then CheckButtons if pin3=0 then b1=1 : goto flash ‘ set b1 to show it was hit first endif b2=1 ‘set b2 to 1 to show it was hit first Flash: high 1 : low 2 ‘LED 1 on & LED 2 off FlashAgain: for w3= 1 to 250 'check for button before changing lights if b2=1 and pin3=0 then PauseBeforeStart if b1=1 and pin4=0 then PauseBeforeStart next w3 toggle 1:toggle 2 ‘switch lights goto FlashAgain: 'continue checking buttons

  34. Tip - Reed Switches • Two small metal plates touch when near a magnet closing acircuit • Contained withina glass vial – VERY Fragile! • Many sizes available

  35. Tip – Magnets for Reed Switches • Deal Extreme 10mm x 1mm Magnets (part #13516) • Very strong – 100 for $12.80 delivered!

  36. Tip – Magnets for Reed Switches • Harbor Freight magnets

  37. Tip – Magnets for Reed Switches • SunTekStore magnets

  38. Tip - Free Magnets • Salvaged 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 • NOTE: some platters are GLASS & are very, very fragile and easily converted to SHARP pieces!

  39. Tip – Magnets as Clamps • I recently had to glue a sign to the middle of a building… • Putting a rare earth magnet on the front and another on the back made it a snap! • Also great • with “1, 2, 3 block” behind magnets • as couplers • to hold bodies on cars

  40. Latching Reed Switches • Pass a magnet over one end – it is ON • Pass a magnet over the other end – it is OFF • Great for turning battery powered lights on/off with a magnet on a stick

  41. Tip - Connectors We are always looking for ways to connect electrical devices together • For low currentuse: • Deal Extreme item # 15234 • $2.99 for 10pair includingshipping!

  42. Tip – Connectors • Connectors: • High current fortrack and batteryconnections: • Deal Extreme item # 10788 • $6.37 for 10pair includingshipping!

  43. 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 • This is the type of connector that I use for programming the PCAXE • Ideal for tender / loco connections in larger scales • Ebay - $3.43 for 10 long extensionshttp://www.ebay.com/itm/10pcs-150mm-Servo-Extension-Lead-Wire-Cable-For-Futaba-JR-/151082981725?pt=Radio_Control_Parts_Accessories&hash=item232d3f595d

  44. Tip – Connectors • Multi pin cables with sockets • Great for connecting cars to one another, tenders to locos, etc • Available in 2 pin  8 pin

  45. Tip – Connectors • Search eBay for jst 1.25to find the smallest connectors

  46. Tip – Tiny Motor • Gear head motor a bit larger than a penny • Surprisingly high torque • http://www.suntekstore.com item # 14002627 • Less than $7.00 shipped • Ideal for many animations • Phil’s Narrow Gauge, too

  47. Useless Gizmo Animation

  48. Tip – Dubro Collars • Ideal for connecting to motor shafts & to join piano wire for servos • http://shop.dubro.com/c/aircraft_collars

  49. Tip – Heat Shrink Tubing • Excellent for insulating joints & making repairs • Soldering wires first is recommended but not mandatory • Available in many colors – great trick for identifying wires • Available in many diameters, too • Fry’s has an excellent supply, BangGood, too!

  50. Garden Railways PICAXE Article April 2013 Issuepages 54-59 Contains a detailed introduction to the PICAXE and several projects

More Related