GOduino II = Arduino + Variable Speed ​​Motor Controller L293D

0
77
Variable Speed ​​Motor Controller

GOduino II = Arduino + Variable Speed Motor Controller L293D

Variable Speed ​​Motor Controller

Variable Speed ​​Motor Controller

Variable Speed ​​Motor Controller

Variable Speed ​​Motor Controller

Variable Speed ​​Motor Controller

Variable Speed ​​Motor Controller

Variable Speed ​​Motor Controller

Variable Speed ​​Motor Controller

Variable Speed ​​Motor Controller

updates

GOduino II was featured on dangerousprototypes.com

07/04/2012, I added a budget slide for readers who are asking where I got my budget <$ 20 for the GOduino II.

INTRODUCTION

The GOduino II is a self-contained programmable controller for robots focused on the wheel. It is a clone of the Arduino Uno and an L293D engine driver for less than $ 20. It regulates the direction of the motor as well as speed. The prototype predecessor of this is the GOduino, a basic version of this controller on a mock-up. I will maintain updates of this guide.

BACKGROUND

I designed some basic robots using the Arduino Uno and motor shields. Both are perfect for prototyping. But I found myself disassembling my robots whenever I needed to build another robot. It is not profitable to buy more Arduino microcontrollers and motor shields for each new robot project.

Also in countries like Jordan where the average monthly income is about $ 300 and an outrageously high fare code that is hostile to technology it becomes a necessity for students and managers to locally search for assembled inexpensive alternatives And repair of imported electronic circuits.

FUNCTIONALITY

The GOduino II works for only 2 engines and leaves a lot of Arduino pins for sensors. This is also my first grippy PCB adventure. If you look at the back of the GOduino II, you will see all sorts of clues to my inexperience. And yes, I’m a software guy that’s all relatively new to me. You will notice that some of my headers have prominent teeth. I had some accidents while welding. My next version will be more neat.

It may not be the finest stuff, but it does the job for me and my protospace members. If this can help someone out there, please send me a link. As always, if you see any flaws or have suggestions that can make this a better design, please share your thoughts.

CREDIT

This project is based on the works of so many good people. See references below for some of the projects the Foundation has provided for this modest PCB project.

LIST OF PIECES

QUANTITY
Atmega328p w / Opti bootloader 1
L293D h-bridge 1
16Mhz crystal 1
PCB 1
22pf caps 2
100UF cap 1
10uF cap 2
0.1uF cap 4
T7805 DC 5V controller 1
TREMPER the 28 pin sockets 1
Dip the 16-pin plug 1
1 Headers
Connection wires 10
LEDs 2
Resistors 220 Ohms 2
Resistance 10K Ohms 1 Pushbutton
1

I estimated the total cost of the GOduino II around $ 20 + shipping and handling.

As for the Arduino IDE 1.0, it can be downloaded for free
http://Arduino.cc/en/main/Software

CARTOGRAPHY L293D PINS AT ATMEGA328P (ARDUINO UNO)

The chip numbers below correspond to pins L293D. This pin mapping works with my Arduino sketch test. But you can change it to suit your needs.

1. enable / disable the motor 1. Also used to control the motor speed 1. Arduino pin PWM digital 9. ATmega328 pin 15.
2. Connect to Arduino to control direction of rotation 1. Arduino pin digital pin 3. ATmega328 pin 5.
3. connect to engine 1 first pole.
4. Connect to ground.
5. Connect to ground.
6. connect to motor 1 second pole.
7. Connect to Arduino to control direction of rotation of the 1. Arduino digital pin 2. ATMega328 pin 4.
8. Connect to power supply that will equip both motors. This can or can not be adjusted.
9. enable / disable for motor 2. Also used to control motor speed 2. Connect to Arduino PWM pin 10.
ATmega328 pin 16. 10. Connect to Arduino direction of rotation control for motor 2. Arduino pin 7. ATmega328 pin 13.
11. connect to motor 2 – pole first.
12. connect to ground.
13. connect to ground.
14. connect to motor 2 – second pole.
15. connect to Arduino control direction of rotation for motor 2. Arduino pin 8. ATmega328 pin 14.
16. Connect regulated 5V DC.

PCB NOTES

Why use male headers to expose the ATmega328p and L293d pins? You can use Arduino-style headers instead, but I had a lot of male headers and many of the female connection wires. But for my next build of GOduino II, I’ll use Arduino-style headers. I feel safer with less exposed IC pins.

L293D CURRENT

The L293D in the GOduino II can handle sustained current of 600 mA per motor. There seems to be some misunderstanding about this ICs ability to handle 1. 2 peak current per motor. The L293D datasheet says it does but for a fraction of a second (100 μs). This is not enough to support a current peak / stall motor that can last a few seconds or minutes.

But the good news is that you can double the 600mA per engine mount by another L293D piggyback. At its simplest, this means welding one L293D on top of the other while matching the pins.

L293D TENSION

