Mini Maestro 12 Channel and Motion Sensor

We have a Mini Maestro 12 Channel servo controller that we would like to add a motion sensor or a button to activate the motion. Is this possible? If so, what options of sensors or buttons do we have. 2731 PIR Motion Sensor?

Thanks!

Hello!

Yes, it is possible to add a button or PIR sensor to your maestro. Our example sketch “Using a button or switch to control servos” in the Example Scripts section of the Maestro Servo Controller User’s Guide shows how you can do that. Our PIR sensor is active low, so it will act in similar way to a button connected as shown in the Maestro’s guide, so the same code can probably be used for either.

Additional information on the maestro 12 channel controller can be found under the “Resources” tab of the Mini Maestro 12-Channel USB Servo Controller product page.

-Dan

Dan,

Thank you for the advice. We used the script just as you had proposed, but the sensor didn’t do anything when we connected it to our current script. Is that a common problem?

Aaron

This is the script that we used.

# Final Test
# when sensor goes to 161.25 begin
begin
  500 4032 7364 7634 4032 0 6016 
  4032 0 0 0 0 0 frame_0..11 # Frame 0
  500 4686 5919 7600 frame_0..2 # Frame 1
  500 6137 frame_1 # Frame 2
  500 8128 5881 frame_0_1 # Frame 3
  500 delay # Frame 4
  500 6266 frame_6 # Frame 5
  500 delay # Frame 6
  500 delay # Frame 24
  500 delay # Frame 25
  500 6786 frame_6 # Frame 26
  500 delay # Frame 27
  500 delay # Frame 28
  500 8000 7788 6362 4032 frame_0_1_5_6 # Frame 7
  500 8000 frame_1 # Frame 8
  500 4032 frame_2 # Frame 9
  500 delay # Frame 10
  500 5380 6670 frame_1_6 # Frame 11
  500 delay # Frame 12
  500 4552 5804 frame_1_5 # Frame 13
  500 delay # Frame 29
  500 delay # Frame 30
  500 4340 4763 5245 frame_0_1_6 # Frame 14
  500 8000 4552 6670 frame_0_1_6 # Frame 15
  500 4340 6651 5245 frame_0_1_6 # Frame 16
  500 4763 frame_1 # Frame 17
  500 7325 4032 frame_1_6 # Frame 18
  500 6651 5245 frame_1_6 # Frame 19
  500 7325 7499 4032 frame_1_2_6 # Frame 20
  500 4032 frame_2 # Frame 21
  500 4032 7404 7634 6016 frame_0..2_5 # Frame 22
  500 delay quit # Frame 23
repeat

sub frame_0..11
  11 servo
  10 servo
  9 servo
  8 servo
  7 servo
  6 servo
  5 servo
  4 servo
  3 servo
  2 servo
  1 servo
  0 servo
  delay
  return

sub frame_0..2
  2 servo
  1 servo
  0 servo
  delay
  return

sub frame_1
  1 servo
  delay
  return

sub frame_0_1
  1 servo
  0 servo
  delay
  return

sub frame_6
  6 servo
  delay
  return

sub frame_0_1_5_6
  6 servo
  5 servo
  1 servo
  0 servo
  delay
  return

sub frame_2
  2 servo
  delay
  return

sub frame_1_6
  6 servo
  1 servo
  delay
  return

sub frame_1_5
  5 servo
  1 servo
  delay
  return

sub frame_0_1_6
  6 servo
  1 servo
  0 servo
  delay
  return

sub frame_1_2_6
  6 servo
  2 servo
  1 servo
  delay
  return

sub frame_0..2_5
  5 servo
  2 servo
  1 servo
  0 servo
  delay
  return

It does not look like you have any commands in your script to read and process the status of your PIR sensor. You will need to add some code to your script, specifically the get_position command, to get the reading from your sensor so that you can evaluate it and begin your sequence of servo movements. (You can find more details on that command in the “Command Reference” section of the user’s guide.) Did you look at the example script I pointed out in my previous post? If you are having a hard time understanding the way these commands should work, please post your questions in as much detail as possible, and I would be happy to answer them.

-Dan,

Dan,

Can you be more specific on where we need the commands? I don’t really understand how the commands cooperate with the servos and sensor. Can you explain the commands that I need so I have a better picture of how they work? Also, I didn’t really get the script you proposed.

Aaron

Before we get too far into troubleshooting code, have you been able to successfully test your PIR sensor to make sure everything is connected and configured correctly? If everything is working correctly, you should be able to monitor the slider for the channel you connected your sensor to in the “Status” tab of the Maestro Control Center and see it respond to motion.

