GOduino - the Arduino Uno + Motor Driver Clone

39K11913

Intro: GOduino - the Arduino Uno + Motor Driver Clone

UPDATES

4/4/2012: The pcb version with variable motor speed, GOduino II, is on my blog http://techbitar.blogspot.com/2012/04/goduino-ii-motor-driver-arduino-uno.html  and here
29/3/2012: Corrections to motor load calculations section.
14/3/2012: I have added a 100 uF electrolytic capacitor between motor power supply (pin 8 on the L293D) and GND. The Fritzing diagram shows the addition of this capacitor but the photos still don't. I have also fixed a few typos. 

INTRODUCTION

I have designed a few robots using the Arduino Uno and the Adafruit Motor Shield. Both are great for prototyping. But I found myself taking my robots apart every time I needed to build another robot. It's not cost effective to buy more Arduino microcontrollers and motor shields for every new robot project.

So I decided to design a low cost "run-time" GOduino robot controller that combines the Arduino Uno functionality and, to some extent, the motor shield's. For this guide, I have used a breadboard but could have as well soldered the GOduino on a PCB. 


I have purchased a few ATmega328p (DIP) ICs with the Arduino boot-loader pre-burned, but you can buy the blank ATmega328 then burn the Arduino boot-loader yourself. The Arduino folks have suggested a few ways to do this: http://arduino.cc/en/Hacking/Bootloader

From now on, soon as I am done building and testing a new robot, I will replace the Arduino Uno and motor shield combo with the GOduino. Of course, the Arduino sketch should be modified to take into consideration that I am no longer using the programming library which comes with the motor shield.

Check the simple test code provided by Guilherme Martins (below) and you will see that it's not that hard to port your motor shield sketch into the GOduino environment. 

To build the GOduino, I combined these two projects:

I) Building an Arduino on a Breadboard by David A. Mellis
http://arduino.cc/en/Main/Standalone

II) Control your motors with L293D and Arduino by Guilherme Martins
https://www.instructables.com/id/Control-your-motors-with-L293D-and-Arduino

I will not repeat the above guides as the authors did a fine job with documentation and illustrations. I will provide visual instructions to help understand how the two projects are combined into the GOduino.

As for programming the ATmega328, I used the Arduino IDE 1.0 to program the microcontroller while still inserted into the Arduino Uno DIP socket. Once the IDE finished uploading my robot sketch, I simply removed the ATmega328 from the Arduino Uno then inserted into the breadboard. 

So my next task is to retrofit my Faz3a II line-following robot with the GOduino while I build another robot with the Arduino Uno and motor shield. 

MOTOR LOAD CALCULATIONS

The total max load (stall/peak load) for each motor should not exceed 600mA for a maximum of  1.2A for two motors. You can find the max/peak/stall current of your motor from the datasheet or by testing with a multimeter.  This is what the L293D supports. The motors on my line-following robot are well within these ranges (360mA each at max/peak/stall). But there is a way to almost double the strength of the L293D. 

It's possible to piggyback two L293D chips for almost doubling of their current. A single L293D can supply 1.2A for both motors. That's about 600mA per motor.  Piggyback a second L293D and the combo can handle 1.2A per motor and 2.4A for both motors combined.  

The SN754410 is pin compatible with the L293D and can provide 1A for each motor for a total of 2A for 2 motors. It's also possible to piggyback the SN754410 for 2A per motor and 4A for 2 motors. 

The L293D has kickback-protection diodes for when the motors reverse direction, hence the D suffix but not the SN754410. It's a trade off. 



PARTS LIST

HARDWARE COMPONENTS

- ATmega328p (DIP) with the Arduino boot-loader burned for convenience
- L293D H-bridge (DIP)
- 7805 Voltage regulator
- 16 MHz clock crystal
- LED
- 220 Ohm resistor
- 10K Ohm resistor
- Capacitors: 100 uF electrolytic, 2 x 10 uF electrolytic, 2 x 0.1 uF ceramic, 2 x 22 pF ceramic
- Arduino Uno w/DIP ATmega328p (for programming only)
- Breadboards and wires
- 2 x DC motors (each < 600mA running and < 1.2A peak/stall)

SOFTWARE 

- Arduino IDE 1.0


As with my other guides, feedback and corrections are most welcome. 

11 Comments

Hi, i did all this same connections but it doesn't work (believe me, i checked it 5 times). It does work with the atmega mounted on the arduino and supplied by VIn and GND from the regulator; but doesn't when the atmega is in the breadboard (this makes me know: code, motors, driver and power supply work as expected). Also i programed another atmega with same result, works on arduino, does not on the breadboard. Thoughts? Thanks!

can you please give me arduino code for IR sensor when meets an obstacle,it causes a dc motor to pause for 3 seconds then moves in the same direction ?

Honestly, on a breadboard, you could probably do without the 22pF caps.
The breadboard has enough capacitance between the runs.
Try it, you may be amazed!
Just what I am looking for. Merci.
You may wish to look at the GOduino II guide. Even if you don't plan to solder anything, the code sample for the GOduino II might be useful to control the speed of DC motors using PWM.
I saw your Goduino2 .The motor voltage can be up to 36V.
How can I do to increase current up to 10A to control electric motorcycle?
Or I should use another chip but L293D. Then, which chip should I chose?
Thanks
You may consider alternatives to the L293d which can support a max of 1.2A if you piggyback two of them. You can build your own h-bridge using MOSFETs, for example or consider some of the high power IC h-bridge packages offered by Pololu, Robotshop, or others. To build your own motor driver, instructables.com is full of great projects such as remote control lawn mowers, motor driven skateboards, segway clones, and other motor-based projects that require high current.