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-shield
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:
Most answers refer to pigpio library (C++), that works specifically for 26 Pin Raspberry Pi 2.
Please suggest a solution, compatible with Pi3 (40 GPIO Pins) that can also run servo motor.
Can Rpi Python control the motor drivers L293D, L298N, and TB6612FNG?
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.
Now there are many types of L298N and TB6612FNG motor drivers, including the following.
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.
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.
L293D Motor Driver Module
/ to continue, …