Smart Speaker | Proximity Potentiometer Proof of Concept

New project! First, here’s a video:

This is the proof of concept for the volume control of the speaker system. In it’s final form, this sensor will be exposed to the outside and will allow users to control the volume without opening the system, preserving the fidelity of the inside. For example, imagine a user is at the beach and wants to change the volume but they have sand covered hands or wet hands. This system will solve that problem.

The sensor is the Sharp GP2Y0A41SK0F. Here are some very very macro shots of sensors inner workings.

But now for what you came here for, the code. It’s very poorly commented as this is just a prototype, but it’s better than nothing. As this project progresses I’ll posted updated versions of this code.

This demo also relies heavily this shift register. I still haven’t decided if i’m going to use a buzzer to interact with the user or if I’m going to use these bar graphs.

Here are some photos of the board if you want to try and work out the schematic:

PiPlanter 2 | Little Plants 1 / Germination Setup

The plants are coming along quite nicely, here is an album of images:

As for my grow setup in this stage, it’s pretty simple. Basically I keep the two desk lamps I have from that area on 24/7 and on the plants. Every morning I put about a half gallon into each of the trays. I also spray about 8oz onto the surface of the plants. Working pretty well so far, all of this growth is only after a week and two days.

PiPlanter 2 | Update / Dirt / Germs

Hi! In order to do PiPlanter 2 at the scale I want, as always, I need money. I’m applying to this grant to hopefully take this project to unreal new heights. In order to apply, one of the component is assembling a budget. In order to do that though, I need to “complete” the whole project… in my head. I have to be able to think of exactly how I want to do the project. From PCB design to pump system, I have to plan it all in order to assemble a realistic budget. There is a lot of good work that comes with this, like schematics and the budget itself. I’ll for sure upload all of the documentation.

On a more stimulating note: I’ve planted the tomato plants in the same manor that I did last summer and here are some pictures of the growth so far.

Here is the dirt and planted seeds:

Here are some very small sprouts that have developed in the last two days.

PiPlanter 2 | Getting Started Again

So I have decided to re write the PiPlanter from the ground up. In essence, it will accomplish the same exact thing but I’d like it to be a lot more of a stable platform to expand upon in the future. I’d also like PiPlanter to be professional enough to bring to market. First off there are a few things you’d need install & a few modifications you’d need to make to Raspian. First thing’s first, you’ll need to enable SPI in the kernel so:

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

Then run this to make it more permanent.

Now for the real meat of it. You’ll need these packages for SPI and the WiringPi library makes things a whole lot easier for us. This program also relies very heavily

Revised python code next post.

PiPlanter | Goals and changes

So I am 151 miles away from the PiPlanter. But thanks to the internet, modern day routers, and wifi dongles I can pretty much control everything about it from here.

That being said, there are a few things I would like to change about the project. First of all, the program itself needs to be more modular. Reason being is that the core program should never stop running, even if changes need to be made. I should be able to screen the main program once, and then never have to stop it ever. This would be advantageous in a few ways but the main example is that the plants will require more water as they get larger, and then less once they start yielding fruit. I could script this, but I think that it would be best to be able to edit the ‘ontime’ value from the program without having to stop the whole process.

I’ll keep y’all posted as I try to implement this.

Multiple Project Update

Hi guys

So I’ve been eeking out all that I can of my last few days of summer, and there hasn’t been much rain or bad weather at all. As a result, I’m not posting much at all.

Doesn’t mean I’m not working though, I’ve been doing a couple things.

First thing’s first my speaker is done. I just need to get a bunch of video edited, and a big post written.

Secondly I’m still working really hard on my dead simple flickr uploader (dsfu). The cool thing about this project is that it has the potential to be very useful to quite a number of people, so I’m trying to make sure that it is very stable, and very easy to duplicate. This means for the most part I’ve been doing a series of 4000+ photo uploads trying to break my script. It’s happened a lot, and you can check my twitter feed to see my brain melt as I try and figure out the problem. This project won’t necessarily be “complete” until I have a 3D printer at my disposal to create the enclosure I want.

As for the PiPlanter, it’s still a work in progress. The update I did with my last post was a start to something really complete it is in no way finished. I still need to move the camera, and the plants.

Thanks for reading!

PiPlanter | Big Overhaul Update

Okay! So I leave for college in less than 30 days, but I’d like to make sure my tomatoes to continue to grow once I leave so I’ve taken some steps to make sure that my departure goes smoothly.

Here’s a video of my revised setup:

There are a few key differences between this setup and my previous one:

The main one is that the watering system has been 100% re-vamped. The water distribution happens via a hose with holes in it instead of using the tray at the bottom of the plant grid in the previous video.

It also takes, uploads and tweets a picture of itself using a raspberry pi camera module.

It also creates a new mysql table every two weeks, and in turn, renders a new kind of graph. The renderscript.php file receives an argument from the python script which is the table code.

Here’s the python script:

Here’s the .php script:

