Difference between revisions of "Traffic light simulator"

From Hackerspace ACKspace
Jump to: navigation, search
(created brain dump)
 
m (fixed TOC transclusion)
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
{{Project
 
{{Project
 
|Featured=No
 
|Featured=No
|State=Planned
+
|State=Active
 
|Members=Xopr
 
|Members=Xopr
 
|Description=School example of implementing traffic lights
 
|Description=School example of implementing traffic lights
 +
|GitHub=digispark-trafficlight
 
}}
 
}}
 +
<noinclude>__TOC__</noinclude>
 +
 +
== implementation ==
 +
Originally, the idea was to implement a 7-pin charlieplexing traffic light, but [[User:Xopr|xopr]] had a "quick" first stab at it.
 +
It was a T-junction created for a play mat for "matchbox" cars (1:64 scale die-cast cars) using common (crafting/electronics) materials:
 +
* gray cardboard (from a vegetable-soup box)
 +
* ductape
 +
* cocktail sticks (the flat ones with a handle at the end)
 +
* black felt pen
 +
* green crayons/pencils
 +
* acrylic glue (or hotglue)
 +
* 5mm wood drill
 +
* some solid core (about 23AWG  or 0.26mm<sup>2</sup> from an old telephone/alarm cable) wire
 +
* red+yellow+green LEDs
 +
* a Digispark arduino-like AVR controller
 +
 +
Apologies for this not being a how-to-build guide, but I do have some notes for:
 +
* the cocktail sticks are really fragile when drilling (have some spares and make sure the drill does not "bite" the wood or it will snap)
 +
* using charlieplexing, the LED's are only on one at a time: this makes them fairly dim
 +
* also, ghosting can occur, especially if there is a current path over two LEDs
 +
* the wires from the "pole" are fanned out (and taped) at the bottom to keep the traffic light upright (assume your child will stand on it and let it bend in stead of break)
 +
* the Digispark serial implementation is really, '''really''', REALLY fragile (it seems to work 1 out of 10 times); probably RAM issues
 +
 +
== original idea ==
 +
The original idea included 3D printed parts, a pin header and poles that can be interchanged.
 +
 +
 
Some brain dump on charlieplexing 8(x3) traffic lights, 4(x2) pedestrian lights, 8 sensors. each number is a pin
 
Some brain dump on charlieplexing 8(x3) traffic lights, 4(x2) pedestrian lights, 8 sensors. each number is a pin
 
<pre>
 
<pre>
Line 28: Line 56:
 
         |            |34
 
         |            |34
 
         |    25  52 |
 
         |    25  52 |
Bottom-right example:
+
</pre>
Main traffic lights use a Z-shape connection so that with 90 degrees turn, all combinations are used
+
Main traffic lights use a Z-shape connection so that with 90 degrees turn, all combinations are used (bottom right: 1&#8596;2&#8596;3&#8596;4)
1 2
+
{| class="wikitable"
o-o
+
!light
/
+
!top
o-o
+
!right
3 4
+
!left
21: Green-A
+
!bottom
12: Orange-A
+
|-
23: Red-A
+
|Green.A
32: Orange-B
+
|6&#8594;7
34: Red-B
+
|1&#8594;3
43: Green-B
+
|7&#8594;5
 +
|2&#8594;1
 +
|-
 +
|Orange.A
 +
|7&#8594;6
 +
|3&#8594;1
 +
|5&#8594;7
 +
|1&#8594;2
 +
|-
 +
|Red.A
 +
|6&#8594;5
 +
|1&#8594;4
 +
|7&#8594;4
 +
|2&#8594;3
 +
|-
 +
|Orange.B
 +
|5&#8594;6
 +
|4&#8594;1
 +
|4&#8594;7
 +
|3&#8594;2
 +
|-
 +
|Red.B
 +
|5&#8594;4
 +
|4&#8594;2
 +
|4&#8594;6
 +
|3&#8594;4
 +
|-
 +
|Green.B
 +
|4&#8594;5
 +
|2&#8594;4
 +
|6&#8594;4
 +
|4&#8594;3
 +
|}
 +
 
 +
Pedestrian light uses L-shaped pinout so that opposing lights carry the same signal. All 4 will draw a square so to speak, if placed on the intersection (bottom right: 6&#8596;2&#8596;7).
 +
One color will follow the L shape, i.e. red is clockwise, green is counter-clockwise around the intersection 'square'.
 +
 
 +
Arrow indicates red light, polarity reversed will make it green.
 +
{| class="wikitable"
 +
!light
 +
!top
 +
!left
 +
!right
 +
!bottom
 +
|-
 +
|Red
 +
|1&#8594;6
 +
|7&#8594;1
 +
|6&#8594;2
 +
|2&#8594;7
 +
|-
 +
|Green
 +
|6&#8594;1
 +
|7&#8594;1
 +
|2&#8594;6
 +
|7&#8594;2
 +
|}
 +
 
 +
Remaining connections: 3&#8594;5 and 5&#8594;3, can be used for different layouts
 +
 
 +
:Normal traffic lamp diameter is 210mm, small (bicycle) light is 80mm, big light is 300mm.
 +
:Die-cast metal cars are between 1:68 and 1:58 scale; assuming 1:64 scale
 +
*LED 3mm (3.8mm) h=5.3+0.8mm) would be 192mm(243mm) &times; 422mm
 +
*LED 5mm (5.8mm) h=8.7+1mm) would be 320mm(371mm) &times; 621mm
 +
 
 +