As Dan mentioned previously, if you are using the #2731 PIR sensor it drives the alarm pin low when it detects motion. The alarm pin is floating when there is no motion detected, so you will need to connect a pull-up resistor to the Maestro channel you are using (similarly to how you would connect a button according to the “Attaching Servos and Peripherals” section of the Maestro User’s Guide). You should also be sure that the channel you are connecting it to is configured as an Input in the “Channel Settings” tab of the Maestro Control Center.

If you are not getting the response you expect from your senor in the “Status” tab, can you post some pictures of your setup that show all of your connections? Also, could you post your Maestro settings file? You can save your settings file by selecting the “Save settings file…” option within the “File” drop-down menu.

-Brandon

Dear Brandon and Dan,

We have successfully been able to test the PIR motion sensor and it is working fine. We are also being able to see the sensor reply to motion in the “Status” tab. Our only problem is that when we run the script for the sensor the sensor does nothing in the script that will start the whole script we want to run. We are using a Keyestudio PIR motion sensor for Human Body Motion. The sensor is an input in the “Status” tab. We don’t know where the pull up resister is on the “mini maestro 12-channel servo controller.” Here is our maestro file settings:

<!--Pololu Maestro servo controller settings file, http://www.pololu.com/catalog/product/1350-->
<UscSettings version="1">
  <NeverSuspend>false</NeverSuspend>
  <SerialMode>UART_FIXED_BAUD_RATE</SerialMode>
  <FixedBaudRate>9600</FixedBaudRate>
  <SerialTimeout>0</SerialTimeout>
  <EnableCrc>false</EnableCrc>
  <SerialDeviceNumber>12</SerialDeviceNumber>
  <SerialMiniSscOffset>0</SerialMiniSscOffset>
  <Channels MiniMaestroServoPeriod="80000" ServoMultiplier="1">
    <!--Period = 20 ms-->
    <!--Channel 0-->
    <Channel name="Hand" mode="Servo" min="4032" max="8128" homemode="Goto" home="5065" speed="50" acceleration="10" neutral="4032" range="1905" />
    <!--Channel 1-->
    <Channel name="Shoulder" mode="Servo" min="4032" max="8000" homemode="Goto" home="7440" speed="10" acceleration="2" neutral="4032" range="1905" />
    <!--Channel 2-->
    <Channel name="Turn Part" mode="Servo" min="4032" max="8000" homemode="Goto" home="7600" speed="30" acceleration="10" neutral="4096" range="1905" />
    <!--Channel 3-->
    <Channel name="Wrist Twist" mode="Servo" min="4032" max="8000" homemode="Goto" home="4032" speed="0" acceleration="0" neutral="6000" range="1905" />
    <!--Channel 4-->
    <Channel name="" mode="Servo" min="4032" max="8000" homemode="Ignore" home="4032" speed="0" acceleration="0" neutral="6000" range="1905" />
    <!--Channel 5-->
    <Channel name="Wrist nod" mode="Servo" min="4032" max="8000" homemode="Goto" home="6016" speed="0" acceleration="0" neutral="4032" range="1905" />
    <!--Channel 6-->
    <Channel name="Elbow" mode="Servo" min="4032" max="8000" homemode="Goto" home="4032" speed="10" acceleration="2" neutral="4032" range="1143" />
    <!--Channel 7-->
    <Channel name="" mode="Servo" min="3968" max="8000" homemode="Ignore" home="3968" speed="0" acceleration="0" neutral="6000" range="1905" />
    <!--Channel 8-->
    <Channel name="Sensor" mode="Input" min="0" max="1024" homemode="Ignore" home="0" speed="0" acceleration="0" neutral="1024" range="1905" />
    <!--Channel 9-->
    <Channel name="" mode="Servo" min="3968" max="8000" homemode="Ignore" home="3968" speed="0" acceleration="0" neutral="6000" range="1905" />
    <!--Channel 10-->
    <Channel name="" mode="Servo" min="3968" max="8000" homemode="Ignore" home="3968" speed="0" acceleration="0" neutral="6000" range="1905" />
    <!--Channel 11-->
    <Channel name="" mode="Servo" min="3968" max="8000" homemode="Ignore" home="3968" speed="0" acceleration="0" neutral="6000" range="1905" />
  </Channels>
  <Sequences>
    <Sequence name="Final Test">
      <Frame name="Frame 0" duration="500">4032 7404 7634 4032 0 6016 4032 0 0 0 0 0</Frame>
      <Frame name="Frame 1" duration="500">4686 5919 7600 4032 0 6016 4032 0 0 0 0 0</Frame>
      <Frame name="Frame 2" duration="500">4686 6137 7600 4032 0 6016 4032 0 0 0 0 0</Frame>
      <Frame name="Frame 3" duration="500">8128 5881 7600 4032 0 6016 4032 0 0 0 0 0</Frame>
      <Frame name="Frame 4" duration="500">8128 5881 7600 4032 0 6016 4032 0 0 0 0 0</Frame>
      <Frame name="Frame 5" duration="500">8128 5881 7600 4032 0 6016 6266 0 0 0 0 0</Frame>
      <Frame name="Frame 6" duration="500">8128 5881 7600 4032 0 6016 6266 0 0 0 0 0</Frame>
      <Frame name="Frame 24" duration="500">8128 5881 7600 4032 0 6016 6266 0 0 0 0 0</Frame>
      <Frame name="Frame 25" duration="500">8128 5881 7600 4032 0 6016 6266 0 0 0 0 0</Frame>
      <Frame name="Frame 26" duration="500">8128 5881 7600 4032 0 6016 6786 0 0 0 0 0</Frame>
      <Frame name="Frame 27" duration="500">8128 5881 7600 4032 0 6016 6786 0 0 0 0 0</Frame>
      <Frame name="Frame 28" duration="500">8128 5881 7600 4032 0 6016 6786 0 0 0 0 0</Frame>
      <Frame name="Frame 7" duration="500">8000 7788 7600 4032 0 6362 4032 0 0 0 0 0</Frame>
      <Frame name="Frame 8" duration="500">8000 8000 7600 4032 0 6362 4032 0 0 0 0 0</Frame>
      <Frame name="Frame 9" duration="500">8000 8000 4032 4032 0 6362 4032 0 0 0 0 0</Frame>
      <Frame name="Frame 10" duration="500">8000 8000 4032 4032 0 6362 4032 0 0 0 0 0</Frame>
      <Frame name="Frame 11" duration="500">8000 5380 4032 4032 0 6362 6670 0 0 0 0 0</Frame>
      <Frame name="Frame 12" duration="500">8000 5380 4032 4032 0 6362 6670 0 0 0 0 0</Frame>
      <Frame name="Frame 13" duration="500">8000 4552 4032 4032 0 5804 6670 0 0 0 0 0</Frame>
      <Frame name="Frame 29" duration="500">8000 4552 4032 4032 0 5804 6670 0 0 0 0 0</Frame>
      <Frame name="Frame 30" duration="500">8000 4552 4032 4032 0 5804 6670 0 0 0 0 0</Frame>
      <Frame name="Frame 14" duration="500">4340 4763 4032 4032 0 5804 5245 0 0 0 0 0</Frame>
      <Frame name="Frame 15" duration="500">8000 4552 4032 4032 0 5804 6670 0 0 0 0 0</Frame>
      <Frame name="Frame 16" duration="500">4340 6651 4032 4032 0 5804 5245 0 0 0 0 0</Frame>
      <Frame name="Frame 17" duration="500">4340 4763 4032 4032 0 5804 5245 0 0 0 0 0</Frame>
      <Frame name="Frame 18" duration="500">5145 7325 4032 4032 0 5804 4032 0 0 0 0 0</Frame>
      <Frame name="Frame 19" duration="500">5145 6651 4032 4032 0 5804 5245 0 0 0 0 0</Frame>
      <Frame name="Frame 20" duration="500">5185 7325 7499 4032 0 5804 4032 0 642 0 0 0</Frame>
      <Frame name="Frame 21" duration="500">5165 7325 4032 4032 0 5804 4032 0 643 0 0 0</Frame>
      <Frame name="Frame 22" duration="500">5145 7404 7634 4032 0 6016 4032 0 0 0 0 0</Frame>
      <Frame name="Frame 23" duration="500">5185 7404 7634 4032 0 6016 4032 0 0 0 0 0</Frame>
    </Sequence>
    <Sequence name="Sensor Test">
      <Frame name="Frame 5" duration="500">5304 7440 7600 4032 0 6016 4032 0 643 0 0 0</Frame>
      <Frame name="Frame 7" duration="500">5483 7440 7600 4032 0 6016 4032 0 643 0 0 0</Frame>
      <Frame name="Frame 6" duration="500">5483 7440 7600 4032 0 6016 4032 0 0 0 0 0</Frame>
      <Frame name="Frame 8" duration="500">5483 7440 7600 4032 0 6016 4032 0 643 0 0 0</Frame>
      <Frame name="Frame 11" duration="500">5483 7440 7600 4032 0 6016 4032 0 642 0 0 0</Frame>
      <Frame name="Frame 9" duration="500">5483 7440 7600 4032 0 6016 4032 0 643 0 0 0</Frame>
      <Frame name="Frame 10" duration="500">5483 7440 7600 4032 0 6016 4032 0 643 0 0 0</Frame>
      <Frame name="Frame 0" duration="500">5205 7440 7600 4032 0 6016 4032 0 0 0 0 0</Frame>
      <Frame name="Frame 1" duration="500">8128 7440 7600 4032 0 6016 4032 0 643 0 0 0</Frame>
      <Frame name="Frame 2" duration="500">8128 7440 7600 4032 0 6016 4032 0 644 0 0 0</Frame>
      <Frame name="Frame 3" duration="500">8128 7440 7600 4032 0 6016 4032 0 643 0 0 0</Frame>
      <Frame name="Frame 4" duration="500">5483 7440 7600 4032 0 6016 4032 0 643 0 0 0</Frame>
      <Frame name="Frame 12" duration="500">5483 7440 7600 4032 0 6016 4032 0 0 0 0 0</Frame>
    </Sequence>
  </Sequences>
  <Script ScriptDone="true"># Final Test
