Project:Traffic Lights
USB Traffic Lights
The traffic lights above Lovelace are currently connected to Babbage via USB. Theyre a USB HID device (Vendor ID 0x03EB, ProductID = 0x2044 - LUFA stack testing vid/pid) that is controlled by a Daemon running on Babbage.
To control them directly you need to send a Set_Report request to the Control Endpoint with the data part being 8 bytes long. The first 3 bytes are uints that represent the 3 lights, the rest of the values can be left as zero. A non-zero value means the light is on
You can also read from the first Interrupt Endpoint to get a report of the current light status.
Babbage Daemon
The daemon running on Babbage (under my account) listens for UDP packets on port 9009. Simply send a 3 character string terminated by carriage return and newline to set the light status, for example:
100\r\n <- green light on
101\r\n <- green and red lights on
This daemon handles the USB stuff for you.
Current uses
Since I changed the API none of the IRC commands that use the lights work.
There is a doorbot listener on babbage that listens for unknown cards at the door and blinks the Red light 5 times. It Erases the current light state after doing this
Safety
The bulbs run on 240v from the mains, theyre isolated from the USB side by 3 solid-state opto-isolated relays. There is a board inside the red module that contains the electronic parts. DO NOT OPEN IT WHILST THE MAINS ARE CONNECTED. The right hand traces of the board will be at 240V and there is NO ground connection