Can’t Buy It? Build It!

,

For my neverending robot project I really needed a good servo tester, but I could not find one to buy. So I designed and built this one. I think it is the ultimate servo test tool! Complete directions for how to build one of your own are in this article.

MegaMosquito’s Ultimate Servo Tester

The servo testers I already had, and the ones I found that I could buy, all have weaknesses that I did not want to accept. So I gave up shopping and went to the “drawing board”. Conveniently the Raspberry Pi people had just released the new Pico, which seemed perfect for a project like this (and was just $4USD). So I ordered a few, and started designing based on their spec.

Design Goals

My design goals were:

  • be able to rapidly turn the power off with a finger gesture (so I can stop my hi-torque servos that are built onto worm-follower or rack-pinion mechanisms before they tear my robot into pieces, as has unfortunately happened to me with the cheap servo testers!)
  • be able to adjust to everything first and only then powerup (for the same reasons as the last item)
  • be able to numerically adjust all of the servo values (frequency, min, max, and “angle”). This way when i finish testing I have hard numeric values I can transfer into the code — no more guesswork!
  • use a rotary encoder to easily enable relative adjustments (versus a variable resistor’s absolute setting
  • enable the use of a separate power supply for the servo (since the Pico uses 5V but in my robot my servos all use 6V)
  • a user interface that anyone can use (because I have a hard time using terrible interfaces… as a friend once put it, I have “Microwave Disfunctional Disorder”… anything more than setting the timer, just fuggedaboutit)
  • comfortable to hold and operate with just my left hand (so my dominant right hand can do other stuff — specifically adjust the controlling variable resistor when it is mounted outside the servo housings as it is for several of the servos in my robot)
Prototyping the Servo Tester (with OLED screen and rotary encoder)

Parts List

Here’s the parts list (about $15USD total)

User Interface

The image below shows the hierarchical menu implemented in the software (it’s in my GitHub for you).

Figure 1: Navigating the menus of the user interface.

There’s a very brief “help” screen (on the right above and I have explained the basics below that screen (i.e., how to use the rotary encoder and each of the buttons).

Using the menus you can navigate to settings (on the left above) to adjust the PWM frequency, and the minimum and maximum values for the servo (especially useful in robotics). Just spin the rotary encoder until the correct value appears next to the arrow, and select the blue button (or use the yellow button to cancel). At the main settings widow you can return to the top level menu by pressing the yellow button.

Once you have adjusted those settings to suit your requirements, and you return to the main menu then you can select “ServoTest” to go into the central section of the user interface. There you can spin the rotary encoder to set the desired percentage value for the servo. Zero percent places the servo at the minimum value you specified in settings. 100% sets the servo to the maximum you specified in settings. Note that setting the percentage at this stage has no effect on the servo! That is because the power is initially off, as shown on the screen, and the LED above the right side of the screen near the buttons is blue to indicate this. Now press the blue button. The servo will then immediately move to the specified percentage value and the screen will show that the servo is powered. The LED will also change from blue to green to indicate the servo is powered. To turn off the servo, press the blue button again. To return to the main menu, press the yellow button.

Here is what it looks like in action:

Servo Tester in action. Sorry about the shakey video!

Plastic Enclosure

I designed the housing for this thing from scratch in my favorite 3D modeling tool, TinkerCAD. You can download the model as “.stl” files for free and use them to print your own. Here’s a peek at the pieces:

I wanted to avoid printing generated support for the left piece, to I added my own strategically-placed support pieces. If you clone this in TinkerCAD you can remove those pieces if you want to use generated support (or if your printer is better than mine and doesn’t need them.

The whole thing is held together with 4 wood screws (#5, 5/8 inch). I used Yellow (i.e., tip size 1) Robertson screws — the most common type of screw head in Canada where I grew up. I really don’t understand why they have not become popular down here too. They are superior to the Phillips style of screw head in every way. But go ahead and use Phillips if that’s all you can get (or if you, for reasons I don’t understand, actually like Phillips screws). Or glue it. Or use duct tape, zip ties, baling wire, rubber bands… any of those will probably work well.

Circuitry

I think I should probably describe the circuitry I used for this thing. The main components are the Raspberry Pi Pico, the miniature OLED screen, the rotary encoder and the relay. I began the project by wiring up the Pico, the OLED, and the rotary encoder, then I wrote some code to verify that I could show things on the OLED, and receive input from the rotary encoder. Since the Pico is new, there wasn’t the best documentation out there for that, but I figured it out and then I knew I could make this thing.

So here’s a circuit diagram for you. Unfortunately, this was entirely hand-drawn because my favorite circuit drawing tool, Fritzing, doesn’t have a Pico model, or a 128×64 OLED, so I gave up and went manual.

Hand-Drawn Schematic For the Servo Tester

Hopefully you can see that the choice of power for the relay is manually switched (by the SPDT switch at the top left) and that whichever power source is selected feeds into the relay to be turned on/off programatically. The relay of course draws more amperage than the Pico GPIO pins can deliver, so there is a standard transistor circuit to power it triggered by the GPIO through a 750 ohm resistor. I wrote an article about that if you want more background on what that is necessary. I used a 2N2222 transistor, and a 1N4001 flyback diode here, just like the ones I showed in that article. All of the LEDs are shown above with 250 ohm resistors but you will want to select the most appropriate resistors for your specific LEDs.

The red and green LEDs below the SPDT switch indicate whether power is connected to the two power sources. The green one indicates the normal 5V power supply is connected (this one is required to power the Raspberry Pi Pico). The red one indicates the alternate power source is connected. Looking at the assembled device, those LEDS are immediately below the switch: red on the left, green on the right. Corresponding to them, if the switch is slid to the left, the alternate power source is selected, and to the right selects the normal 5V power source. In the photo below, the alternate power source is selected.

Showing the Alternate Power Source Selected by the Physical Switch

That’s It!

I think that’s everything you need to make one of these for yourself. I find it very useful, and I wouldn’t change a thing about the design, except possibly to make the housing slightly bigger. I say that because there wasn’t a lot of extra space in there when it came to final assembly. I used used a few excessively long wires and then when it came to assembly time I regretted that. But it was fine. I still managed to get the thing together.

Also, I’m glad I selected the Raspberry Pi Pico for this task. I have used Arduino Pro Minis, and ESP8266/ESP32 boards for similar projects and I could have used one of those here. I used the Pi Pico because I wanted to see how it was in comparison with those others. I really liked it. Using the Thonny IDE was vastly superior to using the Arduino IDE and Micropython support for the hardware made it a very simple project from a software perspective. For this specific project, I think the Pi Pico was a perfect choice.

If you build one of these servo testers, I’d love to hear about your experiences in the comments.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.