PiPlanter | Going from analog data to the web using python, mysql and php

Here’s a video:

Essentially, the adc reads an analog value and sends it to python. Python connects to a mysql database and adds the data to that. Once the user accesses the php script, a table, containing all of the values, is rendered.
First of all, you’ll need to make a mysql table with the correct specifications:

This creates a table that is found in the python script so it is very important that the TABLE values match as well as the column names.
Here’s that python script:

This reads the values from the adc (it is wired up as seen in this post)
Here’s the php, it reads the values from the adc_input_data_10 table on the adc_database.

This is all very preliminary stuff, and I’ll tighten up the code as time goes on.
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 With PHP 2

This is a much more refined version of that graph I created earlier.

This one is much more detailed, and the sizes of the graph can easily be controlled with the imageSizeX and Y Vals.

This program will render:

This image:

And by modifying the values mentioned above to:

You will get this image:

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 | Interfacing an ADC, Python, and MySQL [Documentation]

As this post is more of an update, I won’t be adding any explanations, just giving the python code.

This will read 3 values from the adc and put them into the database “adc_database”. It will put them in the table “adc_input_data_4” in the columns “Channel_1″,”Channel_2” and “Channel_3” respectively.

There you go, bigger post coming later tonight.

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.

Simple ADC with Raspberry Pi using MCP3008

Hello!

So for my own benefit, here’s the steps you need to take to get analog inputs working with a Raspberry Pi.

I’m grabbing most of this from: http://scruss.com/blog/2013/02/02/simple-adc-with-the-raspberry-pi/

The first thing you’ll need is an MCP3008. Using jumper wires, hook it up to your pi using this diagram.

Power your RPi up and run the following commands to get it all set up.

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.

Now everything should be good to go, now for the python.

You can debug this any way you like, but my favorite way to do it is using the program geany. I like to start up a VNC server with root so I don’t get into any trouble with the GPIO permissions.

But here’s the program.

And that’s pretty much it, the result should look something like this:

There you go!

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.

Raspberry Pi Media Server | Mounting Hard Drive & Better Minidlna Config

Please note that this is more for my sake. To mount a hard drive in raspbian do the following: Make sure you have ntfs-3g installed by running:

Then mount the drive read/write with the following command:

And it shout be mounted. /dev/sda1 is the location of your hard drive. Now to configuring minidlna. Location of minidlna.conf file and access command:

This is the file I’m running right now. As I type this i’m successfully streaming to my Kindle Fire HD (the reason why I’ve decided to really make this thing work) but I’m not sure if it’s stable. It’s also able to stream to VLC as of now.

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.

Raspberry Pi Media Server | Moving Backwards to go Forwards

It’s time to face facts, minidlna and XBMC won’t run at the same time in Raspbmc. The basic UPNP included in Raspbmc won’t work consistently and Raspmc and is not nearly as stable as minidlna. OpenELEC is fast enough, but does not have the expandability of a full linux OS. I need to restart this project.

 

First thing’s first I’m going to straight up speed this thing up as much as I can. At the base level, this begins with the SD card. I’m going to go from a junk 4gb standard speed SD card to a 8gb SanDisk Ultra 30mb/s SDHC. On this I’m going to install the latest version of Raspian and overclock it to the maximum 1GHz.

 

I’ll keep you posted on how I progress.

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.

Raspberry Pi Media Server | Streaming To Any Source Using miniDLNA [Documentation]

I’ve made some progress on the RPi Streaming Server.

To replicate this you’ll need to do the following:

1. Install miniDLNA

2. Edit the config file to how you want it. Edit it using vim

3. Here’s what I’m working with, and it works.

You can grab the file itself here. The only thing that’s different is where I put the media directories. The rest of the instructions are still in the .conf, it’s much simpler than mediatomb for example.

Here’s a video of the whole thing working on 3 devices!

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.

PiScanner – GPIO output | Documentation [Research]

I will need to illuminate the “subjects” that I will be capturing. In order to do this, I will eventually need to set some pin high. Weather it be that it sets of a camera flash or turns on some lights for a second, it will need to happen down the line.

 

Like all of my “research” I mostly googled around / plugged in code until something worked. I came back with these links:

http://www.youtube.com/watch?v=q_NvDTZIaS4

https://docs.google.com/file/d/0B2-00drKdqF0V09YSHgxcTEtelk/edit

