Notes
Slide Show
Outline
1
"Microprocessor Controlled Engines"
  • Microprocessor Controlled Engines

    It is much easier than you may think


2
Objectives:
  • Introduce the basics of programming and using microprocessors to control lights, motors and other devices
  • Explore the use of simple microprocessor based controllers in garden railway applications
  • Allow time for discussion and questions


3
Microprocessor Control
    • BASIC Stamp www.parallax.com
    • “PICAXE microcontrollers are exciting, low-cost, re-programmable chips that can be used as low-cost 'brains' in many kinds of electronic projects. “
    • www.picaxe.com


4
Microprocessor Control
    • PICAXE 08M is an 8 pin integrated circuit that can be used to control lights, sound boards, motors and other devices
    • It is also able to “sense”
      • Touch
      • Light
      • Motion
      • other things in its environment

5
Microprocessor Control
    • The key to its simplicity is the capability to program it in BASIC rather than a more complex and difficult to learn language
    • All software and documentation are free
    • Extensive support and sample programs are available
    • Chips range in price from less than $4.00 to around $20.00
    • Even the simplest chip is VERY capable!
6
Flashing Crossing Lights
    • First Project:  Flashing crossing lights
    • Objectives:
      • Flash two red LEDs alternately
      • Pause and repeat
      • Battery power
      • Alter timing from software
7
Flashing Crossing Lights
  • 7404 based LED flasher circuit
8
Flashing Crossing Lights
    • Parts:


9
Flashing Crossing Lights
    • Other items needed:
    • Any PC with serial port (or USB to serial  adapter)
    • programming cable
      • needs only 3 wires
      • can use old mouse cable
    • Soldering iron & wire cutters
    • Software from www.picaxe.com



10
Flashing Crossing Lights
    • Circuit Diagram:
11
Flashing Crossing Lights


12
Flashing Crossing Lights


13
Flashing Crossing Lights
    • Software:


14
Flashing Crossing Lights
    • Software – modified to flash 10 seconds and turn off for 10 seconds


15
Flashing Crossing Lights
    • Hardware modification for button or reed switch activation:
16
Flashing Crossing Lights
    • Software – modified to flash 5 seconds on button push
17
Flashing Crossing Lights on Steroids!
18
Lighthouse Beacon
  • Design objectives
    • Gradually brighten a bulb or LED to near full brightness
    • Flash to full brightness briefly
    • Gradually dim till off
    • Delay for a set time
    • Repeat
    • Provide for LED or halogen lights
19
Lighthouse Beacon
20
Lighthouse Beacon
  • Parts
    • Adds one resistor and one transistor to the flasher circuit
    • The most significant changes are to the software
21
Lighthouse Beacon
  • LED circuit diagram:
22
Lighthouse Beacon
  • Pulsed
  • Width
  • Modulation
23
Lighthouse Beacon
24
Lighthouse Beacon
  • Halogen bulb circuit diagram
    • adds a voltage regulator and larger transistor


25
Infrared Object Detection
  • Eggliner prototype with commercial detection unit
26
Infrared Object Detection
  • Areas for enhancement
    • 9+ volts needed to operate sensor
    • Relay gave full on or full stop
    • Size makes concealment difficult
    • Rapid oscillation between on / off
    • Option to put beacon on car in front
27
Infrared Object Detection
  • Using PICAXE to build on and enhance Ralph’s idea
    • IR LED flasher (38 kHz)
    • IR sensor – high when it sees 38 kHz
    • Relay / resistor for speed control
    • Timed delay to avoid choppy movement
    • Addition of a beacon on forward train to extend distance (FRED)
28
Infrared Object Detection
  • IR LED flasher (38 kHz)


29
Infrared Object Detection
    • IR sensor – high when it sees 38 kHz
30
Infrared Object Detection
    • Relay / resistor for speed control
31
Infrared Object Detection
  • Picaxe sends out pulses, detects them and controls the motor in response to what is “sees”
  • Prototype:
32
Infrared Object Detection
  • Software
33
Infrared Object Detection
34
Crossing Gate with Lights & Sound
  • Objectives:
    • Detect passing train with 38 KHz pulsed IR sensor
    • Lower crossing gate with servo
    • Flash crossing lights
    • Sound crossing bell
    • Continue till 10 seconds passes without detection
35
Crossing Gate with Sound
  • Hardware:
    • Picaxe for control
    • 38 KHz IR transmitter and detector
    • Inexpensive bell module
    • Amplifier and speaker
    • Radio control airplane servo
    • LED lights for crossing
    • Battery or solar power
36
 
37
"' 0=38 kHz pulse chip..."
  • ' 0=38 kHz pulse chip –
  •  ' 1=LED –
  • ' 2=LED –
  • ' 3=input from IR receiver –
  • ' 4=Servo control
  • symbol flashdelay = 15
  • init: high 0: low 1: low 2
  • servo 4, 100
  • start: b3=0
  • low 0 '38kHz on
  • pause 3
  • if pin3=0 then train:
  • high 0
  • pause 100
  • goto start:
  • train: high 0
  • high 1: low 2
  • for b1=100 to 190 step 1
  • pause 15
  • b2=b2+1
  • if b2< flashdelay then skip1:
  • toggle 1: toggle 2
  • b2=0
  • skip1:
  • servo 4, b1
  • next b1


  • loop1: b3=b3+1
  • pause 250
  • toggle 1: toggle 2
  • low 0
  • pause 3
  • if pin3 = 0 then loop1:
  • high 0
  • pause 250
  • low 0
  • pause 3
  • if pin3 = 0 then loop1:
  • if b3<9 then loop1:  ' only stop if no IR for 9 loops
  • high 0
  • for b1=190 to 100 step -1
  • pause 15
  • b2=b2+1
  • if b2< flashdelay then skip2:
  • toggle 1: toggle 2
  • b2=0
  • skip2:
  • servo 4, b1
  • next b1
  • goto init:


38
Robot Train
  • Objectives:
    • Complete speed and direction control
    • Start gradually and accelerate smoothly to top speed
    • Detect magnet on track (reed switch)
      • Decelerate
      • Pause
      • Reverse
    • Repeat
39
Hardware – H-Bridge
  • Motor control is accomplished with an LM293D H-Bridge chip
    • The LM293D can provide up to 1 amp of current
    • Three pins on the LM293 will be connected to the PICAXE.  Two are used for direction control and the third, called enable, for speed.
40
Robot Train
41
Other projects:
User programmable Morse beacon
PWM / remote control track power
control
speedometer
block detection
/ control

Your ideas? ? ?
42


Questions ? ? ?
43