Asked — Edited

Detecting Servo ?

I was just wondering, Is it possible to detect if a servo is present or not? I have an attachment that runs on a servo. I'd like to be able to test if the servo is present before I run a script to use that servo.


Upgrade to ARC Pro

Experience the transformation – subscribe to Synthiam ARC Pro and watch your robot evolve into a marvel of innovation and intelligence.


Good question Slee, the answer is "no". The servo is considered an output, you send the servo a position to move to and inside the servo is a variable resistor (a POT) that tells the servo it moved to the commanded position. But there is no mechanism that sends a signal back that says , "I'm here". You would need some external sensors to see of the servo is there. That seems like a waste of a port to me.

What is the attachment and what is the thinking behind needing to know if the servo is really there? Is the servo in danger of falling off or ripping the plug out?


No the servo is in no danger. My first robot, Droid-mun is the brains. he has the EZB-Board in him. He has a cable that attaches a 1/2 scale R unit named Droid-Et to him. This Droid-Et is his counter part. The first droid Droid-mun has all the brains, where as Droid-Et is merely a shell with a speaker and a servo to spin her head. The first Droid Droid-Mun has a relay that turns on and off the 12 volts power to Droid-Et and another relay switch's between Droid-Mun's speaker or Droid-Et's speaker depending on who is talking. I wanted Droid-Mun to know if Droid-Et was plugged in or not. This would have been vary easy if there connecting cable had an extra set of conductors but it dose not. Here is the scenario, If Droid-Et is unplugged and taken out back for some reason, and then a customer walks in and Droid-Mun then greets the customer and then refers to Droid-Et yet she is not there, she is out back.Iit will look kind of funny. If Droid men could detect the servo that spins her head he would know if Droid-Et was there or not.


No - a servo does not transmit any information. It only receives.


How about this? Mount a switch inside the robot you want to find out if it is active. Attach that switch to an ADC port. Send a signal to a servo that would turn and activate the switch. Your script would be watching the ADC port and when the value changes because the switch was turned on you know your robot is actave. Just a simple set of scripting commands and some imagination and your all set. ;)


Just my 2 cents. Dave's suggestion of using an ADC port is a good one. I'd like to offer a variation, however. Since I don't know how much current the servo you are using draws, nor do I have my robot yet, I can't give you values to use just the principle involved. Perhaps someone in the company can fill in the details.

Take a very low value (a few ohms), but high wattage resistor and put it in series with the servo output line. This will act as a current sensor. When there is no servo attached, there should be no current through it, therefore no voltage drop across it. When the servo is connected, a current will flow and a voltge drop across the resistor will occur. To detect the change, wire the resistor to the ADC port and monitor the voltage across it in your program. Run the Droid-Et servo briefly, and you should be able to tell if the shell is connected or not by the change in reading on the ADC port.


WBS00001, Thanks for all the input!

Dave Schulpius,

There is no extra conductors available in the current cable that connects the two droids.:( The cable has 6 conductors/wires in it. Two for the speaker, 3 for the servo and two for the 12 volt lighting. Had there been two unused wires Id have it made in the shade. :)


Add another cable or swap the cable. Or add a wireless radio link of some sort.


It may be possible to "steal" a wire from your setup if two share a common basis. For example, if one of the servo wires and one of the 12 Volt wires share a common ground allowing those wires to run as one. You really only need one free wire to do the detecting. For instance, use the negative of the 12V lines as a common point and the freed-up wire to feed back +12V. These points then run a relay which can be used as the detection method.

There are other possibilities:

You could also simply place a current sensing resistor in series with either of the 12Volt lines and do the same thing as I described before when using the servo line. This would be better since it would be a steady current as opposed to the servo line. This method, as before with the servo, requires no lines to be freed up.

As mentioned by Justin, another possibility would be to use a wireless system for the speaker. A simple bluetooth or FM transmitter in the primary unit and a simple reciever running from the 12V in the secondary unit. That would free up two wires right off. Running a wireless audio system these days is ridiculously simple and cheap.

It is also possible to run an audio signal over the 12V wires at the same time you run the 12 Volts. Basically you feed the audio from the speaker wires to the 12V wires via a capacitor and pick it off the other via another capacitor. Problem is this method will result in a loud pop on the speaker when you plug it in. There could be a problem at the transmitting end as well since there will be current surge there as well. The capacitors will need to be fairly large. Electrolytics most likely (watch the polairty). Try this at your own risk, however.

All in all though, I gotta say that it would be much easier to simply re-do the existing wiring and add one more wire. That's all you really need, just one more wire. Heck, wrap a small wire around the existing cable and use a second plug and socket. Anything would do. Bannana plug, audio plug, whatever.


>>Heck, wrap a small wire around the existing cable

Yea, I think @WBS00001 found the solution there. You keep your current setup, but use a digital port on the EZb and set it to look for on/off and you make a second a plug that is attached to your main cable...this would act as a jumper and the "sensor" method to know if your cable is plugged in or not. When you pull the main cable out, the secondary "sensor" cable would come out too. That's actually a pretty good idea! :)


Thanks guys. I have an idea on how to do this and its not vary hard. I'm thinking a second cable is the way to go. Thanks. :)