Archive for the ‘hardware’ Category

Greetings Officefighter

Thursday, March 26th, 2009

In the beginning you were a Starfighter, recruited by the Star League to defend the Frontier against Xur and the Ko-Dan armada… well, actually the beginning was something much simpler, something more like Space Invaders.

Space Invaders was a classic, it spurred the video game industry, inspired a vast genre, can still be played online and occasionally even in a lecture hall.

Now, you can play in my office;

Office Invaders

Well, it would be hubris to claim that my humble beginnings have reached the same success but I do believe it has matured in much the same vein. I seem to have moved beyond building a deadly office putting toy to a serious office defense system!

Office Defender

This might even classify as something much more sophisticated than some Russian spy gear! Now I’m truly ready to defend my office against any and all invaders, alien or otherwise!

In truth, I’m hoping I can stash this in a friends office maybe for a surprise ambush! However, in practice it might be hard to convince someone to put on a face shield before heading to work.

Building from my previous creation I connected my wiimote to a servo via some python and my ioBridge 204 module, only this time I replaced the coilgun with a remotely triggered airsoft gun! Now there are no more issues with reloading a weapons system half a world a way after each shot!

Here is the action sequence;

Would you like to know more?

Build your own ioGun!

Friday, January 16th, 2009

I apologize for what will effectively be a brain dump post, but a new friend of mine from the hackaday forums is getting started on his own accelerometer controlled system and I wanted to see if I could save him some time and frustration.

I think standing on the shoulders of Giants is a fantastic aspect of human nature, now if only someone could show me to some friendly Cyclopi (is that really the right pluralization?), and frankly I could not exist, let along thrive in the technological world if it were for the good graces of a great many people.

Perhaps I will write a _very long_ blog thank-you to them (if I can remember them all). So consider this my little chance at saving some of you a few hours of your precious time (and brain strain). Because of the very nature of hacking (i.e. everything’s just a little different and throw together) this can’t quite be the same quality as an instructable but it should get some of you started!

I’ve put up my code here so that’s quite obviously the place to start. You’ll find a python script and an HTML page. The script connects to the MoteDaemon port I referenced earlier and will write these data points out to a JSON file which can be served via your webserver, and is then picked up by the HTML page.

If you look through the code you’ll see there’s clearly some tuning that can be done. As people on many forums pointed out there’s a “lag” which is really just because of my polling rates (and less to do with the network traffic).

Two important things here, first you’ll see that I created a separate thread for the monitoring and one for the output, that’s because the wiimote data is fast and furious and you don’t want to block and miss any!

Second, I know writing to an JSON file isn’t ideal so the output part actually buffers 10 events and writes those, luckily jQuery is smart enough to only pull the file if it’s changed so it’s not as bad as it sounds.

Once you’ve got the accelerometer data into python (and then into JSON) it’s ‘just’ a matter of writing the webpage you want! jQuery makes some stuff really easy so I suggest giving it a look if you haven’t yet!

Of course what makes it really easy for me was the ioBridge module. I just plugged in a servo there and defined a widget on their page and ‘viola I had a webservice I could send commands to!

I hope that helps give some of you (or at least one of you) a boost, and if I can help out at all please let me know!

Wiimote Controlled Coil Gun

Tuesday, January 13th, 2009

I know it seems like a while since I last posted, but since my Christmas enlistment into the Joint Strike Force I’ve been busy winning WWIII for America! Actually it’s not been all video games, I’ve been working on a Django project that I hope to release in a few weeks, and inspired by ServoBeer I managed to find time for some ioBridge hacking.

However, as you can tell my recent militaristic tendencies have probably gotten the better of me!

Weapons of War

Weapons of War

As you know from my previous posts I’m interested bringing a higher level of physical awareness and capability to my typical computing environment. Embedded systems are usually used to bypass the need for sophisticated systems, and the ioBridge is great for those situations.

Yet, I’m perfectly comfortable with the idea of using a laptop for a command and control system. It might be a more “tethered” solution then some people would like but I figure in a few years my iPhone will be able to fulfill the role my laptop currently has!

