Companion computer and tracker programming complete
When I first started this project I was extremely apprehensive about two things, establishing bi-directional communication via the iridium satellite network and creating a front/back-end to handle and display the received data. Since my last update, I burned the midnight oil, ignored my family, and finally completed the programming for both the Arduino companion computer and mapping endpoint. It took some crash course learning of PHP, MySQL, Javascript, and .htaccess files but by golly, I think I’ve done it!
I’ve spent countless bench testing hours debugging and putting the command messaging through its paces to ensure everything works as it should and implementing fixes and improvements where needed. One of the stranger bugs I encountered was during the modem begin process; the Iridium modem would return an “already awake” error on every other modem.begin instance, causing it to miss a send/receive interval (power cycling the physical modem before the second modem.begin sequence didn’t help either). It didn’t make sense to me (most likely a bug in the modem firmware or IridiumSBD library) as to why it happens, but luckily there was a simple workaround.
I hope to have put the Arduino and Rockseven modem through enough scenarios to know how it will react in case it encounters them (and also resolve them). However, no matter how much I think through the many use cases, I know I’ll never be able to completely cover all of them. With that in mind I just created a few major functions to keep things running smoothly.
The Monitors I implemented:
- Pixhawk heartbeat monitor – Check to see if the autopilot is in a frozen state. If so, power cycle it.
- Arduino Watchdog – Check to see if the Arduino is in a frozen state. If so, toggle a reset.
- Motor/ESC RPM monitor – Check if RPM = 0. If so, re-initialize the motor or power cycle the ESC and motor.
Manual Control via Sat modem
- Power cycle or soft rebooting of the Pixhawk autopilot.
- Initiating a soft reboot of the Arduino via watchdog (also disabling/enabling watchdog).
- Disabling/Enabling/Power Cycling of Motor/ESC RPM monitor.
In the unlikely event there’s a malfunction with the Arduino watchdog, I’ve also coded in a boot up send/receive to grab a satellite message before the Arduino watchdog timer function has had enough time to reboot the Arduino (I can disable it completely – scary!).
The only real scenarios which concern me are:
- If the satellite modem dies/disconnects physically and the Arduino no longer sends updates.
- If the Arduino malfunctions completely and does not respond to a reset from the watchdog.
- The Pixhawk autopilot hardware dies and does not respond to a power cycle.
- If the motor or rudder fail.
- LoCARB gets picked up by another vessel.
In the event that any of the above become a reality, LoCARBs mission to Hawaii will have to be declared a partial failure, since just building a working autonomous boat is still a success! In the event LoCARB gets picked up by another vessel, ill have a website URL written on the hull which will give operational status, instructions, and contact information. Hopefully ill be able to establish communication with the vessel and direct them to either send LoCARB home or leave her/put her back in the water.
What now?
With the software and electronics side of LoCARB coming to a close, I can honestly say this has been one of the most complex projects I have ever undertaken. Its given my brain a strenuous exercise and really given me a glimpse of what programmers need to deal with, mad respect. With that said, its now time to build and test a working solar power system and see if my solar power calculations are correct. Ill also be thinking through the physical build of the boat hull and figuring out how to incorporate common off the shelf parts into a boat hull design which will successfully take it across an open ocean to Hawaii.