Welcome to Synthiam!

Program robots using technologies created from industry experts. ARC is our free-to-use robot programming software that makes features like vision recognition, navigation and artificial intelligence easy.

Get Started
Asked — Edited

Building A Slave System

Hello all. A few questions here. I'm building a POC. And i need a little info and some help.

Is it possible to add 8 pots to the ADC ports and control 8 servos?

I'd like to build a slave system to control something. The idea is I have a contraption that I use that has pots located at joints, as i move the pots the servos move with the input from the pots.

I've looked around and found several threads on how to connect the pots to the ADC ports, but I cant seem to find any code to help me use the pot data to directly control the servos.

Also is there a way to add more ADC ports short of adding another EZB?

AI Support Bot
Related Content
Synthiam
PRO
Synthiam
#7  
I edited jeremie's code.. and repasted it here below. Doing a variable comparison in the repeat would cause additional processing vs having a goto loop. So i added that. I also collapsed the code to one line so it's not assigning variables and using extra memory...

Code:


:loop

# ADC signal between 0-3.3V represents 0-255 value
# MAP converts the adc scale 0-255 value to 1-180 degrees

Servo(D0, Map(GetADC(adc0), 0, 255, 1, 180))

Sleep(300)

goto(loop)
PRO
Canada
#9  
Thanks @DJ, we all know that I'm more of a hardware guy lol
PRO
USA
#10  
oOo weee. Them thar are some chunky moves. I would definitely be grateful for a kalman filter plugin, if it cleared up the pulsing.

Would the type of pot make any difference? I have here a 10k and 1k ohm rotating pots both produce about the same results.

Also I'm using a HDD servo and the IO tiny

Lastly in this script would I be able to replace a digital port with support for a virtual port for Dynamixels?
PRO
Canada
#11  
The value of the potentiometer won't matter but the physical size will. The larger the size the better (finer) resolution you will get. A multi turn pot would likely be more ideal.

Yes, you can do the same with Dynamixels.
PRO
Synthiam
#12  
Try removing or lowering the sleep() value in the script loop. I don't know what "chunky moves" means - but if chunky means "jerky", then you'd want a faster refresh.
PRO
USA
#13  
Ok I’ll play with the values a bit. Video is worth a thousand words, if I can’t get it to smooth out the moves I’ll shoot a little video so you can see chunky moves, I know not a very good adjective. :)
PRO
USA
#14  
Thanks on the info Jeremie. Good to hear about the dynamixels and I do have thoose larger pot, I'll look into a mutiturn pot!
PRO
USA
#15  
@DJ, removing the sleep completely, fixed the problem, smooth as butter. As always thanks fellas!


edit:
On second observation, maybe not. It could be this pot. Seems to be several a dead zones, where its moving, then it stops then it tries to quickly move and catch up. Hard to do fine motion. Maybe there needs to be some kinda sleep in there.
PRO
Canada
#16  
Yeah Will, I think you'll need a bit of a sleep in there maybe try Sleep(25) and move up from there if needed.
PRO
USA
#18  
Awesome! Thanks will give it a go this morning.
PRO
USA
#20  
Amazing as always! I’m concentrating on trying to find a better series of pots. I’ve ordered several from amazon.

I favor the mean filter, on 8 with a 25 sleep. Very smooth on the micro servo I tested with. I have like 2 dead zones that I think are related to the pot I bought. Just a cheap $1 pot.
PRO
Synthiam
#21  
Have you tried the complimentary filter as well? The dampening value is a percentage, and you might find it's quite flexible as well.
PRO
USA
#22  
Yes I tried both. Can these be stacked or use one or the other?
PRO
Synthiam
#23  
I sure wouldn't stack - if you think about what they do... You can, because they're commands. And as you learn programming, commands can be used anyway you wish. You can learn more about programming using the robot program found in the learn section - Professor E has a great video on variables, loops and logic.

There's an update to the complimentary filter which allows custom dampening to be applied as an optional parameter. It's documented in the help displayed of the plugin.
#25  
I sure wish DJ would include the source code for the Amazing plugins he creates!

Please? :D:D:D