PiPlanter | Second round of data collection

So as I said in one of my previous posts, I am going to be collecting a lot of data over the next few weeks while the tomato plants grow. I will be doing this to determine when soil is “dry” and how temperature and light effect that process. For the last week I have been collecting data in the configuration seen in my last post and here is the graph it produced you can click to see the full image:

This graph proves a few things. The first thing is that the relative moisture sensor works. As one can intuitively understand, if you don’t add more water into the system, nature will remove water via evaporation. The overall trend of the blue line (the rel mst sensor) is downward, backing up this point.

The problem with this setup was that I was spitting the voltage across the two probes constantly, which along with the water caused the nails to rapidly oxidize, which is something I would like to avoid in the long term. This also may have seriously corrupted the data so besides general trends, this whole set is unusable.

This isn’t necessarily a bad thing though, as I wanted to conduct a second trial with more probes and more dirt.

I decided to go with 4 probes, and here are a few pictures of the assembly process. Assembly process is the same, I just did it at my school:

I cut it into 3cm sections and then drilled holes on the midpoints of the 2nd and 3rd cm as seen in a photo below.

Here are the holes drilled for the nails

Here are the nails inserted into all 4

Here is the wire wrapped around the nail

Once solder is applied, the connection is very strong and conductive

Here’s the gluing process

Here are all of the sensors assembled. I attached headers to the other ends as seen in the last post.

Since i’m using 4 sensors now, and to get around the oxidation problem, I added a NPN transistor to cut the ground current when the sensor isn’t being used so it only turns on when it’s getting polled. Here is the new python code:

It’s pretty much the same thing.

The graph is also very similar, but I won’t post that code as it’s not different enough.

Here are pictures of setting up the whole system:

I used the same soil as seen in the previous post, and added 125mL of water to each sample.

Here’s a video of me explaining the whole process:

Once enough data is collected I’ll post a graph of it here.

Hey! This post was written a long time ago, but I'm leaving it up on the off-chance it may help someone. Proceed with caution. It may not be a good idea to blindly integrate this code or work into your project, but instead use it as a starting point.

PiPlanter | Planting Seeds!

This is a short post illustrating the process of planting the seeds.

 

Hey! This post was written a long time ago, but I'm leaving it up on the off-chance it may help someone. Proceed with caution. It may not be a good idea to blindly integrate this code or work into your project, but instead use it as a starting point.

PiPlanter | Moisture detector and a few other updates

Long time viewers will remember when this idea was conceived two Novembers ago, but essentially it’s a way to detect the relative moisture of a substance.

The principal is the same as in the above post, but this time, I made it bigger and attached it to a Raspberry Pi. The reason this is essential, is because I recently purchased a 12v DC pump capable of moving water. I will be able to sense the relative moisture in the plant, and then the plant will be able to water “itself”.

That will be done in python with the same basic technique I’ve been using all along, but in addition to gathering data about the plant every hour or so, it will be able to see if the plant needs water (by checking hopefully an array of moisture sensors) and then turning on the pump and watering it. I will also eventually integrate twitter and a webcam, but those cosmetic editions come once I know the system works.

To test it, I’ve added another set of data to the graph as seen in the last post and created a testing environment in my windowsill.

Basically I’ve put some dirt and 100mL of water into a container and inserted the sensor and am monitoring the moisture level over the next n hours, here are some pictures:

And here is a graph of some of the data:

I will make another post later today illustrating the process of plating the seeds.

Hey! This post was written a long time ago, but I'm leaving it up on the off-chance it may help someone. Proceed with caution. It may not be a good idea to blindly integrate this code or work into your project, but instead use it as a starting point.

PiPlanter | Graphing timed mysql data with pchart

Time to get this data we’re harvesting graphed. In a couple past posts, I’ve used pChart to graph random data but now since data is getting dumped into a mysql chart, it would make sense to try and graph that data.

To install pChart on my system (same installs as listed in this post) to do that do the following:

First, get the php5-gd package by running:

Then download, rename and move the pChart files to the proper directory:

Now pChart is ready to be used.

I used a lot of the info found here:

http://wiki.pchart.net/doc.mysql.integration.html

http://wiki.pchart.net/doc.doc.draw.scale.html

The code is pretty well commented so I’m not really going to get into describing it, but essentially, the following php will retrieve data from a mysql table (which is being populated by a python script seen in this post) and after leaving it on in my room for like 3 days, render this graph:

Here’s that php script:

Hey! This post was written a long time ago, but I'm leaving it up on the off-chance it may help someone. Proceed with caution. It may not be a good idea to blindly integrate this code or work into your project, but instead use it as a starting point.

PiPlanter | Basic package setup and bringing everything together

I’m in a hotel trying to occupy myself with something interesting so I’ve decided to work on this. I had to re-image the SD card I’ve been developing this project on, but I saved to code so there’s no problem there. Now I need to re-install all the basic packages.

First I need to get the components of a LAMP server with the following commands:

Once you get the mysql server setup, you’ll need to create a database and tables in mysql.

To create the database you’ll be using run the following command:

And then grant the proper privileges to use later with the command:

Then we can enter the database and create a table:

Now we need to set up the specific libraries for python the first of which being spidev, the spi tool for the raspberry pi which we can grab from git using the following commands:

You also need to (copied from http://scruss.com/blog/2013/01/19/the-quite-rubbish-clock/):

As root, edit the kernel module blacklist file:

Comment out the spi-bcm2708 line so it looks like this:

Save the file so that the module will load on future reboots. To enable the module now, enter:

We will also need WiringPi:

Then you need to get APscheduler, the timing program used to execute the incremental timing with the following commands:

You will need mysqldb to interface python and mysql:

Once you reboot, the following program should work:

And there you go! The program should log data every minute and then every hour to two different tables. To view those data sets as php tables you can use this php script:

Sometime later I’ll get to graphing the data.

Hey! This post was written a long time ago, but I'm leaving it up on the off-chance it may help someone. Proceed with caution. It may not be a good idea to blindly integrate this code or work into your project, but instead use it as a starting point.