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

Pololu Forum

Creating a secondary trigger pulse during servo motion

Hello everyone,
I have a question related to the use of a single servo attached to a mini maestro 18 board. I’m using a very simple script (attached below) to cycle the servo between two positions. You can see via the script that the servo travels quickly with a short duration in one direction and moves with much slower speed and longer duration in the other direction.

begin
  10 delay  
  0 0 speed
  5440 0 servo  
  200 delay
  25 0 speed
  6640 0 servo  
  800 delay
Repeat

When the servo is moving only in the direction of slow speed and long duration I need to create a secondary continuous output pulse (that would trigger another piece of electronics). However again this continuous output pulse should only be created during the time frame when the servo is moving in the one direction with slow speed and long duration. This continuous output pulse signal could be almost anything that could be created by the board. My main concern creating this pulse during this specific component of the motion / code. I’m new to using the maestro products, so please forgive my ignorance.

Thank you! Steve

Hello, Steve.

Could you trigger your other electronics with a basic digital high vs low signal? If so, you can configure one of your Maestro channels as a digital output then use the servo command in your Maestro script to drive it low (by using an argument somewhere between 0 and 5999) and high (by using an argument somewhere between 6000 and 32767) at the appropriate points.

- Patrick

Hi Patrick,
Thanks for the reply – yep, I should be able to use a digital high or low signal. Just to confirm, can this signal be associated with a single directional command in the script (e.g. in my example, it only goes high or low when the servo moves in the ‘slow’ direction?). I’m guessing the signal might be high in one direction and low in the other which would be totally fine.

Would it be possible for you to share some script code that could be used to achieve this? Maybe just build upon my simple script inserted in my previous post.

Thank you, Steve

Thanks Patrick,

This is my first use of the Maestro. Could you please forward a bit of code that ties the specific motion of the servo to the high or low pulse. For example to get a high signal when then servo moves in the “slow” direction via the code below? This maybe very basic, but want to ensure I can tie the pulse to the specific motion in the code.

Thanks Patrick, Steve

begin

10 delay

0 0 speed

5440 0 servo

200 delay

25 0 speed

6640 0 servo

800 delay

Repeat

Hello.

Here is an example showing how you might use a Maestro channel (I am using channel 1) as a digital output like you described:

0 1 servo  # Start with channel 1 driven low
begin
  10 delay  
  0 0 speed 
  0 1 servo  # Drive channel 1 low...
  5440 0 servo  # while moving channel 0 servo quickly
  200 delay
  25 0 speed 
  8000 1 servo  # Drive channel 1 high...
  6640 0 servo  # while moving channel 0 servo slowly
  800 delay
repeat

Remember, you have to configure the channel as a digital output in the Maestro Control Center under the “Channel Settings” tab for this to work correctly.

- Patrick

Thank you Patrick, I’ll give this a try.