Python Tutorials – பாடம் 13 – L298N Motor Driver Module using Raspberry Pi Pico

L298N Motor Driver ஐ பயன்படுத்தி 2 DC மோட்டார்களை கட்டுப்படுத்துவது

Required Components

  1. L298N Motor Driver Module-1 no
  2. Raspberry Pi Pico-1 no
  3. DC Motor(gear)-2 no
  4. 12V Battery-1 no
  5. Data Cable-1 no
  6. Connecting Wires-4 no

Circuit

Steps

  1. நாம் பயன்படுத்தும் உபகரணங்கள் சரியாக வேலை செய்கிறதா என்பதை உறுதி செய்து கொள்ளவும்.
  2. மோட்டார் Driver போர்டு உடன் +12V battery இணைக்க வேண்டும்.
  3. +12V பேட்டரி இணைப்புகளை சரியாகவும் கவனமாகவும் இணைக்க வேண்டும்.
  4. மோட்டார் Driver போர்டு ENA, IN1, IN2, IN3, IN4, ENB பின்களை Raspberry Pi Pico பின்களான GP6, GP5, GP4, GP3, GP2, GP7 உடன் இணைக்க வேண்டும்.
  5. மோட்டார் Driver போர்டு OUTPUT பின்களை DC மோட்டார் பின்களுடன் இணைக்க வேண்டும்.
  6. மோட்டார் Driver போர்டு GND ஐ Raspberry Pi Pico board GND உடன் இணைக்க வேண்டும்.
  7. Python program ஐ சரி பார்க்க வேண்டும்.
  8. மின்சுற்றை சரி பார்க்க வேண்டும்.
  9. Python program ஐ ரன் செய்ய வேண்டும்.

Python Program

from machine import Pin
import utime
 
m1 = Pin(5, Pin.OUT)
m2 = Pin(4, Pin.OUT)
m3 = Pin(3, Pin.OUT)
m4 = Pin(2, Pin.OUT)
 
en1 = Pin(6, Pin.OUT)
en2 = Pin(7, Pin.OUT)
 
en1(1)  # motor 1 enable, set value 0 to disable
en2(1)  # motor 2 enable, set value 0 to disable
 
while True:
    #Both Motor in forward direction
    m1(1)
    m2(0)
    m3(1)
    m4(0)
    utime.sleep(1)
    #Both Motor in Reverse direction
    m1(0)
    m2(1)
    m3(0)
    m4(1)
    utime.sleep(1)
    #Both Motor in stop position
    m1(0)
    m2(0)
    m3(0)
    m4(0)
    utime.sleep(5)

Arduino Tutorials – பாடம் 46 – L298N Motor Driver Module control double DC Motor using Raspberry Pi Pico

L298N Motor Driver ஐ பயன்படுத்தி 2 DC மோட்டார்களை கட்டுப்படுத்துவது

Required Components

  1. L298N Motor Driver Module-1 no
  2. Raspberry Pi Pico-1 no
  3. DC Motor(gear)-2 no
  4. 12V Battery-1 no
  5. Data Cable-1 no
  6. Connecting Wires-4 no

Circuit

Steps

  1. நாம் பயன்படுத்தும் உபகரணங்கள் சரியாக வேலை செய்கிறதா என்பதை உறுதி செய்து கொள்ளவும்.
  2. மோட்டார் Driver போர்டு உடன் +12V battery இணைக்க வேண்டும்.
  3. +12V பேட்டரி இணைப்புகளை சரியாகவும் கவனமாகவும் இணைக்க வேண்டும்.
  4. மோட்டார் Driver போர்டு ENA, IN1, IN2, IN3, IN4, ENB பின்களை Raspberry Pi Pico பின்களான GP6, GP5, GP4, GP3, GP2, GP7 உடன் இணைக்க வேண்டும்.
  5. மோட்டார் Driver போர்டு OUTPUT பின்களை DC மோட்டார் பின்களுடன் இணைக்க வேண்டும்.
  6. மோட்டார் Driver போர்டு GND ஐ Raspberry Pi Pico board GND உடன் இணைக்க வேண்டும்.
  7. Arduino program ஐ சரி பார்க்க வேண்டும்.
  8. மின்சுற்றை சரி பார்க்க வேண்டும்.
  9. Arduino program ஐ ரன் செய்ய வேண்டும்.

Arduino Program

int motor1pin1 = 2;
int motor1pin2 = 3;
int enPin1 = 4;

int motor2pin1 = 5;
int motor2pin2 = 6;
int enPin2 = 7;


