0

L293D Circuit Python Code for DC Motor in Micro Servo Body
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

L293D Circuit Python Code for DC Motor in Micro Servo Body

by chadboothe on Tue Feb 04, 2020 8:44 pm

I have a L293D and a Adafruit DC Motor in Micro Servo Body. Can someone help me / provide / point me to a code sample with the CircuitPython code to run the DC Motor.

Thanks!!!

chadboothe
 
Posts: 3
Joined: Sat Jan 18, 2020 3:32 pm

Re: L293D Circuit Python Code for DC Motor in Micro Servo Bo

by V2man on Wed Feb 05, 2020 1:56 am

https://learn.adafruit.com/introducing-adafruit-itsybitsy-m4/circuitpython-servo
From the extracted Bundle Version 5.x examples directory: motor_servo_sweep_simpletest.py found here https://circuitpython.org/libraries

V2man
 
Posts: 703
Joined: Mon Dec 03, 2018 12:38 am

Re: L293D Circuit Python Code for DC Motor in Micro Servo Bo

by kcl1s on Wed Feb 05, 2020 9:31 am

A couple of things...
I assume you mean this motor https://www.adafruit.com/product/2941 which is a true DC motor not a servo.

The L293D works with 5 volt logic and will not work well with the 3.3 volt logic on the Circuit Python boards. You could use level converters but a better choice is to get a motor controller with 3.3 volt logic.

Something like this would work. https://www.adafruit.com/product/4489 I don't see a guide to wiring it up but from the datasheet it looks straight forward. It looks like you just PWM one pin to control forward speed or PWM a second pin to control backward speed.

Fellow hobbyist
Keith

kcl1s
 
Posts: 1453
Joined: Tue Aug 30, 2016 12:06 pm

Re: L293D Circuit Python Code for DC Motor in Micro Servo Bo

by V2man on Wed Feb 05, 2020 10:53 am

Look at CircuitPython_Continuous_Servo.py in the first link I provided.

V2man
 
Posts: 703
Joined: Mon Dec 03, 2018 12:38 am

Re: L293D Circuit Python Code for DC Motor in Micro Servo Bo

by kcl1s on Wed Feb 05, 2020 12:11 pm

V2man wrote:Look at CircuitPython_Continuous_Servo.py in the first link I provided.

Depends on if he has a 3 wire continuous servo motor or the 2 wire DC motor in servo form I linked to above. The 2 wire motor does not have any control electronics onboard.

Keith

kcl1s
 
Posts: 1453
Joined: Tue Aug 30, 2016 12:06 pm

Re: L293D Circuit Python Code for DC Motor in Micro Servo Bo

by chadboothe on Wed Feb 05, 2020 9:49 pm

I have the 2 wire dc motor in a servo body, if that makes a difference with the code.

chadboothe
 
Posts: 3
Joined: Sat Jan 18, 2020 3:32 pm

Re: L293D Circuit Python Code for DC Motor in Micro Servo Bo

by kcl1s on Wed Feb 05, 2020 10:45 pm

chadboothe wrote:I have the 2 wire dc motor in a servo body, if that makes a difference with the code.

Yes you will need a motor driver that works with 3.3 volt signals. The servo .py will not work.

Keith

kcl1s
 
Posts: 1453
Joined: Tue Aug 30, 2016 12:06 pm

Please be positive and constructive with your questions and comments.