Creative Commons images are CC BY 2.0


SparkFun Servo Trigger
project on
hackster.io project

Reclaim that Wasted Heat!
by Luke J. Barker

Description: The SparkFun Servo Trigger is a small robotics board that simplifies the control of hobby RC servo motors. When an external switch or logic signal changes state, the Servo Trigger is able to tell an attached servo motor to move from position A to position B. To use the Servo Trigger, you simply connect a hobby servo and a switch, then use the on-board potentiometers to adjust the start/stop positions and the transition time. You can use a hobby servos in your projects without having to do any programming!

The heart of the Servo Trigger is an Atmel ATTiny84 microcontroller, running a small program that implements the servo control features we are discussing here. On-board each Servo Trigger you will find three potentiometers, “A” sets the position the servo sits in while the switch is open, “B” sets the position the servo moves to when the switch is closed, and “T” sets the time it takes to get from A to B and back. Compared to a servo motor, the Servo Trigger board draws very little current, roughly 5 mA at 5V. Be sure to note that if you’re using the Servo Trigger to control your motor, the absolute maximum supply voltage that should be applied is 5.5 VDC. Additionally, the SparkFun Servo Trigger is designed to make it easy to daisy chain boards – you can simply connect the VCC and GND pads on adjacent boards to each other.

Note: Check out the Hookup Guide in the Documents section below for more advanced tips, configurations, and modes!

Note: This idea originally came from our friend in the Oakland area, CTP. If you see him, please give him a high-five for us.

Features:

  • Recommended Voltage: 5VDC
  • Max Voltage: 5.5VDC
  • Current Draw: 5 mA
  • Three Control Settings
    • A - sets the position the servo sits in while the switch is open
    • B - sets the position the servo moves to when the switch is closed
    • C - sets the time it takes to get from A to B and back
  • Easy Control with Potentiometers
  • Configurable Input Polarity
  • Configurable Response Mode
  • Compatible with Analog Servos
  • ISP Header pins Available for Reprogram

Documents:

Recommended Products

