This project was made for my son, who asked me to make possible wireless control his Lego Mindstorm EV3 robot from PC. Below is the log of what was done, what is needed to be done and several notes and instructions.
- Rover shall has a camera eye and image shall be visible on laptop
- Rover shall be controlled via joystick connected to a laptop
- Rover shall be controlled via laptop keyboard
- Notebook and rover shall communicate wirelessly (e.g via wifi)
- WiFi router and PC or laptop (my with CentOS 7)
- Lego Mindstorms
- Micro SDHC card with ev3dev image
- TP-Link TL-MR3020 router with OpenWRT onboard
- UVC webcam (check list here)
- Arduino UNO board
- Servos
- Joystick
- USB hub
- USB-miniUSB cord
-
Connect Lego EV3 Brick to wifi networkNote: this requires WiFi dongle and will occupy single USB port - Connect MR3020 board to EV3 Brick with USB reverse tethering
- Setup port forwarding from MR3020 to EV3 Brick
- Run python listening server on EV3 Brick and teset connection from laptop
- Make same test with WebCamera and EV3 Brick connected to MR3020 board via USB hab
- Connect joystick to laptop
- Find out a way to code joystick: pygame is quite good!
- Develop python3 listenening server for EV3 Brick
- Code client side application
- Add auto configuration usb0 interface on MR3020 board configure DHCP?
- Run server app as daemon at runtime
- Inernet access for MR3020 brick and/or auto update listening server
- Setup OpenWRT to TP-Link TL-MR3020
- Setup ev3dev for Lego EV3 Brick
- todo..
This simply requires additional package to install on MR3020 board
> opkg update
> opkg install kmod-usb-net-cdc-ether
> reboot
More info about OpenWRT usb reverse tethering
EV3 brick part is described here
USB Hub -> 3020 USB port
Ev3 brick mini USB -> USB hub
UVC camera -> USB hub
3020 mini USB -> external power bank
to /etc/dropbear/authorized_keys
Port forwarding is described in /etc/config/rinetd
> ifconfig usb0 169.254.233.100
Restart rinetd
> /etc/init.d/rinetd restart
Test connection:
> ssh robot@169.254.233.76
pass:maker
link: http://www.ev3dev.org/docs/tutorials/connecting-to-ev3dev-with-ssh/
> sudo passwd
pass: maker
3020 is listening on TCP port 2000 and forwards data to UART
Following line will redirect command to UART using CLI over the network
sudo echo 'any command' | nc <3020 ip address> 2000
ev3dev is listening on port 8080
3020 is listening on port 88 and redirects to ev3dev:8080
sudo echo 'any command' | nc <3020 ip address> 88
Add to /etc/rc.local
python3.4 /usr/local/bin/ev3server.daemon.py start