Asked December 29 2015

Community Question


i have one ( i hope easy) question.

i have a pressure sensor.

Work fine on the ADC!

Now i have one problem.

If the value for the ADC port is under 180 the servo must stop ( hold his position)

my idea of a script :


$CurrVoltage = GetADC(ADC0)
if ($CurrVoltage <= 180)
servo (d0, "stop")
goto (loop)

But the command servo (d0, "stop") donĀ“t exist

So with command i can take what tells the servo he must stop and HOLD his position.

Thanx a lot for helping


January 3 2016
Hello WBS00001,

i check you script and it works a little bit better then from DJ (smoother, but still not the best)

But i found out the problem. If i run you script without the ADC check, the finger moves best off! If i let check the ADC Ports the finger will move not so smooth.

So its the reaction time of reading the ADC, who is not the best. I think at this point nobody can make it better.

I am not lucky with the choppy/juddery way of closing the fingers, but on other hand i think its a soloution for a not profi Home-Robot-Builder.

If someone has a idea, to maybe source out the ADC reading or else, i am open everytime for new tests!


PS: I will got some new servo for the Hand and more pressure Sensor. If i finish one Hand i will post a video.
January 3 2016
Sounds like the issue is with the read of the ADC port. Have you tried to adjust how often the port reads the value? I'm thinking two things may be happening;

1. The port is reading too fast and flooding the commutations link.
2. The port is reading too slow and each time it checks the servo needs to jerk forward to catch up to the reading.

I'm not sure that this method will control the speed of the ADC check in EZ scripts that you write but; In each of the 3 ADC port controls there is a interval setting. It's usually set at 500 ms. setting. It's usually set at 500 ms. After adding that control to your project and setting it to the port, try adjusting that up and down.

There may be other ways to get the ADC port to check values at different intervals. The repeat script command comes to mind. It has a interval setting.

Also, I've found if you leave these ADC controls running and checking ADC status they will slow down your system. Keep them paused till you really need to see performance.

Just some random thoughts on a couple things to try. Good luck.
January 3 2016
I've been working on a ADC issue all day today. It's somewhat similar to yours. I'm trying to stop a motor through EZB's UART port with a opto switch that's attached to an ADC port. I've tried all the suggested scripts and still wasn't satisfied with the responce. Nothing seemed to act fast enough. Couldn't get a good balance between speed and ACD readings.

Anyway, I found that using the ADC_Wait gave me the best responce and got everything working smoothly.


ADC_Wait (adcPort, higher/lower/equals, value, [delay ms])
Wait until ADC port is higher or lower than specified value
The optional parameter Delay MS is the millisecond delay for checking. This value determines the delay between checks.
Example: ADC_Wait(ADC0, HIGHER, 50)
Example: ADC_Wait(ADC0, HIGHER, 50, 50)

Here's another one that may work for you:


ADC_Wait_Between (adcPort, low, high, [delay ms])
Wait (pauses script) until ADC port is between the specified values. Soon as the ADC port is between the low and high values, it will stop waiting.
The optional parameter Delay MS is the millisecond delay for checking. This value determines the delay between checks.
Example: ADC_Wait_Between(ADC0, 20, 50)
Example: ADC_Wait_Between(ADC0, 20, 50, 50)
January 3 2016
Hi Boris;

I don't understand what the difference in the results using the Inmoov hand and my tests using JD's claw. In my tests the claw closes smoothly while checking ADC0 and ADC1 in the test loop. Are you moving several servos to close the Inmoov's hand or just one? Do you have other things running at the same time that may actually be causing the problem? You may want to make a new test project with just the hand closing script in it to see if it runs smoothly then.

Running speed trials, I see it takes a bit less than 14ms to execute a GetADC instruction. A little less than 27 ms to execute the test statement (GetADC(adc0) <= 75) or (GetADC(adc1) <= 175) checking the two ADC ports. That should be plenty fast enough for smooth hand closing.

Are you using the latest version of EZ-Builder? JD has recently made changes that make the script execution much faster?
January 5 2016
Hello WBS00001,

NO, i use a complete new clean Project, no other scripts are running.

I think i will make a video, then you can see more.

But that you got a smooth closing with you JD claw, brings me again a little bit hope!

I will check tommorow afternoon and i will report you.

Thanx for your Help!

@Dave yes i am also not lucky with the speed from the ADC port! I will also check your scripts and i will report.