The L293D has to be powered in two ways. It requires DC 5V for its logic circuits (16 pins) and power from 4, 5V to 36V for the motors (pin 8). Check your motor plug to find its voltage.
I discovered that by controlling the PWM signals of the ATmega328p wired for the pins allow L293D I managed to change the power supply to the motor. So even though I have 7.2V power supply to my engines via the L293D, I can reduce it by manipulating the values in the analogWrite function in my Arduino sketch.

BRUSHED REDUCER

The GOduino II works with up to 2 brushed REDUCTOR range from 4, 5V to 36V with 600mA peak load for each motor. These engines generate a lot of electrical noise which can cause all kinds of poor sensor readout questions (if you have detectors attached to your GOduino II) to constant IC resets. To remedy this, I always place a 0.1uF ceramic capacitor across the poles of each motor.

ENGINE ROTATION

The direction of your engine rotation is a subjective call. In my code, I use the words in front and back to describe some of my functions. In reality, the way you wire your motors and pins determines the rotation of a motor forward, or backward or to the right vs counterclockwise. Remember that the engines on the opposite sides of a robot spin platform in front of each other. If your engine runs the way you want, often the patch may have in your code without recourse to changing the electrical wiring.

PROGRAMMING GODUINO II

So how do you program the ATmega328p on the GOduino II? A computer with a serial port should do well. But without a serial port, here are the alternatives.

1) If you have an Arduino Uno DIP model you can just load your sketch of the Arduino IDE 1.0 as you usually do. Then remove the ATmega328p from your Arduino Uno and insert it into the GOduino II IC socket. That’s all. I have ordered some ATmega328p ICs (DIP) pre loaded with the Arduino Uno bootloader, so I can use them this way.

2) or you can use the Arduino Uno to program an ATmega328p. SparkFun has a good tutorial on how to do it. See the article Reinstall your Arduino bootloader and using an Arduino to program an AVR in the References section.

3) or you can use an online scheduler like those sold by Sparkfun, LadyAda or Pololu to load the sketch Arduino directly from the Arduino IDE into the ATmega328p without removing it from the GOduino II PCB socket. See the link in the References section of David A. Mellis’s article on how to build and program an Arduino Uno on a mockup. You can save a dollar or two by buying the empty 328p then the bootloader will burn if you have the gear and know how.

THE TEST ARDUINO

The Arduino 1.0 test sketch below appears as a long program, but it repeats for most code blocks to run the motors while ensuring the pins and motor poles are properly plugged in. I have written 4 functions that can handle most robot locomotion tasks but do not hesitate to change it as long as the L293D activate pins (1,9) are connected to the PWM pins on the Arduino / ATmega328p and the code below. Below is updated to reflect a RECINATION of pines.

/ *
REMIXED BY: TECHBITAR / HAZIM BITAR

DATE: APRIL 3, 2012

PROJECT: GOduino II TEST

FUNCTION: This sketch is a test program of Arduino 1.0 IDE for the GOduino II PCB board. The GOduino II is a bridge in h Arduino Uno and L293D aka engine allowing forward and backward movement of motors as well as the integrated variable speed “runtime”. This test code assumes two motors (each <600mA in peak current) are attached to the GOduino II

This sketch of the sample calls the following three functions with the variable motornum = 1 or 2 to mean 1 motor and motor 2.

-motorforward (int motornum)
-motorback (int motornum)
-motorstop (int motornum)
-motorspeed (int motor1, int Motor2)

LICENSE: This is a shareware, but please give credit.

Website: http://techbitar.blogspot.com

Email: techbitar AT gmail DOT com

* /

Motor pole card to the Arduino pins
#define motor1pole1 2
#define motor1pole2 3
#define motor2pole1 7
#define motor2pole2 8

L293d motor board activate Arduino pin pins
#define enablePin1 9
#define enablePin2 10

#define M1_MAX_SPEED 100
#define M2_MAX_SPEED 100

#define motordelay 30
#define debugmotorsec 3000

Void setup () {} Serial.Begin (9600);

Mapped set L293D motor1 and motor 2 activate pins on Arduino at output (to enable / disable motor1 and motor2 via L293D)
pinMode (enablePin1, output);
PinMode (enablePin2, output);

The value of the pinned motor poles of the Arduino (via L293D)
pinMode (motor1pole1, output);
PinMode (motor1pole2, output);
PinMode (motor2pole1, output);
PinMode (motor2pole2, output);
Motorspeed (0, 0);
}

Int mspeed = 100; Choose a starting speed up to 255

Void loop () {}

Set the speed of motor 1 and 2 to the same speed
Motorspeed (mspeed, mspeed);

Run engine 1 only in one
direction Serial.Print (“1-speed motor @ forward speed”);
Serial.println (mspeed);
Motorforward (1);
Delay (debugmotorsec);
Motorstop (1);

Run the engine 2 only in one
direction Serial.Print (“motor 2 @ forward speed:”);
Serial.println (mspeed);
Motorforward (2);
Delay (debugmotorsec);
Motorstop (2);

Run engine 1 only in reverse
direction Serial.Print (“rear engine 1 Speed @:”);
Serial.println (mspeed);
Motorback (1);
Delay (3000);
Motorstop (1);