# when sensor input goes to 160.75 begin
begin
  500 4032 7404 7634 4032 0 6016 
  4032 0 0 0 0 frame_0..7_9..11 # Frame 0
  500 4686 5919 7600 frame_0..2 # Frame 1
  500 6137 frame_1 # Frame 2
  500 8128 5881 frame_0_1 # Frame 3
  500 delay # Frame 4
  500 6266 frame_6 # Frame 5
  500 delay # Frame 6
  500 delay # Frame 24
  500 delay # Frame 25
  500 6786 frame_6 # Frame 26
  500 delay # Frame 27
  500 delay # Frame 28
  500 8000 7788 6362 4032 frame_0_1_5_6 # Frame 7
  500 8000 frame_1 # Frame 8
  500 4032 frame_2 # Frame 9
  500 delay # Frame 10
  500 5380 6670 frame_1_6 # Frame 11
  500 delay # Frame 12
  500 4552 5804 frame_1_5 # Frame 13
  500 delay # Frame 29
  500 delay # Frame 30
  500 4340 4763 5245 frame_0_1_6 # Frame 14
  500 8000 4552 6670 frame_0_1_6 # Frame 15
  500 4340 6651 5245 frame_0_1_6 # Frame 16
  500 4763 frame_1 # Frame 17
  500 5145 7325 4032 frame_0_1_6 # Frame 18
  500 6651 5245 frame_1_6 # Frame 19
  500 5185 7325 7499 4032 frame_0..2_6 # Frame 20
  500 5165 4032 frame_0_2 # Frame 21
  500 5145 7404 7634 6016 frame_0..2_5 # Frame 22
  500 5185 frame_0 quit # Frame 23