I wanted to move beyond some of the work I’ve been doing with passive sensors and in thinking about some ideas for a more active interfaces I realized that the wiimote certainly fits the description of a powerful controller! There are already enough great wii control hacks out there and some programs let you use the wiimote as a mouse!

But I wanted more then to just replace my mouse, and in most of these cases the flow control goes from the wiimote to a computer, or the wiimote to an arduino with lots of wiring. I wanted to both avoid the electrical requirements as well as extend the influence and “reach” of my wiimote beyond my immediate vicinity.

There are certainly times when you wouldn’t want to put your expensive new Macbook in harm’s way. Whether on the front lines or in the basement laptops are sometimes the wrong systems to dedicate to a task, so ioBridge to the rescue!

The ioBridge already has a number of features which make it idea for “remote” situations and so all I needed create was a mechanism to coordinate wiimote events sent to my computer with ioBridge events sent to the module. Luckily the team at ioBridge has created just such an API!

In this setup I use a python script and MoteDaemeon to bring the events into my laptop’s domain. Of course I could script up a number of local events but what I wanted to do was act on that data and sending commands to an ioBridge module.

So I build a website which monitors the position from one axis of the wiimote and extrapolates that position to a servo output on a remote ioBridge module (which happens to be in my office, but doesn’t have to be). I’m also tracking some of the button inputs and can expand easilly to include other axes as well!

Now I just needed something fun to control on the other end! I happened to have an office golf putter lying around and that uses an electromagnetic induction coil to generate the force needed for the ball return when you sink a putt. If you take that apart and replace the metal cylinder with something a tad bit smaller then you’re left with a coil gun capable of some pretty powerful shooting!

I’m not sure it’s up to DoD standards yet but remember the only required link between the wiimote and the ioBridge module is the Internet so if you can sneak one of these into your friend’s house, or a colleagues’ office, then you could be anywhere on the planet with Internet access and stick it to them!

How’s that for “Can you hear me now?”. Check out the video of it in action on YouTube or Vimeo!

Taking (and keeping) your temperature!

Friday, January 2nd, 2009

I swear I don’t have a penchant for medical terminology but this ioBridge stuff is making me feel like that time I stayed at a Holiday Inn… so refreshing, I think I could perform surgery!

After my heart hacks (see my previous posts) I had questions from some friends about how we could graph the data from an ioWidget’s (my term). Initially, I wanted to push the data into a Google Spreadsheet but unfortunately there doesn’t seem to be a higher level javascript library supporting Google Docs and sorting through the feed URL’s was just too complicated.

At the same time I was thinking through this request, I received a resounding response from the ioBridge team! Although I’d worked around the need for a simple API they quickly responded to the desire (apparently I wasn’t the only one with interesting ideas) and now there’s a full JSON API!

I won’t bore you with my initial graphing solution as the sample made it into their official API demo (along with some much needed code enhancements). However, there were a few pitfalls with that approach that I still didn’t like, most specifically that the data is “lost” every time you reload the page.

It took me until after the holiday break (along with a welcome return to python) but I’ve solved my initial frustration with great results.

Here’s a script which will poll my ioBridge module and then store the results of my tempreature sensor in a Google Spreadsheet that I created! Once the data’s there you can use Google’s visualization widgets to make some fun graphs!

Aside from some setup and “ease of use” code, the real work is done by two very brief classes. I deliberately didn’t add some error checking nor make the widget class generic (it’s actually proxying the full ioBridge module) so I think it should be straightforward enough to modify for your own uses!

All you need to do is create a spreadsheet and open it in your browser. Copy the key from that URL and paste it, along with your ioBridge feed URL, into the appropriate places in the script (the locations are commented).

I simply run this from a cron script every few minutes (once I get more data I’ll reduce the time) and although there’s not a lot of variation in the data (I deliberately introduced some to make the graph more interesting) it’s a spectacular way to record, visualization and act on the sensor’s findings!

Good luck with your own modifications and let me know if I can help!

Bridge to my heart…

