This is a fun project I did recently.
I was going to build a self balancing robot but decided that I needed to be able to crawl before I can walk.
I didn't see many projects using a stepper motor so that was my first challenge as I need to build that.
I used two NEMA 17 stepper motors and two A4988 stepper drivers. To drive the stepper motors I needed to output a pulse at a set frequency and based on this frequency would drive the motors faster or slower. To do that I used a Propeller mini and the Counters A and B to generate the frequency.
At first I thought this was going to be complicated but it turns out the code is pretty straight forward
void Stepper_speed(short speedA, short speedB)
S = speedA << 10;
FRQA = S;
S = speedB << 10;
FRQB = S;
// printi("Frequency: %d\n", S);
To make the unit run I interfaced my RC radio that used SBUS. The X8R worked great and I already had an SBUS driver written from a previous project. Using the right stick for us US people allows the unit to go forward and backwards as well as left and right or just in a circle.
I also added some delay to the process as the motors would over power the unit and jerk about with sudden acceleration and deceleration.
Now for some math. Each full step of the motor equal 1.8 degrees so that means that on revaluation requires 200 pulses. I have the steppers set to 16 pulses for each full step so I need 3200 pulses to make one revaluation . The wheels have a radius of 2 inches so the circumference of the wheel would be about 12.5 inches. So each full turn would move the unit about a foot. So at 1Mhz frequency the roadster would be moving at about 210 miles an hour.
I also used KiCad to turn my wired boards into PC boards and OSHPark to build the boards. This was my first time doing this and it work out nicely.
All the other parts were 3D printed with PLA except the front fork. Also printed some 5mm to 12mm adapters so I could mount the tires to the stepper motors. I power the unit with a small 3S 1000 Lipo battery that fits nicely between the stepper motors.
There is also a front mount for a camera that I have not done yet that would put me right in the drivers seat.