THE VOICE OF NATURE (GIV NATUREN EN STEMME)

Listening to nature

One love!
One heart!
Let's get together and feel all right
- Bob Marley (music arranged by mikkel)

The aim of the project is to give nature a voice. When the plant is either thirsty (too dry) or satisified (sufficiently wattered), it will play a small tune (audio) and shine its lights (visual).

We, the bohackernists (hackers + botanists), have assembled an arduino-project consisting of an arduino uno, some LED's and a piezo working as a small amplifier.

The functionality is quite simple. The moisture measurer is made from two iron nails which are put in a position with a fixed distance between each other. You can vary the fixed distance between the nails by moving them on an acryl-board made for the nails. Current then runs between the nails: the more resistance, the dryer the plant is; the less resistance, the wetter the plant is.

We have made an arduino-program that makes the plant play a tune when it is thirsty, and shine its lights when it is happy and sufficiently wattered. See below or the the attached file.

Projeckt inspiration:
http://www.electroschematics.com/6519/

Arduino examples used:
LED: http://arduino.cc/en/Tutorial/Blink
Melody: http://arduino.cc/en/Tutorial/Tone
New scale value: http://arduino.cc/en/Reference/Map

Ideas for further work/improvement:
- making the plant speak. In order to do this, it is necessary to make the arduino-project play mp3-files. Maybe it is possible to attach a shield that can read sd-cards.
- making the plant play a tune when it is both thirsty and full. Entails some coding-work that we haven't had time for yet.
- expand the plant's music library
- make a sign

Yours truly,
mikkel & rune_bender

ARDUINO PROGRAM:
const int VAL_PROBE = 0; // Analog pin 0
const int MOISTURE_LEVEL = 60; // the value after the LED goes ON

int speakerPin = 9;
int length = 20; // the number of notes
char notes[] = "ee ed f edcdcedc "; // a space represents a rest
int beats[] = { 3, 3, 1, 1, 3, 3, 1, 1, 1, 1, 2, 1, 2, 1, 2, 3, 2, 1, 3, 3};
int tempo = 200;

void playTone(int tone, int duration) {
for (long i = 0; i < duration * 1000L; i += tone * 2) {
digitalWrite(speakerPin, HIGH);
delayMicroseconds(tone);
digitalWrite(speakerPin, LOW);
delayMicroseconds(tone);
}
}

void playNote(char note, int duration) {
char names[] = { 'c', 'd', 'e', 'f', 'g', 'a', 'b', 'C' };
int tones[] = { 1915, 1700, 1519, 1432, 1275, 1136, 1014, 956 };

// play the tone corresponding to the note name
for (int i = 0; i < 8; i++) {
if (names[i] == note) {
playTone(tones[i], duration);
}
}
}

int led1 = 13;
int led2 = 11;
int led3 = 10;

void setup() {
Serial.begin(9600);
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
pinMode(speakerPin, OUTPUT);
}

//void LedState(int state) {
//digitalWrite(13, state);
//}

void loop() {
int moisture = analogRead(VAL_PROBE);
/* Map an analog value to 8 bits (0 to 255) */
moisture = map(moisture, 500, 1023, 100, 0);

Serial.println(moisture);

if(moisture < MOISTURE_LEVEL) {

for (int i = 0; i < length; i++) {
if (notes[i] == ' ') {
delay(beats[i] * tempo); // rest
} else {
playNote(notes[i], beats[i] * tempo);
}

// pause between notes
delay(tempo / 2);
}

} else {
// turn the LED on (HIGH is the voltage level)

digitalWrite(led1, HIGH);
delay(100);
digitalWrite(led2, HIGH);
delay(100);
digitalWrite(led3, HIGH);
delay(500); // wait for a second
digitalWrite(led3, LOW); // turn the LED off by making the voltage LOW
delay(100); // wait for a second
digitalWrite(led2, LOW);
delay(100);
digitalWrite(led1, LOW);
}
delay(100);
}

Comments

rune_bender's picture

Here's some inspiration for a loud speaker design made out of paper: http://www.wired.com/design/2013/12/a-tiny-speaker-made-out-of-paper/#sl...