The optical sensor can generate lots of data to analyze. Data Analysis (pdf) While I would like to compute and report RPM in real-time, the first step is to analyze static data that I have been able to collect. The first image is the actual readings from the sensor& it is clear that the sensor does not give a on-vs-off reading rather a measure of how much light (or the lack thereof) is fitting through. The way that I wired this setup, the maximum values are reported when the sensor is blocked. The second image is the instantaneous and average RPM rate. As you can see there is a lot of variation in the measure of instantaneous RPM. This is the estimated RPM based on the time it takes to get from one hole to another. As careful as I was, the holes are not perfectly placed.Since the sensor is reading at a predetermined rate, each reading will come at different points relative to the edge of each new hole as it passes by.
The optical sensor needed a better mechanism for reading the holed-CD, ideally it would be able to float up and down, in and out, since the CD itself is not perfectly flat and level, plus the shaft is also slightly off center. So I developed a balanced arm to hold the sensor and added a spring to keep it held to the CD. I added bearings and a guide to keep the sensor centered over the CD. As a nice touch I used thumb screws that my brother Chris made back in high school when he worked at Carlisle Screw Company in Maynard, Massachusetts.
The prototype has been cannibalized and all the parts moved over and installed on Skin. The motor and the linear actuator set up with not much problem. I wrote a second Java program that would spin the sculpture every 5 minutes and that too worked like a charm. Getting the optical sensor to work as a tachometer was another matter.
I just finished a prototype of the mechanism as well as the electronic and software interface to control the spin. The next step is to put the mechanism in place on the sculpture itself. Now is a good time to document what I've been doing over the last year. The most significant development was discovering the Make Controller Kit, which is a microprocessor that can handle nearly all of the control issues that I will need.
Discovering this microprocessor kit was great. Make provides tremendous documentation and makes it easy for a beginner like me to step into the world of microprocessors. In addition to documentation at Make, there is also a nice Wikipedia page, too. There are two aspects of the Make Controller Board. First, is how to electronically hook up the board. And the second, is how to control the board via software. The mchelper application is great to get going, but to really take advantage of what this microprocessor has to offer you need a software interface. Tutorials are set up to provide guidance for Flash, Max, Ruby, Python and C#. Unfortunately, not much was provided for Java, which is what I'm most familiar with.
I spent the last year looking for the right kind of mechanism engage and disengage the motor from the shaft. I tried a couple of solenoids but one type was not strong enough and couldn't sustain a pull, and the other required too many amps (40). So I settled on a linear actuator from Progressive Automations. Their model P-14 has a 1" stroke and 50-ft/lbs of force, 12VDC and draws 1 amp. To control the in and out motion of the actuator I used a Axicon D2n 5VDC Relay switch to switch the polarity.
The current protocol for communicating with the Make Controller Kit is based on OSC (Open Sound Control). I used Eclipse as my IDE and downloaded the JavaOSC library and started to work. First, before getting started I had to fix one small problem in JavaOSC. The developers of JavaOSC used "enums" as an argument which in subsequent versions of Java became a key word. Consequently, this caused a compilation error. However, by simply changing it to something like "xenums" I was able to sidestep this problem. Everything else fell into place as advertised with one exception: It takes a second or two for the microprocessor to receive its listening assignments, so you have to wait before sending it messages.
For what it is worth I have a Java program that can get system information, turn on/off the four LEDs (i.e., /appled/1/state 1), turn on/off motors (i.e., /digitalout/1/state 1). In addition, this program can listen to the analog values flowing from one sensor (i.e., /analogin/1/value). This should be enough to help someone get going in Java. Please note that this is not a finished and polished program. It was just enough so that I could test out a few interface features before I started developing the specific application I needed. Still, for someone who is looking for a key to open a door, this might help.
One feature that I felt was necessary for this project was the ability to measure whether or not the sculpture was actually spinning. An added plus would be to measure its rpm in real time. For this I tried a couple of different kind of sensors: an optical sensor that could read bar codes and a magnetic proximity sensor. Both of these seemed quite sensitive to location or lighting. I was unable to find a setup that resulted in a first-time-and-every-time measure of rotation. A Optek slotted optical switch has worked out much better. I used drilled holes along the edge of a CD which worked out quite well. See layout here. Here's a photo of the piece in action.
The Make Controller Board has to be set to regularly send signals from the sensor at a rate that is sufficient to capture every hole as it goes by. You can use trial and error and/or some math to figure out the refresh rate. I set my refresh rate so that I got about 10 signals per each on-off segment. Since I had 32 such segments, I wanted 320 signals per revolution. With an max RPM of 60 (1 per second), I would need 320 signals per second. To start things off I set the refresh rate to 1 per millisecond, or a 1,000 per second. I saved the signals to an array which I wrote to a text file and analyzed in Excel. Using this I could see what frequency and criteria I needed to measure the rotation speed.
What I am particularly looking forward to is analyzing the speed of rotation as the sculpture slowly comes to a stop. Estimating the moment that the sculpture actually stops will be a fun statistical exercise.
I have completed the first step with Skin; it is now motorized and can be operated by a light-switch. See Torque Requirements. The next aspect of the project involves two steps: (1) operating the on/off switch via the web and (2) watching the sculpture via a webcam.
Much to my surprise, I have not been able to find any examples of this type of project currently on the web. I have heard of various kinds of web-based interactive projects; I just haven't found them yet. As I find examples they will be included in the examples section below.
Beyond providing a webcam and the allowing some user-interaction, there are two additional considerations. For this first project the extent of the user interaction will be very limited, the user will simply hit a Spin button once and the motor will be turned on and applied to the sculpture which will begin to spin. Once it gets up to its maximum rotation speed the motor will be removed and the sculpture will continue to spin on its own; its rate of rotation will slowly decline and it will eventually stop. During this time the Spin button will be disabled. I want to avoid continuously spinning the sculpture, I did not design it for that type of operation.
Second, I will not have access to a static IP address.
If you have some suggestions or comments about this project, you can email me here. Thanks in advance for looking into this project.
Here are some very interesting examples of kinetic sculptures.
This device is the heart of the project. While the webcam will provide the visual interest, it is the interaction between the web page and the relay that provides all the functionality. This is also where an important decision comes: should the relay be IP-based or USB? The USB will require a computer and the IP version will not. The confounding issue is that this project needs for the relays to not only respond to the user actions (i.e., clicking a button), but also to condition the actions based on the status of the sculpture. That is, the relay should turn the motor on only if the sculpture is not currently moving. Thus there should be a local switch or sensor devise. While a local sensor could be added that would enable the relay to turn on the switch only if the sculpture is not moving, but I would also like to report on the website the status of the sculpture, moving or not, if moving then RPM. If this restriction can be set up locally, then it may not be necessary to address the issue of simultaneous users.
National Control Device has an extensive line of products. But there are others, too.
|National Control Devices (NCD)||8 channel ethernet relay||$299||Software: QBasic, Visual Basic MSComm object See examples||Document||Uses virtual ports, Does not reacquire IP after power down, lots of related products|
|Control By Web||WebRelay-X-WR-1R12-1I5-5||$108.95||Visual Basic, LabVIEW, Linux, AJAX, XML or Modbus/TCP requests||WebRelay Users Manual||1 SPDT !! Just 1.|
|Control By Web||WebRelay-X-WR-10R12-IP||$449.95||Visual Basic, LabVIEW, Linux, AJAX, XML or Modbus/TCP requests||WebRelay-10 Users Manual||10 SPDT 30A@240VAC|
|DLI OEM||Web Controlled DIN Relay 8-channel||$149.95||Perl scripts!!||Documentation||comments|
|Sigma Shop||RS485 8 Channel relay||35.00 pounds||Software ExSamples, Com port text||Sigma Shop 8-relay USB Manual||USB 8-relay, UK (there are US) Support forum|
|eCrater (US distributor for Sigma Shop)||RS232 8 Channel relay||$52||Software ExSamples, Com port text||Sigma Shop 8-relay USB Manual||USB 8-relay, UK (there are US) Support forum|
|CNC4PC||C15 - Dual Relay Board||$18.00||TTL parallel port, CNCPlayer, etc.||Manual||CNC parts,|
|Carl's Electronics||Parallel Port Relay Board||$49.95 Assembled||Download zipped software||1601 Manual|