0% found this document useful (0 votes)
61 views5 pages

Objetivo: Integrado L293D: $40.00 2 Motores Braun DC: $30.00 Total: $70.00

This document outlines objectives, materials, and code to control two DC motors using a Raspberry Pi. The objectives are to understand DC motor characteristics and communication, and create Python programs to rotate the motors clockwise and counterclockwise. The materials listed include a Raspberry Pi, microSD card, computer, wires, breadboard, batteries, motor driver chip, and switches. The budget outlines costs of $40 for the driver chip and $30 for the two motors, for a total of $70. The code controls the direction and speed of each motor using GPIO pins and reads the switch states.

Uploaded by

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

Objetivo: Integrado L293D: $40.00 2 Motores Braun DC: $30.00 Total: $70.00

This document outlines objectives, materials, and code to control two DC motors using a Raspberry Pi. The objectives are to understand DC motor characteristics and communication, and create Python programs to rotate the motors clockwise and counterclockwise. The materials listed include a Raspberry Pi, microSD card, computer, wires, breadboard, batteries, motor driver chip, and switches. The budget outlines costs of $40 for the driver chip and $30 for the two motors, for a total of $70. The code controls the direction and speed of each motor using GPIO pins and reads the switch states.

Uploaded by

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

Objetivo

 Conocer las características, funcionamiento y modo de comunicación del


motor de corriente continua.
 Realizar programas en Python para girar en sentido horario y anti horario
dos motores de corriente continua.

Material
• Raspberry Pi modelo B+.
• Tarjeta de memoria microSD con Raspbian.
• Computadora con Tight VNC
• Cables Dupont macho-hembra
• Una Protoboard
• 4 pilas AA
• Un porta pilas
• Dos motores de corriente continua Braun modelo KD158406 4-739-018
• Integrado L293D
• Dip switch 2 interruptores

Presupuesto
Integrado L293D: $40.00
2 motores Braun DC: $30.00
Total: $70.00

Ilustraciones
Código
import RPi.GPIO as GPIO
from time import sleep

GPIO.setmode(GPIO.BOARD)

Motor1A = 16
Motor1B = 18
Motor1E = 22
Motor2A = 19
Motor2B = 21
Motor2E = 23

switch1 = 12
switch2 = 15

GPIO.setup(Motor1A,GPIO.OUT)
GPIO.setup(Motor1B,GPIO.OUT)
GPIO.setup(Motor1E,GPIO.OUT)

GPIO.setup(Motor2A,GPIO.OUT)
GPIO.setup(Motor2B,GPIO.OUT)
GPIO.setup(Motor2E,GPIO.OUT)

GPIO.setup(switch1, GPIO.IN)
GPIO.setup(switch2, GPIO.IN)

while True:
valorEntrada1 = GPIO.input(switch1)
valorEntrada2 = GPIO.input(switch2)

#detener motores
if valorEntrada1 == True:
print "Detener Motores"
GPIO.output(Motor1E,GPIO.LOW)
GPIO.output(Motor2E,GPIO.LOW)
break
#avanzar
if valorEntrada2 == False:

print "Avanzar"
GPIO.output(Motor1A,GPIO.HIGH)
GPIO.output(Motor1B,GPIO.LOW)
GPIO.output(Motor1E,GPIO.HIGH)

GPIO.output(Motor2A,GPIO.HIGH)
GPIO.output(Motor2B,GPIO.LOW)
GPIO.output(Motor2E,GPIO.HIGH)

#retroceder
else:
print "Retroceder"
GPIO.output(Motor1A,GPIO.LOW)
GPIO.output(Motor1B,GPIO.HIGH)
GPIO.output(Motor1E,GPIO.HIGH)

GPIO.output(Motor2A,GPIO.LOW)
GPIO.output(Motor2B,GPIO.HIGH)
GPIO.output(Motor2E,GPIO.HIGH)

GPIO.cleanup()

You might also like