Art 106

Human Machine Interface, San Jose State University, Spring 2011

The final prototype and the work process are posted under Projects/Interactive Sculpture, since this project grew from a class assignment into a major creation. Most likely, I will build my BFA show on this project in the upcoming semester.

While working on the puzzle pieces for the mermaid sculpture, I came up with an idea of making a test copy of the sculpture from cardboard. The plexiglass is a pretty expensive material and it would be a shame if some pieces wouldn’t go together or the sculpture would come out wrong.

Mermaid slices

I noticed an interesting thing by accident a while ago when I stepped on my headphones and one of the speakers stopped working. Since I didn’t have a replacement, I continued to use the broken set. While listening to a favorite song that has the words divided between right and left channels, I was able to hear only the left channel, but my brain completed the rest of the song and instead I heard all of the words. This is just a food for thought about the abilities and functions of human brain.

I started this project with a mere sketch of a cyber mermaid.

Cyber mermaid concept art Sculpture installation concept Sculpture sketch

There are stories about half-humans and half-robots all over the place, but all the mermaid stories are about half-fish and half-human. I decided to sketch a combination of these three creatures. The question was raised about the ability of a cyborg to live under water, but I believe with proper insolation it would not be an issue.

Following the design of the sketch, I decided to laser cut such a cyber mermaid out of translucent blue or transparent plexiglass. Since the laser works with flat sheets of material, I would have to cut up a 3D model of the mermaid in small flat pieces and then glue them together like a jigsaw puzzle. The additional pieces of the sculpture will be a swing that the mermaid will sit on and a base which will house arduino and other electronic components.

The mermaid will be hollow inside to decrease the weight of the sculpture. It will be equipped with LEDs to illuminate the curves of the mermaid. In addition, the sculpture will incorporate a distance sensor which will trigger movement of the swing as well as change the speed of the swing and the color of LEDs. The closer one gets, the faster the swing goes. The swing movement will be controlled by a servo, a belt, and a pulley.

Code

Show ▼

My experiment with driving the servo from the Pololu micro serial controller was semi-successful. Nothing got burned this time; at least, the servo and the controller still work. However, there were some issues when using an external servo power supply.

It took a bit of wiggling with the serial interface to get things going. At first, I tried using SoftwareSerial module that would emulate the interface over one of the regular digital pins. However, I encountered clocking issues where the Pololu controller would not detect the serial baud rate correctly. So, I switched to the hardware serial console (pins 0 and 1) of the Arduino; the Pololu seems to be happy with 38400 baud rate.

The Pololu controller takes command in 5 or 6 byte blocks and requires the 8th most significant bit of every command byte to be 0. This required some bit shifting to split an absolute position value for the servo into two 7-bit numbers and fit them into the 8-bit byte holders. To get things working initially, I decided to set the absolute servo position (range from 500 to 5500) instead of letting the Pololu keep track of the relative position. It seems that my SG5010 servo may not support the complete range, so I may need to narrow it down a bit later.

When both the Pololu controller and the servo are powered from the Arduino, the code executes correctly and the servo moves right. However, it is best to power the servo from an external power supply. I got a generic household 5V/2A power supply and hooked it up to the servo while powering the Pololu controller from the Arduino. However, the servo would no longer move beyond the initial power-on cycle. I do not belive it’s the polarity, since I measure the +5V with the multimeter across the power supply. I think this is due to the different ground connections between the Pololu and the servo. I have not yet tried to power the Pololu controller from the external power supply as well because of fear of burning it out. I will wait until I demo it in class first :)

Code

Show ▼

The latest experiment with a servo as a feedback mechanism for the motion sensors went rather wrong. The idea was to have two motion sensors pointing in different directions and the servo with an arrow that would point toward whichever motion sensor detects movement. Both the motion sensors and the servo modules were tested separately to work fine.

As described in the previous post, the one good servo I had was still having sporadic issues. It would either not move right away or “skip” through movements, reload the Arduino board, and so on. Since I had attributed it to the power issues, I connected an external 12V power supply to the Arduino. It was working fine with the motion sensor scheme and the servo separately.

