<div class="textcontainer"> <br></br> <h1>Week 7: Electronic Outputs — Final Project MVP</h1> <p class = "margin"></p> The deliverable this week was a Minimum Viable Product for the final project — enough of the system actually running, end-to-end, that the path to the full thing is clear. For my swarm-of-robots project, that meant proving two things in one demo: (1) the radio comms layer can pair two boards and stream packets, and (2) a XIAO ESP32-C3 can actually drive motorized hardware. I had (1) from Week 4 already. (2) was the new piece this week. <p class = "margin"></p> <h2>The MVP setup</h2> <p class = "margin"></p> I didn't have my own three robots built yet, so for the MVP I borrowed an existing two-wheeled robot from my TF Bobby. His robot uses a pair of <b>A4988</b> stepper drivers running bipolar stepper motors — different motor/driver pair than what I'll eventually use on my own final-project robots, but mechanically the same idea (differential drive). I dropped a XIAO ESP32-C3 onto the existing wiring, wrote some quick forward-only stepper code to confirm the steppers responded to my microcontroller, and recorded the result. <p class = "margin"></p> <iframe width="315" height="560" src="https://www.youtube.com/embed/2eCM-E-B1qE" title="Final Project MVP" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe> <p class = "margin"></p> The forward-only sketch I wrote here was deliberately the simplest thing that could possibly work — step both motors at a constant rate, watch the robot roll. I didn't save that exact file as its own sketch; the movement primitives got absorbed into the larger follower sketches I wrote in the weeks after, where they live alongside the RSSI logic. <p class = "margin"></p> <h2>The comms half (carried over from Week 4)</h2> <p class = "margin"></p> The radio side is the same three-sketch trio I built out for Week 4. I'm including them here as well so the MVP is self-contained on this page. <p class = "margin"></p> <a href="mvp_board_addresses.ino" download>mvp&#95;board&#95;addresses.ino</a> — utility: prints the XIAO's MAC address over serial. You flash it once per board on first setup, copy the MAC into the other board's <code>peerAddress</code> array, and never touch it again. <p class = "margin"></p> <a href="mvp_sender.ino" download>mvp&#95;sender.ino</a> — sender: registers the receiver's MAC as an ESP-NOW peer, then broadcasts an incrementing <code>uint32&#95;t packet&#95;id</code> at 5 Hz forever. No sensors, no logic — just a steady heartbeat the receiver can measure RSSI off of. <p class = "margin"></p> <a href="mvp_receiver.ino" download>mvp&#95;receiver.ino</a> — receiver: ingests packets, smooths RSSI over a 10-sample window, and switches a MOSFET-driven DC motor on/off through a hysteresis pair (chase at &minus;45 dBm, stop at &minus;35 dBm). Detailed walkthrough is on the <a href="../04_microcontroller/index.html">Week 4 page</a>. <p class = "margin"></p> <h2>Side experiment: my own (eventually scrapped) DC-motor robot</h2> <p class = "margin"></p> Alongside the MVP I was prototyping the drive electronics for the robot I planned to build myself — a custom differential drive on cheap DC gearmotors driven through an <b>L9110</b> dual H-bridge. The smoke-test sketch below cycles STOP → FORWARD → STOP → SPIN → STOP so I could confirm the wiring and direction sense before flashing the full follower on top of it. <p class = "margin"></p> <a href="mvp_motor_test.ino" download>mvp&#95;motor&#95;test.ino</a> <p class = "margin"></p> <pre><code class="lang-cpp">// L9110 wiring + direction smoke test. No ESP-NOW, no RSSI — just cycles // STOP → FORWARD → STOP → SPIN → STOP so you can confirm each command // does what it claims before flashing the full follower. // // Expected behavior: // FORWARD: both wheels turn the same way → robot drives forward // SPIN: wheels turn opposite ways → robot pivots in place (clockwise) // If FORWARD goes backward → swap leads on BOTH motors at the L9110 outputs. // If SPIN drives forward/back → swap leads on ONE motor. const int LEFT_IA = D2; const int LEFT_IB = D3; const int RIGHT_IA = D4; const int RIGHT_IB = D5; const int PWM_FREQ = 1000; const int PWM_RES = 8; const int SPIN_DUTY = 110; const int DRIVE_DUTY = 180; void motorsBegin() { ledcAttach(LEFT_IA, PWM_FREQ, PWM_RES); ledcAttach(LEFT_IB, PWM_FREQ, PWM_RES); ledcAttach(RIGHT_IA, PWM_FREQ, PWM_RES); ledcAttach(RIGHT_IB, PWM_FREQ, PWM_RES); } void motorsStop() { ledcWrite(LEFT_IA, 0); ledcWrite(LEFT_IB, 0); ledcWrite(RIGHT_IA, 0); ledcWrite(RIGHT_IB, 0); } void motorsForward() { ledcWrite(LEFT_IA, DRIVE_DUTY); ledcWrite(LEFT_IB, 0); ledcWrite(RIGHT_IA, DRIVE_DUTY); ledcWrite(RIGHT_IB, 0); } void motorsSpin() { ledcWrite(LEFT_IA, SPIN_DUTY); ledcWrite(LEFT_IB, 0); ledcWrite(RIGHT_IA, 0); ledcWrite(RIGHT_IB, SPIN_DUTY); } void setup() { Serial.begin(115200); delay(500); motorsBegin(); motorsStop(); } void loop() { Serial.println("STOP (2s)"); motorsStop(); delay(2000); Serial.println("FORWARD (2s) — both wheels same direction"); motorsForward(); delay(2000); Serial.println("STOP (1s)"); motorsStop(); delay(1000); Serial.println("SPIN (3s) — pivot in place"); motorsSpin(); delay(3000); } </code></pre> <p class = "margin"></p> This L9110 + DC plan didn't survive contact with the rest of the project — by the time I was building the actual three-robot fleet I'd pivoted to <b>28BYJ-48 unipolar steppers driven through ULN2003</b> boards (cheaper per unit, runs on a single 5 V rail, simpler to clone three of). The L9110 sketch above is captured here as a historical artifact: useful as a reference for the differential-drive control pattern, not the hardware that actually shipped. <p class = "margin"></p> <h2>What this MVP actually proved</h2> <p class = "margin"></p> <ul> <li>Two XIAOs can pair over ESP-NOW and stream usable RSSI <i>(already shown Week 4, re-validated)</i>.</li> <li>One XIAO can drive a real motorized robot platform — at least one I borrowed.</li> <li>The remaining work for the final is mostly mechanical: build three of my own robots that can carry the same comms + motor stack at the same time.</li> </ul> <p class = "margin"></p> <div class="week-nav"> <a href="../06_inputs/index.html" class="week-nav-prev"> <span class="week-nav-label">← Previous</span> <span class="week-nav-title">Week 6 — Inputs</span> </a> <a href="../08_cnc/index.html" class="week-nav-next"> <span class="week-nav-label">Next →</span> <span class="week-nav-title">Week 8 — CNC</span> </a> </div> </div>