http://hackaday.com/2012/06/17/using-the-gpio-pins-on-a-raspberry-pi/

 

Basically you need to install the Raspberry Pi GPIO, Import and use the RPi GPIO

1. Download the library:

$ wget http://pypi.python.org/packages/source/R/RPi.GPIO/RPi.GPIO-0.2.0.tar.gz#md5=0fc4bfa6aabc856b0b75252a40ac75cc

2. unzip the file:

$ sudo tar -zxvf RPi.GPIO-0.2.0.tar.gz

you can remove the .tar.gz at that point

3. get into the directory you just created:

$ cd  RPi.GPIO-0.2.0

4. The devs included a great install script with this package, run it to install with:

$ sudo python setup.py install

Now you should see a bunch of text in the command line. I have no idea why, but my first run of this command didn’t “take” but I ran it again and now it works great.

 

To use this, you need to know what pins correspond to pins on the RPi. You can google this yourself.

 

Now we get writing code. I’m using a graphical python editor called geaney which comes pre-loaded with squeeze.

 

To blink pins 11 and 13, use and run this python script.

You can see the plaintext version of that script here.

 

Essentially i’m trying to mimic things I’ve done with an Arduino for some time.

Maybe later today (if I can somehow find a 100ohm resistor) I’ll work on using inputs. I have a PIR motion sensor with me, but I neglected to bring the proper resistor to use it. I do have tack switches and resistors for those, which I could use to mimic the motion detector, but I don’t think that would be as cool.

 

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.

PiScanner | Basics [Research]

So I’ve determined that there will be 2 parts to this project.

 

1. Be able to take a picture with a USB webcam via command line.

I’ve landed on a program called fswebcam. I found it via a few google searches. I installed it by using the command:

 

$ sudo apt-get install fswebcam 

 

I used the:

 

$ man fswebcam

 

command to “derive” how to use the program, but essentially I made a

 

config file

 

that the program can execute. You can run the program with the above configuration by typing:

 

fswebcam -c /home/user/Pictures/picture.conf //the location of the .conf file should be wherever you put it, so the code after the space after the -c will be different for you. 

 

This will produce an image from your webcam in the location you specified in the picture.conf file.

 

Other info can be found here: http://www.r3uk.com/index.php/home/38-software/100-webcam-capture-using-fswebcam

 

I installed all of this on my server and got the below image. This is what the laptop running this website sees!

 

 

2. Write a python (I’ve decided to go with python because I’ve never used python before, it will be good to learn something new. And because there is already a library for controlling the GPIO pins on the RPi baked into the language.) script that can sense weather or not this sensor‘s alarm pin is pulled low. At that point, the script should then execute the above bash command and take a picture. After that, that photo should be moved somewhere to do something, but I don’t know what that will be yet. It will probably be uploaded to a secure location on my server and then I will have it email me if at the end of the night, something shows up.

http://pypi.python.org/pypi/RPi.GPIO

 

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.

PiScanner | Project Execution [Declaration]

Hello Hello Hello!

//If you just want to see the PiScanner Progress, skip the next 2 blocks

So, you may have noticed an absence of recent posts on this website. This is due to a few factors but the main one is a lack of focus. Not a lack of focus in a multi-tasking sense, but in a sort of literal sense. I’ve got foggy fragments of ideas, but no concrete ideas that are feasible. I think that the introduction of the “Project Execution” prefix in the title of this post (and hopefully all of my other project-based posts) will keep me “responsible” in regard to things I try and undertake.

There will be 5 steps for each project.

  1. Declaration
  2. Research
  3. Documentation
  4. Report feasibility [1] (This is where we will learn if the project is possible or not, and if not why.), Share all code [2] Take Lots of pictures [3]
  5. Demonstrate / Distribute
Now to PiScanner
After Receiving my Raspberry Pi :

Raspberry Pi

In the mail recently, I’ve got a whole new area of new more powerful computer science to enter into, and I think the PiScanner is the best way to do this.

 

The PiScanner will be a program that will identify motion using a PIR detector in junction with the GPIO pins, capture an image using a webcam or other camera compatible with the ports on the board, and then upload that image to a server to be viewed via rss.

 

This will be great for my backyard at night, it’s like animal planet out there this time of year and it will teach me a bunch of new things upon completion.

 

Check back for more!

 

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.