Close

Adding buttons and switches

A project log for Pi-ADAS

A raspberry-pi based platform for the capture of road data-set and the development of vision-based ADAS functions

piat.jonathanpiat.jonathan 01/11/2017 at 11:240 Comments

Now that i have the platform i needed a way to make it convenient to use while in the car. At first i tried using it with no physical niput but it required to :

All these steps prevented me from really doing capture on road. I did it once with the laptop on the passenger seat and a road bump throwed the laptop down in the car. What i wanted to have is a setup similar to an action camera :

I ended up soldering a small stripboard PCB with one button, one led, a set of switches.

The board is connected to the Pi with only two IOs (only one of the switches is used for now). One GPIO is connected to the push button and drives the LED, one GPIO is connected to one of the switches. I setup daemons on the raspberry pi to :

The script for the wifi is fairly simple as it only move configuration files around and reboot the pi3 wifi, but the button handling script does more. The button is configured to that it will ground the IO when pressed. The cathode of the LED is connected to the IO and the anode is connected to 5v through a 220ohm resistor. When pressed the button will light the LED, the script will detect the falling edge on the Pi input and switch the IO direction from input to output and with low level which will keep the led lit even if the button is released. After the that the script tries to mount a USB key connected to the PI, trigger the capture with bag file saved to the USB key. When the capture ends, the script umount the USB key, and get the IO back to its input state. As a consequence the led is lit while the capture is running and turns off when the user can remove the USB key. This means that to capture a sequence i just need to press a button, drive around and wait for the LED to turn off. Then i can tae the USB key and play the files on my laptop.

The next step is to add functionalities with the other switches, such as : configure capture time, change resolution ...

Next step is to design a 3D printed mounting to attach the camera to the windshield !

Discussions