Each motor unit contained a potentiometer, meaning that positional information could be supplied to a microcontroller.
The original plan was to use this to set all of the motors to a 'home' position in between patterns, but I discovered the motors travel slightly faster one way than the other, meaning that this reference point is lost after a short amount of time. A better idea was to simply turn the motors on and off for precise amounts of time, after an initial 'home' visit by bumping against the stop. I had to swallow my pride and abandon a couple of days of wiring for the sake of simplicity.
Next time I will write code to allow each individual motor to continuously check its position.
Investigating how to read data from 49 potentiometers, however, lead to the discovery of the Mayhew Labs multiplexor shield, which allows 48 inputs to be read through only 3 Arduino analogue inputs. The data is collected into three arrays, which can then be used however you like. Potentiometer no. 49 can have an input of its own, as the Arduino Uno has 6 analogue inputs altogether. 49 is a really awkward number to work with - it seemed I had to buy one more of everything to cover that last duck. The multiplexor shield was not used in this project in the end, but I'll definitely use it again at some point.
I'd also like to use the motor units again, as they are very well made, and I can think of plenty of uses for them...
The duck machine contains three Arduino boards. The Uno contains the sequencing information, and relays it to the two Megas via I²C. Mega A controls 25 motors, Mega B the remaining 24. Each motor is controlled by two pins, via a motor driver board. Each Mega sends either 01, 10, or 00, meaning turn CW, CCW or stop.
The motor driver boards accept these signals, and then use a H-bridge to reverse the polarity or turn off the motor. The driver boards contain 4 H-bridges, and so can control 4 DC motors simultaneously. They are based on a motor shield from Adafruit, although I used clones by DK Electronics as they cost less and I needed 14 of them.
The motor driver boards are designed for use as shields, but as I needed to use lots of them from a single Arduino I removed the serial to parallel chip and soldered the inputs to the back of the board. The shields weren't stackable, and I had to distribute them around the sculpture base anyway.
I did initially consider using DPDT relays to reverse the polarity, but H-bridges are more elegant, and quieter!
The cams were made out of clear polycarbonate, as it is a tough material and wouldn't obscure the actuators (the product being advertised) too much.
The edges of acrylic can be flame polished to give a nice finish, but this method isn't possible with polycarbonate, as it contains water and bubbles when you heat it up.
The edges were polished chemically instead, using dichloromethane (AKA methylene chloride), which melts the rough surface and makes it a lot clearer.
I found it easy to wipe the chemical around the edges with kitchen roll, but if you have a complex component with areas that are hard to reach you can apparently use a vapour polishing process, although I haven't tried it yet. Fill the bottom of a metal tray with a some of the chemical, place a component on a little plinth to keep it clear of the liquid, place a sheet of glass over the top, heat up the tray so that the liquid evaporates, and then remove the glass once the machined edge of the component has become clear.
Dichloromethane is really nasty stuff - make sure you wear a mask and work with it outside, or get someone you don't like to do it for you. It even turned all of my skin blue!
I asked a friend why he thought the manufacturers compromise at 99% purity, and he said "Toast crumbs? From the guy stirring the vat?".
I didn't have time to sand out all of the machining marks, but you can see the 'before & after' effect of the chemical here:
The pear-shaped polycarb component has a 2mm fibreglass rod stuck in the top, which is guided by a brass tube up into the duck.
The brass tubes were silver soldered onto the supporting steel bars using a parasene butane/propane blowtorch, which was just about hot enough. I have since learned that you can buy rods with different melting points, for sequentially soldering components without the first bits falling off (start with higher melting points). The silver rods were expensive, but joined the dissimilar metals nicely.
Thanks to Patrick for cutting out the polycarb so nicely, Joe for printing out the drilling template for the base, and Efe / Faz Elektrik for having the confidence to go with the duck idea.
The original concept proposal / drawings for this project can be viewed here.