Info on programming servos

I am relatively new to arduino, but I can’t find anyone doing what I would like to do and I’m looking for someone to point me in the right direction.

I’d like to make a robotic arm (tentacle precisely) that I can program the servos with an rc transmitter. I would like to record 30 seconds of input from the controller then have the arduino repeat the movements indefinitely. I would also like to have the program stored so that it would start the program if unplugged and plugged in again.

Has anyone done anything close to this?

How many servos will there be ?
Will they all move at the same time ?
How many movements will there be in 30 seconds ?

Arduinos as standard store their program and will restart when power is plugged back in so that part is not a problem. Reading data from an RC receiver and controlling servos is something that many people have done before. Just Google "rc control arduino" for plenty of examples.

The rest is possible but it's going to depend on things like how many servos, how many commands do you need to capture for each servo in your 30 seconds etc. Also is this a one-off programming or if not how often will you want to reprogram the 30 seconds? Most Arduinos don't have much space to store loads of information so those answers may determine which one you need to use and what techniques you need to capture and replay the data.


It sounds to me like you need to store the sequence of moves on a SD card. This makes it easy to sequentially read a set of positions and then command the servos to move to those positions.

Others have asked how many servos and that is a relevant piece of information.
I would also ask how many channels from your RC receive? One channel per servo?

What kind of RC receiver? Connecting one pin to each channel means a lot of work watching interrupts. A modern receiver that supports any of the one pin protocols (PPM) makes it much easier to read all the channels.

I have used PPM with my arduino projects but I do not remember where I got the code.
This project looks like it explains it all fairly well.

Thanks for the quick reply guys! Great community!

For one tentacle, I would like 4 servos, Each on their own channel. They would be moving at the same time. And they would each have roughly 8 movements in the 30 secs. This would only be needed to programmed once. Being able to copy the movement record to other tentacles would be a plus. So I’m thinking SD card would be the Right route.

Other tentacle would only need 1 or 2 channels. But with the same result.

I don’t have the transmitter or receiver or servos yet. So I’m open.

I’ve researched how to control with RC. That seems pretty straight forward. I just can’t find any info on how to record that input as a program to then reapply on a loop. I was also curious if it would record the speed of the change of position values as that would be important.

Thanks for the ppm info. That’s right where I need to be I think.

The speed a servo moves is always full speed so the SPEED of change will always be the same. That's how servos work. Perhaps you mean the TIME of the move i.e. how long after the last move. That makes more sense.

Or maybe you are thinking of moving slowly from one position A to the second B in which case that's not one move that's lots of small moves and you're going to need to capture all the moves and their times.


Steve yeah I think I mean the latter. As I’m trying to make the tentacle move realistically so it would have fluid movements. So yes, many inputs of change. Which is why I thought rc transmitter would be the best tool to control the movements although maybe on second though I can just wire in a potentiometer joystick for each two servos. Or a temporary wired controller, Therefore bypassing the rc aspect.

In any case yes, I would need to capture all the moves and the time between each “step”. As it will not be a position A then position B then position C etc. thing, for that would be too herky jerky.

n any case yes, I would need to capture all the moves and the time between each "step".

From the point of view of storing the data it would be more sensible to capture the start and end positions, the number of steps and the required time to get from start to end but that is going to be more difficult

For storing the moves? Easy!

Use a nonlinear mapper for each servo. Take a position reading from your radio every.. say.. 100 ms Same one you are sending to the servos. Pop it into the nonLiner mapper as (time,position). Then, when you are done, just "play it back" from the mapper with a frame rate between 10-20 ms per frame. The mapping function will even out the roughness of the input data.

Want two to run the same moves? Just send the mapped data to both arms.

Under menu item manage libraries search for LC_baseTools. There is a RAM based nonlinear mapper in LC_baseTools.

-jim lee

I think this is exactly what I’m looking for. Just need to figure out how to have a controller then work out the storage

Just review the website I mentioned. A lot of comments are saying the code didn’t work for them. I wonder if that’s because they didn’t have the storage.

Rather than review a website that has code of unknown viability (and even has reviews saying it does not work) I think you should tackle the pieces yourself with our help.

Write and read from an SD card (or persistent memory of your choice)
Read output from an RC receiver.
Write to servos.

With these, I think you should be pretty close.
Maybe some method to put the project into 'learning' mode, where it reads the receiver output and writes data to the card. If your RC transmitter has any switches on channels not used for your tentacle programming, maybe you could use that. My RC transmitter has a flaps channel on a switch. You could read that and if it is high, go into 'learn' mode. If it is low, go into 'play' mode.

I think this is exactly what I’m looking for. Just need to figure out how to have a controller then work out the storage

Good luck then. Let us know how you get on.