Hear Your Plants Play Music! (WIFI Version)

This walk-through will show you how to build a sensor to monitor your plant's environment and use Stats in Sound's ERC-20 app to turn this data into music, allowing you to listen to your plant's reaction to it's environment.  For more information on this project, please visit www.statsinsound.org.uk.  Below is a sample recording of the music generated by the ERC-20, monitoring  sensor attched to a happy healthy chilli plant.

You will need some basic experience with soldering, breadboarding and using the Arduino platform for this tutorial.

This particular instructable is for a sensor that will upload it's data via a WIFI connection. If you house it correctly, you can keep it outside. If this seems a bit adventurous for you, check out the ethernet version here.

To build a plant sensor, you will need the following:

] 1 x Arduino Uno
] 1 x WIfly shield + headers
] 1 x USB A>B cable
] 1 x 5v Relay
] 1 x ZTX605 -type transisitor
] 1 x DHT22 Temperature + Humidity sensor
] 1 x LDR (Light dependent resistor)
] 4 x 10Kohm resistors
] 2 x Nails  (Any nails will do for now)
] Plenty of hook up wire (single core wire)
] A Soldering iron & plenty of solder
] A Mac or windows computer

Once you think you have everything, you can continue to the next step to get started!

Step 1: Prepare the WIFLY Shield

The WIFLY shield is a WIFI card that you can use to let your arduino talk to the internet with relative ease.  It comes without any headers on it so the first thing you'll want to do it solder those on, as in the picture below.

We will need to enable the Arduino to turn the WIFLY on and off so that it can be reset via the software.  This prevents having to manually rest the device if there are any problems.  In order to do this, we need to bend out or cut off  the ' Vin' pin of the shield so that it is not attached to the Arduino.  Instead we will use a relay / transistor circuit to use a digital pin on the arduino to turn it on and off.

The next few steps will describe the major components before we look at the circuit diagram.

Step 2: Connect Up the DHT22

The DHT22 is a great temperature and humidity sensor for projects like this because it's pretty accurate and very cheap.

Here's a few specs:

- 3 to 5V tolerant
-  Good for 0-100% humidity readings with 2-5% accuracy
- Good for -40 to 125°C temperature readings ±0.5°C accuracy
- No more than 0.5 Hz sampling rate (once every 2 seconds)
- Body size 15.1mm x 25mm x 7.7mm

There are four pins but only three are used as follows:

1- Power
2- Data
3- Ground
4- N/A

So we just need to connect the Arduino 5V to pin 1, arduino digital pin 5 to pin 2, and arduino GND to pin 3.  Check the picture for the DHT22 pin numbers.

Step 3: Connect Up the LDR

LDRs are really easy to use.   They are basically just a resistor whose impedance is dependant on the amount of light hitting it's surface. The circuit we use to read them is therefore just a simple voltage divider using and LDR as one of the resistors:

We will hook it up as in the digram below.

Step 4: Connect Up the Moisture Sensor

The theory behind measuring moisture is simple.  Since water conducts electricity, if soil is moist it will have a lower impedance than when it is dry, therefore it acts as a resistor and we can measure it in a voltage divider circuit just like an LDR.

Unfortunately if we just stick two wires into the soil and pass a DC current through it, we will be performing electrolysis, which causes the water molecules in contact with the wires to breakdown, releasing oxygen and hydrogen.  Not only does this cause little bubbles to appear over the wire's surface thus reducing it's ability to pass current, but it will also rapidly erode the wires. 