Thank you for reading!

PiPlanter – A Plant Growth Automator

New Version The Post Below Is Out Of Date Click Here For The New Version


This post is many months in the making and I am very proud of the thing’s I’ve done here, and very thankful to all of those (specifically at www.reddit.com/r/raspberry_pi) who have helped me along my way to getting this project up and running.

This page contains every single post related to this project, please feel free to go back and look at my progression and pick up tips along the way if you want to try something like this.

Let’s get this going, here’s an overview video:

There are 8 parts to this system and, you guessed it, I’ll be going in-depth about every single one!

Sensor Network

So at it’s core, the PiPlanter is a Sensor Network & Pump System. Here’s a video explaining the sensor array:

This project uses a TMP35-37 sensor to get a pretty precise temperature reading of the room. Later down in this post you can find out the algorithm to determine the temperature in Fahrenheit. It also uses a basic LDR to get the relative ambient light level in the room. Along with those two sensors, there are 4 relative humidity sensors of my own design, here’s a picture of them as seen in this post:

9allassemb

They’re hooked up to the ADC (mentioned later) in the same way that the LDR is, with a voltage dividing resistor, and then fed directly into ADC. The principal behind this sensor is that when you insert it into soil, the water in that soil connected the two probes, causing a voltage to flow across them. So if there is more water in the soil, more electrons will flow across them, and the analog value will be higher. It’s very basic, but it works. I’ve done several long term tests, and over time, as the soil becomes dryer, the value gets lower, indicating relative dryness. Here is a picture of the four probes in the soil, with the plants.

The TMP sensor’s output is plugged directly into the ADC and the LDR is very basically connected to the ADC as well, this is essentially how how the whole thing is setup on the breadboard:

Capture

Pump System

The pump system is pretty dead simple. Essentially it is a PowerSwitch Tail II switching the mains to a 9v DC power supply. The 9v power supply is connected directly to a 12v DC submersible pump. Instead of using a motor driver chip, which requires 3 pins to do, and the chip would get hot and whatnot, I’ve decided to go with this method.

The pump is not self priming. This means it cannot make the transition from pumping air to pumping water. I wrestled with this problem for a long time, and came up with what I think is an elegant solution. I submerged the pump directly into the water, which means the pump will never fill with air, and will always pump water when activated. Here’s a video explaining the pump system:

Raspberry Pi ADC

The next system is the ADC connected to the Raspberry Pi. It is an 8 bit, 8 port analog to digital converter that can easily run on 3.3v so it’s perfect for the pi. Here is the chip, and you set it up as follows (I took this from an earlier post I wrote)

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:

To read from the ADC, add the following to your python code. The full code will be listed later:

So just use “readadc(n)” to get a value.

Python Code

I’ve made a real effort this time to comment my code well, so I’m not going to do a line by line breakdown like I often do, but I will clearly state the installs and setup things as follows. I’m assuming you have python-dev installed.

Download and install: APScheduler, this is a very straight forward install

Download and install: tweepy, you will need to go through the API setup process.

Download and install: flickrapi, you will need to go through the API setup process.

Here’s the source code for the python component of this project:

There you go! Essentially, every hour, the raspberry pi samples data from 4 humidity probes, an LDR and a tmp sensor. Once the sampling is complete, it dumps the data into a mysql database. From there the data is rendered into a graph using pChart in the form of a .png image. From there, that .png files is uploaded to flickr using this api. Once the file is uploaded, it returns it’s photo ID to the python script. From there, a tweet is built containing the brightness at the time of the tweet, the temperature at the time of the tweet, and the average moisture of the plants. It also uses the photo ID from flickr obtained earlier to build a URL leading to that image on flickr which it tweets as well. The final part of the tweet is a url that leads to this post! (taken from)

MySQL Database

The database is extremely simple, after installing MySQL set it up and create table that follows this syntax:

Pretty basic stuff, the table is just where the python script dumps the data every hour.

PChart Graph

The software driving the graphing part of the project is a bit of php graphing software called pchart. It allows me to graph mysql values from a table in a variety of ways. It is very important, and the code for the php script is as follows:

As you may be able to guess, upon the calling of this script, the program looks for a table called “piplanter_table_17” and does a bunch of stuff as commented to produce a graph. This is what a sample graph looks like:

Wed Jun 26 19:39:17 2013

This is data taken over 6 days, and it’s a lot to look at, but it’s good stuff.

Twitter & Flickr Integration

As you hopefully derived from the python code, this project uses Twitter to send data to me. Instead of using an email server or sending sms messages, I decided on twitter because of a few reasons. I use the service constantly, so I won’t ever miss a tweet. The API seemed really easy to use (and it was!) and allowed more than one person to acess the data at any one time. I decided to use flickr as my image hosting service for a lot of the same reasons, but the main one was their 1TB storage per person. You’ve already seen a sample flickr upload, so here’s a sample tweet:

That’s essentially it! Thank you for reading, and please ask questions.