0% found this document useful (0 votes)
72 views26 pages

DC Motor

1. DC motors convert electrical energy to mechanical energy to power things like appliances and power tools. 2. Transistors allow controlling high voltage power sources with low current output through a gate, drain, and source. 3. Diodes control back voltage and allow electricity to flow in one direction to protect circuits.

Uploaded by

Gerard Alfonso
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
72 views26 pages

DC Motor

1. DC motors convert electrical energy to mechanical energy to power things like appliances and power tools. 2. Transistors allow controlling high voltage power sources with low current output through a gate, drain, and source. 3. Diodes control back voltage and allow electricity to flow in one direction to protect circuits.

Uploaded by

Gerard Alfonso
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 26

DC MOTOR

DC Motor
•DC motors make things like appliances
and power tools work by converting
electrical energy to mechanical energy
•Inductive device
Transistor
• Components that
allows you to control
high voltage power
sources to low current
output
• Gate – digital switch Gate
• Drain – connects Drain
output device
Source
• Source - GND
Diode
• Components that control
back voltage
• Allow electricity to flow from
one direction
Back voltage – voltage that
may harm circuits
Activity 1 – Motorized Pinwheel
Activity 1 – Motorized Pinwheel
1. Tactile switch
A – 5V
B – resistor & dig. pin # 2
2. Transitor/Mosfet
Gate (leftmost) – dig. pin 9
Drain (center) – negative (motor) + diode to positive PB
Source – GND
3. Motor
Negative – diode
Positive – 5V
4. Battery - connect +PB to positive (+) and –PB to negative(-)
5. Arduino – connect positive PB to 5V
6. Add a common ground to both Arduino and battery
Activity 1 – Motorized Pinwheel
const int switchPin=2;
const int motorPin=9;
int switchState=0;

void setup() {
pinMode(switchPin,INPUT);
pinMode(motorPin,OUTPUT);
}
Activity 1 – Motorized Pinwheel

void loop() {
switchState=digitalRead(switchPin);
if(switchState==HIGH){
digitalWrite(motorPin,HIGH);
}
Activity 1 – Motorized Pinwheel
else{
digitalWrite(motorPin,LOW);
}
}
Activity 1 – Motorized Pinwheel
const int onPin=13;
const int offPin=12;
const int motorPin=10;
const int ledPin=9;
int switchState=0;
void setup() {
pinMode(onPin,INPUT);
pinMode(offPin,INPUT);
pinMode(ledPin,OUTPUT);
pinMode(motorPin,OUTPUT);
Activity 1 – Motorized Pinwheel

void loop() {
switchState=digitalRead(onPin);
if(switchState==HIGH){
digitalWrite(motorPin,HIGH);
digitalWrite(ledPin,HIGH);
}
Activity 1 – Motorized Pinwheel
switchState=digitalRead(offPin);
if(switchState==HIGH){
digitalWrite(motorPin,LOW);
digitalWrite(ledPin,LOW);
}
}
3rdQtrAct1-Zoetrope
3rdQtrAct1-Zoetrope
Materials needed:
1. Arduino Uno 10. H-bridge or L293NE
2. Breadboard
3. 2 Tactile switches
4. 2 10K Resistors 11. Potentiometer – 3pin
5. 6-12V motor
6. 9V battery
7. Battery snap
8. Jumperwires
9. Laptop with Arduino IDE
H-bridge
•An integrated circuit (IC) that has built-in
components of resistors, transistors and
diodes
•16 pins
Potentiometer
A potentiometer is a simple knob that provides a
variable resistance, which we can read into the
Arduino board as an analog value.
Pin Assignments:
1st – 5V
2nd – pin assignment
3rd - GND
Program
const int controlPin1 = 2;// the control pins will carry
the logic - direction to turn and applied to the H-Bridge
const int controlPin2 = 3;
const int enablePin = 9; // attached to the pin EN
const int directionSWPin = 4;// 4 and 5 carry the values
of button switches
const int onOffSwitchStateSWPin = 5;
const int potPin = A0; // analog signal, because it is a
potentiometer delivering continuous values
Program
int onOffSWState = 0;
int previousOnOffSWState = 0;
int directionSWState = 0;
int previousDirectionSWState = 0;
int motorEnabled = 0;
int motorSpeed = 0;
int motorDirection = 1;
void setup() {
pinMode(directionSWPin,INPUT);
pinMode(onOffSwitchStateSWPin,INPUT);
pinMode(controlPin1,OUTPUT);
pinMode(controlPin2,OUTPUT);
pinMode(enablePin,OUTPUT);

digitalWrite(enablePin,LOW);// the motor initializes at


OFF
}
Program
void loop() {
onOffSWState = digitalRead(onOffSwitchStateSWPin);
delay(1);
directionSWState = digitalRead(directionSWPin);
motorSpeed = analogRead(potPin)/4;
if(onOffSWState != previousOnOffSWState){ // this part allows the
user to have the motor spin without having to hold the button itself.
Otherwise we should keep pressing the button switch to turn the
motor.
if(onOffSWState ==HIGH){ // if the user presses the button, the state
changes. Otherwise, it remains unchanged.
motorEnabled = !motorEnabled;
}
Program
if (directionSWState != previousDirectionSWState) {
if (directionSWState == HIGH) {
motorDirection = !motorDirection;
}
}
if(motorDirection == 1){ // If the Direction is 1, turn left.
digitalWrite(controlPin1, HIGH);
digitalWrite(controlPin2, LOW);
}
Program
else { // If the Direction is 0, turn right.
digitalWrite(controlPin1, LOW);
digitalWrite(controlPin2, HIGH);
}
if(motorEnabled == 1) { // If the motor should be enabled, set EN to
HIGH and the motorSpeed indicated by the Potentiometer
analogWrite(enablePin, motorSpeed);
}
else {
analogWrite(enablePin, 0); // If the motor is turned Off, set EN to
LOW
}
Program
previousDirectionSWState = directionSWState;
previousOnOffSWState = onOffSWState;
}

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy