3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

Sheevaplug + Python Daemon + MySQL = RS232 Logging Made Easy

Sheevaplug + Python Daemon + MySQL = RS232 Logging Made Easy
So, you've got some kinda RS232 device and you want to log a bunch of data from it. No problem. What you need is a little Sheevaplug. The Sheevaplug is a 5 watt full blown solid state Linux box running at 1.2 GHz. Now, how cool is that?

Here is a link for a bunch more info on the Sheevaplug:
http://en.wikipedia.org/wiki/SheevaPlug

I think the Sheevaplug is just so darn neat. All that juice in the palm of your hand.

Just recently I re-flashed my old Sheevaplug with the new Ubuntu 9.04 Arm build. After the re-flash the USB/RS232 cables started working for the first time. Seems there was some problem with the old Debian build.

OK, so here is the deal, I'm playing with a bunch of Zigbee radios that generate a few RS232 messages every second. I want to log all those messages so I can analyze them later. Just shoving all those strings into a text file would not be difficult. But, that makes it hard to handle. Plus, it would make it hard to look at the data while the data being collected. Also consider, I'm collecting data for weeks and weeks. Just how big that text file would grow is anybodies guess.

The solution to large amounts of data is a MySQL database. And the solution to pumping data into a MySQL database is Python.

Read on to understand all the plumbing involved in getting your Sheevaplug to pack all that data into a database for you.

Can you tell I'm rather smitten with the Sheevaplug? Disclaimer, although it sounds like I'm a salesman for the Sheevaplug, I'm not. I have no personal interest in the plug other than I think it is cool.
 
Remove these adsRemove these ads by Signing Up
 

Step 1Add flash memory to the Sheevaplug.

Add flash memory to the Sheevaplug.
I wanted my data stored using the SD-Card slot on the plug. I think that just adds to the "coolness" factor.  With an extra 4Gig SD-Card on hand I used the following couple of commands to format and mount the new SD-Card into the file system.

Use this command to delete the FAT partition / make a partition new: "fdisk /dev/mmcblk0"
Use this to format the new partition: "mkfs -t ext3 /dev/mmcblk0p1"
Note, the format command takes a minute, or more, to execute. I had a hard time waiting.
Add this string to /etc/fstab: "/dev/mmcblk0p1 /usr2 ext3 noatime,commit=600,data=ordered,barrier=1 0 3"
Use this command to mount the new file system: "mount -a"
Your new SD-Card should now be mounted on /usr2

You can now test your new file system. I tested by copying some files onto, and off of, "/usr2" as a test.

I learned a lot of really good stuff from this English bloke's web site: http://www.earth.org.uk/note-on-SheevaPlug-setup.html This guy uses the Sheevaplug to log/control his home's solar panel installation. Seems to really know his stuff - very good info.
« Previous StepDownload PDFView All StepsNext Step »
10 comments
Feb 20, 2011. 2:32 PMMY says:
So true Jim! One decade's supercomputer is the next decade's consumer appliance, and one decade's "toy" is the next decade's indispensable business tool!
Apr 6, 2010. 3:50 PMdukechem says:
I've been googling for an hour and looking at spec sheets, but cannot find if the dev-kit comes with any sort of serial cable, be it rs232 and/or usb.

Seems there may be commands to switch the FT2232DF between rs232 and usb mode?

Can you provide any details on the cable connecting to your Zigbee(s), and are you using the rs232 or usb port of the radio(s)?  I want to gather data from old instruments that may use rs232-signals with voltages higher than TTL (plus or minus 5 volts max), typically +12 or -12 volts I think. Currently these connect to laptop com1 port via 9-pin-D connectors.

The spec-sheet for the FT2232DF chip seems to say you need a TTL-to-RS232 voltage-level converter if you were to connect to a older devices with higher-voltage rs232 signals.

You say "The following python code opens a serial port...:
ser = serial.Serial( '/dev/ttyUSB0', 115200, timeout=1 )"

I assume this must be the usb-connector as 232 is not mentioned at:
http://www.globalscaletechnologies.com/t-sheevaplugdetails.aspx#hw_block

I guess what I'd like to know is what are the pin-outs and voltages of the connector named "JTAG UART RS232" at:
www.globalscaletechnologies.com/t-guruplugdetails.aspx#extern

Then I could figure out if I needed a voltage-clipper to use it to talk to my instruments.
Apr 6, 2010. 4:04 PMdukechem says:
One reader suggests a $4 dollar usb-to-db9 adapter here:
http://plugcomputer.org/plugforum/index.php?topic=1070.0

I suspect this would be needed for any "kinda rs232 device", right?  And you were talking to your devices with a cable similar to the usb cable as used with a printer or camera?


Feb 10, 2010. 4:10 PMfrollard says:
I too saw the HAD note about the guruplug today, then noticed this;

I've been itching for a reason to get one - but really, how often does the end user need to log ...anything.  I'd maybe want one as a firewall...

I just can't see using one for virtually anything though :S
Feb 11, 2010. 7:40 AMfrollard says:
I totally agree its a fantastic product; I just can't think of anything to use it for that isn't already tasked by a very small simple device!

Short of a very very full featured router or data logger I can't think of much it would excel at. It has no visual interface by default, so it's relegated to the 'automate' field of computing, which is sadly already taken up with modules in a larger computer system for most people.

For me, I guess it's like trying to come up with 'how to use an arduino' all by itself.  You can blink leds, log data, make an autonomous robot...etc - but until it's been fuufuu dusted with the magic of applications that do the actual cool stuff, it's just a piece of hardware.  Don't get me wrong; I'm super techhy and love gadgety stuff - I just can't comprehend a use for this other than 'server'.
Feb 11, 2010. 11:23 AMfrollard says:
Agreed 100% with everything there; great info.  Camera server is the best use that I could reasonably use in the next while::  I have an ip camera, guruplug == 2 ethernet ports.

Serial in .net is possible, but it's abstracted through so many layers and controls that you can barely use it for terminal ASCII data.  Try bit-banging one. BAH.

I digress.  Cool tech.  The video points out using hundreds of these in places you wouldn't expect - an automated milk-buying fridge, etc.  It just seems like too much power for most small tasks, and not enough power to be a standalone computer.  Five watts is unbeatable though.

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
54
Followers
16
Author:jimk3038(www.ph-elec.com)
Founder of Powerhouse Electronics. For more info goto: www.ph-elec.com