Home Forums Sparkfun MP3 Shield Library Support Forum MP3 player use with PIR Sensor and Servo


Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #2959

    The MP3 player works great with your library.  Thank you for sharing it.  I would like to play a track and write to a servo if the PIR sensor goes HIGH for a Halloween project.  I am using a Parallax PIR sensor and a HITEC 311 standard servo with the standard Servo.h library.  I am using pins D5 (for PIR) and D10 (for servo), but the servo doesn’t respond to commands and starts to jitter. I suspect a there are interrupt collisions with the servo and the MP3 library, or maybe I am using the wrong pins?  I am not library code savvy.  Any suggestions for a work around to get the servo to work with the MP3 Player at the same time?



    I am working with similar settings and for my project I am using D12 for the PIR and D10 to light a button’s LED.

    Hope this helps.




    Troy replied to the notification email instead of posting here. His response:


    I’ve had no issues using PIR sensors and LEDs with the MP3 player.  That works as expected.  It’s only when introducing a servo that operation goes awry.  Perhaps the MP3 player simply isn’t compatible with the timing of servos, unless there is a modification I could do?


    I found a solution to use a servo and the MP3 player at the same time.

    I used an Arduino with the MP3 player and a PIR sensor as the MASTER, and used I2C and the Wire Library with analog pins 4 & 5 to connect to a second Arduino as a SLAVE which used the Servo Library and a servo.  When the PIR senses motion, it kicks off a track and sends a Wire command to the Slave to turn the servo.  When track is over, it sends another Wire command to stop the servo.  Works like a charm.

    This wasn’t a MP3 Library issue, but rather  me trying to figure out a working solution to my project.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.