I’ve been monitoring the python comments lately because I’m thinking about 
learning it to do things like this.

 

Long story, but I’m the type that has to have an actual problem to learn 
something new <grin>

 

Thought I would share some of the things that are being done with python and 
automation in case ya’ll haven’t run across it.

 

I have a interest in this stuff because of what I hope to accomplish on the 
following link.

 

http://keepamericaatwork.com/?cat=62

 

If it doesn’t come through because of the pic’s, etc., send me a email and I’ll 
send you the link

 

Virgil

Keep America At Work

N5IVV

 

From: Keep America At Work [mailto:donotre...@wordpress.com] 
Sent: Wednesday, August 14, 2013 6:41 AM
To: vbier...@gmail.com
Subject: [New post] Interning at Kijani

 


new_kaaw posted: "My summer at Kijani Grows has been very satisfying, as well 
as entertaining, so far. I’ve gotten to apply information learned in the 
classroom to real world problems, which is exactly what I was hoping to do. 
Eric put me to work quickly. My first as" 



        

 



New post on Keep America At Work 

  <http://s.wordpress.com/i/emails/blavatar-default.png> 

 




 <http://keepamericaatwork.com/?author=1> 


 <http://keepamericaatwork.com/?p=214841> Interning at Kijani


by  <http://keepamericaatwork.com/?author=1> new_kaaw 

My summer at Kijani Grows has been very satisfying, as well as entertaining, so 
far. I’ve gotten to apply information learned in the classroom to real world 
problems, which is exactly what I was hoping to do.

Eric put me to work quickly. My first assignment was to create a script that 
connects to his bluetooth device, read the report it sends every 10 seconds, 
and save the report in a file. We decided to use Python because it has 
bluetooth libraries available and because of my familiarity with the language. 
I downloaded a Python coding environment along with the required libraries 
using Ubuntu and got started.

The bluetooth device my program connected to is the small board with green LEDs 
visible at the bottom of the following picture.

 <http://www.kijanigrows.com/wp-content/uploads/2013/07/BT+RelaysOn.jpeg> 
BT+RelaysOn

 

The device is designed to monitor small aquaponic gardens like the one shown 
below. By taking input from sensors, and controlling environmental factors, 
like the lights or pump, with relays, the amount of work required to maintain a 
garden is reduced substantially.

 

 
<http://keepamericaatwork.com/wp-content/plugins/wp-o-matic/cache/36df0c6a67_gardenFullView.jpeg>
 gardenFullView 
<http://www.kijanigrows.com/wp-content/uploads/2013/07/gardenBedView-e1374104388368.jpeg>
 gardenBedView

Eric set this garden up recently. The garden bed has lettuce sprouts poking up.

Once I had a program receiving the board’s information via bluetooth link, Eric 
instructed me to create a visualization of it, choosing HTML as the 
presentation format. He had me set up an Apache server on my Ubuntu operating 
system, so I could view the website locally as I built it. I made a second 
Python script that reads the file created by my first script, created HTML code 
corresponding to the data, and stored it in a file being hosted by the apache 
server. In addition to displaying the data from the garden controller, Eric 
wanted me to make the website an interactive remote for the controller. I added 
buttons to HTML code and modified my original script to send commands to the 
garden controller when they are pushed. Then, I added the visualization; using 
HTML tables I created a small image of a garden and a tank.

 <http://www.kijanigrows.com/wp-content/uploads/2013/07/Version1.png> Version1

 

 

 

After seeing my first attempt, Eric asked that I add the flow back pipe (the 
pipe that allows water to flow from the garden bed back to the fish tank), as 
well as a fish feeder and a reservoir. I drew up a new set of tables and set 
about coding them into the page.

 <http://www.kijanigrows.com/wp-content/uploads/2013/07/Version2.png> Version2

 

Due to numerous visual and functional issues, I aborted my second version. On 
my 3rd attempt I decided to make code that creates the tables dynamically based 
upon a set of constants that can be modified (bed height/width, tank 
height/width, pipe height/width, etc.). In addition I implemented a coloring 
scheme that allowed for easy manipulation. This was particularly useful because 
it allowed the visualization to change its colors in response to different data 
from the garden controller (e.g. a pipe that has water flowing through it is 
blue).

 <http://www.kijanigrows.com/wp-content/uploads/2013/07/Version3.png> Version3

 

 