Monday, December 15th, 2008

Yesterday I talked quickly about my new ioBridge module and how excited I was to get started with it!

As I mentioned, my real goal is to bring physical interactions into the digital world and I had a heartbreakingly simple desire to get started with! Like most of you I’m sure, I have a special someone who’s stuck on the other side of the tubes most of the day.

I’ve known several coworkers to spend quite some time on their cellphones with family members exchanging tidbits throughout the day. I’m lucky that my spouse has some significant technology savvy (who says they can’t be trained… j/k hon!) so we get a lot of our “chit chat” done without breaking the context of our mental modes by using gtalk.

I’m sure many of you use some form of instant messaging for work, and have developed an enjoyable bit of asynchronicity to your conversations. It’s rewarding to be able to stay in the zone and then pick up a conversation where you left off once you’ve got a moment’s break.

However, how many of you have started a conversation with “Hey, are you there?”. It’s a personal pet peeve of mine (i.e. tell me what you need so I can deal w/ it when I have a chance) but often there’s no need beyond wanting to know the other person’s there and still has a pulse.

So that’s where iobridge_project_v0.01 comes in!

If you’ve checked out the link and are a bit confused here’s the explanation!

1) I wanted to build a digital representation of my physical presence and I decided that a “heartbeat” was a pretty obvious analogy.

2) So I found a wonderful tutorial on how to draw animated gifs but stopped with a single heart jpg and then needed to animate this beating in correspondence with my presence.

3) Using the very simple iobridge widget script I’m able to display the temp from my sensor wherever I want. However,  I wanted to actually _act_ on this data!

I’ve already talked with some of the ioBridge guys about them providing an XML / JSON interface and they were really receptive but there’s so much excitement over their device that I knew it would take a little bit of time before they could put something together.

First I tried to use jQuery to make a JSONP call to their server, but that didn’t work. Although I’m not smart enough to understand exactly how JSONP works, but I know the server has to cooperate. Despite their enthusiasm I knew ioBridge had more important things to work on and couldn’t turn around an API in 10 minutes (though I’m sure they’d try if you asked)!

I consider myself a persistent fellow, so I broke out firebug and started tracing through their script! It’s not rocket science, but the session variables and timestamps were a bit daunting. I must say they’ve put some thought and effort in securing your data (they even use HTTPS) and I started to feel myself deflate.

However, I decided to have a bit of lunch before I gave up entirely and that’s when I had my brightest idea all day!

4) I realized I didn’t need to worry about “spoofing” the request I could simply let ioBridge’s code do what it did best, polling the data! In turn, I did what I could do best, which was utilize the power of jQuery to get to that data!

5) So I simply hid the content div that I’d wrapped the ioBridge Widget in and proceeded to parse out the data! It’s as simple as;

$("#content").hide();

Then to get the data you just need to do this;

var t = $("#content").text().split(";")[1];
new_temp = parseFloat(t);

6) After that you just need a little UI logic and you’re good to go! Here’s a description of what I settled on but check out the page for the full on code;

I build an “animate heart” function which is triggered to fade in and fade out the heart. This is a simple function and could get more complicated if you’re a better animator then I am. Then I build a control function which would query the current temperature and compare that to the previous temperature. If things had changed (up or down) it simply tweaked the timing interval and reset the trigger event on the heart icon to have it beat faster or slower!

So there you have it! I can tuck the tempreture gague under my laptop so you can see how hard I’m working, or I can put it the back of my chair so you can get visual feedback as my body heats up the seat!

I know you’ll have to take the pulsing example with a bit of faith, but compare that to the temerature results and see the correlation! Also you can twitter me if you want me to go hold the sensor and make sure I’m moslty human!

ioBridge setup

Sunday, December 14th, 2008

Although I’m often working with “web stuff” or Enterprise Architectures I’ve always had a soft spot for what used to be called “ubiquitious computing”. I once had an interview at IBM and their interpretation of the term was “the ability to buy something online wherever you are” (say wha!!?) so if you’re not familiar with the phrase I doubt it was ever popular enough to have an agreed upon meaning.

