Monday, January 4, 2010

Open Source Hardware, Gadgets, and a StickyNote App

I promised that I'd have more time than normal this past week, and it turned out to be true. I've been making lots of progress writing up my notes from my interviews on Open Source Hardware, and more importantly, I've had time to write some new code... like this blog here...

If Open Source Hardware is to succeed, it's going to be because it allows everyday hackers to build things, like gadgets, faster and cheaper than they could the "traditional" way. By traditional way, I mean the sell-your-soul-to-a-large-company-by-signing-up-for-a-crappy-2-year-contract-thinking-that-there'd-be-an-app-for-that-only-to-realize-that-the-apps-are-all-closed-source-you-can't-run-your-own-code-without-violating-the-warranty-and-the-AT&T-network-is-slow-and-sucks.

There are problems with the old model. One problem is that closed and proprietary are meant to protect the average consumer from screwing up their devices, invalidating their warranties, and costing companies $$$ in tech support fees. That may have been the case 15 years ago, but is it still the case today?

I just came from visiting my family, and the elders were talking about CDMA vs. G3, the children were scrambling around the tree looking for properly set voltage wall-warts, and the mothers are talking about how BluRay format is sharper but the density of the media suffers, and even the family toddler was crawling around with a blackberry that he pressed to make the screen glow.

The "average" is definitely getting more tech savvy.

Here's a very specific example: my cousin is 12. She has jailbroken her iPhone because "all her friends at school are doing it." A 12 year old girl is breaking the law, because it's socially acceptable to be a hardware/firmware hacker. Of course she probably wouldn't call herself a "hardware hacker", but the point is:

Jailbreaking an iPhone is a gateway drug to Open Source Hardware.

One minute you're thinking, "I wish I could make this device work differently," and the next minute, you're thinking, "I wish I could make it run different code, I wish I could put another button on it, I wish I could put a bigger storage drive on it, I wish it had a different wireless protocol with longer range."

Well, it's not going to happen instantaneously, but I think we're getting there. I tried a little experiment... I've always wanted to make myself a desktop digital sticky-note application, but never had the right parts lying around to pull it off. I timed myself in trying to figure out two different ways to do it:

1) Use Open Source Hardware and Software modules based on the Arduino (e.g. what I'm used to)
2) What it would take to write the same program on my^D^Da jailbroken iPhone

It didn't take long to figure out that the easiest way to go is with the commercial SDK. The jailbroken way is really messy, and would take months. Meanwhile, I took some of Chris' old code, and made my Arduino-based stickynote program in 2 hours and 15 seconds, flat.

Now someone else could take the code, and since it's open source, they could tweak anything they wanted in seconds, and have a perfectly customized Arduino-based StickyNote app :-)

Here's a picture of all the modules, including an Arduino, a TouchShield Slide, a ButtonShield, an ExtenderShield, and a Lithium Backpack:


This is a picture of me holding the finished gadget:

I color-matched the StickyNote app to perfectly match the Arduino IDE:

Here's a shot of the StickyNote app with the lights turned off, so that the OLED is illuminated:

I've uploaded all the code to the Open Source "App Store" over here. The major function is the part where the key presses get translated from the ButtonShield to the Slide, with this code:


if ((pTime-lTime)>300) { //"debounce", e.g. wait a little bit

if (myButt == 0) {
sprintf(out,"",myButt);
} else if (myButt == 61) {//newline
lTime = pTime;
pouty += 1;
poutx = 1;
} else if (myButt == 63) {//space
lTime = pTime;
poutx += 1;
} else if (myButt == 62) {//popup keyboard display
lTime = pTime;
if (keyout) {//hide the keyboard
fill(33,104,134);
stroke(33,104,134);
rect(1,190,320,190);
maxrows = 24;
keyout = 0;
} else { //display the keyboard
fill(4,79,111);
stroke(4,79,111);
line(0,190,320,190);
rect(0,190,320,190);
maxrows = 18;
stroke(0,0,0);
for (int i = 97; i<123; keyout =" 1;" ltime =" pTime;">
Here's a video walkthrough:







No comments: