Asked
— Edited
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?
Take the pcb out of a Servo. Just like the other conversation thread you were involved in about linear actuator.
Hi Will,
Yes, you can definitely add 8 potentiometers to the 8 ADC ports to control 8 servos. You will need to attach one side of the potentiometer to GND and the other side to 3.3V and the wiper will go to the ADC port. Replicate this wiring for each potentiometer.
Here's some example code to control one servo with a potentiometer:
If you want to add more ADC ports I believe there are I2C to ADC solutions out there but I haven't had any experience with them.
That wont work as i have $1200 worth of servos to test with and will be sending some back to the store. I'd rather not dismantle them and void them from return.
By using the ADC I have the choice of using rotational pots, slider pots and flex pots, and or mix and match.
I just found this 6 year old thread. My project is similar to the video he posts #7, but way more involved.
https://synthiam.com/Community/Questions/285
@jeremie Thank you. Exactly what i need.
Oh geez - I totally read that wrong. Yes, jeremie is correct and what i said is not valid at all. My suggestion would have been turning a motor into a servo, and you want to control servos with pot.
Use jeremie's suggestion...
You might find a bunch of jitter with the pot - in which, i can whip up a kalman filter plugin for you. It's something i've been meaning to do anyway...
Ok cool! I'll let you know how it goes!
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...
Ok thank you.
Thanks @DJ, we all know that I'm more of a hardware guy lol
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?
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.
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.
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.
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!
@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.
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.
Use this: https://synthiam.com/redirect/legacy?table=plugin&id=256
Awesome! Thanks will give it a go this morning.
And?
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.
Have you tried the complimentary filter as well? The dampening value is a percentage, and you might find it's quite flexible as well.
Yes I tried both. Can these be stacked or use one or the other?
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.
Got it thanks!
I sure wish DJ would include the source code for the Amazing plugins he creates!
Please?
Many of the EZ-Robot plugins do have source code available on the plugin page.
Here is the list of what I found. I thought the Bing speech Recognition one was as well, but I don't see the link. It was in a discussion thread a few weeks ago.
SMTP https://synthiam.com/redirect/legacy?table=plugin&id=128 Dynamixel https://synthiam.com/redirect/legacy?table=plugin&id=39 Display Popup https://synthiam.com/redirect/legacy?table=plugin&id=17 TicTacToe https://synthiam.com/redirect/legacy?table=plugin&id=6 Screen Recorder https://synthiam.com/redirect/legacy?table=plugin&id=38 Command Duplicator https://synthiam.com/redirect/legacy?table=plugin&id=165 User Defined Function https://synthiam.com/redirect/legacy?table=plugin&id=162 Remote Mouse https://synthiam.com/redirect/legacy?table=plugin&id=37 TCP Client https://synthiam.com/redirect/legacy?table=plugin&id=48 Augmented Reality https://synthiam.com/redirect/legacy?table=plugin&id=50 Oculus Rift Camera https://synthiam.com/redirect/legacy?table=plugin&id=59 Connectoin Diagnostic https://synthiam.com/redirect/legacy?table=plugin&id=64 Camera Click Servo https://synthiam.com/redirect/legacy?table=plugin&id=58 Camera Overlay https://synthiam.com/redirect/legacy?table=plugin&id=47 Target Overlay https://synthiam.com/redirect/legacy?table=plugin&id=51
Alan