I much prefer the more current term, “augmented reality”, although that often has connotations of games or enhanced social interactions. If you ever get a chance to read Donnerjack I think it’s got some great illustrations of what life could be like once we unlock “computational intelligence” from the machine.

What’s always frustrated me about the computer is that for decades our most popular input device has been the mouse (although I’m a keyboard user myself). Why must I get RSI from paging through my Google Reader simply because the ‘j’ key (or repeated clicking) was the “least worse alternative” for “next post”?

One of the reasons I’ve loved my iPhone is that it’s given me another chance at decoupling my “interface” from the computer. Even if it’s via simple web pages it’s nice to have an alternate. I have a friend who has setup a page to control his streaming DVR, audio and much more. It’s a simple advancement but being able take the convenience of a remote and the scripting power of code has been really powerful. If we can get excited about “always on” video cameras for life streaming, well I’m even more so about the time when my computer ( or cloud companion ) knows I’m on the move (and how urgently) because it can read my Nike+ transmitter!

If you’ve seen any impact of the “Makers Movement” you’ll likely agree that we’re entering a time in history where we have the ability to shape the way we want to interact with our devices. From on demand fabrication and open interfaces there’s likely a good chance that you can find a way to interface with what you want, how you want!

However, even with the multitude of arduino tutorials I’ve found it hard to get started with some of the embedded programming. I have some friends who are interested in using embedded systems to remove their need for the computer. My desires are a little different in that I want to use embedded systems to even more strongly couple myself to my system but via better interface patterns.

In essence I want the reverse of augmenting reality with technology, I want to augment software with more realistic interfaces! Let’s call it “realistic augmentation” until O’Reilly coins a more acceptable term.

So it was with much excitement that I saw the announcement of iobridge coming to market! From the writeups it looked like iobridge was a painless way achive the interlocking I’ve been looking forward to for so long!

I managed to buy one of the last modules (and a temperature sensor for starters) before they sold out and when it came I was setup in less then 5 minutes!

Here’s a quick record of what I did to get my test setup going for anyone else who’s interested in it. I already have a “usage case” in mind but I’ve been messing with jQuery for my new site (wjhuie.com) and hadn’t gotten around to it yet.

When my order came there were all of 4 things to deal with, one of which was supplied by me (the network cable). I took the   module (part 1) connected it to my router via a self-supplied Cat5 (part 2) and then plugged in the power cable (part 3). The power pack is a very nicely build module which has very low profile.

Once the module’s plugged in you’ll see a numeric LED display light up (along with two onboard LED’s, one red and one green). I plugged my module in and then went to the iobridge site and signed up. It asks you for your confirmation code (which you get via email after your order) and you’ll also have to be prepared to read off the serial number (stamped on the top of your module). Once you’ve entered those you hold down the button on the side of the module till it presents a ‘-’ sign and click “next” on the page.

ioBridge will instruct your module to display 3 random numbers (at least I assume they’re random) and you simply read them off the digital display and enter them into the site. Once that’s been done, you are done. Literally, it’s that simple!

I then plugged my temperature module into the port (which is keyed to only go in one way so you can’t mess it up) and was instantly reading analog input values taken by my sensor off their website! It was a bit unintuative but I realize you can click on the “Raw” specification and convert it to a different unit (in my case Fahrenheit).

From there you can create a widget if you’d like by clicking on the widget menu then selecting “Create Widget -> I/O Module -> Analog Input -> Module Select -> Channel 1″… If that seems complex to you, trust me it’s not. You simply hit “Next” 5 times and ‘viola!

You can change the “Analog Input Scale” here as well and select “Auto refresh” so the data’s automatically updated (or you can click on the number to refresh). From this page you can also easily copy some javascript to embed on your page and you’re done!

If you’ve noticed I’m not much for screen shots but it’s as easy as can be to get running and I’m excited about what’s in store from the company and for me! Until next time, get real… go augment your life!

Update: I forgot to include the widget!
Check this out and see how hot my office gets, even in the winter!