Ethernet Controlled ROVER
by manu2022 in Circuits > Raspberry Pi
2647 Views, 33 Favorites, 0 Comments
Ethernet Controlled ROVER
This is Ethernet Controlled ROVER that you can watch the images by streamingin your pc. I made this proyect for fun and as cheap as possible. I've learned very much with this proyect so I'm so happy with that.
If you liked please vote me for the first time author contest, thank you!
Let's See the Materials
For this rover we will need:
- A Raspberry Pi with WiFi and a SD card (mine a Rpi 3)
- Motor driver
- Lipo battery 7.4V or 11.1V(better 11.1V, at 7.4v will work but too slow)
- DC motor 12V N20
- Robot wheels
- Arduino board(I use nano because space)
- 9g mini servo x2
- Webcam or Rpi camera
- Dupond cables
- Bridles
- XT60 connector
- Mini breadboard
- NPN transistor
- USB step down
- White led lights
- Wooden table
Screw drivers
Pliers
Hot Glue
Soldering Iron and acc.
Wires for soldering https://es.aliexpress.com/item/Free-shipping-5M-10...
Drill
Setup the Raspberry Pi
First you will have to install Raspbian into the SD card. You can follow this tutorial if you dont't know how. Python is already installed in that distro, so you won't have to worry about it.
https://www.raspberrypi.org/documentation/installation/installing-images/
Make the ROVER Chasis and Cam Turret
My chasis and turret is made of wood because I don't have any 3D printer and I wanted to make this proyect as cheap as posible. First we will draw the shape of the body, as long as you want, I did more big than needed to possibly add future expansion and develope it more.
After you draw the base to include motors, turret, Rpi, etc... make sure to mark the holes that you will drill for fix all the components to the base.
After that let's desing the turret to hold the camera. I did a 2 axis turret but if you want to simplify it you can just do it of one axis. I glued the servo's "arms" to the wood in wich I drilled a hole to attach it to the servo.
Then you fix the servo to the board on the position you want. I did without glue because the future modifications I'lll realise.
Schematic
It's importand to solder properly all the components because when you put it all on the base it will move so maybe connections can get broken. In the step down regulador I use a USB that is regulated at 5V an includes a voltimeter. I use that because is much easiest and you don't need to calibrate it.
Yoy can use any transistor that you want because is very low current, just two leds. I would have put a white led stripe so It would have lighted more, but I just have two white leds so...
The real photo is just to make you see how messy it can get.
Soldering Motors and Wires
We need to solder our motors, I soldered them in pairs(one pair for each side). Also we will solder the wires of the battery and conecctions for each component. Also you can so most of them by a breadboard.
Drill a hole in the wood board to pass the wires to the motor driver.
Try to put the same colour on the motor's polarity because their are connected reversed in the motor driver. If the code doesn't work fine just change the configuration of the wires.
Setup the Arduino Code
Before put the components to the chasis I configued them to work properly to see if the wiring is okay, the directions are okay, the turret works properly, etc...
In this step you can load the code in the arduino and you won't have to do any more with this.
My controlls are:
f->foward
s->back
d->turn right
a->turn left
q->stop
o->lights on
u->lights off
i & k ->Y axis of webcam
j & l ->X axis of webcam
SSH to Raspberry to Control Rover
With SSH enabled we will be able to configure our raspberry from another PC. If it isn't enabled you use the raspberry in the monitor and write in the terminal "sudo raspi-config"
MJPG Streamer
We will use this program to stream the video from the webcam connected to the Raspberry. You can install this on raspberry
$ ls -l /dev/video*
If any webcam is detected, it's not connected or compatible
$ sudo apt-get install libjpeg8-dev
$ sudo apt-get install imagemagick $ sudo apt-get install subversion
Now we creater a folder
$ mkdir mjpg
$ cd mjpg
$ svn co https://svn.code.sf.net/p/mjpg-streamer/code/mjpg... mjpg-streamer $ cd mjpg-streamer $make
And after this it should be installed, you write on the navigator "Raspberry'sIP:8080"(not literally)
Some Python Scripts for the Rpi
On the mjpg-streamer folder you write
nano control.py
It will open a text editor, then you paste this into that file. Yoy maybe need to change the address of your arduino.
import tty
import sys import termios import serial import os arduino = serial.Serial('/dev/ttyUSB0' , 9600) #maybe the addres of your arduino can be ACM0 orig_settings = termios.tcgetattr(sys.stdin) tty.setraw(sys.stdin) x = 0 while x != chr(27): # ESC x=sys.stdin.read(1)[0] arduino.write(x) termios.tcsetattr(sys.stdin, termios.TCSADRAIN, orig_settings)
Fix Components to the Board
Fix the arduino, motor driver, Rpi, servos, motors... Then do all the connections, try with the arduino if motor drivers and the directions of motors and servos are okay. Put the wheels on the motors. After this connect the raspberry with the camera on the turret.
Use It!
From a pc make the ssh connection. Go to the folder mjpg-streamer. In other terminal do the same.
In one terminal write
control.py
In the otherone
./mjpg_streamer -i "./input_uvc.so -d /dev/video0 -y" -o "./output_http.so -w ./www"
Then open your favorite navigator and put the raspbery's IP followed by :8080
And just have fun!