Asked
— Edited
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
Get access to the latest features and updates with ARC Early Access edition. You'll have everything that's needed to unleash your robot's potential!
Based on your post activity, we found some content that may be interesting to you. Explore these other
tutorials and community conversations.
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?
https://www.facebook.com/photo.php?fbid=806714699441191&set=a.173472779432056.35956.100003080059485&type=1
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.
Dave Schulpius,
There is no extra conductors available in the current cable that connects the two droids.
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.
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!