Customer Comments

  • Servo Trigger firmware on the Arduino: I’ve ported the firmware written by Byron Jacquot for this excellent device. It will control 2 servo motors (pin 9 and pin10 using Timer 1) with independent FSMs and software configurable settings. It’s a prototype for a larger project, but this was a great place to start.
    Full instructions here

  • Could you post dimensions for this board? Apologies if I’ve missed them.

    • The board outline is 1.7" by 0.9".

      The mounting holes are 0.125" in from each corner, and 0.13" in diameter, for 4-40 machine screws.

      The dimensions are in the Eagle BRD file. Turn on layer 47 (“Measures”) to see them.

  • Could this board be used with an Arduino to trigger its input? How would it be hooked up?

  • Where were you guys a decade ago when I made this circuit out of 555s? Could have saved me an afternoon of grief.

    http://i.imgur.com/krRLvW0.png

    Might I suggest you take your circuit and sell it to the physics folks around the world that are using it in their fancy science learning machines – it’s a far more elegant solution than mine. Although sometimes its worthwhile to ground the power/signal leads for experiments as it prevents erroneous signal noise in high sensitivity environments.

  • Hey guys, issue I am having….is then I first apply power….the servo does not always start in same position…..when I have my servo arm connected…and if it was to move to random position, then it want to break servo….only when I have board powered, and then connect servo, can I get it to work reliably….. Is there another workaround?? Or is something wrong with my board?? Thx again Kerry

    • It sounds like something isn’t right. It should power up without issues.

      What servo motor are you using?

      Also, what power supply are you using?

      If you can provide links or part numbers for those, I can try to recreate the situation here.

      Since you encounter problems when you power everything up together, but it works OK if you power up the trigger, then add the servo, it sounds like there might be some startup interaction between the motor and the power supply. If you have an oscilloscope (or even a DC voltmeter), watch the 5V line while you power up, and see what happens - if it dips or spikes, it might be causing the servo or trigger to get confused. I’ve seen servos draw an amp or more right when they start, then settle to a much more reasonable draw, maybe 20 mA.

      There’s some more info about this in the hookup guide, in the Power Notes section.

      If you can substitute a different servo or power supply (like 3 flashlight batteries), that might help isolate what’s going wrong.

  • This product is super clever. Nice job.

  • For model railroad applications, this controller is perfect for driving servos connected to turnouts (switches) or semaphore (signal) blades.
    Some suggestions: - Replace the pots with header pins, which tie through a ribbon cable, to a button/pot programming pendant. Save position values in Flash. - Add a third servo position and have a separate input for it or have three input bits. The ability to just ground an input for the position you want is very powerful and convenient. A 2 to 3 Mux/Decoder can be added by the user. - Reduce the price.

    Is the sketch code available?

  • May I ask what goes into deciding which Attiny chip was selected?? Sort of why Attiny84 vs. 85 vs. ?? and the like.

    • Two factors, mainly:

      First, the application determined the minimum number of pins required:

      • Three ADC pins for the pots.
      • One pin on a timer output for the servo control, configurable as PWM of suitable period & pulse width. A 16-bit timer, with a 1 MHz clock, let me have 1 uSec pulse resolution, which is better than many servos.
      • One pin for the switch input.
      • In-System-Programming & debugging make development easier, but can constrain how those pins can be used by the application. If I hadn’t had the single wire debug, I’d probably still be working out bugs.
      • Some extra pins for configuration jumpers were a bonus…in the end, I came up with even more modes than I had jumpers for.

      Of course, the pins and peripherals also have to be setup such that the functions aren’t mutually exclusive. That caused some problems with the 8-pin Tinies that I looked at.

      Second, availability. We already use the 84 in the Tiny USB Programmer stick, so it’s a part that’s already in our pipeline. We also have the DIP-14 version in stock, which I built my initial prototype around.

      So, yeah, pins and availability.

  • It would be nice to be able to some how “read out” the PWM values that the CPU is actually using. I can see a use for this in that you could use it as a “calibration harness” for a more sophisticated robot – unplug the servo from the “normal” controller, temporarily plug it into a WIG-13118 and adjust the range to get the “end points”, read out the values to put into the “normal” controller, move the servo back to the normal controller, and repeat for the next servo.

    Yeah, you could guesstimate the values from the pot positions, but a digital readout would be more accurate.

    At the moment, I don’t have the immediate need for it, but it’s something that crossed my mind as I looked at it. (I rather suspect that there could be something with using the ISP as a SPI bus, but it’s likely going to take an upgrade to the program.)

    • That poor lil' Tiny84 is almost out of pins. The only ones currently unused are MISO and SCK, not quite a full SPI bus. You could conceivably bit-bang an output on those pins (write-only 2-wire SPI, or bit-banged UART), though.

      Thinking about this a tiny bit more - 50 BPS is a very low, but standard, baud rate – you’ll see it in some terminal programs. It also happens to match the servo pulse rate! You could add a tiny bit of code to print out the pulse widths from within the timer IRQ.

      Alternatively, you could use a second microcontroller, with a timer in input-capture mode to measure the pulse widths, and display them. Or just use cursor mode on an oscilloscope.

  • Under the idea that “the only stupid question is the one that isn’t asked”: What happens when you hook one of these to a continuous rotation servo?

    • If you set it correctly, “A” sets how fast it drives one direction while the switch is open, “B” sets how fast it drives the other direction while it’s closed. “T” Sets the time it takes to decelerate, re-accelerate when the switch changes state.

      You could also set it so it’s stopped at “A” and moving at “B”, or vice versa.

      Keep in mind that continuous rotation servos have an internal trimpot that sets their center-point response, and that will interact with the A and B settings.

      If you want to load different firmware, there’s a toggling mode that I devised to control continuous servos. It’ll run one way until a switch closure, then run the other way until it closes again. I built a little cart with switches in the bumpers that would drive back and forth using it. Check the Expert Exercises in the hookup guide, and get the firmware from GitHub.

      • Any chance we’d see a continuous servo version of this as a different SKU? Two NO switches in parallel to act as endstops, button changes direction, ABT with functionality you suggested? (Velocities and accel)

      • Thanks for the quick response, Byron! The thought had crossed my mind for a rather simplistic robot that has a sensor for when it encounters an obstacle, it backs up (and turns?), then when the obstacle is no longer triggering the sensor, it returns to going forward. (Yeah, I first saw such at the likes of Radio Shack many years ago, but this device would make it simple to do.)

  • This uses analog potentiometers to control analog parameters (timing), but it does it with a digital microcontroller. I remember the days when this would have been implemented with a couple of timers and perhaps a shunt transistor or analog switch. In fact, I’m tempted to grab a 556 and 4066 and give it a try.

    • Reminds me of the time, maybe 20 years ago, when I took a class in OOP, and as a “demo” we wrote a program to simulate a (no sensor) traffic signal. I was first playing with PEEL (and electrically erasable PLA), and “simulated” the 60 or so line program with just two ICs (the other being a 555 to generate a roughly 1 Hz clock).

Customer Reviews

4.3 out of 5

Based on 7 ratings:

Currently viewing all customer reviews.

1 of 1 found this helpful:

Great idea. Wish it went more than 90 degrees.

Everything about this is excellent, except the limited range. I had some projects in mind that would utilize the full 180 range of a servo, so the fact that this limits this by HALF is a bit of a disappointment.

1 of 1 found this helpful:

Range

It would be nice if the range was > 90° in my case the full 180° would have better for my application.

This thing works great!

Hooked this up to the output from an IR sensor and it gave me great control of the two positions of the servo depending upon the presence or absence of the IR beam on the sensor. The pots are a great way to control the positions. Kudos!

These couldn't be easier to use

If you are looking for a project to work on as someone new to electronics, or something that is fun to work on with kids, these are really great. No programming involved at all. A perfect way to get straight to building the mechanics with immediate results.

Hope the next version goes 180 degrees

Awesome board

I used this with a custom CNC pen plotter to control the pen up/ down movements. This board provides a lot of function in a small package, yes I said that. It was a great way to keep my project clean. I do recommend this product. To see my application visit https://www.youtube.com/watch?v=WUFH7A565E0

Works exactly as described

I’m using these triggers with servo motors to control model railroad track switches. They work perfectly and allow me to slow down the movement to more closely model the real world. The only thing I don’t care for is that since virtually all servo motors are prewired with standard width female pin connectors. So why aren’t the pins installed on the trigger card?

Great product

Works as advertised. A very handy board!

Related Tutorials

Servo Trigger Hookup Guide

March 26, 2015

How to use the SparkFun Servo Trigger to control a vast array of Servo Motors, without any programming!

Servo Trigger Programming Guide

May 26, 2016

Looking under the hood of the Servo Trigger -- using the development environment and some finer details of the firmware.