Thursday, August 15, 2013

Python! And the Raspberry Pi

Exploring the Python Programming Language to Control the RPi Camera

Appropriate that the RPi comes out of  John Cleese's Head
I have done wonderful things with the Raspi camera from the command line, and I'm totally satisfied that this RPi peripheral will satisfy all my needs for imaging. Now before me is the arduous task of controlling the camera via code in a web interface. Enter PYTHON!

Taken from Wikipedia...
An important goal of the Python developers is making Python fun to use. This is reflected in the origin of the name which comes from Monty Python,[34] and in an occasionally playful approach to tutorials and reference materials, for example using spam and eggs instead of the standard foo and bar.[35][36]
Being a huge fan of "Monty Python and The Holy Grail", "The Meaning of Life", and just about every episode of "Monty Python", I had to give this language a chance. I have written in DOS, assembly for an amazing list of processors, C, C+, C++, and C#, VS, VB, VBA, PHP, Java, HTML, and ASP. What's one more language? Except for confusing the common conventions, I'm excited about getting ANY Linux-friendly language under my belt. On thing I hate though, is not having a full debugging environment in an IDE, or even HAVING an IDE. Both of these issues don't exist anymore with Python, or so I have read.

So here I go, armed with a new language, a new platform, and new hardware. Discovery is where dreams are made, realized, and brought to reality!

More when I discover and code it. =)

Wednesday, August 14, 2013

Raspbian (Debian) LAMP with WEBMIN, SAMBA and FTP on the RPi

RPi Web Server not as Hungry on Resources as Expected

I now have my Raspberry Pi Model B Revision 2.0 running a fork of Debian called Raspbian, configured as a LAMP server. I added Samba and Webmin so I could access the web files, and use a web interface to monitor, control, and update the RPi from remote. Also added was FTP, although I am not certain this is necessary since Samba was installed.

webmin's front end status page served via my RPi
All works very well! I have served up my first web page and plan to have a lot of fun with that.

I initially thought about using Cherokee in place of Apache because of its reduced foot print and faster speeds. After researching it further though, I decided to stick with my old friend Apache. Cherokee is still fairly new by comparison so the community would be smaller. And I viewed a few comparisons showing its performance gains to be minimal.

Updating is really slow, but then we are using a single core 700 MHz processor. It is easy to see the difference between this hardware and perhaps a dated laptop, but then you think about how you are even making a comparison at all. Something this small running this type of software, and successfully!!

I killed the GUI via the raspi-config option for booting to the command line, and changed the memory allocated to the GPU to zero. Webmin (see image above) shows just a hair over 25% RAM usage.

Serving up files and web pages turned out to be necessary for my projects. I needed to be able to interact with my RPi without keyboard, video, and mouse, and a web interface is perfect for that. This will be the next stage of the project development. If all goes well, I will have this first device time lapse recording the perseid meteor shower Sunday night, Monday morning, and have the movie encoded and ready for download on my home network.

When I write something a little more functional for front page of the RPi's web interface, I will run a simple Apache AB on it and share the results on my next blog entry.

More when I code it. =)

Monday, August 12, 2013

Initial Impressions with the Raspberry Pi Model B Revision 2.0

I have run into a brick wall or two, but the hardware is awesome!

I have received my Raspberry Pi in the mail a few days ago, and finally had a chance to play with it Sunday. After a very scary initial attempt to get it working, I realized it was USER-ERROR and exercised best practices with the device, and all is good!

The device certainly has it's problems. The most important of those issues is power management. Set that issue aside though and you have an amazing device that gives embedded system designers a LARGE boost to their development projects. And my RPi is still running, responsive to my Putty commands from my laptop, and it has been 2 days so far!

As many before me have hoped for, this platform gives the user an opportunity to throw code at their invention. Running in a Linux Debian environment, I have been able to take total control of my camera addon hardware and run code on what I get from it. 

The most popular via YouTube now is what people are doing with this hardware and the camera, and taking breath-taking time-lapse images of their world. There are some interesting offerings on YouTube right now showing what this is looks like.

I for one am looking deeper. I want cameras on every corner of my house, on every vantage point of my Jeep. So my needs are a bit deeper.

For now, I want to monitor via time lapse, my seeding beds. But, in the future, I want to have a complete videography of my travels in my Jeep! This device makes that possible, but is it viable?

Only time will tell as I incorporate the hardware with my everyday life. CERTAINLY more to come.

Hop

Saturday, August 10, 2013

Time Lapse Imaging using the Raspberry Pi Model B Revision 2.0

HopWorks First Raspberry Pi Model B Project: Time Lapse Seed Starter Bed Imaging - IDEA STAGE

I just received my Raspberry Pi in the mail yesterday and I already have a quick use for it. I am going to mount it over my seed starter germination bed and use the camera to take time lapse images of the seeds as they germinate. This project will be expanded to allow time lapse images to be acquired from other sources, like IP cameras, web images, etc.

The idea here is to acquire and store high resolution images of our seed starter germination bed, store them, process them a bit, and make them available to the home network via FTP, web interface, or database access.

This should be easy enough to do for a functional starter project. But as some things in our lives seem simple at the end-result, often the inner-workings are a bit more complex. So let us get started!

First, I need to be sure the RPi (short for Raspberry Pi) is working. This involves placing the NOOBS software on a 8gb flash card, connecting a mouse, keyboard, and HDMI monitor, and booting up the RPi. Once in, I will have to set the IP address to a static one from a DHCP assigned one. Also, I will need to set up SSH access so I can terminal the device with my other machines and their installed Putty clients. When that is working, I will have to install LAMP (Linux, Apache, MYSQL, and PHP) software and configure it, set up VNC so I can remote access the RPi desktop, Finally, I will have to install support for the RPi camera device.

All that above is just to get going on the project. I will then have to write software, probably in Python, that will take an image from the camera at a set interval and store that image on the flash card. I will also have to write the web interface so those images may be obtained from other users on my network. I haven't decided how the images will be processed yet, but probably using PHP to time-stamp them, and use them to create on-demand movie files for time-lapse viewing. I already know how to include meta-data in the images and how to encode them to say JPG, PNG, or even raw format.

After all this is in place, I can code features that will allow me to acquire images from existing IP cameras on the network using the same image storing process. All of this on one networked RPi.

I have a lot of work to do on this so here I go! =)

More when I code it.

Hop