Once the visualization was good enough, it was time to do away with the raw 
display, as most users would not use it. I took whatever data wasn’t shown in 
the visualization and displayed it in the area the report used to reside.

 <http://www.kijanigrows.com/wp-content/uploads/2013/07/LatestVersion.png> 
LatestVersion

Below are pictures with modified dimension and color constants respectively, to 
demonstrate the ease of modification.

 
<http://www.kijanigrows.com/wp-content/uploads/2013/07/LatestVersionDimensionshift.png>
 LatestVersionDimensionshift

 

 
<http://www.kijanigrows.com/wp-content/uploads/2013/07/LatestVersionColorshift.png>
 LatestVersionColorshift

 

Once the visualization was complete, Eric moved me on to something different, 
having me work on his code for the garden controller.  He asked me to add 
support for commands in the form of a JSON string, and to add cyclic timer 
functionality. That is, instead of merely telling the garden controller to turn 
something on or off, I will tell it “turn the pump on for 5 minutes, off for 10 
minutes, repeat”, and it will make the cycle autonomously. Using my own arduino 
kit as a development environment, I added the functionality. The command 
parsing proved difficult, as an ATMega328p (the microprocessor being used) has 
only 2 KB of SRAM, I had to use character arrays and pointers instead of String 
objects that are memory expensive. This particular problem was the most fun and 
difficult programming challenge I’ve encountered so far at Kijani. Eventually, 
I got the functionality Eric was looking for. The controller takes in commands 
in the form of a JSON string, the commands contain information about a 
particular control’s cycle. The controller maintains this information in 
non-volatile memory, so cycles will not be forgotten when power is lost. This 
cyclic capability can be used to turn lights on and off, as shown in the photos 
below.

 <http://www.kijanigrows.com/wp-content/uploads/2013/07/BT+RelaysOff.jpeg> 
BT+RelaysOff 
<http://www.kijanigrows.com/wp-content/uploads/2013/07/BT+RelaysOn.jpeg> 
BT+RelaysOn

 

Once the garden controller could enact cycles and receive commands to modify 
them, I added a cycle status section to its report, and returned to my second 
Python script. I added another area to the visualization web page that displays 
the cycle information from the board. In the same area, a user can create or 
modify cycles, and send them to the board.

 <http://www.kijanigrows.com/wp-content/uploads/2013/07/UpdatedVersion.png> 
UpdatedVersion

 

The next step in the project is to make the visualization accessible to anyone 
using a garden with one of the bluetooth microcontrollers (it is currently 
hosted on my computer for development, it isn’t available on the web). This may 
involve setting up a master web server that will host web pages for many 
gardens in the area nearby, or an Android application that connects to the 
bluetooth directly and uses a completely different visualization.

The project is for Eric’s Guns to Gardens program currently being set up at 
Castlemont High School in East Oakland. There, he is clearing out an old JROTC 
shooting range and filling it with smart aquaponics gardens. Eric will be 
teaching classes there, Castlemont students will have the opportunity to learn 
how to grow food with the gardens, as well as how to build and maintain them. I 
have been to Castlemont with Eric on two occasions, and I’m excited about the 
program.

It has been a good summer so far, a lot of work, but also a lot of fun. Eric is 
fun to work with, and is a good teacher, if you ask the right questions. 
Hopefully, I can learn some more before Fall arrives and I go back to school.

 <http://keepamericaatwork.com/?author=1> new_kaaw | July 18, 2013 at 4:49 am | 
URL:  <http://wp.me/p3NGb5-TTb> http://wp.me/p3NGb5-TTb 


 <http://keepamericaatwork.com/?p=214841#respond> Comment

    <http://keepamericaatwork.com/?p=214841#comments> See all comments

 


Unsubscribe or change your email settings at  
<https://subscribe.wordpress.com/?key=e00b1920a15a3e7dca89a1a1e210e411&email=vbiersch%40gmail.com>
 Manage Subscriptions. 

Trouble clicking? Copy and paste this URL into your browser: 
 <http://keepamericaatwork.com/?p=214841> 
http://keepamericaatwork.com/?p=214841 

 

        

  
<http://stats.wordpress.com/b.gif?host=jetpack.wordpress.com&blog=56169215&post=214841&subd=keepamericaatwork.com&ref=&email=1&email_o=jetpack>
 



--- StripMime Report -- processed MIME parts ---
multipart/alternative
  text/plain (text body -- kept)
  text/html
---

_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/011001ce98eb$d1d35e70$757a1b50$@gmail.com
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to