MotorShield

From XinCheJian
Jump to navigation Jump to search
         
MotorShield

Release status: Stable [box doku]

Roboshield-overview.jpg
Description L293N H-Bridge Arduino Shield for Motors
Author(s)  theNelson, paul
Last Version  1.0
Platform  Arduino
Download  order from us

Motor Shield is commonly used for roboracing or controlling up to two independent motors of various sizes with a separate power supply. Designed in the summer of 2011 by theNelson at XinCheJian after holding a Eagle CAD workshop, these went for production and is commonly used on the monthly roborace, some uncommon uses also happen when a member wishes to control *something* with an independent power supply.

Usage examples

Roboshield-feedback-3v3.jpeg

  • This is a simple Arduino to h-bridge power loopback to take the power from the Arduino

Roboshield-original.jpg

  • This was the original sockets before i got to burning it, notice the power in and the motor out's


Diagram

Roboshield-power-and-connectors.jpg

Please note:


Sample Code

//h-bridge shield 
  int m1[] = {5,6};
  int m2[] = {9,10};

void setup() { 
  pinMode(m1[0], OUTPUT); 
  pinMode(m1[1], OUTPUT);
  pinMode(m2[0], OUTPUT); 
  pinMode(m2[1], OUTPUT);
}
void loop() {
  // motor 1 or m1
  //forward for 2 seconds 
  digitalWrite(m1[0],HIGH); 
  digitalWrite(m1[1],LOW); 
  delay(2000);
  //reverse for 2 seconds 
  digitalWrite(m1[0],LOW); 
  digitalWrite(m1[1],HIGH); 
  delay(2000);
  //do nothing for 2 seconds 
  digitalWrite(m1[0],LOW); 
  digitalWrite(m1[1],LOW); 
  delay(2000);
  //do nothing for 2 seconds 
  digitalWrite(m1[0],HIGH); 
  digitalWrite(m1[1],HIGH); 
  delay(2000);
  //motor 2 or m2
  //forward for 2 seconds 
  digitalWrite(m2[0],HIGH); 
  digitalWrite(m2[1],LOW); 
  delay(2000);
  //reverse for 2 seconds 
  digitalWrite(m2[0],LOW); 
  digitalWrite(m2[1],HIGH); 
  delay(2000);
  //do nothing for 2 seconds 
  digitalWrite(m2[0],LOW); 
  digitalWrite(m2[1],LOW); 
  delay(2000);
  //do nothing for 2 seconds 
  digitalWrite(m2[0],HIGH); 
  digitalWrite(m2[1],HIGH); 
  delay(2000);
}

Parts List

(components slightly modified by Paul for better re-plug-ability for hackables (more male pins).

  • 5x 104 Ceramic Capacitors
  • 2x 100uF 16v Capacitors
  • 1x XinCheJian roboracing bootstrap Shield printed PCB
  • 1x L293D h-Bridge Chip
  • 1x 16pin DIP socket
  • 4x 3x1 male pins
  • 2x 2x1 male pins
  • 2x 1x1 male pins
  • 2x 1x8 extra long female pin sockets
  • 2x 1x6 extra long female pin sockets
  • 1x 4pin button
  • 1x 10k 1/4w resistor


Assembly

There are better ways to start soldering but here is a straight-forward example of soldering.


Roboshield-blank.jpg

  • start with the blank shield - check it for errors

Roboshield-step1.jpg

  • Soldier in the DIP socket for the l293d chip, the small dent in the top should match up with the printing

Roboshield-step2.jpg

  • Soldier in the TWO capacitors, make sure you use the correct - or + as these are polarized (look for the printed - mark on the side)

Roboshield-step3.jpg

  • Soldier in all 5 Ceramic 104 capacitors, it doesn't matter which way around they go

Roboshield-step4.jpg

  • Reset button, this isnt needed but handy to have, it doesn't matter which way around.

Roboshield-step5.jpg

  • 10k Resistor standing up! doesn't matter which way up

Roboshield-step6.jpg

  • the 1x3 male sockets, these are great for external attachments.

Roboshield-step7.jpg

  • the 1x2 male sockets either side of the L293d DIP socket
  • the extra long legged female sockets are put on.

Roboshield-overview.jpg

  • the 1x1 male sockets for power in also note the direction of the l293d chip.