Now Playing Tracks

BeagleBone GPIO input methods

I’ve been utilizing /sys/kernel/debug/gpio to get pin state on the Beagle for some time. It was a slow solution but I really enjoy simplistic things. I didn’t want to install another library.

Tonight while commuting, I became frustrated with the slowness. I spent a bit of time trying to come up with a better solution. I ended up using Adafruit’s GPIO library. It works, but isn’t ideal.

The library supports “events” which is closer to where I wanted to be. I can set an event on a pin and watch for high, low, or “both” states. The events can be polled and the call to do so is non-blocking. I don’t need to continuously poll a file or run a series of commands to see if a change has occurred. It is doing all of this work behind the scene in a much more efficient manner than I was.

The library stops a little short though of what I’d like. I’d love to have multiple events on a pin and it doesn’t look like I can do that. I can tell it to alert me when pin GPIO1_13 does something, but I can’t get a different event to trigger when it goes high, or when it goes low.

My workflow became:
Event triggers
Read Pin state

I can get around the second step if I know the previous pin state. The pins are either on or off so any event would signal a change. I still need to read the pin state at start to verify that my view of the pin states matches reality.

I’ve found come up with two solutions that feel a little better. I haven’t successfully implemented either yet.

PRU solution:
PRUs are my new hammer. My thought is to have the PRU watch the pin state. When it changes, the ASM alters memory shared between the PRU and the host. The host script runs and looks for changes. This moves the heavy lifting of the polling to the PRU. The CPU is just in a tight loop, not doing much and possibly sleeping between loops.

Device Tree:
I’m not familiar enough with the device tree files to get this working properly. I started to play around with it but got stuck. If I revisit later this week, I’ll update this. My thought was to have the pins generate keyboard events in Linux. This appears to be feasible. This eliminates my need for an intermediate script that reads events. Most of the software I wish to use can trigger off keystrokes on it’s own.

Thoughts? Do you have a better solution? I really dislike using many third party libraries to accomplish simple things like this.

Internet Speedometer

A project that Jon and I wrote for Radioshack’s weekend project series just went live! It features my PRU/Tri-Color LED driver that was previously documented here! Build this device to have a visual representation of your Internet connection speed.

PureData - Networking with PD, a quick introduction.

PureData is an amazing software based synthesizer language. It is a branch (kinda) of Max/MSP. If you aren’t familiar with what PureData is, go check out the website. It’s okay, I’ll wait.

The documentation for PureData (PD) is hit or miss. I assume if you have been working with it for a while that it makes sense. Sometimes they leave out important things. Today I’ll touch on networking. I eventually found someone detailing my issue but it took a while.

PD can be interfaced with keyboards, files, hardware midi devices and network programs very easily. If you want two PD patches to talk to each other on different machines, networking is common. PD includes two objects to very easily do this over TCP and UDP. They are [netsend] and [netreceive]. Making them talk within PD is pretty simple see here.

Have a different program or language that you want to talk to PD? That is where my adventure began. Connecting to my PD patch was very simple. I used python and using the socket library established a connection to a TCP port on [netreceive]. Off the left most output I added a [print msg] object. I sent messages from python and waited. And waited some more. And waited more. I tried sending another message. Nothing was printed on PDs console. Changed logging level, no luck. Tried sending various combinations of end line characters, no. Tried to disconnect, no.

Eventually I setup a server in Python had PD connect to it and send me a message. Sure enough PD was sending an end-line character ‘;’. I couldn’t find it anywhere in the documentation at the time. Adding a ; to the end of each message made it pop right into PD.

If you are just getting started with PD check out [route] which you can use as a case statement and break apart different messages. Also note that the outputs of route work as both (bang) and [X] boxes. You can trigger either from a change in output based on what the downstream objects expect.

In my next PureData post, I’ll cover undocumented requirements when you are trying to read from a file!

The Tea Party (band) on 89.7 Windsor!

I was just telling a good friend earlier this weekend that I was disappointed I hadn’t heard The Tea Party (the band, not the political group) on the radio since moving to Ann Arbor.

I assumed with my proximity to Canada, I would. I occasionally caught 89.7’s Canadian hour on Sunday nights and still had not heard them.

I spent a large portion of my teens listening to The Tea Party and trying to import their albums. I discovered them from a fellow gamer that hung in The True Lodge on Battle.Net.

This evening I went for a drive and heard The Tea Party. They are hosting an entire hour of the Sunday evening Canadian X-Ports show. I was so excited that I even came home and hooked up an antenna to my tuner. Still listening now.

This is an amazing way to finish a weekend! Thanks 89x! I’m hoping to hear “Heaven Coming Down”!

thisisaadl:

Lots of folks stopping by to visit the fairy door at the library today! We have printed maps that can guide you through all the fairy doors in town, too! 

zaheroux:

My husband and I visited the fairy village yesterday. I love my city!
#annarbor #michigan #fairyvillage #whyistay

Curious how to get a Fairy door added to the map? All Hands Active on Liberty has one inside our building.

Someone has been creating new fairy furniture for the set I designed! http://www.thingiverse.com/thing:375453

We make Tumblr themes