The code repository for all things needed to create an internet-controllable ROV.
TODO:
- Excel budget and inventory
- Finish combining working modules
- Web interface:
- Buttons that call the cgi-bin scripts without refreshing or leaving the page
- Graphical rather than text overlay for data
- Options page to set streaming parameters in case badwidth isn't enough
- Web interface:
- Develop salinity sensor module
- Modify pressure sensor to use I2C-3
- Make sure wiringPi doesn't interfere with I2C hacks
- Purchase and test ethernet add-on board or USB through the GPIO.
- Setup a full working hardware prototype (so the pins can be tested for conflicts)
- Package and tutorial around ethernet gadget mode (for Pi0 only)
- List of apt packages required
- Screenshots for everything
The internet ROV is powered by the budget Raspberry Pi Zero and common off-the-shelf components found that is built around the Raspberry Pi platform as well as basic programming. The goal of this project is to enable a remote user to access a ROV without being on the docks.
The remote user connects to a proxy server (a workaround to port-forwarding restrictions) that forwards all connections to the ROV server, which is onboard the ROV itself. All calculations are excecuted on the ROV itself. The user can see a live image of the ROV, an overlay of various data, and control using onscreen buttons or a keyboard. The onsite operator should be able to simply connect the ROV to a laptop and power source, connect to the internet, and run a script which handles all the initialisation of software, such that no configuration or programming is needed.
- Raspberry Pi Zero (or Raspberry Pi Zero W, soldered headers optional)
- 1x SD card for Raspberry Pi OS and software storage
- 4x Motor control boards
- 1x Raspberry Pi Camera
- 1x OpenROV combo sensor: Adds compass heading, orientation, pressure, and temperature data retrieval
- 1x Salinity sensor
- 1x Portable computer for configuration and tethering
- 1x Mobile hotspot
Item | Link | Quantity | Price/Unit |
---|---|---|---|
Raspberry Pi Zero W | https://www.adafruit.com/product/3400 | 1 | $10.00 |
Raspberry Pi Zero | https://www.adafruit.com/product/2885 | 1 | $5.00 |
NOTE: Most sites only allow 1 RPi per purchase | Alternate links: https://www.raspberrypi.org/products/ | ||
2x20 Breakaway Header Strip | https://www.adafruit.com/product/2822 | 1 | $0.95 |
8GB SD Card | https://www.adafruit.com/product/1294 | 1 | $9.95 |
Adafruit DRV8871 DC Motor Driver Breakout Board | https://www.adafruit.com/product/3190 | 4 | $7.50 |
Zero Spy Camera for Raspberry Pi Zero | https://www.adafruit.com/product/3508 | 1 | $19.95 |
OpenROV IMU/Compass/Depth Module | https://store.openrov.com/products/openrov-imu-depth-module | 1 | $120.00 |
Water level or salinity sensor module | http://www.elechouse.com/elechouse/index.php?main_page=product_info&cPath=&products_id=2233 | 1 | $4.99 |
Total | $168.34 |
- Latest Raspbian image
- [RPi Web Cam Control Interface]
- Adafruit Python libraries for sensors
- Customizations of software
- Remote server for SSH tunnel to serve data to user
- Grab the image from [link].
- Use [Etcher] to burn the image to an sd card.
- Open wpa_supplicant.conf on the image and configure your network settings. See step 4 from the "Build from Scratch" section.
- Save the file, and eject the SD card.
- Insert the SD card into the Raspberry Pi.
- Power on laptop and connect to mobile hotspot.
- Connect Raspberry Pi to power source and laptop.
- Run [init scripts]
- Download latest Raspian image from Raspberry Pi's site [https://www.raspberrypi.org/downloads/raspbian/].
- Burn the image to SD card using Etcher [https://etcher.io/] or Win32DiskImager[https://sourceforge.net/projects/win32diskimager/].
- Steps:
- Skip steps [#] to setup internet over USB instead.
- Create a file wpa_supplicant.conf (ignore filetype change warning). You can edit this file with Notepad.
- Paste the following into the file, substituting WIFI NAME and WIFI PASS for the network you're using. (NOTE: only works with networks that don't require logging in, and be on the same network as the computer. Make sure your uppercase and lowercases, as well as punctuation is correct):
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=US
network={
ssid="WIFI NAME"
psk="WIFI PASSWORD"
scan_ssid=1
}
- Move the wpa_supplicant.conf file to the SD card. DO NOT RUN A REPAIR WHEN WINDOWS COMPLAINS. The correct drive should be named boot.
- Duplicate wpa_supplicant.conf on the SD card. Open it and replace all text with a single space, then rename the file to ssh without any file extensions.
- To setup and connect the Raspberry Pi Zero to the internet over USB:
- Install SD card into Raspberry Pi and plug it in. Give it a few minutes to boot fully.
- Download and install Advanced IP Scanner from [https://www.advanced-ip-scanner.com/]. To use this program to find the IP address of the Raspberry Pi:
- Launch program and select the button with C (tooltip:
Subnet of class "C" will be scanned
) - Hit the Scan button to begin finding devices on the current network. Find the IP address of the Raspberry Pi in the list.
- Remember this IP address
- Launch program and select the button with C (tooltip:
- Download PuTTY from [link].
- In PuTTY input pi@IP_ADDRESS, replacing IP_ADDRESS with the IP found in the previous steps to log into the Raspberry Pi console.
- Enter
raspberry
for the password. - Copy
sudo raspi-config
and right click to paste, then press enter to run. Use arrow keys to choose menu options, tab to select buttons, and enter to select:- Go to [Interfacing]
- Enable Camera, I2C, SSH
- Run
sudo apt update && sudo apt -y upgrade && sudo apt -y dist-upgrade && sudo rpi-update
- Reboot the Pi by typing
sudo reboot
.
- Run
sudo apt install -y git python-smbus python-pip build-essential python-dev
- Run:
git clone https://github.com/silvanmelchior/RPi_Cam_Web_Interface.git #Software bundle to easily use the Raspberry Pi camera module
git clone git://git.drogon.net/wiringPi #Software to control output to General Purpose Input Output pins on the Raspberry Pi
git clone https://github.com/johnweber/Adafruit_Python_BNO055 #Python library customized to allow interfacing with the orientation sensor over the I2C interface, works around the hardware driver bug that the Raspberry Pi has
git clone https://github.com/bluerobotics/ms5837-python.git #Python library for using the pressure/temperature sensor
- Begin install of the RPi Camera Web Interface:
cd ~/RPi_Cam_Web_Interface
./install.sh
- A configuration will pop up. User arrow keys to choose menu options, tab to select buttons, and enter to select:
- Under [folder] type
cam
. - Under [server] delete
apache
and type [lighttpd
] - Under autostart type [no].
- Press enter to save everything and finish installation.
- Select [no] as we don't need to start the camera just yet.
- Under [folder] type
- Install wiringPi:
cd ~/wiringPi
git pull origin
./build
- Setup I2C over GPIO
sudo nano /boot/config.txt
- Use arrow keys to navigate to the very bottom and add the line
dtoverlay=i2c-gpio,i2c_gpio_sda=<pin>,i2c_gpio_scl=<pin>
. Edit the two<pin>
numbers to the correct SDA and SCL pins used. It should be [###] and [###] accoding to the diagram. - Press CTRL+X to begin saving the file, press Y to accept the filename, and press ENTER to exit nano.
sudo reboot
to reboot the Raspberry Pi.modprobe i2c-dev
to finish the setup.
- Install BNO055 sensor:
cd ~/Adafruit_Python_BNO055
sudo python setup.py install
- Test the camera:
cd ~/RPi_Cam_Web_Interface
./start.sh
to turn on the camera.- On your computer, open a browser and type
http://[raspberrypi ip address]/cam/min.php
- There should be a live feed.
./stop.sh
to turn off the camera.
- Test wiringPi (motors):
gpio readall
will print a diagram of all the pins on the Raspberry Pi.- If motor is connected:
gpio mode <pin> out
once for each data pin of the motors being tested.gpio write <pin> 1
will enable the motor to turn. Rungpio write <pin> 0
to turn off motor.gpio unexportall
to finish testing.
- Test the BNO055 sensor:
cd ~/Adafruit_Python_BNO055/examples
python simpletest.py
This should show a live steam of data about the sensor. Move the sensor module around to see if it's working.- Press CTRL+C to quit the program.
- Test the ms5837 sensor:
cd ~/ms5837-python
python example.py
WIP Steps:
- Create index.php in /var/www
sudo lighttpd-enable-mod cgi
sudo lighttpd-enable-mod fastcgi
sudo nano /etc/lighttpd/lighttpd.conf
- Change the line
server.documet-root="/var/www/html"
to read"server.document-root="/var/www/"
. - In
server.modules = ()
add"mod_cgi",
.
- Change the line
sudo /etc/init.d/lighttpd stop
sudo /etc/init.d/lighttpd start