0

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.

  • What is the question? What does the two links shall tell us? – Ingo Apr 8 at 9:14
  • Stepping motor, servo, or DC motor? – tlfong01 Apr 8 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 8 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 9 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 at 1:44
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, ...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.