0

I am trying to make a Robotic Car using 4 motors and L298n for a motor driver. The motor specifications as listed on the purchase site are given below:

  • Operating Voltage: 3V~6V DC
  • Gear Ratio 1:48
  • No-load speed(5V): about 208RPM
  • Rated Torque: 0.8 Kg.cm @ 5V
  • Load current: 170mA (when it is 4.5V)
  • Size: 70 x 23 x 18 mm
  • Weight:28g
  • Shaft Length: 10 mm
  • Shaft Type: 6 mm, Double-D

I have made the connections as show in the image below : enter image description here

(I have removed all jumpers)

and following is the code I am using the run the motors

import RPi.GPIO as gpio
import time
gpio.setmode(gpio.BOARD)
gpio.setup(7,gpio.OUT)
gpio.setup(11,gpio.OUT)
gpio.setup(13,gpio.OUT)
gpio.setup(15,gpio.OUT)

gpio.output(7,True)
gpio.output(11,True)

while True:
    gpio.output(13,True)
    gpio.output(15,False)
    time.sleep(2)
    gpio.output(13,False)
    gpio.output(15,True)
    time.sleep(2)
    gpio.output(13,False)
    gpio.output(15,False)
    time.sleep(2)

Problem : When I run the script, The motors spins first cycle of the loop and the stops spinning.

What I tried : The motors only start spinning again for another cycle if I disconnect and reconnect the ground cable that connects Rpi ground to L298n ground. This problem doesn't occur when I am providing 12V 1A power supply(reads as 20V DC on my multimeter, I don't know why though) instead of the 4 x AA 1.5V batteries which I want to use.

Question : Is this a problem of power supply or am I doing something else wrong? I have tried multiple tutorials on the youtube but couldn't figure out the problem.

I am stuck with this for a week now. I can provide with more information, if you can specify what you want in the comments....

1
  • Disconnecting Gnd is a good way of destroying the Pi
    – Milliways
    Oct 2 '20 at 22:58
2

From your description the batteries can not supply enough power for a sustained period. They are drained after four seconds of use until you give them a period of rest when they recover enough for a few more seconds.

You need more powerful batteries or smaller motors.

1
  • Thank you. Supposing I use 6V, how would I calculate the required battery specifications, would required Ampere rating be 170mA*4 = 680mA? Oct 3 '20 at 13:21

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.