Wiznet makers

TheoIm

Published May 28, 2025 ©

34 UCC

25 WCC

5 VAR

0 Contests

0 Followers

0 Following

Original Link

Let's Make Your Underwater Drones - A Foundation for Sensor-Based Mobility Project

This project provides an automatic depth control and sensor logging system for an underwater drone. But it's more than just a drone controller.

COMPONENTS Hardware components

WIZnet - W5500-EVB-Pico2

x 1


PROJECT DESCRIPTION

This project provides an automatic depth control and sensor logging system for an underwater drone. But it's more than just a drone controller — it demonstrates a solid architecture for a wide range of sensor-based mobility systems (e.g., underwater ROVs, ground robots, autonomous platforms). With features like sensor integration, multicore processing, real-time control, and a UART-based command interface, this structure can be directly adapted for various maker applications.


🧠 Key Features Overview

FeatureDescription
Auto Depth ControlMaintains target depth using pressure sensor and PID control logic to adjust thruster output
Sensor IntegrationCollects real-time data from MS5837 (temperature/pressure), BNO055 (IMU), INA228 (voltage/current), and GPS (NMEA)
Manual/Auto Mode SwitchReceives UART commands to switch control modes or issue manual motor control
Multicore LoggingCore0 handles control loop; Core1 handles CSV data logging to SD card
Structured LoggingUses FATFS on SD card to store structured log entries in log.txt
Power Safety CheckStops thrusters and activates LED warning if voltage drops below safe threshold

🔧 Used Libraries and Interfaces

Library / DriverPurpose
func-pwm.hMotor PWM control (0–100%)
func-i2c.hI2C setup and communication
func-MS5837-02BA.hPressure + temperature sensor driver
func-BNO055.hIMU and magnetometer driver
func-INA228.hVoltage/current/power sensing
func-usbuart.hUSB-UART command interface
sd_card.h, ff.hFATFS-based SD card logging

⚙️ System Flow Overview

Initializes sensors, PWM, and SD card

Core1 creates and prepares the log file

Core0 collects sensor data and performs PID control every loop

UART commands change control mode, target depth, or gain in real-time

Sends LOG_WRITE_COM to Core1 to trigger log entry

Stops all motors + flashes LED on power fault


📦 Applications

This code structure can be applied directly to:

Depth-stable underwater drones (ROVs)

RC boats with autonomous navigation

Land robots with GPS/IMU integration

Data-logging platforms with SD card backup

Multi-sensor integration testbeds


🎮 UART Command Examples

CommandDescription
12345Initiates start sequence
0Confirms start and begins loop
-1111Switch to manual mode
-8888Return to auto mode
-9999Stop system immediately
n000mSets motor n to m% duty (e.g., 30045 = motor 3, 45%)

📎 Final Thoughts

This is more than a depth controller for drones — it’s a template for structured, sensor-centric control systems. The modular design supports reuse across various robotics and mobility projects.

📁 The code includes everything from driver-level I2C communication and PWM logic to FATFS logging and multicore operation. You can extract and apply any part of it to your own builds.

What makers often need isn't more hardware — it's a good starting point. This project can be that starting point.

Documents
Comments Write