Friday, April 28, 2017

SeeedStudio's 4A Motor Shield

I recently have been playing a little bit with an Arduino UNO I have at home. I gotta admit that, even though I'm utterly bad at electronics, this microcontroller makes it really easy for people like to build simple prototypes.

One of my pet projects is building a robot car, yes I'm that original 😉. For this, I bought a motor shield[1] from SeeedStudio which makes the Pulse-Width Modulation, PWM, very simple: You connect three cables to the oulets in the shield, program your Arduino sketch (no more than 5 lines) and use the SeeedStudio's library[2] and you will get your motor working. Just that easy!

However, I faced one problem that I was able to manage. In the library, the specified pins are

  • Motor A: 8, 11, 9. Pin 9 is used as PWM.
  • Motor B: 12, 13, 10. Pin 10 is used as PWM.
But for this shield in particular, the pins are different. Based on the schematics[3], I noticed the correct order:
  • Motor A: 5, 6, 9. Pin 9 is used as PWM.
  • Motor B: 7, 8, 10. Pin 10 is used as PWM.
I decided to fork the library in GitHub and make my own modifications to make them available to anyone who's having the same problem as me.

If you have a different board, make sure you are using the correct pins and also make sure that the PWM pin number you're specifying in your Arduino sketch is in fact an enabled PWM pin. They differ from board to board. For instance, in the Edison the default PWM pins are 3, 5, 6 and 9 and if you need pins 10 or 11 you'll need to adjust your PWM swizzlers[4].

Are you as interested as me on these pet projects? Share yours and lets exchange ideas.

Happy reading!




  1. very useful to the users and thanks for providing keep updating like this. For more updates get touch with AWS Online Training Bangalore

  2. A bewildering web journal I visit this blog, it's unfathomably heavenly. Oddly, in this present blog's substance made purpose of actuality and reasonable. The substance of data is informative
    Oracle Fusion Financials Online Training
    Oracle Fusion HCM Online Training
    Oracle Fusion SCM Online Training

  3. Very informative and useful historical post. I see you have a lot of other cool stuff available at your website, simply bookmarking it to check in spare time. Thanks and keep the good work up.DataScience with Python Training in Bangalore


Enterprise Integration with AWS

Today I published a blog post at IO Connect Services blog where I describe my experience building a solution to achieve enterprise integrat...