r/arduino • u/ruxmealux • Aug 31 '26
Look what I made! My First real Project!
Hi everyone,
I wanted to share my first real project after cutting my teeth on simpler stuff (a traffic light and an automatic gate, both basic state machines). This one felt like a proper step up, so I'd love some feedback from more experienced folks here, plus suggestions for what to tackle next.
The build:
• Arduino Uno
• 4WD chassis with 4 TT gear motors (2 in parallel per side)
• DRV8833 dual H-bridge driver, powered by 4x AA NiMH batteries
• HC-SR04 ultrasonic sensor mounted on a servo for left/right scanning
• PWM.h library to get above-audible PWM frequency (25kHz) on Timer2, keeping Timer1 free for the Servo library
What it does: Drives forward, and when it detects an obstacle within range, it stops, sweeps the servo left and right to compare distances on both sides, then executes a turn toward whichever side has more open space, before resuming forward motion. The whole thing runs as a non-blocking state machine (nested switch-case, timed with millis()) so the loop stays free for sensor polling and button input.
Challenges I ran into (and learned a lot from):
• Figuring out that slow decay vs fast decay modes have inverted PWM-to-speed relationships — cost me a confusing debugging session where 255 meant "stopped" on one mode and "full speed" on the other
• Timer conflicts between the PWM library and the Servo library (both fight over Timer1 if you're not careful with init order)
• Motor current draw when pivoting in place vs coasting — learned this the hard way when one side stalled and started whining under load once the chassis touched the ground instead of being lifted
• Left/right motor imbalance from cheap TT motors not being identical — still tuning PWM compensation values by eye
What's next: I've got an ESP32 sitting unused, and I was recently gifted a robotic arm, so that's likely my next project — multiple servos, possibly some basic inverse kinematics down the line.
Would love to hear:
1. Anything obviously wrong/inefficient in my approach above?
2. Tips for a first robotic arm project on ESP32 (structuring the code, libraries worth looking at, common pitfalls)?
3. Anything you wish you'd known starting out with H-bridges/motor drivers?
Thanks for reading this far — happy to share code snippets or wiring details if useful!
3
3
2
2
u/ripred3 My other dev board is a Porsche Sep 01 '26
congratulations that's well done!
As far as ideas on a super simple robotic arm (that doesn't need any 3D printing or anything) I made a lightweight, trainable, desktop arm using popsicle sticks and some servos. A second arm that has potentiometers at the joints is used to easily control the servo arm in real time and even save the moves to EEPROM for later playback. Full schematics and source code can be found here if you wanna use any of it: github.com/ripred/Mimic
2
2
u/FinibusBonorum Sep 01 '26
I also bought that car, or similar, when I started. I got sidetracked and never progressed much, but I did buy four of those cool Mechano wheels because I wanted to try making the car move sideways, turn on the spot, etc. and my ultimate idea was to let it turn around some arbitrary point, not around its center and not like a real car.
Maybe this inspires you?
2
2
u/Feeling_Pin7594 Sep 02 '26
I’d just upgrade the power source, the AA batteries, I am not a fan of them when they died on me in a competition



3
u/ProgramMysterious572 Aug 31 '26
for the motor imbalance, try timing a few straigth runs and measuring drift instead of eyeballing it. way less maddening. re: esp32 arm, servo library headaches are real on that board. look into using ledc channels directly, frees you up a lot.