The 'solution'  (I use inverted commas since it doesn't solve the problem as much as to slow it..) is to alternate the current.  This means you send the current through the wires one way then the other way, in theory preventing electrolysis.  In practice, it doesn't work forever, so we may have to change the soil contacts every couple of months, but that's a small price to pay for the simplicity of this method of moisture measurement. 

The circuit used to connect it up will be shown in the following step.

The code to alternate the current and take a reading is all in the Arduino sketch later in this instructable.

Step 5: Wire It Up

Now we need to wire everything up.   Below is the circuit diagram, it's up to you whether you want to do it all on a breadboard, stripboard or use the little patch on the Wifly shield to connect it all.

I used the area on the Wifly board and although it's quite fiddly, it's a bit more compact than using a separate board.

Step 6: Create a Cosm Feed

We want to record our sensor readings over time so that we can play back through them later on.  Cosm is  great online platform for doing just that, allowing you to upload data to 'datastreams' and query it later on to visualise or sonify your data. 

You will need to set up a 'feed', which will hold all the sensor data for your plant.

Head over to http://cosm.com  set up an account.  The website will guide you through this process.

Create a new feed and make a note of your api key and your feed number.

We can then put these in your arduino sketch so that the data ends up in the right place.

Step 7: Program the Arduino

The last step in getting your sensor up and running is to program the Arduino.

Attached below is a zip file with the following folder:

DHT22 - Library to get data from the DHT22 sensor. 
Wifly - Library to get the Wifly shield working.
sis_wifi - The stats in sound arduino sketch

First, add the DHT22 and Wifly libraries to Arduino (if unsure how check here).  Next open up the StatsSketch.  Click on the settings tab at the top and enter in your own Cosm feed ID and api-key.

Connect your arduino and upload the sketch... and there you have it!!   The replay will click every 10 seconds or so, powering on and off the wilfy.  After a few seconds, you can head over to your feed page on the cosm website and watch the data coming in.

Step 8: Listen to Your Plant!

In order to start listening to your plant through the Stats in Sound ERC-20, just head over to www.statsinsound.org.uk and download a copy for Mac or Windows.

Mac:  statsinsound.org.uk/wp-content/uploads/ERC-20/ERC-20.zip

Type your feed ID into the box and select the type of composition you would like to hear.  Remember you will need a week's worth of data in your Cosm feed before you can use the 'Past week' function.

Enjoy and please let us know how it goes.



    • Epilog X Contest

      Epilog X Contest
    • Remix Contest

      Remix Contest
    • Faux-Real Contest

      Faux-Real Contest

    14 Discussions


    3 years ago on Introduction

    Hello, I try to construct a device like this one, but instead of touching plant, I want to use the potential difference between the root and the leave. Can you help me to do that ? It will be inspired of the work of Damanhur.

    1 reply

    Reply 3 years ago

    Hey man, did you accomplished what you intended ? i am interested in that method too...

    Akin Yildiz

    4 years ago on Introduction

    this is exactly what I am trying to accomplish, but in my case I just need the plant to upload sensor data online, preferably to google docs. any idea on how to do that? will wifly work to post on google docs? thank you

    2 replies
    mattomattoAkin Yildiz

    Reply 4 years ago on Introduction

    Hey Akin,

    Any particular reason why you are using google docs? Looks like Cosm has moved on now sadly, but there will definately be a relevant platform out there for you. Once your Arduino is connected to the internet it will be able to post data to various website APIs using the POST command, as it does in my code. You just need to look in the documentation for the API you are hoping to use (In your case good docs.. https://developers.google.com/google-apps/documents-list/) and see if there's anything in there that mentions being able to update a spreadsheet via an http post command. Can't help but think there's a better way though!

    Akin Yildizmattomatto

    Reply 4 years ago on Introduction

    well my reason is that i feel like google docs would be the most worldwide applicable way to post it. assuming most people already have google accounts and it's all free. but honestly i haven't seen many people give this a try. everyone uses a webpage that i've never heard of before, like cosm in your case. that's why i was wondering if it was even possible. i did come across some great posts that people did do it, but like you said it seems way harder...


    5 years ago on Step 8

    Ok, Cheers. I just googled DHT22 and used one of the pics!


    5 years ago on Step 8

    DHT-22's have a white case. Although they function the same way, what you have shown with the blue case is apparently a DHT-11, a cheaper, less accurate version of the temperature / humidity sensor.


    6 years ago on Introduction

    You said "First, add the DHT22 and Wifly libraries to Arduino (if unsure how check here)."
    But there's no link. I think you intended on a link. Do you have it?
    This is exciting, and making me want to try using Arduino for the first time.

    1 reply

    Reply 6 years ago on Introduction

    Ahh sorry, yes I just forgot to post the link. Here it is:


    I've updated the instructable too.

    I would suggest that if this is your first arduino project, you try to get each bit working separately fist and really understand it all, so that you can better troubleshoot it if something goes wrong.

    It's quite an advanced project for a beginner!! Good luck :)


    Reply 6 years ago on Introduction

    Thanks, it sounds nice.

    But please help me to understand (consider I don't speak English, too): there is a musical background, and it changes depending on the state of the plant? Or is the plant who generates ALL that music?


    Reply 6 years ago on Introduction

    The application has lots of music pre-recorded and chopped up. The data from the plant is used to select elements of the music, mix them and add effects to create an overall soundscape. So yes there is a musical background that changes depending on the sate of the plant. :)