Chris from Rocket Brand Studios sent me 4 wheels that fit the little 28BYJ-48 stepper motors a couple of months ago. I only had 2 steppers so I ordered 2 more motors and control boards on Ebay. Cost me less then 2€ a piece, and that’s for the stepper motor and control board.
I wanted to try something different then the usual differential drive robots. Since I had a lot of spare servos I decided to fit the motors to 4 cheap MG995 servos. I just hot glued the 4 motors to the servo horns. I then used double sided tape to attach the servos and motors to a plastic box that is the chassis. This gives my robotic vehicle 4 wheel drive and 4 wheel steering.
The Arduino IDE comes with a stepper library, but I decided to write my own stepper code. For 4 stepper motors I would have needed 16 digital pins and then another 4 pins for the servos. Controlling a stepper motor is not that difficult. It’s just a matter of setting the pins high/low in the right sequence at the right time. I thought why not try and use a couple of 74HC595 shift registers to control the stepper motors? I have controlled 16 leds with 2 shift registers in the past so why not 4 stepper motors? I soldered 2 shift registers to a piece of perfboard and tested the board with some leds. That worked 🙂 There is an excellent tutorial that shows how to connect 2 74HC595 shift registers to an Arduino on the bildr.org website. The bildr tutorial also includes code on how to control each pin of a shift register individually. Based on that code I started writing a sketch that would let all 4 stepper motors run in the right direction.
These little stepper motors are slow and have very little torque. From what I have read they are manufactured to be used in the blinds of air-conditioning systems. To speed them up and give them some more power I used a 3S Lipo battery. This is well over the 5V at which these motors are rated. I have not killed a motor yet… Since they are so cheap it’s worth taking the risk. To let them run at a reasonable speed I had to write code to slowly ramp up the speed. Else the motors would not move.
This turned in to a huge sketch. The sketch in the following video contains over 1400 lines of code. There must be a much easier way of coding this? You can download the sketch here: 4 wheel drive and 4 wheel steering stepper bot sketch.