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

L298N Motor Driver ஐ பயன்படுத்தி 1 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 பின்களை Raspberry Pi Pico பின்களான GP4, GP2, GP3 உடன் இணைக்க வேண்டும்.
  5. மோட்டார் Driver போர்டு OUTPUT பின்களை DC மோட்டார் பின்களுடன் இணைக்க வேண்டும்.
  6. மோட்டார் Driver போர்டு GND ஐ Raspberry Pi Pico GND உடன் இணைக்க வேண்டும்.
  7. Python program ஐ சரி பார்க்க வேண்டும்.
  8. மின்சுற்றை சரி பார்க்க வேண்டும்.
  9. Python program ஐ ரன் செய்ய வேண்டும்.

Python Program

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

Leave a Reply

Your email address will not be published. Required fields are marked *