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.