Week Two: Motors

5th of Febuary 2020

This week, we programmed our motors. An SN754410NE driver was used to increase the current going through the motors. without it, the motors speed would be decreased. Below is the Pin Configuration and Functions for the driver chip. Here is where you can find the data sheet: http://www.ti.com/lit/ds/symlink/sn754410.pdf

Here is how the motors were connected to the driver chip on the circuit.

motor dimensions

The motors were programmed to spin in specific directions for a certain amount of time.

Code for Motors

//Andrea Lafford and Nader Maloudi
//Code for Motor Directions


void setup() {
// put your setup code here, to run once:

Serial.begin(9600);

//Set motors to chosen pins on the Arduino chip

pinMode(4, OUTPUT);
pinMode(3, OUTPUT);
pinMode(7, OUTPUT);
pinMode(6, OUTPUT);

}

void loop() {

digitalWrite (3,HIGH); //Set Both Motors to move "CounterClockwise" "Forward"
digitalWrite (4,LOW);
digitalWrite (6,HIGH);
digitalWrite (7,LOW);

delay(2000); // 2 second duration of action

digitalWrite (3,LOW); //Set Both Motors to STOP
digitalWrite (4,LOW);
digitalWrite (6,LOW);
digitalWrite (7,LOW);

delay(2000);

digitalWrite (3,LOW); //Set Both Motors to move "Clockwise" "Backwards"
digitalWrite (4,HIGH);
digitalWrite (6,LOW);
digitalWrite (7,HIGH);

delay(2000);

digitalWrite (3,LOW); //Set Both Motors to STOP
digitalWrite (4,LOW);
digitalWrite (6,LOW);
digitalWrite (7,LOW);

delay(2000);

digitalWrite (3,HIGH); //Set right motor go "clockwise" and left motor to go "counterclockwise"
digitalWrite (4,LOW);
digitalWrite (6,LOW);
digitalWrite (7,HIGH);

delay(2000);

digitalWrite (3,LOW); //Set Both Motors to STOP
digitalWrite (4,LOW);
digitalWrite (6,LOW);
digitalWrite (7,LOW);

delay(2000);

digitalWrite (3,LOW); //Set right motor go "counterclockwise" and left motor to go "clockwise"
digitalWrite (4,HIGH);
digitalWrite (6,HIGH);
digitalWrite (7,LOW);

delay(2000);

digitalWrite (3,LOW); //Set Both Motors to STOP
digitalWrite (4,LOW);
digitalWrite (6,LOW);
digitalWrite (7,LOW);

delay(5000); // 5 second duration of action

}
circuit diagram

To test if the motors are functioning, connect the input leads into ground.







Leave a comment

Design a site like this with WordPress.com
Get started