loading
This instructable will show you how to wire up your raspberry PiFace to allow you to control the direction of a DC Motor.

Kit Needed:
1 x DC Motor
1 x Power for the motor (I've used a 9V Battery) and connecting leads
1 x Raspberry Pi
1 x PiFace
1 x L298N Motor Driver Board (Can be purchased from eBay)
Selection of Jumper Leads/Wire depending on exactly what kit you have.


Step 1: Connecting the L289N to the PiFace

This is the bit I found the trickiest to work out however now I've got it working it seems obvious.

First connect the +5V on the L289N to the 5V on the PiFace.
Now connect the 0V on the PiFace and the negative lead from your battery/power supply to the 'power GND' on the L289N.
Connect the positive lead from your battery/power supply to the +12V on the L289N.
Connect your DC motor to one of the outputs, it doesn't matter which terminal you connect each wire to.
Put a jumper on the enable pins for the output you are using or just wire them together.
Connect the 2 input pins next to the output you are using to outputs 0 & 1 on your PiFace

You are now all connected up and ready to make your motor move!

Step 2: Make Your Motor Move!

To quickly test that this works turn output 0 on (using the emulator), this should cause the motor to spin. Turning off output 0 and turning on output 1 will make the motor spin the other way.

If you wanted you could now write some python code to control your motor, I've written this as I Cannot find a single other guide that covers L289N use with PiFace so hopefully you will find this helpful.
<p>Hi, thanks for your tutorial which is very nice..</p><p>I'm interested to have the python code to handle the device.</p><p>Can you be so kind to tell me where can I find this?</p><p>Thanks again.</p><p>Arnaldo</p>

About This Instructable

12,147views

17favorites

License:

More by Pick Up a Pi:Raspberry PiFace L298N Bi-Directional DC Motor Control PiFace LED Chasing Lights Raspberry Pi Setting up a PiFace with your Raspberry Pi 
Add instructable to: