Arduino Wednesday March 8, 2011
Rakesh and Alith introduced Arduino, GPS and RFID as tools for building interactive spaces.
They started with a short history of processing platforms. It all started with the development of advanced calculators, devices for memory storage and interfaces to external peripherals. After that the microcontroller was developed in the seventies, a small computer on a single integrated circuit.
1 – 1
2 – 10
3 – 11
4 – 100
5 – 101
6 – 110
7 – 111
8 – 1000
9 – 1001
10- 1010 If you have an 8-bit RGB code, Red, Green and Blue are represented by codes of 8 digits, there are 255 possible codes per color. After the colors we looked at how sound is represented in binary code. Sound consists of pressure differences in air which can be described as waves. The computer records sound in the variation of amplitude in time. The quality of the recording is defined by the number of intervals on which it stores the positions on the graph of amplitude in time. This is expressed in samples per minute. And the more number of bits you have the more precise and clear the sound will be. As a third example of binary code we looked at how documents are stored as numbers. Every letter has a number. The first standard for coding is the ASCII code (American Standard Code for Information Interchange). Every character is represented in a 8-bit code, mapped in numbers from 0-255 (266 possibilities). For example A = 65, B = 66, C = 67. See for the ASCII table http://www.asciitable.com/ After a small break we talked a bit more about sound and how it is represented by the computer. (Sound recording two) A human ear can hear 20 Hz – 20000 Hz.
Frequency is the number of cycles per seconds, two cycles per second is two Hz.
Amplitude is the height of the waves.
The Fourier transform is a mathematical operation that decomposes a signal into its constituent frequencies. http://en.wikipedia.org/wiki/Fourier_transform
Claude Elwood Shannon developed information theory, which provided the tools for translating the continuous variation of sound into discrete ones and zeros, a process known as digitizing. http://en.wikipedia.org/wiki/Claude_Shannon
It is impossible to store the full sinus waves in your computer because the time and space between two points on the sine wave are infinite, you will never have enough storage space. This is why you have to take samples. Every sample will be mapped trough a binary number. So far the introduction into digital logic. By this time we where craving for a break and the beautiful lunch on the roof top terrace of the new Srishti building. After the lunch break we dived into the programming of Arduino.
(Sound recording three) On the two sides of the Arduino Programming Platform you have two strips of pins (connection points).The pins on the top are digital (14 x > numbers 0-13) and the pins on the down right corner are analogue (6x) and next to that are a few power pins. You can configure the pins as output or input – the pin is on or off (high or low) or you can write an on state/ off state on it. To these pins you can attach different input generating tools like a switch, a knob, a LDR (light dependent resistor) or a temperature sensor. To the output pins you can attach different tools like a LED (light-emitting diode) or a buzzer.
You can get many different shields to attach different other tools to the Arduino, for example a battery shield which allows the board to run on itself for six hours or a 3G shield to connect it to internet. Programming:
If you are making a sketch (a program you are writing in the programming platform) you can copy ready-made programs which you can modify. You can also make use of pre-defined functions, you can find these in the Arduino program under HELP – REFERENCE. Programming language:
/* between these digits are comments and is not included in the program */
// an other way is to start with two slashes, you can write a comment till the end of the line Notions:
Variables – entities you use to store something which can be expressed in integer (int) (whole numbers)
Functions – name and operation – a substitution for a set of instructions so you have to write them only one time
Reserved words – if, break, return, etc. You can not use them as a variable and operators
- +, -, =, etc. Programming example 1: int area(int 1, int b) int area = function name, int = return type, 1 and b = valuables
{
int a ;
a=1*b;
return a;
return
} …
int arect;
arect = area (5,3); Programming example 2 – Hello World: void setup() {
pinMode (13, output) // pin nr. 13 is defined as output
} void loop() {
digitalWrite(13, HIGH); // set the LED on
delay(1000); // wait for one second
digitalWrite(13, LOW); // set the LED off
delay(1000); // wait for a second The long leg of a LED light is positive, the short leg is negative. You have to connect the long leg to one of the pins (in this example pin 13) and connect the short leg to Ground (GND). To create more Ground (and more space to add things to) add a bread board to the Arduino board. Programming example 3 (button sensor): /*
Blink
Turns on an LED on for one second, then off for one second, repeatedly.
This example code is in the public domain.
*/ int sw; void setup() {
pinMode(12, INPUT);
pinMode(13, OUTPUT);
}
void loop() { sw = digitalRead(12);
digitalWrite(13,sw);
} Programming example 4: The Knob sensor (potential meter) produces output variating between 5V and 0V, defined in a 8 bit number. int brightness;
int fadeMode = +1; void setup()
{
pinMode(11, OUTPUT);
Serial.begin(9600);
} void loop()
{
analogWrite(11, brightness);
delay(10);
brightness+=fadeMode;
if (brightness = = 255) // max. brightness
fadeMode = -1; // brightness decreases
if (brightness = = 0) // min. brightness
fademode = +!; // brightness increases
) After a small break we talked about art works which make use of Arduino. One interesting example that was mentioned was a work which consists of a projection of google earth on the ground on which you can stand and navigate through changing your position. Websites with Arduino projects:
http://www.arduino.cc/playground/Projects/ArduinoUsers#SonicBody
http://www.instructables.com/tag/type-id/category-technology/channel-arduino/ We went on with a speed introduction in GPS, Global Positioning System, and RFID, Radio Frequency Identification.
(Sound recording four) GPS was developed by the American military. It makes use of 24-32 satellites which use
trilateration for locating your longitude and latitude through combining the spheres of three satellites. To define your altitude as well you need to combine the information of four satellites. http://www.circuitstoday.com/how-global-positioning-systemgps-works The GPS receiver downloads orbital information and correct its clock from the satellite's time signal. It computes the orbital position of the satellites and measures the distance to each of the satellites from the time lag in their signal reception. It performs trilateration and computes the position. It can as well compute other navigation parameters like speed, distance to another point, bearing, etc. and Applications of a GPS system are position / navigation / object tracking, survey and mapping synchronizing clocks in multiple locations. GPS doesn't work very well inside, the radio signals are blocked by the concrete. There are more expensive GPS tools which can function inside, but they can still have problems with echoes. Mobile phones with GPS make use of other techniques, like defining the position through making contact with cellphone towers.
Nomadic Milk, GPS art project by Esther Pollak. http://nomadicmilk.net
RFID (Radio Frequency Identification) is a technology that uses communication via radio waves to exchange data between a reader and an electronic tag attached to an object, for the purpose of identification and tracking. RFID is similar to the concept of barcode and is used to identify objects. Next to that it can also be used for time and attendance systems, automatic entry systems and package tracking systems.Tags come in various shapes and sizes for different applications. There are tags in the form of key rings, chips which you can embed in your body, shirt buttons and smart cards, like door cards or ID cards.
A RFID reader can be attached to an Arduino board, so you don't need to attach it to a computer. If you add a shield for 3G or GPRS, you can connect the RFID reader to the internet. This allows you to upload or download information to and from the internet. http://en.wikipedia.org/wiki/Radio-frequency_identification After this long and very technical presentation Prayas mapped out how we will pursuit with the 'Space the Final Frontier' project. We will form clusters based on concepts, in which collaboration can take place. Everybody gets three yellow chits which stand for time and skills. You have to invest two of these chips into projects initiated by other participants of Space the Final Frontier. This model for collaboration is based on a model developed by Kitchen Budapest, a new media lab. http://www.kitchenbudapest.hu/en
Waiting for the bus to the hotel.
I will post the sound recordings of the day in the next post.