I have found a bit older project of mine while browsing through my photos.. on a relatively unclean desk you can see a combination of two 28BYJ-48 motors, some screws, metal parts and a flashlight. Last of them could be replaced for example by a laserpointer, simple sensor or a distance measurement device.
Originally this was created to be placed on my amosero robot as a very simple form of an robot arm. Sadly work forced me to not follow that project side track any further which is why I can’t share more than these pictures: Maybe some when if time allows, I will recreate this and make it more accessible.
For low cost robots, remote controlled laser pointers, cat or fish feeding machines I found a really cheap way to move things by programmable wifi. The already handy usable 28BYJ-48 coming small motor driver i board is available in china for about 2$. It additionally needs to be driven by a fast micro controller like the Arduino or the much more capable Raspberry Pi. As I was experimenting with the esp2866 12-Q recently, the combination of this two useful things seemed more than obvious. Therefore I decided to give it a try.
Unfortunately the stepper motor and its driver chip the ULN2003a need at least 5Vs to run, a voltage the esp2866 would by killed by as its maximum rating is about 3.6. in conclusion two power circuits or two power sources would be required. I tried to keep things simple by using an 5V-12V power source and step down converting it to 3.3V with an lm2655 based step down circuit. This setup allows an efficiency about 95% and avoids producing high amounts of heat as linear step down converters would have done. Overall the motor and the controllers consume 0.35 Amps at 5V therefore about 1.75 Watts.
28BYI-48 stepper motor with Wifi – esp2866 on breadboard adapter
28BYI-48 stepper motor with Wifi ULN2003a driver board
28BYI-48 stepper motor with Wifi – final setup
28BYI-48 stepper motor with Wifi -final setup 2
28BYI-48 stepper motor with Wifi – final setup 3
28BYI-48 stepper motor with Wifi – final setup 4
2$ 28BYJ-48 with ULN2003a motor driver
> 0,5$ breadboard 2.5 mm adapter for the esp8266
> 0,.5$ for15 cm of additional cables low diameter
soldering equipment and an 3.3V FTDI Adapter for flashing the esp2866
Steps to build your own:
solder the esp2866 on the adapter board
reverse the in1 in2 in3 in4 pins to the other side of the motor driver ULN2003a board
put the breadboard adapter on this pins starting with vcc followed by in1 to in4
connect the v_out of the step down circuit with vcc of the breadboard adapter
connect v_in of the step down circuit to the vcc of the motor driver board
connect all GNDs together
add pins on the breadboard adapter for flasingh the esp2866, GND, VCC, TX and RX
The Adafruit Motor Shield is a very well documented piece of electronics. Its capable of controlling 2 stepper motors or 4 dc motors with a additional possibility of moving 2 servo motors at once(!). So its perfect for small robot projects!
It has four phases of 1,4 Amps maximum current each with an even higher peak current – in case you cool it for instance by a fan it should even take more regular current like the chips datasheets promise. The voltage of the motors should be between 5 and 12 Volts (can be increased to 13 like most car batteries do have at least as long as I’ve connected it to mine for about 30 minutes).
The coolest thing about it is the I²C protocol (and the connected build in PWM-Chip) it speaks. Because of that its stackable with for instance other motor shields and can drive up to 96 Motors with a single i2c signal giver.
In most cases the signals come from the arduino family, more precisely the Duemilanove, Diecimila, Uno (all revisions), Leonardo and Mega/ADK R3 and higher. As you might recognized, there is no arduino micro in the list, but as it is just a smaller version of the Leonardo it should be possible to work too – right? The answer is: yes it does – at least if you solder right and find the connections that need to be made since the SDA and SCL Pins are digital 2 and 3 on the Micro and A4 and A5 on the shield. Adding 5V, 3V and ground is enough to get it running. (But keep an eye to short circuits and separate powering circuits for the micro)
the arduino motor shield v2 attached to the Motors
the motor shield close up
connections to the arduino Micro
connections to the arduino Micro
the Micro itself again
soldering isn’t something like driving the bike
you have to practise it a bit everytime 🙂
The motor shield comes with an arduino library where everything gets explained very well. Just one thing they forget to mention is the needed:
the motors I’ve got to admit that the motors had been a bad joice so far – they are way to weak. I nearly drove me nuts to get them working, because I couldn’t believe how weak they are 🙂
So I’ve learned a lot about stepper motors datasheets and all of its very confusing unit handling the hard way. And I’ve done the mistake a lot of stepper motor newbies do: assuming the voltage needs to be the same as the batteries voltage. Avoid that thought in case you are building a robot currently 🙂
Today I experimented with a 12V bipolar stepper motor and the 5V arduino micro.
To get things working I’ve put the 9V from my six 1.5V Batteries into an UBEC which accelerates them to 12V at a loss of below 10% (at 350mAh) connected them to the VCC of the L298N and wired the 4 signal cables of the motors to it. Because thats a lot of numbers to keep track of – I’ve made a small video of the setup:
Doing the math according to a wheel with 5,8cm heigth and 150rpm I’ve reached, my robot will be able to run about 1,6 km/h – this might be increased with a better motor driver like they used on the arduino motor shield. I’ve read they reached about 250 rpm on the same motor which would be 2,73km/h.
The code of the arduino is pretty simple:
constintstepsPerRevolution=200;// change this to fit the number of steps per revolution
So before trying to get the planned stepper motors running, I quickly put a dc motors setup together:
The fully wired l298n
arduino micro supporting 5V and IN1,IN2,IN3,IN4
I’ve got two dc motors coming with my make block robot starter kit. And for research I also ordered a small l298n motor controller shield which is able to control motors up to 24Vs and 2A each by 4 small input wires at for example 3,3V and 2 additional +5V motor enablers.
There is a nice little page which explains all states of the L298N according to the arduino micro here. For a [amazon &title=Raspberry Pi&text=Raspberry Pi] I found a nice Youtube video explaining everything here.
For me in the end both motors rotated quite nicely, like this video shows: