Saturday 9 February 2013

L298N

To drive TankPi, I needed to get a pretty decent motor driver that will drive my motors, yet to be decided.

I decided to get the L298N motor driver chip on a board off Ebay. It drives motors up to 35v and takes 5v logic power. Sounds perfect!

The L298N is great, meant for Arduino, but it works great with the Raspberry Pi GPIOs. 


That's it. Small and awesome.

The terminal connector on the far left bottom is the first of the 2 motor outputs, and top right is the second motor out. The 3 port terminal in the middle is VCC (motor power) GND (common ground) and +5VDC (logic power). The pins in the middle are the Pi connection pins that go to the GPIO. 

This is eventually going to be mounted on the underside of the TankPi chassis (picture to come).

Jamie

4 comments:

  1. Hi guy,

    Can you post any python code ?

    Thanks

    ReplyDelete
  2. Sure can, to use it, wire up GPIO 18 on the Pi to a input pin on your motor driver. Then connect the GND (ground) of the motor driver to the GND on the Pi. This code just pulses the motor every second for a second.

    To get the code, connect your Pi to the internet and type into a terminal, "wget http://cloud.jami.org.uk/downloads/raspicode/pulse.py".

    To run the code, you need Python-Dev. Get that by running "sudo apt-get install python-dev" on your Pi. You also need the RPi.GPIO API for Python. You can get this here: "https://code.google.com/p/raspberry-gpio-python/downloads/list". Lastly run "sudo pyhton /pulse.py", where is the path to where "wget" downloaded it to (usually in your home directory).

    If you need some code that uses PWM (Pulse Width Modulation), then drop another comment and I'll get some code for that.

    Jamie :)

    ReplyDelete
  3. Hi,
    I am unable to download the Python code using the above link.
    Can you post the code here on this forum or a link to where I can copy/paste it from.

    Thanks.

    ReplyDelete
  4. Sorry, I had IP issues. Use this link, this definitely works!

    http://jami.org.uk/downloads/pulse.py

    Jamie

    ReplyDelete

Thanks for your comment! If it's a query or question, I'll try to get back to you as soon as I can. I hope this blog has helped or inspired you!