void setup() {
  pinMode(motor1pin1, OUTPUT);
  pinMode(motor1pin2, OUTPUT);
  pinMode(enPin1, OUTPUT);
  digitalWrite(enPin1, HIGH);

  pinMode(motor2pin1, OUTPUT);
  pinMode(motor2pin2, OUTPUT);
  pinMode(enPin2, OUTPUT);
  digitalWrite(enPin2, HIGH);
}

void loop() {
  digitalWrite(motor1pin1, HIGH);
  digitalWrite(motor1pin2, LOW);
  digitalWrite(motor2pin1, HIGH);
  digitalWrite(motor2pin2, LOW);
  delay(1000);

  digitalWrite(motor1pin1, LOW);
  digitalWrite(motor1pin2, HIGH);
  digitalWrite(motor2pin1, LOW);
  digitalWrite(motor2pin2, HIGH);
  delay(1000);
}

Python Tutorials – Lesson 13 – L298N Motor Driver Module control double DC Motor using Raspberry Pi Pico

To control 2 DC motors with directional and speed control

Required Components

  1. L298N Motor Driver Module_1 no
  2. Raspberry Pi Pico_1 no
  3. DC Motor(gear)_2 no
  4. 12V Battery_1 no
  5. Data Cable_1 no
  6. Connecting Wires_4 no

Circuit

Steps

  1. Make sure the components are working properly.
  2. Connect the 12V Battery to the L298N Motor Driver.
  3. Connect the ENA, IN1, IN2, IN3, IN4, ENB pins to the Raspberry Pi Pico board pins GP7, GP5, GP4, GP3, GP2, GP6 properly.
  4. Connect the DC motor pins to the motor driver output pins.
  5. Connect the ground connection respectively.
  6. Check the Electrical Circuit.
  7. Check the Python program.
  8. Run the Python program.

Python Program

from machine import Pin
import utime
 
m1 = Pin(5, Pin.OUT)
m2 = Pin(4, Pin.OUT)
m3 = Pin(3, Pin.OUT)
m4 = Pin(2, Pin.OUT)
 
en1 = Pin(6, Pin.OUT)
en2 = Pin(7, Pin.OUT)
 
en1(1)  # motor 1 enable, set value 0 to disable
en2(1)  # motor 2 enable, set value 0 to disable
 
while True:
    #Both Motor in forward direction
    m1(1)
    m2(0)
    m3(1)
    m4(0)
    utime.sleep(1)
    #Both Motor in Reverse direction
    m1(0)
    m2(1)
    m3(0)
    m4(1)
    utime.sleep(1)
    #Both Motor in stop position
    m1(0)
    m2(0)
    m3(0)
    m4(0)
    utime.sleep(5)
    

Arduino Tutorials – Lesson 46 – L298N Motor Driver Module control double DC Motor using Raspberry Pi Pico

To control up to 2 DC motors with directional and speed control

Required Components

  1. L298N Motor Driver Module_1 no
  2. Raspberry Pi Pico_1 no
  3. DC Motor(gear)_2 no
  4. 12V Battery_1 no
  5. Data Cable_1 no
  6. Connecting Wires_4 no

Circuit

Steps

  1. Make sure the components are working properly.
  2. Connect the 12V Battery to the L298N Motor Driver.
  3. Connect the ENA, IN1, IN2, IN3, IN4, ENB pins to the Raspberry Pi Pico board pins GP7, GP5, GP4, GP3, GP2, GP6 properly.
  4. Connect the DC motor pins to the motor driver output pins.
  5. Connect the ground connection respectively.
  6. Check the Electrical Circuit.
  7. Check the Arduino program.
  8. Run the Arduino program.

Arduino Program

int motor1pin1 = 2;
int motor1pin2 = 3;
int enPin1 = 4;

int motor2pin1 = 5;
int motor2pin2 = 6;
int enPin2 = 7;


void setup()
 {
  pinMode(motor1pin1, OUTPUT);
  pinMode(motor1pin2, OUTPUT);
  pinMode(enPin1, OUTPUT);
  digitalWrite(enPin1, HIGH);

  pinMode(motor2pin1, OUTPUT);
  pinMode(motor2pin2, OUTPUT);
  pinMode(enPin2, OUTPUT);
  digitalWrite(enPin2, HIGH);

}

void loop() 
{
  digitalWrite(motor1pin1, HIGH);
  digitalWrite(motor1pin2, LOW);
  digitalWrite(motor2pin1, HIGH);
  digitalWrite(motor2pin2, LOW);
  delay(1000);

  digitalWrite(motor1pin1, LOW);
  digitalWrite(motor1pin2, HIGH);
  digitalWrite(motor2pin1, LOW);
  digitalWrite(motor2pin2, HIGH);
  delay(1000);
}