Once the servo scheme and the motion sensors were connected together (same +5V output on Arduino), the overall system worked well for a little while. As I was debugging some issues, I noticed that the servo started to have sporadic issues again. Furthermore, the Arduino board was getting extremely hot even as the servo was not moving. After disconnecting the power and letting the board cool down, I tried testing the servo alone again but the board would still heat up in a big way even when the servo was simply connected with no program running.

I double checked the connections, but could not find any issues. After a few more tries, the servo was barely moving and the current drain from the Arduino was high enough to disrupt the program operation. At this point, it was obvious that the servo went bad as well. I am not sure of the specific trigger, but it did appear that it was draining too much current from the board which was even overloading the voltage regulator on the Arduino. I took the servo apart, but could not find any obviously fried components. I suspect that it was damaged during the previous projects which made it difficult for the motor to spin; this resulted in the additional drain of current that eventually degraded the component.

At this point, I have ordered a new servo to get the project back to an operational state.

Code

Two PIR sensors and servo
Show ▼

Four PIR Sensors only
Show ▼

I had a few ideas for the exercise, but I hit some limitations.

You do not necessarily need an external servo controller for Arduino since it can control the servos directly. It may actually be more difficult to work with an external controller due to a need for a specialized serial interface and command language. There is a plug-in shield available specifically for Arduino that reduces the complexity:
http://www.ladyada.net/make/mshield/

For simplicity, I have decided to use Arudino to control the servos. It works great, but there are some gotchas that I am going to address later.

At first, I wanted to make a slingshot using the two servos, but after a few hours of trying to get the first servo to work, I realized that it’s not working. A good working servo will briefly spin when you connect power to it. If your servo does not do that, it may be faulty, too.

The second servo worked, but with some glitches due to power supply issues. If used without an external power supply, the servo drains too much power and Arduino shuts down or “slips” – it may skip certain instructions or delays, for example. If other components (sensors, speakers, and so on) are used, the Arduino may be unable to deliver enough power to it at all. You can measure voltage across the power and ground pins of the connected servo to see if it matches the minimum (typically, 5V). If it is much lower, you will absolutely need an external power supply. If the power is enough, you would need to make sure the movements are quick and there is enough post-movement delay built into the program to allow Arduino to recover. I used 30 degree turns and 5 second delay after each move to maintain stability.

This particular type of servo is very powerful and precise. It can only turn a total of 180 degrees; this could be useful for robotics. For example, one could create a slap-hand. While studying or writing a paper, the student activates the slap-hand and every time he or she visits Facebook, Twitter, or another social media site, the slap-hand slaps him or her! This is a way to become very productive : D

Another idea was to place a surveillance camera attached to the servo in a corner of the room and add three PIR sensors. If there’s motion, the camera will react to it and turn to the respective direction.

Code

Show ▼

Music box with two buttons, potentiometer and two LEDs.

Code

Show ▼

pitches.h
Show ▼

Code

Show ▼

A typical use case for an array is to step through it and perform the same operation on each element. To accomplish that, you use an index variable that increments in a “for” loop; to access a particular element in an array, array_name[index] form is used. For instance, the following array of integers will contain the pin numbers (10, 11, and 12) for the respective LEDs:

int ledPins[] = {10, 11, 12};

Since we need to know how many elements there are in the array, we will use the following variable to keep track of how many LEDs we have:

int numLeds = 3;

Now, we use temprorary variable i (index) that starts and 0 and goes up to 2 (one less than the number of LEDs); here is a “for” loop for that:

for (i = 0; i < numLeds; i++)

Within the “for” loop, we set the pin for every LED as “OUTPUT” by calling pinMode() function and supplying the pin number retrieved from the current position in the array as the value:

pinMode(ledPins[i], OUTPUT);

With each iteration of the loop, the value returned by ledPins[i] changes as i increments (ledPins[0] returns 10, ledPins[1] returns 11, and ledPins[2] returns 12).

If you are running Windows 7 OS (64 or 32 bit) and have problem uploading code to your Arduino, try installing these Virtual COM Port Drivers.

  • Download here
  • Installation guide here