Pololu Robotics & Electronics
Menu
My account Comments or questions? About Pololu Contact Ordering information Distributors

Pololu Forum

Connecting a motion sensor to a 12 channel mini servo controller

Please talk to me like I am a child. I am so terribly confused haha. I purchased the 12 channel mini (servo controller). This is for a haunted house where I will use it to make doll heads turn. How can I hook up a motion sensor to this? Can I add sound as well? Sorry- I got in over my head with this project. sigh

Hello.

The specifics about how to connect a motion sensor and if it is compatible with the Maestro depends on your particular sensor. Did you already have one in mind, or are you looking for one?

The Maestro does not have any special support for adding sound, but you can use a separate audio board such as SparkFun’s MP3 Trigger V24 or Adafruit’s Audio FX Mini Sound Board and have the Maestro trigger the sound and time your servo movement appropriately. Both of those sound boards are able to trigger sounds from digital signals (e.g. connecting specific pins to ground) or through UART serial commands (which the Mini Maestro is capable of sending from a script). You can find an example of how to use serial commands to trigger sounds from the MP3 Trigger V24 in this post from Jon.

Brandon

1 Like

Thank you! I don’t have a specific sensor in mind- I’m pretty much open to anything.

We carry several sensors that can work with the Maestro and might work for your application. If you want a sensor that specifically detects the motion of people, something like this PIR Motion Sensor might be an option.

Alternatively, if you want the detection area to be more targeted, you might consider our Digital Distance Sensors (in particular, the versions with a digital output since it would not be practical to read a pulse width output with a Maestro). However, please note that these sensors work differently; they do not actually detect motion, but rather the presence of an object within their sensing distance. They come in different versions with maximum ranges varying from 5cm to 200cm.

Brandon

1 Like

Sorry I didn’t respond sooner- I ordered the items you suggested and just got them today. I apologize, again, for being very ignorant on this subject. From what I can find- it seems like we hook up the PIR to a new end and plug it into one of the channels on the maestro. Then we have to write the code/script? Can you help with the code/commands. This is way more difficult than I thought it would be. I purchased the Adafruit audio mini sound board.

We have servos connected to the maestro and have successfully figured out how to operate the programming software to get them to move how we want. My husband said that the next step is to select “copy to script”. Once we have that done how do we write the script to get the motion sensor to trigger the sound board and the movement of the servos?

And thank you so much for taking the time to help!

If you have set up a sequence to get the motion you want in the “Sequence” tab of the Maestro Control Center, you can use the “Copy Sequence to Script” button, then manually edit the script to make it use the PIR sensor.

You can find some details about connecting the PIR sensor to the Maestro in this post by Ryantm. After that, if it is configured and working properly, you should be able to see the PIR sensor respond by monitoring the channel you used in the “Status” tab of the Maestro Control Center. The PIR sensor should give you a low signal when motion is detected and a high signal otherwise, so you can essentially treat it a button. Depending on how you want it to work, you might be able to use the snippet of code I posted about here for starting a script with the push of a button as a starting point.

For the Adafruit audio board, I recommend reading through their Audio FX Sound Board guide for how to set it up. It has a couple different methods of triggering audio, so you could set it up so driving individual pins low causes specific audio files to play (which you can do from individual Maestro pins configured as “output”), or it can be configured to accept serial commands to trigger the audio (which you can send from a Maestro script using the serial_send_byte command as long as you are using a Mini Maestro).

If you get stuck while progressing through any of these steps, you can post more information about what you have done so far and I would be happy to help further. It would probably be helpful to post a copy of your Maestro settings file as well, which will allow me to see how everything is configured on your Maestro, including your script. You can save a copy of your Maestro settings from the “File” drop-down menu of the Maestro Control Center while the controller is connected.

Brandon

1 Like

Thank you!!