Arduino servo control for large number of servos

I'm trying to determine whether I can use an Arduino for this project and also to get some coding ideas for translating a down sampled video into servo control through Arduino. As many have probably see, Nike and others have used servo control with Kinect and other input devices in order to create interactive sculptures, whether for advertising or art. I would like to start by emulating those leaders and then to branch out with my own ideas. I am a novice programmer so I have a learning curve to deal with.

My questions are:

1. Video downsampling output: who to downsample? Do I need to find a way to code a video downsampling program to create a black and white intensity, GIMP-style video output; or is something already available? I would prefer to use a stepped servo and thus it would be great to capture about 6 shades from gray to black.

**2. Arduino programming: how to translate video to arduino?**How do I get the Arduino to react to a variation in output numbers? I would have a video downsampler which translates into numbers that are output to Arduino, but how do I make the output go to Arduino? Please accept my apologies in advance if this should be more obvious, but like I said, I'm a novice. I would like about 24 frames per second, preferably more but I think it might be too noisy and energy intensive with the servos always jumping around.

3. How many servos can an Arduino control? Can I use multiple Arduinos? Is this the wrong platform?
If each average area is equivalent to one pixel, that means an investment in about 200 servos similar to what Dan Rozin used. I would prefer to use stepped servos (unlike Rozin).

Thanks for pointing me in the right direction!

SamApoc:
**2. Arduino programming: how to translate video to arduino?**How do I get the Arduino to react to a variation in output numbers? I would have a video downsampler which translates into numbers that are output to Arduino, but how do I make the output go to Arduino? Please accept my apologies in advance if this should be more obvious, but like I said, I'm a novice. I would like about 24 frames per second, preferably more but I think it might be too noisy and energy intensive with the servos always jumping around.

I don't understand this question. It's hard to follow, at least for me. Do you want your Arduino to do image proccesing? I would recommend to do processing on the PC and use the Arduino only to servo control. Pc and Arduino can easily communicate by serial port or usb COM.

SamApoc:
3. How many servos can an Arduino control? Can I use multiple Arduinos? Is this the wrong platform?
If each average area is equivalent to one pixel, that means an investment in about 200 servos similar to what Dan Rozin used. I would prefer to use stepped servos (unlike Rozin).

Arduino UNO can handle 12 servos I read but not confirmed.
And this arduino shield can handle 16 servos.Adafruit 16-Channel 12-bit PWM/Servo Driver - I2C interface [PCA9685] : ID 815 : Adafruit Industries, Unique & fun DIY electronics and kits

The shield is stackable, the website says if you stack 62 shields you control 992 servos. But obviously there is the restriction of power, flash, sram and all that stuff.

But again, 1 Arduino + 1 arduino servo shield = 28 servos theoretically.

SamApoc:
I would like to start by emulating those leaders and then to branch out with my own ideas. I am a novice programmer so I have a learning curve to deal with.

Perhaps you should start where the leaders started and slowly work up to their proficiency ???

Get an Arduino - perhaps a Mega because it can manage up to 48 servos - and 5 or 6 cheap servos to start with.
Learn how to write a program to control them.
Learn about the capabilities and limitations of the Arduino.
Learn how to communicate between a PC and an Arduino.

The Arduino IDE comes with servo examples and the important Blink Without Delay example. I wrote a demo of communication between a PC and an Arduino using Python here and an extended demo of the BWoD technique here.

...R

For question 1, I suggest you create an application using OpenCV on a computer. There are various language bindings for OpenCV and C++ is supported, so that would be a sensible choice IMO. To convert an incoming video stream to gray scale and read the brightness of each pixel will take a couple of dozen lines of code.

For question 2, I suggest you send the pixel data over the USB serial connection to the Arduino. You will need to choose a message format for the data. Given the quantity and rate that you're sending I suggest using a binary format such as one byte per pixel giving the corresponding servo position, with some start-of-message and end-of-message markers. Arduino code to read a stream of servo positions and adjust each servo to its new position would be relatively simple. If you want the Arduino to apply any extra logic, such as interpolating or smoothing the position values, then you need to work out how much memory and processing speed that is going to require and choose a platform with sufficient resources.