repeat

sub frame_0..7_9..11
  11 servo
  10 servo
  9 servo
  7 servo
  6 servo
  5 servo
  4 servo
  3 servo
  2 servo
  1 servo
  0 servo
  delay
  return

sub frame_0..2
  2 servo
  1 servo
  0 servo
  delay
  return

sub frame_1
  1 servo
  delay
  return

sub frame_0_1
  1 servo
  0 servo
  delay
  return

sub frame_6
  6 servo
  delay
  return

sub frame_0_1_5_6
  6 servo
  5 servo
  1 servo
  0 servo
  delay
  return

sub frame_2
  2 servo
  delay
  return

sub frame_1_6
  6 servo
  1 servo
  delay
  return

sub frame_1_5
  5 servo
  1 servo
  delay
  return

sub frame_0_1_6
  6 servo
  1 servo
  0 servo
  delay
  return

sub frame_0..2_6
  6 servo
  2 servo
  1 servo
  0 servo
  delay
  return

sub frame_0_2
  2 servo
  0 servo
  delay
  return

sub frame_0..2_5
  5 servo
  2 servo
  1 servo
  0 servo
  delay
  return

sub frame_0
  0 servo
  delay
  return</Script>
</UscSettings>

Thank you,
Aaron

Since it sounds like your sensor is working and you can see it responding in the “Status” tab, you probably do not need to use an external pull-up resistor with the PIR sensor you are using.

You can use a “GET_POSITION” command to read the sensor and process it accordingly. My post in this thread has some advice for starting a program with a button press that you might find helpful. It should be very similar to using a PIR sensor since it is just a digital signal. Please note that you might need to adjust the code in that post to work with your setup. For example, the channel number is different, and you might need to change the “greater_than” to a “less_than” depending on how your sensor works.

Brandon