About
It is very simple demonstration how to use Carambola as rover platform with video feedback. It could be nice toy to build in couple of hours.
Hardware
I used very simple hardware setup. Key components are motor controller, 47:1 gearmotors, wheels, UVC webcam supported by mjpg_streamer and of course Carambola.
Connection
- Webcamera - just plug to USB port.
- Motor controller - connect to Carambola serial port. Use 2(TX) and 5(GND) pins. (see diagram below)
- Motors - see diagram below. Connect 2 motors in parallel.
Building system
- Build image with video support (see USB webcam)
- Flash fresh image to Carambola (uploading firmware)
- Setup wireless connection Wifi intialization
- Set system password (we will need this later for ssh access)
passwd root
- install package for video streaming
opkg update opkg install mjpg-streamer
- edit
/etc/config/mjpg-streamer
if you like. Default settings works fine.
config mjpg-streamer core option device "/dev/video0" option resolution "400x200" option fps "25" option port "8081" option enabled "true"
opkg install ser2net
- edit /etc/ser2net.con - comment all lines at the end of file and add this one
2002:raw:600:/dev/ttyS1:115200
- edit
/etc/rc.local
file to add ser2net autostart functionality
ser2net exit 0
- Now you are able to connect to Carambola's serial port via telnet 2002 port.
- You can now reboot your Carambola to see if everything works.
reboot
Testing
Video
- open favorite network stream player (I have tested vlc and chrome web browser - both worked) and paste url
http://192.168.0.112:8081/?action=stream
- For VLC make sure you setcaching to 0ms instead of 1200ms (default) to reduce video lag
Controls
- To test if robot responds to commands
- Forward
0x8A, SPEED, 0x8D, SPEED
- Backwards
0x88, SPEED, 0x8E, SPEED
- Left
0x88, SPEED, 0x8D, SPEED
- Right
0x8A, SPEED, 0x8E, SPEED
- Before you start playing, you should press setup button. It sends safety configuration to motor controller
- Serial port idle timout = 0.25s
0xAA, 0x0A, 0x04, 0x03, 0x01, 0x55, 0x2A
ToDo
This quick example illustrates how to interface motor controller and webcam. Further you could connect these items to build autonomous vehicle.
- gps
- counter on all wheels
- sonar
- robotic arm
- lights
- wifi booster
- volt meter
- wider angle lens
- smaller (lipo battery)
Notes
- I ordered 47:1 gear motor (285 RPM), which is still a bit to fast. So, if you plan to replicate this by your self, consider buying germotor with 75:1 or even 99:1 ratio.
- After you reboot Carambola, connect to it using ssh and type
ser2net
this will enable communication to motor controller. - It is good idea to close all electronics and put external led's to indicate wireless signal level and other status signals.