Raspberry Pi and L298N motor driver boards

L298 Driver board

A few connections to the Raspberry Pi, a power supply and motors… simple!

A quick search of Ebay revealed these little beauties – L298 motor drivers. There’s a 3-pin terminal block for power (I used the 12v and Ground connection), 4 pins available for connecting to the GPIO and terminal blocks for a pair of DC motors. I didn’t use the 5v connection.

At the end of the 4 pins you will also find the “enable” inputs. This could be used to control the motors from a common PWM signal but I left the jumper links in place so that the motor controllers are always active.

In order to connect the driver board to the Raspberry Pi, a 4-way female-to-female ribbon connector is needed. Also required is a common ground connection and a simple way of doing this is to cut the end off a spare connector cable, strip it and push it into the ground connector for the power supply.

The module specifications state that it can work from a wide range of power supplies(5-35V)  and interfaces easily with the Raspberry Pi. I’ve so far used it with the 9v Fischertechnik motors but my next stage is to connect it to some 4.5v Lego Technic motors. I’ve done similar with the L293 and the PICAXE so I’m not expecting any difference. I haven’t yet found out what the voltage drop across the internal transistors is, so I’ll have to pick my power supply with care.

L298 diagram

These are the basic connections. I left the three jumpers as supplied.

Another use that might not be so obvious is that the module can also drive light bulbs and stepper motors. One board would suit a 2 phase bipolar motor and it would be a straightforward job to write the patterns required to step the motor around. Note, however that this would require four GPIO connections per motor, so it might be convenient to use some sort of port expander if this is the direction chosen.

This particular driver board will probably end up on my disassembled Big Trak. I’ve got a 5v power supply that will run from 7.2v R/C racing packs.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s