Sunday, August 10, 2014

RaspberryPi to run DC Motor using L298N Motor Controller

Raspberry Pi is an awesome and interesting . I was totally astonished after knowing about it from one of my friend and colleague "Alex" at Misys, who keeps sharing many interesting things of this kind.

I did computer application and always had this in mind that I missed to Engineering/Robotics. As I have no knowledge about electronics and mechanics so it really looked difficult for me to try something in this area. One of the main reason is the complexity involved in the Robotics in general (At least complex in my mind till i tried it).
Raspberry PI has made it simple and abstract for the users like me to achieve the same.

They say it is for the kids to enjoy...... I am still thinking, is it really only for kids? Any way i am enjoying this.

You can find more about the Raspberry PI from there website. What is the most amazing thing for me is that with this small credit-card sized computer it can be used to control devices. In this post i am not showing anything different than what others have done. In-fact i have also referred some of them.

I have ordered the following from ebay to make motor running work for me:

RaspberryPI    - 1
DCMotor        - 1
L298N Motor Controller  -  1
PowerSupply (2*2)  -  1
Male-Female and Female-Female connectors.  - Few


DC Motor                                                                                                                                                   

L298N Motor Controller

Following video should give you some idea about  RPi and what it can do.

You can find the python program which was used to control the motor here:

Connectivity for the pins is explained below:

Feeling excited about it by thing about the various opportunities about the application of R_PI.
Already received Raspberry PI Cam, and planning to make my own security system. :-)

This is the most amazing thing I have come across in the recent time.

I faced specific problem with my monitor for HDMI connectivity. My first configuration was with a relatively new monitor (Dell) and it was fine. But when i switched to another monitor (LG), it did not work, there was no display. I struggled for few days but finally found the way and posted the solutions here :


  1. I did exactly as you suggested and the motor only spins in one direction. What could be wrong?

  2. I copied yours but motor only rotates in one direction.

  3. I read your blog such a helpful to me…… Thank you for posting…..!!!
    Dc gear motor

  4. I truly like to read your post. Thank you so much for taking the time to share such nice information.

    Dc gear motor