For question 3, what is a stepped servo? Do you mean a stepper motor?

mart256:
I don't understand this question. It's hard to follow, at least for me. Do you want your Arduino to do image proccesing? I would recommend to do processing on the PC and use the Arduino only to servo control. Pc and Arduino can easily communicate by serial port or usb COM.

I probably wrote poorly, but you are on the same page with me anyway! Yes, I think a computer must do the image processing. I can use whatever computer but obviously cheaper is always better. I wanted to use a raspberry pi but I'll probably just end up using a macbook air/pro.

SamApoc:
3. How many servos can an Arduino control? Can I use multiple Arduinos? Is this the wrong platform?
If each average area is equivalent to one pixel, that means an investment in about 200 servos similar to what Dan Rozin used. I would prefer to use stepped servos (unlike Rozin).

Arduino UNO can handle 12 servos I read but not confirmed.
And this arduino shield can handle 16 servos.Adafruit 16-Channel 12-bit PWM/Servo Driver - I2C interface [PCA9685] : ID 815 : Adafruit Industries, Unique & fun DIY electronics and kits

The shield is stackable, the website says if you stack 62 shields you control 992 servos. But obviously there is the restriction of power, flash, sram and all that stuff.

But again, 1 Arduino + 1 arduino servo shield = 28 servos theoretically.

I saw those, but I don't know how to control stacked servos to pixelate an image. Just wanted to know if going in that direction (with stacked Arduino servos) is the good route?

Robin2:

SamApoc:
I would like to start by emulating those leaders and then to branch out with my own ideas. I am a novice programmer so I have a learning curve to deal with.

Perhaps you should start where the leaders started and slowly work up to their proficiency ???

Get an Arduino - perhaps a Mega because it can manage up to 48 servos - and 5 or 6 cheap servos to start with.
Learn how to write a program to control them.
Learn about the capabilities and limitations of the Arduino.
Learn how to communicate between a PC and an Arduino.

The Arduino IDE comes with servo examples and the important Blink Without Delay example. I wrote a demo of communication between a PC and an Arduino using Python here and an extended demo of the BWoD technique here.

...R

I completely agree with you, of course, but I wanted to get yours and everyone else's expert knowledge with the additional benefit of second guessing the "leaders" prior to jumping into this project. For instance, if I just started from the beginning blindly, then I would be doomed to recreate all of the mistakes already made and I'm really, really hoping to avoid those mistakes because I will probably have enough lessons learned on this endless path...but it's the journey, right? :slight_smile: I just wanted to say that, because I feel like my question could be really annoying to people in the know and it's not directed to you in particular, but just...I feel self conscious about it.

Anyways, YES, you are 100% correct, I will do the baby steps of controlling a few servos first and then moving up. I'm just trying to stack the odds in my favor and to determine if Arduino is, in fact, the way to go here. Your links are really helpful and I appreciate it!

PeterH:
For question 1, I suggest you create an application using OpenCV on a computer. There are various language bindings for OpenCV and C++ is supported, so that would be a sensible choice IMO. To convert an incoming video stream to gray scale and read the brightness of each pixel will take a couple of dozen lines of code.

For question 2, I suggest you send the pixel data over the USB serial connection to the Arduino. You will need to choose a message format for the data. Given the quantity and rate that you're sending I suggest using a binary format such as one byte per pixel giving the corresponding servo position, with some start-of-message and end-of-message markers. Arduino code to read a stream of servo positions and adjust each servo to its new position would be relatively simple. If you want the Arduino to apply any extra logic, such as interpolating or smoothing the position values, then you need to work out how much memory and processing speed that is going to require and choose a platform with sufficient resources.

For question 3, what is a stepped servo? Do you mean a stepper motor?

Extremely helpful advice, I really appreciate it!!! This is perfect, says I'm on the right track. I really apologize for my baby steps here, guys, but it took me a long time to jump into this, commit time to figure out a plan, and now it's time for the major learning curve. When you aren't a programmer and you want to jump into this stuff, it's really daunting.

