-
1Step 1
Wireless Router
I chose the GL.iNet 6416A for this project because it is an extremely small wireless router (dimension: 58*58*22mm), the 5 GPIOs & serial port are all easily accessible via though holes or headers.
All other wireless routers supporting OpenWrt should work fine provided there is enough space in flash, you can find a list of supported router models on OpenWrt's website.
Most of the wireless router may not have enough GPIO to control the motors, however, you can use other pin on the router such as the LED pin, this require to unload the leds_gpio module or this way to control LED manually.
-
2Step 2
Webcam
I do already have a Microsoft HD-5000 webcam, it’s capable of capturing video up to 1280x720 pixels. The auto-focus was really getting annoying and I do not want autofocus in a car, so I must disable this feature.
Those USB webcams that are UVC compliant should work for this project.
-
3Step 3
Motor Controller Board
A motor may require significantly more current than the wireless router can provide, it may damage your router if you control the motor without a H-bridge. Hence the L298N Motor Driver Controller Board Module is used in this project in order to control the direction & speed of two DC motors.
I found out that there is about 1.5V voltage drop between the input voltage and the L298’s motor outputs.
-
4Step 4
Multifunctional DIY DC to DC Converter Auto Step - Up Step - Down Boost Buck Solar Power Supply Module
This is a buck–boost converter that has an output voltage magnitude that is either greater than or less than the input voltage magnitude.
Comparing with linear regulator, dc-dc converters primarily strive for efficiency, it can deliver efficiencies greater than 95% while boosting and hence reducing power consumption.
Here is a simple test for the module. I set the module output to 5V and feeding 2V-24V to its input, no matter the input voltage is higher or lower than 5V, I always get a very stable 5V except the input is lower than 2.6V.
-
5Step 5
Car Chassis Kit
Chassis is made from acrylic material, size(L x W x H) 19.8 x 14.0 x 6.5 cm which is smaller than expected, I ended up spending hours and scratch my head on how to fixed all the gadgets/modules/devices onto the chassics.
The kit included two deceleration motors, two plastic wheel, a battery holder for 4xAA batteries, and there are also two speed encoder which I'm not using.
The motor power supply is 3V-12V according to the product description given by Gearbest.com, following is the additional specifications getting from internet.
- Recommended operating voltage of about 6 to 8V
- Maximum torque: 800gf cm min @3V
- No-load speed: 1:48 @3V
- Load current: 70mA (250mA MAX) @3V
-
6Step 6
Batteries and voltage supply
I'm using 4 pcs 3.7V 18650 Li-on Rechargeable Batteries, 2 pcs connecting in series and the other 2 pcs connecting in parallel yielding 7.4V (full charge = 8.4V). Charging or using the batteries incorrectly may cause explosion or fire, therefore I suggested to use the batteries with built-in protection circuits.
-
7Step 7
OpenWrt - a Linux distribution for your router
The GL.iNet wireless router comes with OpenWrt Barrier Braker pre-installed, it includes their newly designed easy to use web interface for configuring the router. Navigate to http://192.168.8.1 & login to the router, the GL.iNet web interface should appear on the screen.
You can click on the Advance Settings (or navigate to http://192.168.8.1/cgi-bin/luci) in order to open the traditional Luci Web Interface.
'm faced with a problem that the video streaming is not working without login to the router, for this reason I have to download the image file from OpenWrt website and flash it to the router.
If you do not already have a OpenWrt firmware on your router, please refer to this tutorial for instructions on how to upgrade the firmware.
-
8Step 8
Network and Internet Connection
The wireless router need to have internet connection in order to perform the package installation. Check this tutorial out, it gives you a detailed guide to setting up network and internet connection for your router. Additonal it shows you how to create a new virtual interface (SSID) that allows your devices such as computer/notebook/smartphone connect to the router.
-
9Step 9
Installing packages - Install Additional Software On Router
By default, OpenWrt includes standard software that lets the router create wireless network or join existing ones, it would require to install additional software on the router which is currently not included. Steps below show you how to install all the software needed by webcam, you can skip this section if you don't have a webcam or you don't need video streaming.
- SSH to router and execute the command line by line, preferred PuTTY.
- You must download the current list of packages available from local package repositories before you can install packages onto your router.
opkg update #update list of available packages
- Set Up a Web Camera, please read this turotial for more info.
opkg install kmod-video-uvc #UVC camera driver opkg install mjpg-streamer #stream JPEG files over an IP-based network
- Edit the file /etc/config/mjpg-streamer in order to enable video. I'm using WinSCP to edit file.
config mjpg-streamer core option enabled "1" option device "/dev/video0" option resolution "640x480" option fps "10" option www "/www/webcam" option port "8080"
- Require to install uvcdynctrl if you want to disable/enable auto-focus.
opkg install uvcdynctrl
- Require to install lsof if you want to get the webcam status.
opkg install lsof
- Start video on router reboot.
/etc/init.d/mjpg-streamer enable
- Reboot the router and you are ready to stream.
- Command below will temporary disable auto-focus. You should disable auto-focus on startup
uvcdynctrl --set='Focus, Auto' 0
Getting webcam state via lsof commandlsof /dev/video0
-
10Step 10Disable auto-focus on startup
Save the following code to /etc/init.d/disableAutoFocus. Please click here for more information about Init Scripts.
#!/bin/sh /etc/rc.common START=99 STOP=15 start() { uvcdynctrl --set='Focus, Auto' 0 } stop() { uvcdynctrl --set='Focus, Auto' }
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.