Built on Arduino; Bluetooth control via the Blinker IoT platform. A phone pairs with the Lolin32's BLE radio.
Source: firmware/frog-main/frog-main.ino
#include <Arduino.h> #define BLINKER_BLE #include <Blinker.h> #include <OneWire.h> #include <DallasTemperature.h>
Install Blinker, OneWire and DallasTemperature through the Arduino Library Manager.
| App button | Blinker key | Callback | Function |
|---|---|---|---|
| GoForward | gf |
GoForward_callback |
Forward |
| TurnLeft | tl |
TurnLeft_callback |
Turn left |
| TurnRight | tr |
TurnRight_callback |
Turn right |
| Suck | sk |
Suck_callback |
Sample water |
Open-loop timed sequencing. Every delay was tuned empirically in the pool. There is no feedback — no pressure sensing, no IMU in the loop.
void GoForward_callback(const String & state) { digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN)); // command received digitalWrite(pineg, HIGH); delay(3000); // build pressure, 3 s digitalWrite(pinlb, HIGH); digitalWrite(pinrb, HIGH); delay(200); // hind limbs fire first digitalWrite(pinlf, HIGH); digitalWrite(pinrf, HIGH); delay(2000); // forelimbs follow digitalWrite(pinlb, LOW); digitalWrite(pinrb, LOW); delay(500); // vent hind limbs digitalWrite(pineg, LOW); digitalWrite(pinlf, LOW); digitalWrite(pinrf, LOW); // vent all }
The 200 ms offset matters. Hind limbs lead the forelimbs, mirroring the frog's gait where the hind limbs drive and the forelimbs stabilise. Turning simply drives one forelimb — left turn fires the right-front valve and vice versa.
- Serial at 115200 baud, MCU to on-board BLE module
- All six control pins
pinMode(OUTPUT)anddigitalWrite(LOW) Blinker.begin(), thenattach()for the four button callbacks
A DS18B20 on GPIO 26, 9-bit resolution, reported back to the phone via BlinkerNumber.
Fixed for release. The archived version referenced an undefined
deviceAddressand an undefinedNumber1, and would not compile. The publishedfrog-main.inocorrects both, adds a disconnected-sensor guard, and polls at 1 Hz rather than every loop iteration (a 12-bit DS18B20 conversion blocks for ~750 ms, which would otherwise stallBlinker.run()).
The firmware/legacy/ directory preserves the development sequence:
| Directory | Notes |
|---|---|
00-platformio-prototype/ |
Earliest PlatformIO version, two test buttons, pressure-sensor definitions |
01-basic-test/ |
Basic valve test, 90 lines |
02-add-single-valve/ |
Single-channel addition, 112 lines |
03-single-route-test/ |
Single pneumatic route test, 167 lines |
04-add-pump/ |
Pump control added, 122 lines |
05-pump-and-temperature/ |
Pump + temperature, 136 lines |
../frog-main/ |
Final, 210 lines |
Blinker provides BLE access for ESP32 boards. The project uses its button widgets to dispatch commands; no custom app was written.
Prev: 5 · Electronics · Next: 7 · Simulation