Anyway, you guys are awesome! To answer your last question, yes I think stepped servo motors should be better because they won't eat up enough power. My plan is to have the following:

  1. interactivity...for instance as a mirror (Rozin inspired), 3D detection with a Kinect (Nike, BMW inspired), something new.
  2. standard time resetting to zero, to accommodate potential servo errors due to stepped motors, and to give the sculpture a "rest" period (benefitting the devices and viewers).
  3. If I can figure out how, I'd like to be able to drop in periodic commands that can either be pre-programmed easily (preferably remotely). If it's just pre-programmed, it would be cool to have about 20-30 pre-programmed commands/operations that activate and are randomly selected. One example of a preprogrammed sculpture is the BMW kinetic sculpture. https://www.youtube.com/watch?v=hlx-M53dC7M

I promise, no more big picture posts about my goals! It's time to get into the nitty gritty and dive into some programming...

It's a pita just to install opencv, and I'm not the only one who is confounded by it.

Another thing to keep in mind is that there will come a stage when your project will become too big or too complex to get effective advice on this forum.

It is much easier to get advice about small specific issues which can be illustrated in a short sketch of 20 or 30 lines. This is another reason for trying out stuff step by step.

I see a lot of requests for help after people have concocted a huge mess of code for sensors and servos and LCDs that they don't understand and where it is almost impossible to figure out and unravel without devoting several hours to it.

...R

SamApoc:
It's a pita just to install opencv, and I'm not the only one who is confounded by it.

What platform are you trying to install it on?

Robin2:
Another thing to keep in mind is that there will come a stage when your project will become too big or too complex to get effective advice on this forum.

It is much easier to get advice about small specific issues which can be illustrated in a short sketch of 20 or 30 lines. This is another reason for trying out stuff step by step.

I see a lot of requests for help after people have concocted a huge mess of code for sensors and servos and LCDs that they don't understand and where it is almost impossible to figure out and unravel without devoting several hours to it.

...R

Thank you for this advice, I think this is very wise and will come in handy! I've seen those long code posts before and I'm like, that's going to take a better man than me to sort out! :slight_smile:

PeterH:

SamApoc:
It's a pita just to install opencv, and I'm not the only one who is confounded by it.

What platform are you trying to install it on?

Trying to put it on a mac with mavericks.

SamApoc:

PeterH:

SamApoc:
It's a pita just to install opencv, and I'm not the only one who is confounded by it.

What platform are you trying to install it on?

Trying to put it on a mac with mavericks.

Not familiar with that platform, but I see there is a binary for Linux/Mac - doesn't that work? If not, there seem to be a few tutorials about such as OpenCV Projects: Tutorial: Installing OpenCV on a Mac (OS X 10.9.1 Mavericks)

I'm afraid it seems to be the norm for open source software to have multiple pre-requisites and for the documentation to be patchy and out of date - although opencv may seem to be a pita to install, it's better than many.

PeterH:

SamApoc:

PeterH:

SamApoc:
It's a pita just to install opencv, and I'm not the only one who is confounded by it.

What platform are you trying to install it on?

Trying to put it on a mac with mavericks.

Not familiar with that platform, but I see there is a binary for Linux/Mac - doesn't that work? If not, there seem to be a few tutorials about such as OpenCV Projects: Tutorial: Installing OpenCV on a Mac (OS X 10.9.1 Mavericks)

I'm afraid it seems to be the norm for open source software to have multiple pre-requisites and for the documentation to be patchy and out of date - although opencv may seem to be a pita to install, it's better than many.

Thanks for replying regardless, I need therapeutic support, lol! You are right, people are going nuts trying to install opencv. To anyone who understands, I have opencv installed, mostly. I can't tell if it's looking to the right libraries or not, but it's otherwise installed. I'm basically at the point where I need to start writing code for the video capture part.

Does anyone know of a good tiny camera? I wish I could use an iPhone camera that is separated from the phone parts. Thinking to try something like this: http://www.newegg.com/Product/Product.aspx?Item=9SIA2KA0YK0357&nm_mc=KNC-GoogleMKP&cm_mmc=KNC-GoogleMKP-_-pla-_-Surveillance+Accessories-_-9SIA2KA0YK0357&ef_id=U7iEVQAABEEQ3FDF:20140807002828:s