Auto Eyes Demo
LED Light Strip Controlled by Python on Raspberry PI
Project Auto Eyes is about creating common communication protocols for common road scenarios, however, technology works better when demonstrated in the real world.
Follow this guide to build your own real world example and see Auto Eyes work with your own eyes.
What it Does
Point a mobile phone at an Actor and the lights on the LED strip follow the Actor giving the sense the Actor is being watched.
Video demo coming soon
Purchase
For approximately $150, you can set up this prototype, although the costs could be reduced by a knowledgeable person since this parts list caters to ease of setup.
- 1 - $37 5 meter Medium Resolution LED Strip
- 1 - $26 Power Supply
- 1 - $80 Raspberry PI Kit
- 1 - $5 Jumper Wires
Optional:
- 1 - $23 1 meter High Resolution LED Strip in addition to or instead of the 5 meter light string
Assemble
- Setup the Raspberry PI with the included USB power supply, per the instructions that came with the kit.
- Install the Raspian Lite OS without the desktop environment.
- Shut the Raspberry PI down once you confirm it works (either by direct keyboard+monitor or ssh).
- Connect the LED Strip power wires to the female DC connector using a small screwdriver.
- Negative (-) connects to black.
- Positive (+) connects to red.
- Connect the LED 3pin JST-SM connector to the Raspberry PI GPIO connector with the jumper wires
- Use the 3 wire with a female JST-SM connector provided with the LED strip
- Choose a red, green and blue jumper wire from the jumper wires
- Cut and strip one end of each of the jumper wires
- Connect each jumper wire to the corresponding color of the 3 wire JST-SM connector
- Ideally solder each wire, but twist + tape will suffice.
- Connect each wire to the GPIO board
- Red (Power) -> Pin 2
- Black (Ground) -> Pin 6
- Green (Data) -> Pin 12 Source: CanaKit
- Plug the female DC connector to the male DC connector and plug power cord into the wall.
- Notice this powers both the LED strip and the Raspberry PI so do not use the USB power supply.
- Confirm the Raspberry PI is powered up and available.
- Continue with the software setup to confirm the light strip is working.
Software Setup
Test the Light Strip
Demonstrate the light strip works by running a quick test in python3.
python3 --version
-> Python 3.5.3
(known to work)
Install PIP used to install python packages:
sudo apt-get install python3-pip
Install the light strip python3 driver:
sudo pip3 install rpi_ws281x
Download the test python
wget https://raw.githubusercontent.com/rpi-ws281x/rpi-ws281x-python/master/examples/strandtest.py
Run the test:
sudo python3 strandtest.py -c
Expected Results: You should see the first 16 LEDs cycle through Red, Green, Blue and some rainbow cycles.
Modify the test to illuminate all of your pixels.
nano strandtest.py
Change the LED Count on line 13:
LED_COUNT = 16
-> LED_COUNT = 144
- 1 Meter Strip = 144 (High Resolution 144/m)
- 5 Meter Strip = 300 (Medium Resolution 60/m)
Run the test again and you should see your entire strip light up.
Auto Eyes Setup
Change the hostname to autoeyes
.
sudo raspi-config
-> 2
-> N1
-> Ok
-> autoeyes
-> Ok
then Finish and reboot
Confirm hostname changed and determine IP address.
ping autoeyes.local
Install git so you can download the source.
sudo apt-get install git
Clone the AutoEyes source code.
git clone https://github.com/aroller/autoeyes
Install package dependencies.
sudo python3 setup.py install
Run the API connecting to the LED strip.
cd ~/autoeyes/demo/python
sudo AV_EYES_LED_MODE=true python3 api.py
Confirm LED Strip shows splash sequence of two white lights looping around in opposite directions ending with 4 segments of different colors.
curl -X PUT "http://autoeyes.local:9090/v1.0/actors/abc123?bearing=5" -H "accept: application/json"
Confirm the first 5 LEDs are lit in white.
Get to Know the API
Visit the API in a web browser of a computer on the same network.
http://autoeyes.local:9090/v1.0/ui/
Use the web api user interface to PUT various combinations of bearing, action, direction, urgency. You should see the LED lights change accordingly.
Run the Compass Client
View the compass UI in a web browser on a computer.
http://autoeyes.local:9090/client/compass.html
In a mobile web browser you may need to access by ip address.
http://{autoeyes.local ip address}/client/compass.html
Demo
Auto Eyes scenario demos To Be Determined.