Category Archives: Hacks

Programming an Arduino Pro Mini with another Arduino

Warning: Executing the steps below will re-program both of your Arduinos, so if you have something valuable on the Arduino Nano please be sure to backup first. If you can’t afford to  erase your Nano please don’t follow this instructions

I usually use Arduino nano 3 for all my projects because it is reasonably small and still has a lot of pins, it also uses male headers instead of the female ones that the Uno does, of course this is not breadboard friendly but I kind of like it more.

But there comes a time when you want your projects to be even smaller and if possible a lot cheaper.

For that purpose I recently bought a couple of arduino pro minis(5 volts version). They also have the Atmega328P chip as the Nano and the price is much cheaper but don’t have the micro usb port and there lies the trouble… How can I program this?

arduinoProMini

I searched the net for possible solutions and found a lot which ranged from using external USB to serial board to … well using an arduino uno and removing its chip while programming, but all I had was an Arduino Nano R3!

Arduino Nano 3

Ordering a usb to ttl serial adapter was not an option because of the long delivery time so I had to do something…

I have done a lot of thinking and here is what I came up with…

What will happen if I just connect GND to GND, 5V on the Nano to the VCC of the PRO MINI, RX0 on the Nano with the RX1 on the Pro Mini, the RST on the Nano with the RST on the Pro mini and the TX1 on the Nano with the TX0 on the Pro Mini? After all they have the same chip ATmega328P

The only thing that can happen is an error while programming because when starting the programming the Arduino IDE will ask the microcontroller stuff and both chips will answer

Ok then… let’s make the Pro Mini unable to answer(no, I’m not going to break stuff :)). The thing we will do is disconnect the cable that goes from TX1 to TX0. And voila! You can program your Arduino Pro Mini with the Arduino Nano!

Go to Arduino IDE and select Arduino Nano /w ATmega 328 as your board and upload the sketch. Doing so will really be programming both Arduinos but who cares!

The same hack should work with other Arduinos as well but it always has to be the same chip running on the same frequency and the same voltage. Do not try it if these three conditions are not met!

Enjoy!

Connect the pro mini and the nano as follows:

arduinos

Driving 28BYJ-48 step motor with Pololu A4988/DRV8825 drivers

I have always liked the 28BYJ-48 motor because of its power and price, it also supposed to very reliable since it is used in different types of air conditioners.

motor

Some information about the motor:

This motor is very small but has enough power for most of the projects because it has a built-in 1/64 reduction gear. The result is a very small step of the motor which is 0,087890625 degrees per step. The reduction gear of course has its downiside which is the speed – you can typically drive this motor with maximum frequency of 100Hz which result in 100 steps per second which is 8,7890625 degrees per second. That is 41 seconds per revolution – Not very speedy :) but for the price of under 2$ it still is a very good motor. Needless to say they are two versions of the motor(in fact 7 or even more), one is 12 volt and the other is a 5 volt version. They are pretty much the same except for the resistance. In this example I will be using the 12 volt version because of the higher resistance.

The main issue about driving this motor with a pololu a4988 driver is that this is an unipolar motor and the pololu driver is designed to work with bipolar motors. The best driver for our motor is the ULN2003 or similar but the point is to make it work with pololu drivers. What is the point? you may ask… the point is to be able to create different type of high precision machines which usually use the pololu driver. Such machines would be a mini CNC router, a 3D printer and especially a laser engraver because of the high precision. Another point is the cost, this motor costs less than 2 bucks a piece compared to a 15+ dollars for a Nema17 stepper motor

Ok, so straight to the point. How can we solve the issue? The answer is simple, we modify the motor to be bipolar. How?  Just cut the red wire :-)

cutwire

This is however not that simple. We definitely don’t need the red wire so we can cut it but we also need to cut the path which is connecting the two sets of coils. The picture above shows what should be done.This is accomplished by removing the blue plastic cover of the motor and cutting one of the paths. Do not try to disassemble the motor itself because it will be too hard to assemble, just grab a knife or a sharp flat screwdriver and carefully pull out the blue plastic cover. Do not worry if it breaks, it will be pretty easy to get back in even if it does. Just try to not pull the wires too much when doing this.

 

Motor cutting path

After you remove the blue plastic you will have access to the path we need to remove. Can you see the cut in the picture above?   That is best cut with the tip of a sharp knife.  We only need to cut the path in the middle just like shown in the picture. Make sure that the cus is deep enoug and there is no contact between its two sides – otherwise the motor will not work as a bipolar one.  At this point we are pretty much done. We just need to put back the blue plastic cap to its place and we are done. The thing you might want to do is to cut the red wire before closing the cap since we will no loger need it.

Congratulations!, you now have a bipolar 28BYJ-48 motor

Last  but not least the two pair of wires are orange/pink and blue/yellow. Between each pair there should be a resistance doubled in value of the original – In my case it was 210 Ohms but this really depends on the motor type. From what I can see in the spec there are 7 types of motors each with different resistance ranging from 60 Ohms for the 5v version to 380 for the 12v versions

At this point you can connect the motor to the a4988 driver. The good news is if you are using RAMPS you can rearrange the wires in the motor connector and cut out the fifth pin and it can be directly plugged in to the RAMPS X,Y or Z ports

Don’t forget to adjust your A4988/DRV8825 driver current to the minimum! These motors cannot take more than about 100mA per phase. Forgetting to do that will burn or even melt the motor. You can also decrease the resoulution of the driver to 1/2 step

The 12 volt version of the 28BYJ-48 motor is pretty hard to find but they sell it at Aliexpress

And if you are looking for 5 volt version these are the cheapest I could find