Close
0%
0%

BeagleBone Black and a L298 Motor Driver

This is a L298 motor driver from Open-Electronics.org and a BeagleBone Black w/ Python software using Adafruit_BBIO.

Public Chat
Similar projects worth following
Hello,

This is a project that creates a geared, DC motor to initialize, start in forward, and go in reverse, and then to stop.

Seth

Hello...

I am going to add the second motor soon. Enjoy...

Seth

L298motorsII.py

getting some help from #beagle at Freenode IRC...

plain - 591.00 bytes - 05/07/2018 at 03:18

Download

L298_schematic.PNG

schematic of this particular board...

Portable Network Graphics (PNG) - 308.06 kB - 05/07/2018 at 03:15

Preview

master_pin.py

initial software...get started. This should start and stop the motor(s). I may have made a mistake. It may not revolve in reverse. I will update it in time.

plain - 369.00 bytes - 05/07/2018 at 03:14

Download

  • 8 × leads wiring it up
  • 1 × BeagleBone Black beagleboard.org target board for accessing embedded Linux
  • 1 × L298 motor driver from Open-electronics.org and can be found online...
  • 2 × Generic geared, DC motors

  • 1
    Hello...

    Attach the wiring from the BBB while it is unplugged and there is no power going to the BBB to the L298 motor driver from Open-Electronics.org.

    One of the four wires controls the on/off functionality (En A or En B). Then, the other wires, one ground, control forward and backwards capabilities. Attach your other wiring, the wiring for forward/backward, to ln1 and ln2. The En B and ln 3 and ln 4 are for the second motor.

    Go to beagleboard.org/latest-images. Grab your image, i.e. preferably the newest available. If your pins are configured for other uses outside of GPIO functionality, use config-pin gpio for each pin that is used.

    If you are having trouble w/ config-pin and you need support, try to use sudo or see here: https://github.com/adafruit/adafruit-beaglebone-io-python.

    There is a small section on config-pin on this GitHub.com page. 

    So, that connection w/ this software will get you up and running quickly:

    import Adafruit_BBIO.GPIO as GPIO
    import time
    
    Master_Pin =  "P9_21"
    ln1 =         "P9_22"
    ln2 =         "P9_12"
    
    if __name__=="__main__":
    
        GPIO.setup(Master_Pin, GPIO.OUT)
        GPIO.output(Master_Pin, GPIO.LOW)
        
        GPIO.output(Master_Pin, GPIO.HIGH)
        time.sleep(5)
        GPIO.output(Master_Pin, GPIO.LOW)
        
        GPIO.output(Master_Pin, GPIO.LOW)
        GPIO.cleanup()

    If this software only goes forward, stops, and shuts down, let me know. If that is too boring, look below. This software will control initialize, start forward, stop, reverse, and stop, and then shuts down and closes the software as it completes.

    import Adafruit_BBIO.GPIO as GPIO
    import time
    
    Master_Pin =  "P9_21"
    ln1 =         "P9_22"
    ln2 =         "P9_12"
    
    if __name__=="__main__":
    
        GPIO.setup(Master_Pin, GPIO.OUT)
        GPIO.output(Master_Pin, GPIO.LOW)
    
        GPIO.setup(ln1, GPIO.OUT)
        GPIO.setup(ln2, GPIO.OUT)
    
        GPIO.output(Master_Pin, GPIO.HIGH)
        GPIO.output(ln1, GPIO.HIGH)
        GPIO.output(ln2, GPIO.LOW)
        time.sleep(15)
    
        GPIO.output(Master_Pin, GPIO.HIGH)
        GPIO.output(ln1, GPIO.LOW)
        GPIO.output(ln2, GPIO.HIGH)
        time.sleep(15)
        print "I love your body Larry!"
    
        GPIO.output(Master_Pin, GPIO.LOW)
    
        GPIO.output(Master_Pin, GPIO.LOW)
        GPIO.cleanup()

    If you are wondering about the schematic of this particular motor driver, see the photos section or see here now:

    See the L298N, dual H-bridge section for pin connections that need to be made.

    Seth

    P.S. Use a 12v battery if available. The motors can handle 2A maximum each forward and backwards. The L298 board can handle 5 to 30V DC.

View all instructions

Enjoy this project?

Share

Discussions

silver2row wrote 05/09/2018 at 22:07 point

Hello Again,

I am working on a schematic on KiCad w/ the BBB and this L298 motor driver for ideas.

Seth

  Are you sure? yes | no

silver2row wrote 05/07/2018 at 03:19 point

I created this project to get people interested in motors and to promote collaboration on this subject.

Seth

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates