October 28, 2025
`wanna pivot to hardware?`
`1. start small. buy an arduino or esp32. blink LEDs, move servos, read sensors. get your hands dirty.`
https://x.com/oprydai/status/1978525711834218890
Not sure if I wanna pivot to hardware but I want to learn it.
I've been wanting to learn electronics and hardware for...a really long time.
Now I'm attempting that and logging what I learn here, day by day.
I have a box of parts I've accumulated from microcenter, mostly clearance Arduino kits with various components that I've bought and not done anything with.
I'd like to make something to present at [Opensauce](https://opensauce.com/) next year but I have no idea what.
This is day 1.
I hooked up a stepper motor to the Arduino, pasted some Claude generated code into the IDE and boom, the motor moves.
![[Pasted image 20251028194802.png]]
Hardware:
- Arduino Uno R3
- Inland 28BYJ-48 Stepper Motor Drive Board + Stepper Motor
Hook up the motor to the board. Hook up the board pins to the Arduino:
VCC -> 5V
GND -> Ground
In1 -> 8
In2 -> 9
In3 -> 10
In4 -> 11
Write Some Code:
```
#include <Stepper.h>
const int stepsPerRevolution = 2048; // 28BYJ-48 specific
// Initialize with pins IN1-IN4 in sequence
Stepper myStepper(stepsPerRevolution, 8, 10, 9, 11);
void setup() {
myStepper.setSpeed(15);
}
void loop() {
myStepper.step(stepsPerRevolution); // One revolution forward
delay(1000);
myStepper.step(-stepsPerRevolution); // One revolution backward
delay(1000);
}
```
I should probably try to learn something every day aside from just plugging this thing in.
So here's some stuff I learned:
- This is a stepper motor, not a servo.
Servo: motor with a limited angle, usually 180 degrees.
Can be set to an exact angle in that range.
Stepper: infinite rotation
doesn't know what angle it's currently sitting at
Can be rotated by an angle it's told
of rotation and can tell the angle it's at. Steppers rotate from their current position.
- Pins have to be fired in a specific order
`Stepper myStepper(stepsPerRevolution, 8, 10, 9, 11);`
I expected this to be 8, 9, 10, 11.
But it's not.
This tells the arduino what order to fire the pins in.
Apparently the motor internals require you to fire in this order or the motor just vibrates.
- The board is a [ULN2003](https://hackaday.com/2024/05/25/everything-you-ever-wanted-to-know-about-the-uln2003/) (or rather, it contains one.)
This is something called a Darlington transistor array.
Arduino pins provide 20-30mA of current. My stepper motor needs 10x the amount, around 200-300mA. This board prevents either device from getting friend. It switches power around
- The motor has a 64:1 gear reduction
That's it for now
Sources and links:
https://docs.arduino.cc/libraries/stepper/
https://components101.com/motors/28byj-48-stepper-motor
https://hackaday.com/2024/05/25/everything-you-ever-wanted-to-know-about-the-uln2003/
https://youtu.be/15K9N1yVnhc
[difference between a stepper and servo motor](https://www.youtube.com/shorts/rift8UbrAyQ)
[Parol 6 - a cool 3d printed robot arm](https://www.youtube.com/shorts/HfR3GO239qs)