Rotate motor 2 only in the opposite
direction Serial.Print (“Motor 2 return Speed @:”);
Serial.println (mspeed);
Motorback (2);
Delay (debugmotorsec);
Motorstop (2);

Stop both motors 1 and 2
Serial.println (“both STOP motors for 2 seconds”);
Motorstop (1);
Motorstop (2);
Delay (2000);

Rotate the two motors in a direction
Serial.Print (“both motors @ forward speed:”);
Serial.println (mspeed);
Motorforward (1);
Motorforward (2);
Delay (debugmotorsec);

Stop the two motors
Serial.println (“both STOP motors for 2 seconds”);
Motorstop (1);
Motorstop (2);

Delay (2000);
Rotate the two motors in reverse
direction Serial.Print (“both return motors @ Speed:”);
Serial.println (mspeed);
Motorback (1);
Motorback (2);
Delay (debugmotorsec);

Stop the two motors
Serial.println (“both STOP motors for 2 seconds”);
Motorstop (1);
Motorstop (2);
Delay (2000);

Rotation of two motors but in opposite
directions Serial.Print (“MOTOR1 impatiently | MOTOR2 DOS @ SPEED:”);
Serial.println (mspeed);
Motorforward (1);
Motorback (2);
Delay (debugmotorsec);

Stop the two motors
Serial.println (“both STOP motors for 2 seconds”);
Motorstop (1);
Motorstop (2);
Delay (2000);

Rotate the two motors in the opposite opposite
direction Serial.Print (“MOTOR1 return | MOTOR2 @ SPEED OF PROGRESS:”);
Serial.println (mspeed);
Motorback (1);
Motorforward (2);
Delay (debugmotorsec);

Stop the two motors
Serial.println (“both STOP motors for 2 seconds”);
Motorstop (1);
Motorstop (2);
Delay (2000);

Mspeed + = 50; Add 50 to the engine speed. Max speed 255

Set the speed of motor 1 and 2 to the same speed of new
Motorspeed (mspeed, mspeed);

}

MOTOR FUNCTIONS

Void motorstop (int motornum) {}
Delay (motordelay);
If (motornum == 1) {}
digitalWrite (motor1pole1, bass);
DigitalWrite (motor1pole2, bass);
}
ElseIf (motornum == 2) {}

DigitalWrite (motor2pole1, bass);
DigitalWrite (motor2pole2, bass);
}
Delay (motordelay);
}

Void motorforward (int motornum) {}
If (motornum == 1) {}
digitalWrite (motor1pole1, HIGH);
DigitalWrite (motor1pole2, bass);
}
ElseIf (motornum == 2) {}

DigitalWrite (motor2pole1, bass);
DigitalWrite (motor2pole2, HIGH);
}
Delay (motordelay);
}

Void motorback (int motornum) {}
If (motornum == 1) {}
digitalWrite (motor1pole1, bass);
DigitalWrite (motor1pole2, HIGH);
}
ElseIf (motornum == 2) {}
digitalWrite (motor2pole1, HIGH);
DigitalWrite (motor2pole2, bass);
}
Delay (motordelay);
}

Motorspeed Sub (int motor1speed, int motor2speed) {}
Motor1speed = M1_MAX_SPEED; Maximum speed limit
Si (motor2speed> M2_MAX_SPEED) motor2speed = M2_MAX_SPEED; Maximum speed limit
Si (motor1speed <0) motor1speed = 0; Keep the motor above 0
Si (motor2speed <0) motor2speed = 0; Keep the motor speed above 0
analogWrite (enablePin1, motor1speed);
AnalogWrite (enablePin2, motor2speed);
}

// ====================================

LAST NOTES

I will continue to evolve the GOduino II while looking for the best solutions that are high on the repairability score and abbreviability. A $ 30 Arduino Uno could end up costing $ 60 after customs duties and shipping in Jordan. And if something goes wrong with it, you might as well throw away since there is no local installation to replace or repair the CMS components. Since basic electronic parts are readily available locally, it should be easy and inexpensive to build and repair the GOduino II. DIP feeds …

BUDGET

Some readers ask where to buy the coins to stay in the budget. I order my parts from Futurlec.com the GOduino set is less than $ 12 If you do not have an Arduino UNO DIP microcontroller and do not want to buy one, you will need a USB-serial FTDI . You can buy these for about $ 15

Futurlec is not my godfather and I do get commission or discounts to mention them.

REFERENCES

GOduino: The Arduino Uno + clone driver engine

Building an Arduino on a model by David A. Mellis
http://Arduino.cc/en/main/standalone

Order your L293D and Arduino engines by Guilherme Martins

Order a DC motor with Arduino chip and L293D
http://luckylarry.co.uk/Arduino-projects/Control-a-DC-Motor-with-Arduino-and-l293d-Chip

Reinstall your Arduino
bootloader http://www.Sparkfun.com/tutorials/247

Using an Arduino to program an AVR
http://www.Sparkfun.com/tutorials/200