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.

Android IP Webcam Screenshot

I have to admit that I’m pretty impressed by the Foscam’s IR capabilities. I snapped a screenshot on my Droid last while we were getting the princess ready for her bath…

android night vision
samurai dude says hi

The lab was light-free, and I was connected to the camera’s web server via my 3G connection. Controls are fairly snappy, and the image looks good even when pushed via cellular. Response time is very quick on the network itself…but remoting in to the router does the trick nicely.

I’m keeping my eyes peeled for a second cam…set designated choppable. We’ll see…I’m growing attached to this guy, but really want to get into its guts.

RBG LED Controller

My off-the-cuff remark about building an auxiliary bilirubin light manifested itself into a quick project.

In order to approximate the specific color of the bilirubin lamp, I figured that I would need to provide a means of setting PWM values for the three inputs. I had hard-coded values in Arduino code in the past, so thought about taking that route initially. I blew the dust off my Duemillova, fired up the Arduino IDE, and promptly decided to modify my Java servo PWM code to do the job.

Sort of growing attached to the IOIO…sorry Arduino.

So, the controller was born…IOIORBG.

rbg led
RBG ... RGB

Hit the bump for a video and some more info…
Continue reading “RBG LED Controller”

Android IOIO Project | IOIOSeek

I hope you don’t mind, but I went ahead and stepped it up a few notches.

My newest project brings my end-goal a few steps closer. I now have the pieces in place to put together an actual robotic implementation with the IOIO…since things have officially reached the cool stage, I decided to drop this as a stand-alone project. Complete with pics, a vid, and an app.

IOIOSeek:

IOIO android servo seek
dig the lighting

What I have here are two slider bar controlled servos, an analog input-read solar panel, and some LEDs toggled via a button. The control is via the IOIO / Android.

servos and solar panels on ioio android
dig the wires

The pictures, however nice, don’t really tell the story. Take a look at the video to see this thing in action:

As the video alludes to, I am going to run with this concept. The automation (robotics) lies in the analog reading with respect to the servo positions. I plan to ‘scan’ the panel…that is the piece that is missing. Once I can implement that mess, I will have a tracking system. Implementations will fall out of that.

analog input ioio
+1 tape

As with the last few projects, I have dumped the app on the Android Market for general perusal. The app’s description provides the details of the pin configuration, which is straight forward. I have two PWM outputs, a pure 3.3V digital toggle, and a pin configured for analog input. That is that.

I will push my code to GitHub as well eventually, and provide a link therein. I still need to polish my generic servo code, since my latency was borderline awful in retrospect. Look for that in the near future as well.

As always, drop any questions to joe[at]swantron[dot]com. Feel free to share your IOIO projects with me…

LED…Matrix or Cube?

They’ve arrived…

white leds
nearly a gross

125 white LEDs. My first thought is 5*5*5 LED cube, powered by the Arduino. I am also thinking that a 6*20 LED matrix would be pretty slick. Either way, my soldering skillz will be put to the test, and awesomeness will surely ensue.

Garage Door Hack

Introducing Open-er-o-matic 3000. OOM3K. My finest project to date. I have my Arduino poking around with a PING))) sensor, a servo, some LEDs, and best of all…my garage door opener. End result: some Star Trek-ass shit.

hit the vid
Ronco alert

Check this footage of the OOM3K in action. Here, I had it configured to open the door when the ultrasonic sensor echoes off of something within 8 cm…

After the bump, of course

Continue reading “Garage Door Hack”

Ping Sensor Project Preview

Parallax Ping))) sensor in the house. Literally.

ping ping ping ping ping ping ping ping
pong

This dapper-looking little guy can accurately measure distance from a few to a few hundred cm. It is very simple by design…basically just a sonar setup. My sketch sends out a signal and listens for the signal’s signature upon return…calculates time elapsed and interpolates distance using the approximate speed of sound. Slick like Rick.

I hugged the sensor on my binary-project-having breadboard, as this is going to be incorporated in some way. My fr1st thought is to turn those LEDs into range holders, and output according to range. Could be awesome. Stay tuned.

Driving Multiple LEDs with an Arduino

I have had a bunch of white LEDs in my Amazon shopping cart for quite some time. I was tossing around the idea of doing a 5×5 cube a while ago, but ran out of steam on that project. I blame the PowerSwitch Tail…I had relays on the brain, big time. Still drafting out my big project on that front; stay tuned for some sweet garage door action. I rarely find my self with two projects in flight, that may actually turn into something, but I just might have stumbled back into the LED arena.

Long story short, I had my Arduino, Mini 9, some white LEDs, and exactly seven jumper wires in my backpack. I stepped upstairs at work for lunch, and decided to horse around with them…see what it takes to run multiple LEDs. Seems basic, and it is. Fortunately…

Here is he setup…

six shooter
not much to it

I put together a little sketch. I managed to grab the time-stamp notion from this sketch that is included with the IDE, and run with the rest of it. There will be snippet, but snippet will follow A SWEET VIDEO FTW

Video / snippet / wrap-up after the bump
Continue reading “Driving Multiple LEDs with an Arduino”