-1

It is dangerous to run motors directly from the Pi, hence we need a motor shield.

I own an Adafruit arduino motor shield clone: https://learn.adafruit.com/adafruit-motor-shieldenter image description here

Note: I'm aware about how to use motors with python, just want to use the H bridge capabilities of the shield.

Tried and failed referring to:

How to use Arduino Motor Shield with Raspberry Pi?

http://abyz.me.uk/rpi/pigpio/ex_motor_shield.html

Most answers refer to pigpio library (C++), that works specifically for 26 Pin Raspberry Pi 2. enter image description here]![enter image description here

Please suggest a solution, compatible with Pi3 (40 GPIO Pins) that can also run servo motor.

tlfong01
  • 4,665
  • 3
  • 10
  • 24
  • What is the question? What does the two links shall tell us? – Ingo Apr 08 '19 at 09:14
  • Stepping motor, servo, or DC motor? – tlfong01 Apr 08 '19 at 14:11
  • This site doesn't write code on demand. If you've tried something and have a specific question, please edit your post to reflect that, including what you tried and why or how it failed. As written, this question is too broad. – Brick Apr 08 '19 at 16:41
  • Sorry for the ambiguous language. Link 2&3: the solution that doesn't work for me. Link1: Product page of shield, I own. – Abbas Kagdi Apr 09 '19 at 12:19
  • @ Abbas Kagdi Your project spec is now almost complete. Now I also know your motor knowledge and skills. I started getting serious playing motor controller only a couple of months ago. Some years back I used Arduino Decimilla (My first Arduino) with L293D (which your Adafruit motor driver uses) etc. I also once messed around with steppers and servos. Now I am into L298N and TB6612FNG. I also would like to refresh my Arduino motor projects to Rpi. Perhaps I can answer your question from my couple of months hobbyist experience. – tlfong01 Apr 10 '19 at 01:44
  • I checked that your L293D motor driver is very out of date. Nowadays everybody is playing L298N. I would suggest you changing the title to something like "How can Raspberry Pi control the L298N motor driver?" We don't need to be specific to Rpi 1/2/3 (4 is coming soon!), or DC/stepping/servo motor, and of course not mentioning of Adafruit or Amazon. – tlfong01 Apr 10 '19 at 03:17
  • Thanks for the insight. But I'll still keep digging into it, to leverage my existing L298d motor shield. – Abbas Kagdi Apr 10 '19 at 08:34
  • I see. I forgot if I still have L293D modules in my junk box. If I found some, perhaps I would see if my python program can cater all L293, L298, and TB6612. – tlfong01 Apr 10 '19 at 09:22
  • Before I search for my old L293D board, I googled and found L293 boards have the same control input signals, Enable, IN1, IN2 etc. I am pretty sure that the python program can run all L293D, L298B, and TB6612FNG boards without any changes. – tlfong01 Apr 10 '19 at 13:11
  • Does your AdaFruit card looks like this one? https://item.taobao.com/item.htm?spm=a312a.7700824.w4002-18130655753.12.33b121fc7Byhae&id=567549302448 – tlfong01 Apr 12 '19 at 03:56
  • yes similar to this – Abbas Kagdi Apr 13 '19 at 06:20

1 Answers1

0

Question

Can Rpi Python control the motor drivers L293D, L298N, and TB6612FNG?

Short Answer

Yes, Rpi python can control all of them which have the same input control signals ENA, ENB, IN1, IN2, IN3, and IN4, to drive a DC, stepping or servo motor.

This short answer briefly describes only about driving a DC motor, using the most popular L298N as an example.

The long answer below is not just about L298N, but also TB6612FNG and L293D; and not just about DC motor, but also stepping and servo.

L298N driving DC, stepping, and servo motors.

Long Answer

Now there are many types of L298N and TB6612FNG motor drivers, including the following.

l298n and tb6612fng motor ddrivers

Testing cheapy, newbie friendly L298N motor driver module

Now I am going to test the cheapest L298N module I can find. First thing first is to read the schematic, which newbies hate most, until they have burnt their motors and fingers. The more motors they burn, the more they would love to read the friendly schematic.

L298N schematic

The schematic is from SunFounder, whose L298N motor is much more expensive, and more newbie friendly. Their jumper row at the bottom is designed to make the no rpi, no software, dry run easy. To test, you just connect the left most 3 jumpers, ie, Enable to 5V, IN1 to 5V, IN2 to Ground, then the motor connected to the left output terminal would run. As simple as that!

For poor hobbyist like me, I have to assemble three jumper wires, green, orange, yellow, for ENBL, IN1, and IN2. I connect IN1 to Ground, IN2 to 5V, and as soon as I connect ENBL to 5V, my motor will run (but not the newbie's motor, because they always forget to connect this and that wire, and when they are instructed to cut the blue wire, they would instead cut the red, wire, and of course the bad guy's time bomb explode).

So it is important for the newbie to first watch what the jinja hobbyist, ie, me, is doing, as shown below.

l298n wiring, dry run

L293D Motor Driver Module

L293D Motor Driver

L293d motor driver

/ to continue, ...

tlfong01
  • 4,665
  • 3
  • 10
  • 24