"Quick & dirty" scripts to remotely drive a robot car powered by Android & Arduino
Created to let my adult children feel like "coming home" sometimes and to enable my experiments on integration of robots with Ethereum smart-contracts.
An Adroid phone is mounted on the "car" and drives the motors via an Arduino board.
A remote linux host accessible from the Internet (an AWS ec2 instance) acts as a proxy. Bash scripts in "scripts" folder automate establishing connections.
The user interacts with the bot remotely via a web-browser.
The UI supports streaming video/audio from the Andoid phone and driving remotely (moving) the bot (wheels) via keyboards.
The user commands get sent via websockets protocol ("socket.io").
Video/audio stream from the car is generated by the "IP web-cam" android app and forwarded by the node.js web-server that the Android phone runs.
The web-server runs on node.js (express.js + "http-proxy-middleware") inside the "Termux" android app. Node.js listens to commands and controls the Arduino board over "Firmata" protocol ("johny-five" lib).
Sensors and motors are connected to the Arduino Nano board that runs "Firmata".
The Arduino Nano board runs "Firmata" software. It is connected to the Android phone via USB OTG.
As the "johny-five" lib can not directly communicate to serial devices over a USB port on Android:
- the "TCP_serial port" application re-directs the connection to a TCP port
- the "etherserial" module provides the "johny-five" lib with support of TCP connections
- 4-wheels chassis with 2 motors
- Old Android phone
- 10000 mAh rechargeable battery
- Arduino Nano
- HC-SR04 sonar sensor
- Servo for the sonar
- Arduino Pro mini as a controller for the sonar
- 3 "dry contact" sensors
- Redirector TCP_SerPort https://play.google.com/store/apps/details?id=ru.shipov.tcp_serport&hl=en
- IP Webcam https://play.google.com/store/apps/details?id=com.pas.webcam&hl=en
- termux + packages https://play.google.com/store/apps/details?id=com.termux&hl=en -- openssh-server, openssh-client -- node.js + packages (see package.json)
- Arduino Nano (main controller): standard Firmata https://github.com/firmata/arduino
- Arduino Pro-mini (sonar controller): Proximity - HC-SR04 I2C Backpack http://johnny-five.io/examples/proximity-hcsr04-i2c/
- dyndns.net service used to link AWS server to a fixed "URL" (ex.: "myBestTelebot@dyndns.net")
- AWS ec2 instance running linux + openssh-server acts as a proxy