Python IO on rPi

My next ‘real’ project involves implementing a web interface to control some of the things around swan tron global HQ, the half of the garage I reserved for my lab. I’ve been a huge fan of the Raspberry Pi since the mission was announced. Linux and IO…you have my attention. Add in the $35 price tag and my penchant for destroying hardware…huge fan is correct.

Before I start planning my real project, I need to figure out how this differs from the microcontrollers I’ve used in the past to deal with similar implementations. I know the CPU is going to show itself, but not to what extent. Time to start poking around.

I decided to horse around and knock out a few birds with one stone…python library, digital out, and basic pin function. Oh, and LEDs. Everyone loves LEDs.

the 80s called, they want their printer cable back
cobbler and bread

Prior to this effort, I have mainly explored the rPi via x. I’ve spent a decent amount of time inspecting the file structure (Debian, no surprises) and the xwin UI. It is no speed demon, but it does the trick. I have the wireless adapter configured and set to auto-start, which was most of the battle. It basically performs as advertised, which on paper is very awesome for the price.

My general setup for this was very simple. I bought a cobbler set from Adafruit, which acts simply to pull the IO pins out to a breadboard. Two LEDs, two resisters. A few jumpers. Very simple.

I booted the device, and used aptitude to update and snag the rPi GPIO library.
sudo apt-get update
sudo apt-get install python-rpi.gpio
That does the heavy lifting with the python implementation…sample code is available on the main python site. The update was I used vim to create a dirty python script…unworthy of a repository, but worth a pic:

fugly code
no comments, no worries

The digital outs worked as anticipated. Timing was a bit odd…I ended up playing around a bit with some pauses in order to tune the blinks as I wanted. It looks like coordinating pin outs might be tricky for more complex operations, but at least the library and hardware is up and running.

Don’t take my word for it:

The next steps will be interesting. Figuring out how to ssh into the box in order to run a script of this magnitude will be next, followed by profiling the voltage on the pinout. It should be able to throw my 5v relay with a little tweaking…if not I’ll figure out PWM and tackle the switching mechanically. Fun stuff to come…happy to be playing with the rPi finally. Stay tuned.

Adafruit Raspi Kit

Time to blow the figurative cobwebs off my figurative Python skill set…

pi case
cobble cobble

Adafruit RasPi kit has arrived…the cobbler kit is the final piece I’ve been waiting for. I have a USB hub and my wifi configured…time to cut code.

Nerdy Weekend

Disclaimer: I have two baseball games in which to play tomorrow. Play well, FWIW.

I am spending my night watching ‘Ask an Engineer.’ Getting my nerd on (well, FWIW.)

ask an engineer
+1 beer (at least)

Support Lady Ada / Adafruit via purchasing the type of stuff you see on swantron.com…she is one of the good guys. Have a nice weekend…

Lady Ada Would Be Pissed

My source for the Arduino Motor Shield would not approve of my soldering iron. Not by any means…

lady ada
fail

I still have the ‘made in china’ tag on this piece of shit. Poorly played.

In case any of my reader-base has taken an interest in microcontrollers, robotics, or awesome crap in general, Lady Ada has you covered. I recieved my motor shield in no time what-so-ever, and Limor’s prices smoke those of Amazon to boot. Don’t get me started about her tutorials…pretty bad ass.

I need to toss the pictured iron in the trash and get a real iron before I get after my motor shield project…I can say that the servos she shipped me are tits.