Let's Make Robots!

Sensing servo feedback

Hi,

I'm new to this forum, robotics, electronics and microcontrollers, however I have been programming a long time and I'm currently studying computer science.

I recently bought an Arduino board with the purpose of making robots for experimenting with my special interest: AI.

I wish to build a walking robot and experiment with varios ways of giving it a nervous system. So I will need to find a way to get feedback directly from the servos, thereby being able to read the amount of stress (load) they experience at a given time.

So far I thought of 3 ways to do this:

1) The simplest way is connecting the servo output (=the servos ground wire) to an analog in port on the Arduino. My classmate who's into electronics said this was possible if I attached a small resisitor to the Arduino ground. The thing is he said that the Arduino would have a large resistor build in (so to speak) on the analog in. So if I just connected the servo output to the analog in without the resistor I would get no reading cause the electricity would flow into the Arduino ground where there is no resistance. Makes sense. He also calculated that I need a 6 ohm resistor based on the peak current draw of the servos I intend to use (HXT900 = 750mA). I'll try this out soon.

2) I could also use a current sensor (thermistor I believe they're called) to do the same thing, connecting it either to the servos 5V input or the output (not sure how?), and again reading the value from an analog in port. I'll also try this solution.

3) This is the really cool but difficult solution. A servo has build in a potentiometer. There are ways to modify servos so that you can read the position from this potentiomenter. Then one can actually move the servos position MANUALLY and later read it's position. And it can also provide a way of reading the stress of the servo.

Here is a manual on this conversion:

forums.trossenrobotics.com/tutorials/how-to-diy-128/get-position-feedback-from-a-standard-hobby-servo-3279/



So basically I need all the advice/input I can get. Does this sound plausible? Is there a 4th or 5th solution I haven't considered? Anyone has tried something similar? Any ideas would be appreciated...


Aniss1001 :)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Nice to hear from someone who actually used one of these things (shunt resistors). However I'm just starting to read circuit diagrams, I'm still not that good at it and the one you linked to is particularly confusing. Couldn't make any sense of it.

Basically what I need to figure out is:

1) What kind of shunt resistor to buy. I need one that measures from 0 to 1 Amp running 5 Volts.

2) Where to place it in my circuit. Eg. before or after the servo which current draw I'm measuring and how to connect it to my Arduino. I presume one wire goes to an analog in and another to the Arduino ground (and perhaps a 3rd to the Arduino 5V)?


I haven't had much luck finding a resouce that makes this clear, but here is a simple diagram (from this page):

00165.png

I presume my Arduino will act as the voltmeter, but I'm still not sure how to connect it. The volmeter's - would be the Arduino ground and the + would be the analog in perhaps? That seems a bit weird though?! Besides all the shunt resistors I've seen look like this:

shunt-resistor-of-electricity-meter.jpg

As you can see they have 3 wires. Not 2 like in the diagram I posted (as well as other diagrams I've seen)?! 

Or perhaps I don't need a "special" shunt resistor like that? Could I just do it with a "normal" resistor?

 

Thanks for the input...

Aniss

PS: Nice robotic arm :) But doesn't it need a gripper or something? What do you plan to do with it?

I use a normal resistor at 0.1 ohm. 

If it is 0-1 Amp, the voltage to measure is 0-0.1 Volt. Just use an op amp to amplify the voltage to 0-4 volt and fed the amplified signal to the ADC input. 

 

The robot arm is a chess playing robot with vision:

http://letsmakerobots.com/node/2429

I checked the link (book) you provided. And this diagram I could read but it doesn't seem that simple to me. There are 5 resistors + the op amp. Since I plan to measure the current draw of 12 servos that means 60 (!!) resistors + 12 op amps.

So please excuse me if these are silly questions:

1) The simple 1 resistor circuit I posted wouldn't work (if I added an op amp)? Are 5 resistors necesary for my needs?

2) Would it be possible to use an analog muliplexer in combination with the current measuring circuit in such manner that I only need 1 such circuit to measure the current of 8 servos (or 16 depending on the no. of channels on the multiplexer)?

 

Thanks for your advice :)

Aniss

PS: VERY impresive chess playing robot :| Especially the machine vision. I've been studying and playing with some machine vision myself. Mainly some motion detection and some neural net based object/facial recognition. So I'm curious: Which tecniques did you use to make it recognize the chess pieces?

If you want to monitor and measure the current for 12 servos, may be u shall use current sensors (e.g. the one used by openservo, http://www.diodes.com/datasheets/ZXCT1009.pdf). I have no experience in multiplexer.

For the robot arm vision, I use opencv and some technique described here:

http://hk.myblog.yahoo.com/jw!afd6dGGRHBRkp2laqwk198fg/article?mid=462

 

BTW, if you want to measure the stress of a servo at any time by taking measure of the current it uses, you have to make sure the servo is not moving at the time of measurement. The reading of a moving servo is not useful in this case.

I would suggest you use a digital servo (e.g. with openservo) for your case. You can always read back the velocity, error, and other useful information from the servo to meet your need.

 

I was definately NOT aware that I can't measure the current while the servo is moving. In fact I thought that a servo didn't use any current (or very little = standby) when it wasn't moving.

Are you sure that is the case?

That pretty much changes everything. It may still be useful, but not for what I originally had in mind.

 

Again..thanks for your input

Sorry for the misleading english.

I mean that when a servo is moving, it is not very useful to measure the corresponding current it is using. Only when you believe the servo is stopped, a high value of current using indicates a "stress" on the servo.

So you may need to take the data together with the servo controller to make a clever guess on the stress levels on the servos.

 

I've made a video:

http://www.youtube.com/watch?v=9RRb78VJUp0

The situation will be like this: 

- when the robot is at rest, it takes about 0.25-0.35 Amp current.

- when the robot is moving, it takes about 0.35-1 Amp, on average. Note that you need to compute the average reading or otherwise there will be a lot of noise.

- when I bend the leg of the robot, some servo is under stress, the current usage is going up to 1.4 Amp.

Hope this can you help visualize your idea.

1st of all you're english seems fine. Sorry if I gave you any other impression.

The reason I wrote "what?" was because you said...

"if you want to measure the stress of a servo at any time by taking measure of the current it uses, you have to make sure the servo is not moving at the time of measurement. The reading of a moving servo is not useful in this case."

...And I was unaware that a servo even draws current while NOT moving. So I got confused. I still have very limited knowledge of servos.

My idea was to measure the current draw ONLY while the servo is moving. Like this: I tell the servo to move to a specific position. If something is blocking it's movement then it stalls and I should be able to detect an abnormally high current draw, thus I would know that something is blocking it's movement.

So I wanna ask you one more thing: in the video..is the current draw reaching 1.4A simply because you're bending the leg OR because it's trying to move at the same time (thus it is stalling)?

Sorry if my questions seem silly. I will off course be spending hours experimenting myself once I get my setup up and running...


Thanks again for all your input :)

Aniss


PS: WOW! Your walking robot is even more impressive. I hope one day to be as skilled as you. Respect!!

>> And I was unaware that a servo even draws current while NOT moving. 

You are basically correct. The servo only draw a very little current when it is not moving when it is not under "stress". i.e. the servo already move to the decided position.

>> So I wanna ask you one more thing: in the video..is the current draw reaching 1.4A simply because you're bending the leg OR because it's trying to move at the same time (thus it is stalling)?

When I bend it, the servo positions are shifted away from the original position, so it tries very hard to restall back..and thus a high current is measured. 


>> PS: WOW! Your walking robot is even more impressive. I hope one day to be as skilled as you. Respect!! 

Thank you ! I am also a beginner in robot building.