This is the software that runs my ROV (well an attempt at writing it anyway).
uses RPi-Cam-Web-Interface
https://www.convertcase.com/hashing/adler-checksum
- Philip 'Skippy' McGaw - philip@mcgaw.eu - philipmcgaw.com
- Tamarisk 'NotQuiteHere' McGaw - tamarisk@mcgaw.eu - tamarisk.it
- Bob 'thinkl33t' Clough - bob@clough.me - thinkl33t.co.uk
sequenceDiagram
autonumber
participant Webbrowser
participant FLASK
participant NGINX
participant Webcam
participant MQTT
Webbrowser ->> FLASK: Can I have the initial webpage please?
FLASK ->> Webbrowser: Here you go!
Webbrowser ->> NGINX: Can I have the static files please?
NGINX ->> Webbrowser: Here are the static files!
Webbrowser ->> NGINX: Can I have the video please?
NGINX ->> Webcam: Can I have the video please?
Webcam ->> NGINX: Here you go!
NGINX ->> Webbrowser: I will proxy this for you
Webbrowser ->> MQTT: Can I subscribe to the following topics please?
MQTT ->> Webbrowser: Here is the Data
---
title: Hardware Layout
---
architecture-beta
group topside[Topside]
group rov[ROV]
group water[Water]
service laptop[Laptop with Webbrowser] in topside
service switch[Ethernet Switch] in topside
laptop:B <--> T:switch
service hid[Human Interface Device] in topside
hid:R <--> L:switch
service topboard[Topboard] in topside
topboard:T <--> B:switch
service tpower[Power Manafment] in topside
tpower:R --> L:topboard
service psu[batteries or PSU] in topside
psu:T --> B:tpower
service bottomboard[Bottom Board] in rov
service cameras[Cameras] in rov
service sbc[Raspberry Pi] in rov
service control[Control and Interface PCB] in rov
sbc:R <--> L:control
sbc:B <--> T:bottomboard
topboard:R <--> L:bottomboard
cameras:B --> T:sbc
service bpower[Power Managment] in rov
bpower:T <--> B:bottomboard
service bat[Batteries] in rov
bat:T <--> B:bpower
service motorcont[Motor and Light contol board] in rov
sbc:R <--> L:motorcont
bottomboard:R <--> L:control
bottomboard:R <--> L:motorcont
service temp[Thermomiter] in water
service absor[Absorbance Spectrometer] in water
service depth[Pressure Transducer] in water
service salt[Salinometer] in water
service motors[thrusters] in water
service lights[Lights] in water
junction junctioncontrol
control:R <-- L:junctioncontrol
junctioncontrol:R --> L:temp
junctioncontrol:R --> L:absor
junctioncontrol:R --> L:depth
junctioncontrol:R --> L:salt
junction junctionmotor
motorcont:R <-- L:junctionmotor
junctionmotor:R --> L:motors
junctionmotor:R --> L:lights
| Topic | Adler 16 ID | Direction | Description | Format of data | Frequency | Pin Number |
|---|---|---|---|---|---|---|
system/idn |
From SBC | Identification | ROV | 30 s | n/a | |
system/uptime |
4282 | From SBC | Uptime from /proc/ | D HH:MM:SS | 1000 ms | n/a |
system/time |
From SBC | Current time | HH:MM:SS | 1000 ms | n/a | |
system/date |
From SBC | Current data | YYYY-MM-DD | 1000 ms | n/a | |
system/network/{adapter.nice_name}_{i} |
From SBC | List of IP addresses | String(ip) | 30 s | n/a |
| Topic | Adler 16 ID | Direction | Description | Format of data | Frequency | Pin Number |
|---|---|---|---|---|---|---|
power/battery/board/idn |
DD26 | To SBC | Identification | PowerPCB | 30 s | n/a |
power/battery/board/heartbeat |
74A5 | To SBC | incrementing number 1 per second | uint8 | 1000 ms | n/a |
power/battery/board/serial_number |
0467 | To SBC | SerialNumber | adler16(String) | 30 s | n/a |
power/battery/board/software_version |
38d4 | To SBC | software version | string containing date:time | 30 s | n/a |
power/battery/1/soc |
fa4f | To SBC | Calculated SOC | uint8 (percentage) | 1000 ms | |
power/battery/1/voltage |
bc06 | To SBC | Voltage in Volts | uint8 / 10 | 1000 ms | |
power/battery/1/current |
9a17 | To SBC | Current in Amps | uint8 / 10 | 1000 ms | |
power/battery/1/temperature |
1ec7 | To SBC | Tempriture in Deg C | uint8 / 10 | 1000 ms |
I have built a Fake AHRS (Attitude and heading reference system), that sends a set of representitive data via serial to the control computer, each data feild is made up of the topic, and message (This is the same format as I expect to push the data to the MQTT server).
For example: "05c0:127" should put the value "127" into the topic "sensor/ahrs/board/heartbeat" so that it can be made available to anything that needs that data.
The AHRS software will be written to work on an Arduino compatible board.
MQTT Topics and Data Formats
| Topic | Adler 16 ID | Direction | Description | Format of data | Frequency | Pin Number |
|---|---|---|---|---|---|---|
sensor/ahrs/debug/demand |
c673 | From SBC | Set AHRS into Debug mode | bool | 5s or on change | |
sensor/ahrs/debug/status |
96ae | To SBC | current debug status | bool | 30 s | |
sensor/ahrs/board/idn |
c741 | To SBC | Identification | AHRS | 30s | |
sensor/ahrs/board/heartbeat |
05c0 | To SBC | incrementing number 1 per second | uint8 | 1000 ms | |
sensor/ahrs/board/serial_number |
0182 | To SBC | serialNumber | string | 30 s | |
sensor/ahrs/board/software_version |
86ef | To SBC | software version | string containing date:time | 30 s | |
sensor/ahrs/imu/gyro/spin |
77f8 | To SBC | Spin from the gyro measured in deg/s, | int8 | 5s or on change | |
sensor/ahrs/imu/gyro/tilt |
7200 | To SBC | Tilt from the gyro measured in deg/s, | int8 | 5s or on change | |
sensor/ahrs/imu/gyro/veer |
5ef0 | To SBC | Veer from the gyro measured in deg/s, | int8 | 5s or on change | |
sensor/ahrs/imu/accelerometer/x |
To SBC | X axis from the accelerometer in g | int8 | 5s or on change | ||
sensor/ahrs/imu/accelerometer/y |
To SBC | Y axis from the accelerometer in g | int8 | 5s or on change | ||
sensor/ahrs/imu/accelerometer/z |
To SBC | Z axis from the accelerometer in g | int8 | 5s or on change | ||
sensor/ahrs/imu/magnetometer/x |
To SBC | X axis Magnetic feild (Guass) | int8 | 5s or on change | ||
sensor/ahrs/imu/magnetometer/x |
To SBC | Y axis Magnetic feild (Guass) | int8 | 5s or on change | ||
sensor/ahrs/imu/magnetometer/x |
To SBC | Z axis Magnetic feild (Guass) | int8 | 5s or on change | ||
sensor/ahrs/imu/pitch |
To SBC | Pitch angle (degrees) | int16 | 5s or on change | ||
sensor/ahrs/imu/roll |
To SBC | Roll angle (degrees) | int16 | 5s or on change | ||
sensor/ahrs/imu/heading |
To SBC | Magenetic Heading (degrees) | int16 | 5s or on change | ||
sensor/ahrs/gps/lock |
To SBC | Can we trust GPS data? | TBD | 5s or on change | ||
sensor/ahrs/gps/time |
To SBC | Time from GPS | string(hh:mm:ss) | 5s or on change | ||
sensor/ahrs/gps/location/lng |
To SBC | Longitued | float | 5s or on change | ||
sensor/ahrs/gps/location/lat |
To SBC | Latatuide | float | 5s or on change | ||
sensor/ahrs/gps/location/altitude |
To SBC | Altitude from GPS | float | 5s or on change | ||
sensor/ahrs/misc/barometer |
To SBC | Pressure (hPa) | Uint16 | 5s or on change | ||
sensor/ahrs/misc/altitude |
To SBC | Altitude in meters | int16 | 5s or on change |
Device path root light
| Topic | Adler 16 ID | Direction | Description | Format of data | Frequency | Pin Number |
|---|---|---|---|---|---|---|
board/idn |
57D3 | To SBC | Identification | LightPCB | 65s | n/a |
board/sn |
9D79 | To SBC | serial number | A string of 12 characters | 65s | n/a |
board/ver |
84E5 | To SBC | software version | A string containing compile date and time | 65s | n/a |
board/heartbeat |
B57 | To SBC | Incrementing number 0-9 | uint8 | 1000 ms | n/a |
out/left |
593 | From SBC | Left front light | int (% of PWM) | 5s or on change | 3~ |
out/right |
2A0B | From SBC | Right front light | int (% of PWM) | 5s or on change | 5~ |
out/aux1 |
E567 | From SBC | Aux Pin (PWM) | int (% of PWM) | 5s or on change | 6~ |
out/aux2 |
E668 | From SBC | Aux Pin (PWM) | int (% of PWM) | 5s or on change | 9~ |
out/aux3 |
E769 | From SBC | Aux Pin (PWM) | int (% of PWM) | 5s or on change | 10~ |
out/aux4 |
E86A | From SBC | Aux Pin (PWM) | int (% of PWM) | 5s or on change | 11~ |
out/laser |
804 | From SBC | laser spots for distance | Bool On or Off | 5s or on change | 2 |
out/stobe |
F47C | From SBC | navigation storbe light | Bool On or Off | 5s or on change | 4 |
out/nav |
7B2D | From SBC | Navigation lights | Bool On or Off | 5s or on change | 7 |
out/aux5 |
FAIL | From SBC | Aux Pin (Bool) | Bool On or Off | 5s or on change | 8 |
out/aux6 |
FAIL | From SBC | Aux Pin (Bool) | Bool On or Off | 5s or on change | 12 |
| Topic | Adler 16 ID | Direction | Description | Format of data | Frequency | Pin Number |
|---|---|---|---|---|---|---|
sensor/water/board/idn |
To SBC | Identification | WaterSensor | 30s | ||
sensor/water/board/uptime |
To SBC | incrementing number 1 per second | uint8 | 1000 ms | ||
sensor/water/board/serial_number |
To SBC | serial number | A string of 12 characters | 30s | ||
sensor/water/board/software_version |
To SBC | software version | A string containing compile date and time | 30s | ||
sensor/water/temperature |
To SBC | fint / 10 | 5s or on change | |||
sensor/water/salinity |
To SBC | int / 10 | 5s or on change | |||
sensor/water/depth |
To SBC | int / 10 | 5s or on change |
| Topic | Adler 16 ID | Direction | Description | Format of data | Frequancy | |
|---|---|---|---|---|---|---|
output/motor/board/idn |
To SBC | Identification | MotorDriver | 30s | ||
output/motor/board/uptime |
To SBC | incrementing number 1 per second | uint8 | 1000 ms | ||
output/motor/board/serial_number |
To SBC | serial number | A string of 12 characters | 30s | ||
output/motor/board/software_version |
To SBC | software version | A string containing compile date and time | 30s | ||
output/motor/motor1/speed/demand |
From SBC | Motor 1 speed | int8 (between -100 - 100) | 5s or on change | ||
output/motor/motor1/speed/status |
To SBC | Motor 1 speed | int8 (between -100 - 100) | 5s or on change | ||
output/motor/motor2/speed/demand |
From SBC | Motor 2 speed | int8 (between -100 - 100) | 5s or on change | ||
output/motor/motor2/speed/status |
To SBC | Motor 2 speed | int (between -100 - 100) | 5s or on change | ||
output/motor/motor3/speed/demand |
From SBC | Motor 3 speed | int (between -100 - 100) | 5s or on change | ||
output/motor/motor3/speed/status |
To SBC | Motor 3 speed | int (between -100 - 100) | 5s or on change | ||
output/motor/motor4/speed/demand |
From SBC | Motor 4 speed | int (between -100 - 100) | 5s or on change | ||
output/motor/motor4/speed/status |
To SBC | Motor 4 speed | int (between -100 - 100) | 5s or on change | ||
output/motor/motor5/speed/demand |
From SBC | Motor 5 speed | int (between -100 - 100) | 5s or on change | ||
output/motor/motor5/speed/status |
To SBC | Motor 5 speed | int (between -100 - 100) | 5s or on change | ||
output/motor/motor6/speed/demand |
From SBC | Motor 6 speed | int (between -100 - 100) | 5s or on change | ||
output/motor/motor6/speed/status |
To SBC | Motor 6 speed | int (between -100 - 100) | 5s or on change | ||
output/motor/motor7/speed/demand |
From SBC | Motor 7 speed | int (between -100 - 100) | 5s or on change | ||
output/motor/motor7/speed/status |
To SBC | Motor 7 speed | int (between -100 - 100) | 5s or on change | ||
output/motor/motor8/speed/demand |
From SBC | Motor 8 speed | int (between -100 - 100) | 5s or on change | ||
output/motor/motor8/speed/status |
To SBC | Motor 8 speed | int (between -100 - 100) | 5s or on change | ||
output/motor/motor9/speed/demand |
From SBC | Motor 9 speed | int (between -100 - 100) | 5s or on change | ||
output/motor/motor9/speed/status |
To SBC | Motor 9 speed | int (between -100 - 100) | 5s or on change | ||
output/motor/motor10/speed/demand |
From SBC | Motor 10 speed | int (between -100 - 100) | 5s or on change | ||
output/motor/motor10/speed/status |
To SBC | Motor 10 speed | int (between -100 - 100) | 5s or on change | ||
output/motor/motor11/speed/demand |
From SBC | Motor 11 speed | int (between -100 - 100) | 5s or on change | ||
output/motor/motor11/speed/status |
To SBC | Motor 11 speed | int (between -100 - 100) | 5s or on change | ||
output/motor/motor12/speed/demand |
From SBC | Motor 12 speed | int8 (between -100 - 100) | 5s or on change | ||
output/motor/motor12/speed/status |
To SBC | Motor 12 speed | int8 (between -100 - 100) | 5s or on change |
The Adeept hat is a board for the Raspberry Pi; it connects on the 40 way GPIO connector.
| Topic | Adler 16 ID | Direction | Description | Format of data | Frequancy | Pin Number |
|---|---|---|---|---|---|---|
adeept/input/analog/battery/raw |
input | Analog channel 0: Battery Level | uint16 | |||
adeept/input/analog/light_tracker/raw |
input | Analog channel 1: "Light Tracker" | uint16 | |||
adeept/input/analog/2/raw |
input | Analog channel 2: un-used | uint16 | |||
adeept/input/analog/3/raw |
input | Analog channel 3: un-used | uint16 | |||
adeept/input/analog/4/raw |
input | Analog channel 4: un-used | uint16 | |||
adeept/input/analog/5/raw |
input | Analog channel 5: un-used | uint16 | |||
adeept/input/analog/6/raw |
input | Analog channel 6: un-used | uint16 | |||
adeept/input/analog/7/raw |
input | Analog channel 7: un-used | uint16 | |||
adeept/output/servo/camera/demand |
output | Servo channel 0: Camera Servo | int8 (-90/+90) | |||
adeept/output/servo/front_left/demand |
output | Servo channel 1: Front Left thruster | int8 (-90/+90) | |||
adeept/output/servo/front_right/demand |
output | Servo channel 2: Front Right thruster | int8 (-90/+90) | |||
adeept/output/servo/rear_left/demand |
output | Servo channel 3: Rear Left thruster | int8 (-90/+90) | |||
adeept/output/servo/rear_right/demand |
output | Servo channel 4: Rear Right thruster | int8 (-90/+90) | |||
adeept/output/servo/vertical_left_front/demand |
output | Servo channel 5: Vertical Left Front thruster | int8 (-90/+90) | |||
adeept/output/servo/vertical_right_front/demand |
output | Servo channel 6: Vertical Right Front thruster | int8 (-90/+90) | |||
adeept/output/servo/vertical_rear_left/demand |
output | Servo channel 7: Vertical Rear Left thruster | int8 (-90/+90) | |||
adeept/output/servo/vertical_rear_right/demand |
output | Servo channel 8: Vertical Rear Right thruster | int8 (-90/+90) |
note: Add more servos if needed; however, H Bridge uses channels 12-15.
https://38-3d.co.uk/blogs/blog/communicating-with-an-arduino-using-a-raspberry-pi
cd /dev/serial/by-id
lsusb
Bus 001 Device 009: ID 1a86:7523 QinHeng Electronics CH340 serial converter -- ../../ttyUSB0 [115200] -- Light Bus 001 Device 008: ID 2341:0043 Arduino SA Uno R3 (CDC ACM) -- ../../ttyACM0 [115200] -- AHRS
stty -F /dev/ttyUSB0 115200 cat /dev/ttyUSB0
- U01 Underwater Thruster with 45A Bi-Directional ESC,12V~16V 2Kg Thrust Brushless Underwater Subsea Thruster/Propeller for ROV Boat(CCW)- https://amzn.to/3L75YPU £40 each
- U01 Underwater Thruster with 45A Bi-Directional ESC,12V~16V 2Kg Thrust Brushless Underwater Subsea Thruster/Propeller for ROV Boat(CW - https://amzn.to/4oDKNU7 £40 each
- Raspbery Pi Camera MJPG https://github.com/jacksonliam/mjpg-streamer
Code added to the project should be formatted using Ruff / isort. A pre-commit config is provided to assist with this process.