Home > Previous Page >  The Traffic lights project
Archive Search  

The Traffic lights project.

On pages 151 and 152 of the Jupiter Aces users manual there is an example of how to control external devices connected to the Aces edge connector and AceForth, the traffic lights controller and relay. I thought it would be good fun to build the lights controller to see if the example works. Many thanks to Edwin for getting the parts for me, including the 10 mm LED's! The transistors listed in the manual are 2N3904s, which were hard to get in the UK.



The simple project was constructed on veroboard as you can see in the images. It works by sending a value to a I/O port address using the OUT word, this example uses port 1 and expects the data bytes by the computer to be coded as follows:

1 turn on red light
2 turn on amber light and turn everything
3 turn on red and amber lights else off
4 turn on green light 8 turn on relay
0 turn everything off


These are the AceForth words used with the lights and relay board.

:  CHANGE
( data -)
( writes to I/O port 1) 
1 OUT
;


:  ROFF
( -)
( turns relay off) 
0 CHANGE
;

:  RON
( -)
( turns relay on) 
8 CHANGE
;

:  WAIT
( delay - delay) DUP 0
DO
LOOP
;

DEFINER LIGHT
( light code -)
C,
DOES>
( address of light code -) 
C@ CHANGE WAIT
;

1 LIGHT RED
2 LIGHT AMBER
3 LIGHT RED&AMB
4 LIGHT GREEN

: SEQUENCE
( delay - delay)
RED RED&AMB GREEN AMBER
;

: RUNLIGHTS
( delay - delay) BEGIN
SEQUENCE 0
 UNTIL
;

To ID the parts just hover your mouse on the image.

e.g. 10000 RUNLIGHTS will sequence through the lights repeatedly, using 10000 to determine how long WAIT waits at each colour. See below in the AVI clip

Note: From Edwin. You can see an extra 1N4001 diode the black one next to the relay. This is soldered over the relay coil to prevent inductive current from the relay damage to the transistor. It should be soldered with the cathode (white bar) to the positive side so the negative currents will be shortened to ground 0V.