The main goal is for it to stay outside indefinitely without losing communications or control of any part of it. since it’s a test bed for a boat that will be out of reach it needs to be able to handle any error or fault without physical intervention.
main components consist of
Ardupilot Matek H743 Wlite
mLRS 868mhz on a pair of FRsky R9 modules for RC and backup mavlink telemetry connection
Here+ M8p GPS/compass
LD06 Lidar
FMK24 5200 RADAR
AMB82-mini AI Camera board
hall sensors of the center board are connected to the flight controller so they can be used as wheel encoders,
Samsung A21s phone running Andruav with dual sim cards in tilting gimbal.
soyes xs16 phone in 2 axis servo gimbal.
48v 20ah ebike battery
mppt charge controller
The first step was building a rover that could handle outdoors, The problem where I am is it rains just about every second day so everything has to be waterproof. the chassis is built around stacking plastic euro crates, these are 600x400mm and are standardized so you can take different crates and stack them up like Lego with each crate having a set of components, in the bottom one I have all the drive components, and electronics, further contained in Tupperware containers. The center crate has the batteries and the top one has the sensors and solar panel attached to it. the gold foil is just for the Mars rover look
For propulsion, it uses hoverboard motors, which are cheap with lots of torque and the controllers can be flashed for use with Ardupilot.
the wheels are 3d printed to give maximum traction on the soft sand.
One of the main goals of this year has been power management. When I was testing last year even with a 48v 20ah battery it was struggling to stay alive, with motor controllers being on the rover would use almost 50W at idle so all it took was a rainy day and the battery was flat in a day. I added a relay bank so it could switch off components automatically now like the motor controllers, sensors and flight controller. It brings the power consumption down to less than 10w with just an esp32 and a pair of mobile phones left running.
It has 2x 100w solar panels connected to a MPPT charge controller that charges a 48v 20ah Ebike battery. because it rains so much meaning there is very little direct sunlight it needs to be able to reduce its power consumption a lot for it to be able to survive the night. when I tested it last year I was having a lot of problems with it running out of power during the night, so I have improved the power management so it can power off everything non-critical and added 2x backup batteries, one for the phones and one for the esp32 so I can still monitor it even when the main battery is flat. the flight controller uses a Matek 150a hall sensor for monitoring power consumption but im going to swap that out for a pair of the CAN node sensors to simplify wiring and let me monitor solar power generation.
The motor controllers were the biggest culprit for idle power consumption with the 3 controllers using almost 30W at idle.
The flight controller, lidar, AI camera, RADAR, WIFI camera only use around 10w, but even with that off its still using 10w to run the phones and esp32. I would like to turn the phones off at night but I don’t have an easy way of remotely turning them back on so I have been looking at moving to a PI controller instead of phones , then I could turn everything off and put the esp32 to sleep bringing power consumption under a watt.
The esp32 main controller is where most of my time has gone. this is the main management controller for the vehicle so it has a few functions:
Receives commands over the internet to my server using JSON.
Reads Mavlink and converts to json values so I can log all the telemetry and receive alerts to my phone if anything goes out of range.
Monitors all the batteries using its adc inputs since I can’t read it from the flight controller when its off.
Relay control so it can cut power to all the other parts of the vehicle to save power.
Send some basic commands to the flight controller like change mode or arm/disarm
UPS backup battery so even if the main battery runs out the ESP32 will still have power.
It can read from an RC input channel so i can use my RC transmitter to trigger actions
and control all the lights, the rover has low beam, high beam, left turn, right turn and hazard lights.
one of the main issues I ran into last year was Ardupilot going strange after being on outside for weeks at a time, things like finding the artificial horizon spinning possibly due to temperature fluctuations and h743 controllers can corrupt their settings if the power is not switched on fast enough like when the battery runs out or gets slowly charged. so now the esp32 now controls power to the flight controller so all the voltages are stable before the flight controller is switched on, it is then switched off before the voltage gets too low, this has stopped the corruption issue I was having and now it can be restarted if I find the gyros spinning. I might look into a cube for a temperature-stabilised IMU, it might be able to run for longer before it starts spinning.
To control each hoverboard I’m using a RP2040 to read servo output mavlink data from the flight controller and convert that to RPM commands that are sent to the hoverboard controllers via hoverserial protocol. I have all the left wheels on channel 15 and the right wheels on channel 16 since most flight controllers don’t have physical pins for those outputs but you could assign a channel to each wheel if you wanted to. The telemetry values left input, right input, left throttle, right throttle, voltage, and temperature are read from each of the controllers via hover serial protocol and sent to the flight controller as Mavlink named floats
The 3.3v rail of each hoverboard motor controller is connected to a pin on the P2040 Arduino board, this lets the RP2040 detect the state of each board and use relays to control them individually to keep them in sync. Group switching is controlled by a pin on the 2040 if it is held high the boards are all on if it is down they are off. I’m using the esp32 controller to manage this but it could be controlled with the ardupilot relay output.
I have a version of this that uses serial to connect to the BMS that the main battery is fitted with so I can monitor all the cells individually by sending it to the flight controller as a mavlink battery. I also plan on adding some failsafes to it like it will switch off a motor controller if it gets too hot or alert when there is an RPM mismatch between the 3 wheels on either side of the rover.
A big problem I have run into is the lack of Mavlink serial ports on flight controllers, even with an H743 you’re limited to 4, unfortunately, I need around 6. I had a look at an Arduino mavlink router but it couldn’t handle 6 devices. so I had to get creative. so my understanding of Mavlink routing is that every packet is sent to every port regardless of where it came from.
so in theory you could attach the TX of a device to one mavlink port and the RX to another port and it should work fine (I’m sure there are exceptions to that).
Based on that logic I used one of the basic Arduino passthrough examples and just copied and pasted it so it would read data from 5 serial ports RX pins on a RP2040 board and send it all down the port 6 TX pin to mavlink port 1 on the flight controller, all the mavlink devices RX pins are all bridged and connected to the tx pin of port 2 @ 115200 on the flight controller since they can all read the data at the same time. when I first tested it I was getting some data loss probably due to congestion as I had a lidar attached to it. but changing flight controller mavlink port 1 to 1500000 baud fixed that so it’s now 5x 115200 ports feeding into 1500000 baud port now. It’s not ideal since devices cant communicate with each other but I haven’t got a better way of multiplying ports.
since it’s going to be in a public place I need to add some proximity avoidance so I don’t hit anything or anyone so I got one of these LD06 Lidars, they were very cheap, I got it for £20 off eBay. but they have some issues. the main one was that it’s not a laser dot that comes off it like some lidars but it’s more of a detection cone that aims up. so if you mount it inverted all you get is a circle where it’s picking up the ground. I have converted it to mavlink using an RP2040 and then sent it to the flight controller, I think it’s natively supported now.
since this is all eventually going on a boat I needed something more than a lidar since it’s not going to work well on water. so I have an AMB-82 mini AI camera system with an FMK24 radar connected to it. so I can use the camera to identify what’s detected then use pixel position to give me an angle relative to the vehicle and use the radar to give it a range. the AMB82 has a built-in NPU so it doesn’t need a companion computer but it’s very low-powered so it only gets around 5fps at 640x480. thats more than enough for my rover thats going to be running less than 1m/s. my logic is the closer the object is to the bottom of the image the closer it is to the vehicle so I’m sorting the objects by the lower box position and then using that to assign radar returns to the objects but it’s not ideal and prone to errors when there are multiple objects or the vehicle is rolling so I need to work on that more. I am eventually going to do some slightly different actions based on what is detected. so on the rover, if it detects a person or animal it will immediately stop just to be safe.
there is a second esp32c3 mini onboard with extra sensors, for environmental sensors, it has temperature, pressure, and humidity, for security when it is stationary and charging it has 3x directional human presence radars, a vibration sensor, and audio level sensor that will flash the hazard lights and sound the car horn and I get alerts to my phone if anything is triggered.
The rover has been doing laps around the park, it will do a lap, then stop at the top of the hill for 10 minutes or until the batter is charged above the minimum and then it will restart. if it survives for a few days then i will going to take it to the beach to do laps.
I have added a geofence around the area that im driving so it should stop if it goes too far.
my next step is to get the power consumption down when sleeping, 10w is still a lot especially when it starts to get dark in winter. to get it through the winter I will need to get the power consumption under 1 watt. I have ordered a pizero2 to run Drone Engage, which should let me replace the Android phones running Andruav to save power as it’s much simpler to shut down and restart a pi than a phone. since the Pi doesn’t have a modem I have ordered a ZTE 4g Wifi hotspot that has a pair of external antennas, this should give a better signal than the phone and it can be on without the Pi so I can shut down the video and still have telemetry.
The esp32 has an 8mhz ultra-low power core that I want to take advantage of if the power gets too low so it can still be running to monitor essential sensors and wake the main controller with an interrupt if a value or pin is triggered. it can’t do wifi without the main cores but it wakes them up for that. it should bring the power consumption of the esp32 from 0,33W down to 0.0033W when just monitoring for GPIO changes.
I found a lot of useful information here about how to run ardupilot without intervention. I am just planning to send my boat around the islands of Scotland where I should have mobile coverage so I shouldnt need a satellite connection.
there is still a lot to do so I will update with more progress.