Difference between revisions of "Traffic light simulator"
(cleaned page) |
(added first, slimmed down implementation) |
||
Line 1: | Line 1: | ||
{{Project | {{Project | ||
|Featured=No | |Featured=No | ||
− | |State= | + | |State=Active |
|Members=Xopr | |Members=Xopr | ||
|Description=School example of implementing traffic lights | |Description=School example of implementing traffic lights | ||
+ | |GitHub=digispark-trafficlight | ||
}} | }} | ||
+ | __TOC__ | ||
+ | |||
+ | == 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> |
Revision as of 12:28, 20 February 2021
Project: Traffic light simulator | |
---|---|
Featured: | No |
State | Active |
Members | Xopr |
GitHub | digispark-trafficlight |
Description | School example of implementing traffic lights |
Picture | |
Contents
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