0
\$\begingroup\$

I have a system which includes a Raspberry Pi, 2 a L298N module, 12V Battery source(8x1.5V AA) and a motor (a "PMDC Spur Gear Motor/KGA25RP")

When I connect everything right and run a simple program, only thing I see is a very low buzzing sound from motor while program running. Is my battery too low to move motor?

The code :

import RPi.GPIO as GPIO
from time import sleep

GPIO.setmode(GPIO.BOARD)

Motor1A = 38
Motor1B = 40
Motor1E = 7

GPIO.setup(Motor1A,GPIO.OUT)
GPIO.setup(Motor1B,GPIO.OUT)
GPIO.setup(Motor1E,GPIO.OUT)

print "Going forwards"
GPIO.output(Motor1A,GPIO.HIGH)
GPIO.output(Motor1B,GPIO.LOW)
GPIO.output(Motor1E,GPIO.HIGH)

sleep(2)

print "Going backwards"
GPIO.output(Motor1A,GPIO.LOW)
GPIO.output(Motor1B,GPIO.HIGH)
GPIO.output(Motor1E,GPIO.HIGH)

sleep(2)

print "Now stop"
GPIO.output(Motor1E,GPIO.LOW)

GPIO.cleanup()

Photos : imgur.com/ujjtbIH,Db3ingN,gXR3vjL

I used Raspberry pi's 7(motor 2 enable),38(IN4),40(IN3)pins.

keytosmart.com/wp-content/uploads/2014/07/B_Diagram_large.png (Can't link more than 2 links.)

\$\endgroup\$
  • \$\begingroup\$ Comments are not for extended discussion; this conversation has been moved to chat. \$\endgroup\$ – Dave Tweed Mar 3 '17 at 14:37
  • \$\begingroup\$ For a start you never turn off the move backwards, you just turn off your direction indicator. Try following the steps here: instructables.com/id/Raspberry-PI-L298N-Dual-H-Bridge-DC-Motor ....he provides you with better code. You should be able to test your motor connected directly to the battery, if that does not work then you need to fix that first. \$\endgroup\$ – Jack Creasey Mar 3 '17 at 19:10
0
\$\begingroup\$

Make sure your the ground on your RPi is tied to the ground of the driver board.

|improve this answer|||||
\$\endgroup\$

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.