Wednesday, December 14, 2011

Review of Processing Books

It has been quite quiet here lately. Not because I have abandoned this blog, but because I have spent numerous hours and nights learning to program with  Processing (www.processing.org).

Reason for this has been a project named as UNUI.

 UNUI is an improvisation project by voice/sound artist Aava Uusikuu, visual artist Outi Aho and sound editor Jouni Korhonen. "Unui" is a word of an imaginary ancient language. It is some kind of glossolalia, enjoyable movement of a mouth without closed meaning. Live shows contain visual structures, organic soundscapes and affective human cries, murmurs, mumbling, babbling, singing and speaking weird languages. Each performance is different, because the song, sound and visual elements are generated during the presentation. (https://www.facebook.com/#!/pages/Unui/188416394512662?sk=info)
My role has been to provide the interactive visual improvisation for the presentation.  I have used my drawings, paintings and photographs as the source of visual material. During the show, this material is animated, combined and manipulated both by the computer (based on the improvised sound)  and by myself .

I wanted to program the software by myself.  I selected Processing, because I already knew some basics of it due to fact that it is used in conjunction with arduino. I did study other possibilites also (such as PureData and VVV) but I decided to use processing because I already have some basic knowledge of C and C++ .Otherwise I didn´t knew anything about graphical capabilities of the Processing or Java.  

As an incurable book-a-holic. I decided to buy several Processing books to support my learning path. Actually I bought four of them. I do not regret buying any of those because all of the have special unique merits. Below some of my feelings related to those books.

Getting Started with Processing, Casey Reas & Ben Fry, 2010
This small booklet (194 pages) is a good and a very quick starting point to learn and understand Processing. I went through the whole book and all examples just using two days. After that I had a confidence that I can start my part of the UNUI project with Processing. The book is concise and explains the basics very thoroughly and clearly. I could have even managed to do my program only by using this book and the Processing web side if I would have more time. However, I wanted to have some kind of paper manual also for quick reference. So I bought also:

Processing, A programming Handbook for Visual Designers and Artist, , Casey Reas & Ben Fry, 2007
This book is what is says to be - a Handbookwith a capital letter. It has 710 pages full of information and examples. This book works well if I need to check some basic things. I also like that the book contains information about actual Art projects and interviews of the Artists. I also like that this book has hard covers which make it easy to use it as a "bed-time reading book".  The minuses are that the book has rarely any color pictures.

Processing for Visual Artists, Andrew Glassner, 2010
I admit, that I bought this book mainly due to its cover picture that somehow appealed to me. I also liked that the book has plenty of color pictures and a lot of visually interesting projects. What I have liked about this book is that it explains also a lot of principles of computer generated graphics and image processing. Examples are well thought over and the book proceeds  in a iterative way from easy to more complicated examples. What I don't personally like is that the text has been written in a very chitchatting way.  I have not yet went though all examples, but I have been planning to do it soon. The minuses are that the book has soft covers and glued quite poorly.  I am afraid the pages will fall off very soon.

Learning Processing, A Beginner´s Guide to Programming Images, Animation, and Interaction, Daniel Shiffman, 2008
I bought this book because I first found the coding examples of the book  from the web. They seemed to be very interesting and useful  for me. Also I liked that the book also covered some examples about Video and Sound processing. The book is intended to be used as text book for introductory level programming course. Therefore the structure of the book is organized as lessons with related exercises and small projects. The book is maybe too basic for me, but as I already mentioned, examples are great. I also liked that the author did talk something about Java, too.

Monday, August 1, 2011

How to program Arduino Mini without Mini USB adapter

I am using Arduino Mini ( http://www.arduino.cc/en/Main/ArduinoBoardMini) in my ongoing project.
Therefore I bought the device together with Mini USB Adapter.

Only after I had received both gadgets by mail, I started to study how I can program Arduino Mini  (http://arduino.cc/en/Guide/ArduinoMini).

I have thought that I could easily connect the Mini USB adapter directly to Arduino Mini. I soon realized that connecting these devices together was not so easy after all.

If I would liked to use the Arduino Mini adapter, I should use protoboard and wire correct signal to correct ports with jump wires. OK, that is not so difficult, but I am a lazy lady and do not want to do simple things over and over again.

I noticed that I could actually connect Arduino Mini to regular Arduino by just removing the ATmega chip from some old arduino board (as Arduino Mini Guide instructs).

I already had made this kind of "stripped" Arduino in oder to program my Arduino XBee shields. In this kind of set-up I would still need to use the protoboard and make the wiring. Ripping the Arduino Mini out from the protoboard every time I would like to test it in real application was not a very fascinating idea.

Then I got a great idea. Why not make my own Arduino Mini programmer!!!

I already had one unused protoshield. I just soldered  12 -pin sockets on top of it. After that  I connected all necessary signals to correct places in the protoshield so that I could stack the modified protoboard on top of the "stripped" Arduino board.



Thats it. Good ideas are very simple. No need to fuss with protoboards and wires at all.



I have three Arduino boards stacked to top of each other: "stripped Arduino" + my Arduino Mini programmer + Arduino Mini.

Now I just need to remember which way I have to connect the Arduino Mini to my programmer. Nice feature is also that I have the reset button easily available on top of the "Arduino Mini programmer".

I also connected all inputs and outputs of the protoshield to Arduino Mini sockets expanding the  "Arduino Mini programmer" to be "Arduino Mini programmer + SW testing board" :-)

Tuesday, July 19, 2011

How to connect Flex Sensor to Arduino

I have been working on my new artproject in which I will use Flex Sensor as "a switch" to change the track of a Mp3 player. Flex Sensor and the MP3 player are both connected to the arduino, that controls the action.

Flex sensors are sensors that change in resistance depending how much the sensor is bend. Sensors convert the change in bend to electrical resistance - the more the sensor bend, the higher is the resistance value.

Using the Flex Sensor is very easy. There are couple of different manufacturers in the market.
I used the 4.5" long from SpectraSymbol. Their datasheet is very clear and informative (http://www.sparkfun.com/datasheets/Sensors/Flex/FLEXSENSOR(REVA1).pdf).

Datasheet instructs you to use operational amplifier (opamps). That may be useful if you plan to use flex sensor as stand-alone device (without any microcontroller). Because I am using arduino, I skipped all OpAmps and made a very simple circuit with only one additional resistor.



Varying the value of the resistor will results different readings. With 22k Ohm resisor I will get values between 300-700. This works fine for me. In my code I assume that all values under 400 mean that the sensor is bend. All values above 600 mean that sensor is nor bend. Note that Flex sensor give reliable readingsONLY if you bend it on the specific direction (usually towards on the text side of the sensor).

I have not yet integrated the sensor to final artwork, so I do not have any world of warnings of my own. I have played with the sensor in the protoboard without any problems. (Legs of the connectors fit nicely to protoboard.)


The most fragile part of the sensor seems to be near the connector legs. I think it would be wise try to avoid any substantial bend on that area. I might protect that area with some sort of plastic encasing.

Saturday, May 28, 2011

Tinkering Loudspeakers

It has been quite a while here in this blog lately, but it does not mean that nothing is happening.

I am working on an interesting performance project with a singer and a sound recorder. This performance requires quite expensive equipment, so we need to get external support for financing before we can continue further. However, this project has made me study more deeply programming languages such as Processing, VVVV and Pure Data.

In the mean time I have continued in my other project where I will make "an audiobook" of my own. For this project I need to have loudspeakers that are as flat as possible. This has proven to be quite difficult task.

Passive speakers as such are not a good option, because Arduino (+ Mp3 player) will not be able to feed enough power to them. You can get some signal out, but the sound is so silent that it is practically useless. I tested several passive speakers with Arduino/MP3Trigger and the results were poor. Therefore I needed to have some kind of powered amplifier to get reasonable loud sound out of the system.

I could have tried to make a powered amplifier by myself, but it would not be flat enough for my purposes. Then I finally remembered that what I need was actually already  in my storage !! Cheap, ready-made speakers intended for MP3 players.

I had bought some HAMA loudspeakers couple of years ago. At that time, I was not satisfied them, because they were too bulky. Because I was not using them, I though it does not matter if I broke one down to see if there is something useful inside.



And there was everything what I needed: a very small and neat power amplifier and quite flat loudspeakers!! I just needed to remove one led (only indicating that the device was powered).  I also modified the circuit so that the device is always on if the external power is connected. I got what I wanted easily and much cheaper than if a have bought parts and build everything from scratch (HAMA loudspeakers costed about 10 €)

The lessons learned could be that tinkering your old useless gadgets might be more worthwhile that buying new stuff.


p.s. While looking for some help from internet, I found interesting link that showed how to make very flat loudspeaker from fabric. Although they are not very practical to my "audiobook" project, I will definitely try making my fabric speakers in the near future.

Monday, January 10, 2011

The most stupid Arduino mistakes I have made

Lets face it! There are stupid mistakes, and most of them are repeated time after time. At least I do it !

Luckily you will gradually learn to check the most common causes before panicing and causing more severe mistakes than the original one. Here are a list of the most common and "stupid" problems I have faced while working with Arduino.

ARDUINO

Actually I have been lucky and I have never broke any arduino board by causing short circuits  etc. I think the reason is that I am always using RED wire for the power and BLACK wire to the ground. And I never ever use these wires to connect data ports. 

I have also learned to CONNECT FIRST ALL GROUND WIRES before connecting anything else.  Possibility to have some kind of voltage peaks while connecting the circuit to the power source is diminished.



One weird error happened once with my robot - it started to move by itself when I put my hand near it!!

It took some time to figure out the reason. My robots have two arduino board that are connected together. The first arduino was controlling the motors and the second one was handling all the communications and data from sensors. Obviously the data signal that commanded first arduino to steer motors was floating. When I approached the robot, the state of that data signal changed due to my capacitive load I was introducing to the circuit.

The reason was naturally as simple as that these two aduino boards did not had a common ground. The correction was easy. I just connected all the ground signals to one common ground. Since this, I have remembered to check that my circuit will allways have only one common ground. The lesson was learned.

ARDUINO + MP3 PLAYER

1) You connection should  be OK, but the MP3 files are not playing

- Are you sure that you have correct memory card in the MP3 player?
- Are you sure that you have turned the loudspeaker on?
- If you use serial connection : are the RX and TX signals cross-connected?  the RX port of the arduino should be connected to the TX port  of the MP3 player, and vice versa.
- Have you renamed your files in PC having Windows operating system? Windows may add EXTRA suffix at the end of the file without showing it!! You may think that name of your file is for example TRAC0001.MP3 but actually it is TRAC0001.MP3.MP3. In this case the MP3 player will not recognize the file. I have learned to check the filenames by using MS-DOS/Windows promt before moving them to the memory card.

Thursday, November 25, 2010

Electric Pea : How to connect vibration motor to arduino

I wanted to make an "electric pea" to my artwork : The Real Princess ( based on H.C.Anderssens fairytale the Princess and the Pea).  The idea was that when a person lays down to the bed, he/she would feel some odd vibration in his/her back. He or she could then imagine actually feeling the pea that was put under 20 mattresses.


The idea was to implement this by sewing a textile switch on to the  upper side of a thin matress (about 3 mm thick) and the vibration motor to the backside of the mattress. The weight of the person would trigger the textile switch and start the motor.

 I though that this task would be quite easy to manage.  I already had bought a pressure sensitive textile switch made by PlugandWear


I just needed a small vibration motor. They are easily available from any electric shop that sell Sparkfun products (product code ROB-08449).


The basic consept was that when someone was laying above the pressure sensitive switch, Arduino receives a signal to one of its input ports. Arduino would then steer the motor to vibrate until the pressure sensitive switch was again open (no pressure detected).

However I didn't want to use Arduino as a power source for the vibration motor for safety reasons. (Arduino is pushing 3,7 V - 4.9 v through the pins, and the vibration motor is operating at 2,5 - 3,8 V range.) Thus I needed external power source for the motor, a transistor to control the motor, and couple of resistors.

I was even able to draw the circuit diagram by myself:


Then troubles began.

I made an initial circuit to the protoboard.I downloaded the datasheet for transistor (BC639) from the web in order to figure out the correct pin order. I was sure that I had not made any mistakes - but the vibration motor was not running!!! I debugged sw and calculated the correct resistor values - nothing helped.

Luckily my husband still remembered how transistors can be used as diodes by short circutting the base and the collector of a transistor and using its two terminals as two terminals of PN junction diode. By measuring all the pins this way, he figured out the the datasheet that I had downloaded was not valid to my transistor (even the name of the transistor was the same !!) After figuring out the correct pin order of the transistor - everything worked fine.

The next problem was related to the pressure sensitive textile switch. The wires in the switch are very weak and almost as thin as human hair. They broke easily and are very difficult to connect to any "normal size" wires. The manufacturer instructs to use small uninsulated boothlace ferrules. I did have those, but still the connection was very sensitive to any movement of the wire. Finally I got the pressure sensitive switch working on top of my table (hard material below the thin matress), but the switch was not working properly on top of a soft matress I intented to use in my princess bed. :-(

I also noticed the the vibration of the motor was not strong enough to be noticed if there was any soft material below the motor.  :-(

And I also heard that the museum where the work was exhibited had to forbid people to climb to the bed. The bed is 280 cm high and does not have any safety railings. Still the parents were allowing very small kids to climb into it. Seems that parents do not have any common sense any more. :-(

Even though the project did not progess how I wanted, I learned many good lessons about transistors and textile switches. I am still planning to make a pressure sensitive switch totally by myself someday in the future.

Monday, November 1, 2010

Robots don't cry?

My art piece: ROBOTS DO NOT CRY? is currently presented at juryed exhibition ARTISTS 2010 by Finnish Artist association. Exhibition has 93 artworks that were selected from 1841 proposed ones.



The exhibition is at Tampere, Finland. My work is at Galleria Nottbeck. The exhibition is open during 30.10.-5.12.
The artwork consist of three robot balls that are covered by woolknit. These robotballs present crying songs (laments) that describes different feelings from joy, frustration, and sorrow. The crying songs have been traditionally presented at funerals, weddings, and other social situations. While presenting the songs, they also move slowly.

More information about this work can be found from my web pages.