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!

References

[1] https://www.seeedstudio.com/4A-Motor-Shield-p-1954.html
[2] https://github.com/Seeed-Studio/SeeedMotorShieldV2
[3] http://wiki.seeedstudio.com/images/9/93/4A_MOTOR_Shield_v1.0.pdf
[4] http://www.instructables.com/id/PWMSwizzling-an-Edison-Arduino-Breakout-to-work-wi/

2 comments:

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...