According to an article on 3 March 2016, yellow light times are increased to:
 +
* @80km/h &#8594; 5s
 +
* @70km/h &#8594; 4.5s
 +
* @50km/h &#8594; 3.5s
 +
 
 +
Some Traffic light brands:
 +
* Futura
 +
* Imtech BV (formerly (Groenpol) Peek) (Dutch standaard(?))
 +
* Alustar
 +
* Econolite (American vintage signals)
 +
* VIALIS Nederland Haarlem 'Classic'
 +
* Stoye
  
Pedestrian light uses L-shaped pinout so that opposing lights carry the same signal
+
Some traffic automation brands:
1 6
+
* Ko Hartog Verkeerstechniek B.V.
o o
+
* Siemens Nederland NV
  |
+
* Swarco Nederland BV
o-o
+
* VIALIS
7 2
 
16: Red-A
 
62: Red-B
 
27: Red-C
 
71: Red-D
 
61: Green-A
 
26: Green-B
 
72: Green-C
 
17: Green-D
 
  
rest:
+
Straight intersection: arrange left, straight + right
35,53</pre>
+
Uneven intersection: arrange left + straight, right

Latest revision as of 16:32, 22 April 2023

Project: Traffic light simulator
Featured: No
State Active
Members Xopr
GitHub digispark-trafficlight
Description School example of implementing traffic lights
Picture
Traffic light simulator Picture.jpg

implementation

Originally, the idea was to implement a 7-pin charlieplexing traffic light, but xopr had a "quick" first stab at it. It was a T-junction created for a play mat for "matchbox" cars (1:64 scale die-cast cars) using common (crafting/electronics) materials:

  • gray cardboard (from a vegetable-soup box)
  • ductape
  • cocktail sticks (the flat ones with a handle at the end)
  • black felt pen
  • green crayons/pencils
  • acrylic glue (or hotglue)
  • 5mm wood drill
  • some solid core (about 23AWG or 0.26mm2 from an old telephone/alarm cable) wire
  • red+yellow+green LEDs
  • a Digispark arduino-like AVR controller

Apologies for this not being a how-to-build guide, but I do have some notes for:

  • the cocktail sticks are really fragile when drilling (have some spares and make sure the drill does not "bite" the wood or it will snap)
  • using charlieplexing, the LED's are only on one at a time: this makes them fairly dim
  • also, ghosting can occur, especially if there is a current path over two LEDs
  • the wires from the "pole" are fanned out (and taped) at the bottom to keep the traffic light upright (assume your child will stand on it and let it bend in stead of break)
  • the Digispark serial implementation is really, really, REALLY fragile (it seems to work 1 out of 10 times); probably RAM issues

original idea

The original idea included 3D printed parts, a pin header and poles that can be interchanged.


Some brain dump on charlieplexing 8(x3) traffic lights, 4(x2) pedestrian lights, 8 sensors. each number is a pin

        | 36  63     |
      45|            |
      67|            |
        |            |
      16|            |16  12
      72|            |72  34
--------'            '--------

                            37

51                          73

15

--------.            .--------
  45  16|            |16
  67  72|            |72
        |            |
        |            |12
        |            |34
        |     25  52 |

Main traffic lights use a Z-shape connection so that with 90 degrees turn, all combinations are used (bottom right: 1↔2↔3↔4)

light top right left bottom
Green.A 6→7 1→3 7→5 2→1
Orange.A 7→6 3→1 5→7 1→2
Red.A 6→5 1→4 7→4 2→3
Orange.B 5→6 4→1 4→7 3→2
Red.B 5→4 4→2 4→6 3→4
Green.B 4→5 2→4 6→4 4→3

Pedestrian light uses L-shaped pinout so that opposing lights carry the same signal. All 4 will draw a square so to speak, if placed on the intersection (bottom right: 6↔2↔7). One color will follow the L shape, i.e. red is clockwise, green is counter-clockwise around the intersection 'square'.

Arrow indicates red light, polarity reversed will make it green.

light top left right bottom
Red 1→6 7→1 6→2 2→7
Green 6→1 7→1 2→6 7→2

Remaining connections: 3→5 and 5→3, can be used for different layouts

Normal traffic lamp diameter is 210mm, small (bicycle) light is 80mm, big light is 300mm.
Die-cast metal cars are between 1:68 and 1:58 scale; assuming 1:64 scale
  • LED 3mm (3.8mm) h=5.3+0.8mm) would be 192mm(243mm) × 422mm
  • LED 5mm (5.8mm) h=8.7+1mm) would be 320mm(371mm) × 621mm

According to an article on 3 March 2016, yellow light times are increased to:

  • @80km/h → 5s
  • @70km/h → 4.5s
  • @50km/h → 3.5s

Some Traffic light brands:

  • Futura
  • Imtech BV (formerly (Groenpol) Peek) (Dutch standaard(?))
  • Alustar
  • Econolite (American vintage signals)
  • VIALIS Nederland Haarlem 'Classic'
  • Stoye

Some traffic automation brands:

  • Ko Hartog Verkeerstechniek B.V.
  • Siemens Nederland NV
  • Swarco Nederland BV
  • VIALIS

Straight intersection: arrange left, straight + right Uneven intersection: arrange left + straight, right