PiPlanter 2 | Plant Update and Daughter Board Migration

First, a video:

I’ve worked very hard since my last update to move all of the hardware that interfaces the Raspberry Pi with the plants (GPIO, ADC etc) from on board the Raspberry Pi using the GIPO to a daughterboard based around an Arduino.

This has been a lot of work to accomplish, but as of about a week ago, the transition was completed in it’s entirety and everything is operating totally normally without using any GIPO on the Pi.

This provides a portability for the platform that I haven’t been able to achieve so far. As the name of the project suggests, I’ve only used a Raspberry Pi to drive all of the hardware so far as well as do everything with the software. This transition opens up the possibility of using any computer running linux to be able to drive a PiPlanter if they have the board.

I’ve outlined the “PiPlanter Hardware Specification” in the current block diagram for the project. So if you have these parts, you can make a PiPlanter. The protocol for communicating between host computer and the Arduino is outlined here. I’ve decided to go with plain text serial using a rudimentary handshake to handle the communication. Pretty much all computers have a serial port, and the Arduino is very good at dealing with it as well.

One of the next steps that I take in this project would to be to design and fabricate PCB’s for specifically for this. This is certainly going to be a challenge for me, but it’s nothing I can’t handle. This also gives me the opportunity to maybe start selling PiPlanters which is exciting. I might need to change the name for obvious reasons…

Here are some nice photos of the updated setup:


All of the code and documentation for this version of the PiPlanter can be found here.

I am going on break from school from today, December 18th 2014 to on or around January 14th 2015. Now that the PiPlanter isn’t at my house, I can’t access the network remotely and make changes to the code. The next month will be a good stress test of the new daughterboard infrastructure. Hopefully it all goes well.

Thanks for reading!

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 2 | Python Modules & Text Overlays

So in my last posting of the PiPlanter source code, the python script alone was 500 lines long. The intent with was to make things more modular and generic compared to the original version of the code that ran two years ago. Since the project has expanded a considerable amount since two summers ago, my goal of keeping everything short and concise isn’t really valid anymore so I’ve decided to split the code up into modules.

This improves a number of things, but it makes it kind of inconvenient to simply paste the full version of the source into a blog post. To remedy this, I’ll be utilizing www.esologic.com/source, something I made years ago to host things like fritzing schematics.

The newest publicly available source version can be found here: http://192.168.1.37/source/PiPlanter_2/ along with some documentation and schematics for each version to make sure everything can get set up properly. What do you think of this change? Will you miss the code updates in the body text of a blog post?

With all that out of the way, let’s talk about the actual changes I’ve made since the last post.

The first and foremost is that using Pillow, I’ve added a way to overlay text onto the timelapse frames like so:

Before

After

 

This was prompted by some strange behavior by the plants I noticed recently seen here:

I thought it was strange how the chive seemed to wilt and then stand back up and then wilt again, it would have been nice to be able to see the conditions in the room to try and determine what caused this. Hopefully I can catch some more behavior like this in the future.

Here is the new Image function with the text overly part included if you’re curious:

Now that I’ve got the PIL as part of this project, I’ll most likely start doing other manipulations / evaluations to the images in the future.

Okay! Thanks for reading.

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 2 | Interfacing a Mikroelektronika CANSPI and an Arduino

The CANSPI board is a nice integration of the MCP2515 CAN Bus Controller and the MCP2551 CAN Bus Transceiver. To interface with these boards I’m using an Arduino Nano and the Seeed Studio CAN Bus Shield Library.

Here are some photos of the configuration, including the switch position on the CANSPI being used:

The wiring diagram goes as follows:

There are two parts of Arduino code, the sender and the receiver. The following code sends a sample piece of CAN data. Attach a potentiometer to A0, and twist it to see the differences in data in the receive code:

The following prints all CAN data received to the serial monitor:

Twist the potentiometer and see the change in data to see that it’s all working:

Thanks for reading!

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 2 | Adding Youtube Upload Functionality

In order to keep things moving quickly, I’ve decided to take a shortcut when it comes to uploading timelapse videos to youtube. I’ve decided to basically create a function that passes data to youtube-upload, a command line utility for linux that can upload videos very simply.

Here’s the function:

It should remind you a lot of “TryTweet” from the main version of the PiPlanter.

 

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 2 | Solving Broken Pipe Errors [Errno 32] in Tweepy

If I haven’t mentioned it already, https://twitter.com/piplanter_bot IS the new twitter account for PiPlanter. Like last time, I’m using the tweepy library for python to handle all things twitter for the project. What I’m NOT using this time is Flickr. From a design point of view, it wasn’t worth it. It was too complicated and had too many things that could go wrong for me to continue using it. Twitter is more than capable of hosting images, and tweepy has a very simple method of passing these images to twitter. Recently I moved the whole setup indoors and mounted it all onto a shelf seen here and it came with a set of strange problems.

Long story short, what I think happened was that since I moved them to a different location, the complexity of the images increased, causing an increase in the size of the images themselves. A broken pipe error implies that the entirety of the package sent to twitter wasn’t sent, causing the tweet not to go through. I first started to suspect this problem after seeing this:

 

The graphs were going through just fine, but images were seeming to have a hard time. You can’t tell from this photo, but those tweets are hours apart as opposed to the 20 minutes they are supposed to be. Once I started having this problem, I bit the bullet and integrated logging into my project which produced this log:

Hours and hours of failed tweets due to “[Errno 32] Broken pipe”. I tried a lot of things, I figured out that it was the size of the images after seeing this:

Photos that were simple in nature had no problem being sent. After scaling the image size down, I’ve had absolutely no problem sending tweets.


If you are tweeting images with tweepy in python and getting intermediate Broken pipe errors, decrease the size of your image.
Thanks for reading.

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 2 | Progress Update

I’m almost done with a very stable version of the Python code running the PiPlanter. There are many specific differences between this version of the python code and the version I wrote and implemented last summer, but the main one is that I tried to write functions for pretty much every task I wanted to do, and made each routine much more modular instead of one long line after line block to do each day. This took significantly longer to do (thus the lack of updates, sorry) but is much more expandable going forward. Below is the new version of the code, but by no means am I an expert programmer. The following code seems to work very well for what I want it to do.

Note the distinct lack of comments. I will put out a much more polished version of the code when it’s done. Before I move onto things like a web UI etc, I would like to do a few more things with this standalone version. The above version renders videos into time lapses, I would like to be able to upload those videos somewhere, hopefully youtube. I would also like to be able to email the log file to the user daily, which should be easier than uploading videos to youtube.

The script that renders the MySQL data into a graph is the following, it on the other hand has not changed much at all since last year and is still the best method to render graphs like I want to:

Here are some photos of the current setup, it hasn’t changed much since last time:

Thank you very much for reading.

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 2 | Another Plant Update

They’re getting bigger!

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 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.

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 2 | Strange Fuzz

I have no idea what this could be!

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 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.

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.