Thursday, May 29, 2008

The Customizable Gamer is Still Vapor

Project Update:
I have been researching my Customizable Gamer for the past week and decided a few more things about the device.
  • I scratched the buttons idea and decided to go with a touch panel for my buttons. The reason I decided against the buttons was the touch panel can allow for multiple buttons all on the same panel.
  • I scraped the Liquidware LCD screen. The screen I found is very similar to the one on Liquidware except it larger and has a pre-mounted touch panel.

Larger = Better :o)

  • Other developments include choosing a processor for the project; in my case I chose the ATMega 256 series of Atmel microcontrollers. The 256k of program memory might be a little over kill, but I want plenty of room to code in tons of games and bitmaps.
  • Finally, I decided what my first game would be. Some may consider it an archaic game, but I have plenty of fond memories clicking the up down arrows of "Pong".

Update on multiprocessor Arduino

I've made it to a couple of major milestones in the software development so far, most notably:

  • Daisy chained communication between Arduino's
  • Very basic Map-Reduce algorithm (thanks, Google!)
  • Basic network-level routing protocol
  • Multi-port power across 5 Arduinos
All in the name of progress ... but I still haven't assembled anything yet, so there's not much to talk about.

The biggest challenge I'm having is trying to imagine a form factor that will allow me to have compressed access to each Arduino, while allowing expansion through shields, etc.

Time to spend some quality time with the white board, and browsing the net for some non-traditional approaches to embedded parallelism. Let me know if you know of anything cool I should look in to!

Wednesday, May 28, 2008

TouchShield 2-Axis Accelerometer Graphing

Here is the TouchShield and Arduino reading and graphing the output of a Parallax dual-axis accelerometer. This is first time I've played with one these things. They're so cool!




Drop in the graph-002 TouchShield library to give graphing functionality.


Here is the TouchShield code (touch):

#include
#include "math.h"
#include "string.h"

unsigned char x,xl,xh,i,yl,yh;
unsigned int adc;
unsigned int xacc;
unsigned int yacc;

char out[4];
COLOR blue = {0,0,255};
COLOR black = {0,0,0};
COLOR green = {0,255,0};
COLOR yellow = {255,255,0};

float scale = 0.00488;
float result,sum;


barGraph myBarX = barGraph("Xaccel",2,10,120,30);
barGraph myBarY = barGraph("Yaccel",2,70,120,30);


void setup()
{
image_interface_begin();
Serial.begin(9600);

myBarX.setColor(green); myBarX.setPrecision(0); myBarX.setMinMax(0,400);
myBarX.refresh();

myBarY.setColor(yellow); myBarY.setPrecision(0); myBarY.setMinMax(0,400);
myBarY.refresh();

}


POINT p;

void loop()
{

xh = Serial.read();
delay(1);
xl = Serial.read();

delay(1);

yh = Serial.read();
delay(1);
yl = Serial.read();

adc = (xh << adc =" (yh">




And here is arduino (base):

#include

#define rxPin 3
#define txPin 2
#define xacc_pin 7
#define yacc_pin 6

unsigned int xacc,yacc;
SoftwareSerial mySerial = SoftwareSerial(rxPin, txPin);
unsigned char x;

void setup()
{
pinMode(xacc_pin,INPUT);
pinMode(yacc_pin,INPUT);
pinMode(rxPin,INPUT);
pinMode(txPin,OUTPUT);
mySerial.begin(9600);
Serial.begin(9600);
}

void loop()
{
xacc=0;
yacc=0;

delay(5);


while(digitalRead(xacc_pin) == LOW){;}
while(digitalRead(xacc_pin) == HIGH){;}
while(digitalRead(xacc_pin) == LOW){;}

while(digitalRead(xacc_pin) == HIGH)
xacc++;


mySerial.print((unsigned char)(xacc>>8));
delay(5);
mySerial.print((unsigned char)xacc);

delay(5);


while(digitalRead(yacc_pin) == LOW){;}
while(digitalRead(yacc_pin) == HIGH){;}
while(digitalRead(yacc_pin) == LOW){;}

while(digitalRead(yacc_pin) == HIGH)
yacc++;


mySerial.print((unsigned char)(yacc>>8));
delay(5);
mySerial.print((unsigned char)yacc);
Serial.print(yacc);
Serial.print("\r\n");


}



Feel free to change the graphing colors or graph style to make your application unique.

TouchShield: Mac OS X Image Uploading!

In the past, Mac users had to flip over into Windows XP to send their bitmap images to the TouchShield. That was then, and this is now...

because there is a TouchShield bitmap image uploader for Mac OS X!

Thanks to everyone for all your help!

The files are rubyUploader-001.zip and touch-007(mac).zip and are posted on liquidware.org as interim releases for testing. When it's free of bugs, it'll be merged with standard touch core and released as the touch-008 release.

It should even run on other *nix OS's too!

What you'll need,
rubyUploader-001 (rubyUploader-001.zip)
TouchShield Arduino API (touch-007(mac).zip)


The TouchShield code,

COLOR blue = {0,0,255};
COLOR black = {0,0,0};
COLOR white = {255,255,255};

void setup()
{
lcd_puts("Starting...",0,0,blue,black);
image_interface_begin();
lcd_clearScreen(white);
bmp_draw("applelo",20,10);
}

void loop()
{

}

Upload the above app to the TouchShield.

Then execute,
# ruby rubyUploader.rb -port /dev/tty.usbserialXXXXX


Remember, you need to replace XXXXX with your correct serial port.

rubyUploader takes any 24-bit bmp images that are in the script's directory and sends them all to the TouchShield.

Good luck,
Chris

Questions? Leave a comment, or shoot me an email: avrman@gmail.com

The Road to a Sustainable Open Source Hardware Community

As Matt suggested in an earlier post, there are four main barriers in open source hardware. Here’s what can be done to overcome them:

Knowledge: Tutorials and Wiki style information
Physical Skill: This takes practice. Maybe we can do something about this through hands-on training workshops
Time: Make collaborative work more efficient
Money: Subsidize costs of development

Right now, the user base will still be fairly small, and investments in innovation will remain at the hobbyist level, with the user footing both time and financial costs of tinkering. The goal will be to go from having these people coordinate only with us, to having them work with one another.

So one approach to this is that individuals contribute to areas where they have a comparative advantage. If you know something, teach it. If you’ve got crazy hands, teach people or use them. If you have time, help someone out. And if you have money, you can donate.

But what does each individual get out of this? Good question. I’ll put it this way. This structure of collaboration, where an individual developer can trade one type of capital for another, allows the community as a whole to create a successful project. Each individual can reap a reward from being part of a successful, productive community, though that reward may not necessarily be financial. It’s almost imperative that this exchange not be (purely) financial in nature. Otherwise that becomes the only reason people do anything, and it is the standard by which they measure their personal contributions and involvement. As a finite and scarce resource, if money is the reason that people participate in your community, you’re going to run out of money long before you get that core group of users going.

Even if all we can tackle all the barriers described above, we’re still missing one thing. The successful community that makes any progress whatsoever must have leaders to guide its initiatives. As a community, our goal is then to have a core set of users that moderates and guides the community. And each project needs a leader as well. This is the key to sustainability.

Sustainability isn’t everything, though. Community growth is yet another issue I’ll try to tackle next time.

Tuesday, May 27, 2008

TouchShield Life by Josh!

Chalk this one up to the coolest thing I've seen someone do so far with the TouchShield - and in record time! This is so cool, I just had to take a video of it.

But first... many thanks to Josh over at www.twilightedge.com for sending this in. Very impressive, and even more impressive given you somehow whipped this together in what - less than a week?

Here are the controls:
  • Tap on screen: Add a Glider at the tap location
  • Double-Tap: Add 10 Gliders at random locations
  • Triple-Tap: Clear screen



So cool!

Here's a link (and a mirror) to the zip file.

Thanks, Josh

Sunday, May 25, 2008

Another way to look at economies of scale

Way back in the Middle Ages, it was all about the individual artisan, the subsistence farmer, those independent workers. Some time after that, these independent workers realized that they could achieve more if they pooled their resources together with those who were doing similar things. In other words, they could achieve more working together than working independently.

It’s a pretty well known concept about economies of scale. Let’s say my neighbor and I are both small time carpenters who make tables. We each have about $500 to operate our business each month. Operating independently, we buy wood in small quantities and work by hand to produce our tables. So we each make about 20 tables a month. Pooling our resources together, we have $1000- which is enough to purchase and operate a table-making machine, saving us time and building us more tables. Not to mention that we can get bulk discounts on wood.

But looking around, you see economies of scale taken just a bit too far. Bloated corporations (I won’t name names) support layers of bureaucracy and middle management that simply don’t add much value. And yes, there is such a thing as having way too many cooks in the kitchen.

Now take a look at your typical startup or small company. Each person plays multiple roles, and everyone must pull their weight for the company to survive. It’s bare bones, it’s lean, and guess what? People are passionate about what they do. There’s no 9-5, no “I’m just doing this so I can watch TV and pay rent”. It’s about making things happen, and maybe they don’t sleep as well at night, but they’ve got a great reason to get up in the morning. And they absolutely love it.

A great example is the difference between big pharma and small biotechs. There are a million and one biotech companies, and 99.99% fail. But I can guarantee you that those folks innovate harder than many a large pharma company. Don’t get me wrong. I’m not proposing anything new here—we all know that pharma is working on reviving that roaring R&D machine so dependent on innovation. However, it seems more and more that biotechs are the ones doing the innovation because they care, because they have to, and because the promise of licensing or bringing their molecule to market could be the best thing in the world. Their livelihood depends on it.

In the past five or so centuries, we’ve gone from independent agrarian lifestyles to the extreme economy of scale. It’s time to find a solution that works. Keep that independent, entrepreneurial spirit while sharing the benefits of economies of scale. What if you had small, lean units doing the innovation, and coming together only when it came time to share resources? Small groups of people innovating, and a place they can go to make those ideas a reality. That’s the vision for the open source hardware community.

Saturday, May 24, 2008

TouchShield: Screen Dimming

On the TouchShield, you're able to control the brightness. Using the right commands, you can raise the brightness to this, Okay, you got me, but you can adjust the brightness using this command:

lcd_brightness(brightnessValue);

You have brightness control in 16 steps.

Friday, May 23, 2008

I Have An Idea

Did you ever have a crazy idea but not know how to build it? I have lots of crazy ideas that never get invented; this is mostly because I don't have the skills or tools to make something real. But I recently came up with an idea for a 3 inch monochrome LCD screen with an AVR. I would use the AVR to control the graphics controller and I would add some kind of button interface. If I was working on this by myself I would probably have trouble getting the LCD screen programmed.

I like to call this the "Customizable Gamer". I would create tons of different games for it by using a variety of line and shape algorithms. It would be like a customizable Game Boy that anyone could hack. If I was building games by myself I could probably only make a hand full of games a year, but if I had some help I could create exponentially more games and graphics.



I am going to use the LCD screen on the Liquidware store as a starting point for this invention. Once I get this running, it could be an endless source of entertainment. If anyone has any suggestions, please feel free to add to the design on Liqudware.org

Happy Hacking

Thursday, May 22, 2008

Towards a scaleable platform for modularity

My background is in computational algorithms and computer architecture. One of the basic tenets of architecture design is that whenever you have a basic building block defined, it's important to create scalable interfaces for the platform. Most people would agree that the Arduino is today's leading module in the emerging community and field of open source hardware.

The Arduino, however, is a rather elementary unit of computation compared to modern devices. I can see it moving forward in three meaningful directions:

1) increasing the performance of the individual platform
2) providing the ability for multiple blocks to expand through add-ons
3) providing a way for modularity

The first is a source of constant debate, but it would raise the price of the basic unit to a point where it might be cost-prohibitive to the mass group of tinkerers - me included.
The second is the current strategy pursued by most groups, and it revolves around building shields for the Arduino
The third, however, is largely unexplored. If expanded upon, it would satisfy the cost/price constraints, but would also provide a way to address the performance scalability issue. It would allow the Arduino to form the basis for a larger architectural platform of scalable product design.

Where are we today?

There have been two main attempts to my knowledge to experiment with multiprocessing and parallel architecture scaling on the Arduino:

1) "Dual-core" approach, using 2 atmegas sync'd on one chip

http://www.hackaday.com/2008/04/11/dual-core-arduino/
http://blog.makezine.com/archive/2008/04/dual_core_arduino.html



dual168-1.jpg


2) "Dual core" approach, using 2 atmegas on a single board

http://www.electronics-lab.com/blog/?p=1811



So I'm about to start on a third approach in the coming weeks. My goal is to create a scalable, dynamic hardware system with the Arduinos!

A Community of Teachers

I think it is safe to say that all of us go to bed at night (or in the wee hours of the morning if you can't pull yourself away from your new Touchshield) having learned something new that day. In the realm of open source hardware (OSH), it's almost impossible to not learn something new every time you tinker. The best part about this community is that everyone has the same goal which makes it easy for us to relate, learn, and help one another increase our production of newer and cooler products around the clock. What is this goal you ask? World Domination. But you already knew that didn't you.

I'm constantly looking for ways to teach more people how to use OSH and make product design easy and accessible for anyone interested in developing their skills and our community. How can we make the Arduino a more simple building block for newer hobbyists and electrical engineers to create less complex devices?

Personally, I find OSH to be a "learn by doing" experience. Every bit of input or help I can get to give me the feeling that I did something myself is invaluable. Take this opportunity to respond to blogs and comments from people that are new to the community and you will go to bed having learned of your previously untapped potential as a teacher.

Wednesday, May 21, 2008

TouchShield: Serial Communications

Overview,
This shows you how to send the state of a pin from the Arduino to the TouchShield and display it's state on the OLED.

With the help of LadyAda's softwareSerial fix, I was able to communicate with the TouchShield via serial. This allows me to let the Arduino do the hard stuff like signal processing, freeing up the TouchShield to display the data and handle touch events.





Arduino,
Sending a message....

First, fix software serial bit timing by downloading ladyada's softwareSerial2

Define constants and display global variables

#include "AFSoftSerial.h"
#define RXPIN 3

#define TXPIN 2
AFSoftSerial mySerial = AFSoftSerial(RXPIN,TXPIN);


The next block of code is the setup routine. This is where I'll make the Arduino's pin an input and set the baud rate to 9600.

void setup()
{

pinMode(RXPIN, INPUT);
pinMode(TXPIN, OUTPUT);
mySerial.begin(9600);

pinMode(9,INPUT);
}


In the main loop, I read the state of the pin and Transmit a byte to the TouchShield.

void loop()
{
mySerial.print((unsigned char)digitalRead(9));
delay(100);
}

TouchShield,
Reading a byte and displaying the state...

Initialize the TouchShield's serial to 9600. Remember, the Arduino has a small delay before it exits it's bootloader.

COLOR blue = {0,0,255};
COLOR black = {0,0,0};

void setup()
{
Serial.begin(9600);
}

void loop()
{

if (Serial.read() )
lcd_puts("HIGH",60,60,blue,black);
else
lcd_puts("LOW ",60,60,blue,black);

}



As you can see, because the communications interface is simple, you can create more complicated code elsewhere ;-)

Hilary and Obama Debate... on my Arduino?

In the spirit of the United States Primaries I decided to reenact a debate between Barack Obama and Hilary Clinton.
I first asked my friend Billy to play the part of Obama...
But he didn't respond positively.

So I asked another good friend of mine...
Me- "George, do you want to reenact a debate with me?"
George- "Yeah, I love debates."
Me- "OK, you can be Hilary and I will be Obama."
George-

Me- "A simple no would have been sufficient."
But unfortunately no one wanted to play with me; so I enlisted the help of my Arduino and TouchShield.
1. Uploaded some pics using the ImageUploader
2. Wrote some code:
void setup()
{
if ( touch_get_cursor(&p) )
{
bmp_draw("obama01",0,0); //draw the bitmap
}
while(1); //wait forever
}
3. Brodcasted the debate live.

Tuesday, May 20, 2008

The For-Profit Business Model for Open Source Development

I know most of you guys are techies, but for the pie-in-the-sky theorists out there, this one's for you. When I discussed the nonprofit model and the long tail of consumers, I promised you one more piece of the puzzle, or at least my thoughts on it. The nagging question:

How can we, as a community, develop a profitable business model around open source?

Everything that’s already been done with open source software suggests releasing software into the open source world as a way to gain market share and win recognition as a platform on the basis of being free, constantly improving, and extremely customizable. Then companies generate revenue by providing support, consulting and other services off of the open source software. Open source software has had a fundamental issue in generating revenue intrinsically, as the product itself is free. But that doesn’t mean it’s not possible. And open source hardware, as it is deals with a tangible product, is another creature entirely.

Fundamentally, we are dealing with three “moving parts”. They are somewhat interdependent, too, so the choices made in one category may affect the options available in the second category.

1) The range of open source or closed source: do we want to be entirely open source, entirely closed source, or a mix of both?
2) Where is the income coming from? Donations, publication/book/speaking engagements, low/high margins on manufactured components, or low/high margins on a finished product (like an assembled combo kit with a case), closed source software, etc.
3) What is the income going towards? Back to the community to facilitate/subsidize prototyping costs, paying dividends on investors’ equity, etc.

The final piece of the puzzle that isn’t “moving” is, as I’ve mentioned, the fact that there is a tangible product involved. What this means is that there is some cost involved in production and distribution—and in turn, a justifiable market price. Benkler poses the argument based on the efficiencies of free access to information, and he has a great point. But the argument can be made with information because the costs of dissemination are marginal.

Where many see it as a hurdle in open source hardware development, the tangible property of the product may in fact be the opportunity that “saves” the paradigm from relying purely on donations and volunteer work of developers. How about answering the three questions above as follows?

1) Open source with designs and software, but manufacturing is “closed”. Manufacturing, distribution and retail are done independently as the revenue generating component of the process. However, these hardware manufacturers must pay 5% royalties on each sale, to be distributed in an incentive structure based on a community developer’s contribution to the project. Should this work, the incentive structure would need to be very well thought out. Pricing of the manufactured product should be at a moderate margin—high enough to fund the community and incentivize production, but low enough to be a cost-effective, customized option for consumers.
2) The income would come from the sales of hardware devices to end users, as well as the purchase of prototyping components by developers within the community. Donations are also accepted.
3) A fraction of the income will go to the community site for maintenance purposes and to pay the “centralized” people whose full time job it is to make sure open source hardware design can happen. This income will also fund community matter such as grants, pro-bono projects, competitions, and in-person workshops.

Craigslist asked its community members to help decide on a “business model” to sustain them, so I thought I’d turn to you as well. What do you think?

Monday, May 19, 2008

+10V Underwater!

While playing around with the new Ballistics-proof cases, I noticed there's a rubber gasket around the sealing edge of the case. Why is this there?

One possible explanation is to keep out water. So in the spirit of breaking things, I took a 10v power source, an LED, and the case to test and see if it was in fact, watertight!


Ballistics Case

10V Power Source:
Building +10V battery source to power an LED is a snap using Lithium backpacks.

Lithium Backpacks have +5v


Now two wired together to make 10V


Put into the Ballistics Cases


Here it is about to get dunked into the soapy water!


And the Video

Results: It survived!

FLIR Lithium Backpack

I used a Forward Looking Infrared camera (FLIR) to take pictures of my Lithium Backpack.

The original Lithium Backpack from the Liquidware community.





In this picture the Lithium Backpack was warmer than the air. The whiter colors represent heat and the darker colors represent a cooler temperature.






In this picture you can see the Integrated Circuits are hotter than the rest of the board. The large white area is the 3.3V regulator and the boost circuitry.

What else should I take pictures of?

TouchShield: SoftLED

Inspired by Matt's bitDJ program, this TouchShield example puts a modern spin on those retro LED matrices. Sure, OLED screens are LED matrices too with one difference, they're the cool kind ;-)



If you look at the code, you'll notice this app builds off the previous pointInRect tutorial post.

TouchShield code,

COLOR BLACK = {0,0,0};
COLOR RED = {255,0,0};
COLOR BLUE = {0,0,255};
COLOR WHITE = { 255,255,255};

unsigned char x,y,state;
POINT p;

void setup()
{
state = ON;
ledControl(state);
drawButton(state);
}

LCD_RECT buttonRect = {10,100,40,120};

void loop()
{

if (touch_get_cursor(&p))
{
if (pointInRect(p,buttonRect))
{

if (state==ON)
{

state = OFF;
ledControl(state);
drawButton(state);

}
else
{
state = ON;
ledControl(state);
drawButton(state);
}

}



}

}

void drawButton(unsigned char state)
{

lcd_rect(buttonRect, BLUE, BLACK);

if (state == ON)
{
lcd_puts("On", 20, 108,BLUE,BLACK);
}
else
{
lcd_puts("Off", 20, 108,BLUE,BLACK);
}

}


void ledControl(unsigned char state)
{
COLOR ledColor = {0,0,0};

if (state == ON)
{
ledColor.red = 255;
}

for(x=1;x<4;x++) y="1;y<4;y++)">

Sunday, May 18, 2008

Ballistics-proof hardware physical computing, anyone?

In the spirit of really cool looking electronics, I'm happy to introduce the Ballistics ProtoHack Pack. It's the answer to portable hardware hacking cases! Open up the blacked-out ballistics case, and inside there's a DoubleWide ExtenderShield, with two mini protoshields for circuit prototyping. There's space underneath, and plenty on top for circuits.



Here's one of my favorite pictures I took tonight, with two red mini protoboards. I almost can't describe it... it brings tears to my eyes :)


The white on black also looks really slick:


I just showed it to some friends, and I can attest that it adds a "wow that's cool"-factor to any standard circuit. Everyone wanted to hold it, and open and close it. I'm thinking the next thing it needs is a sensor that detects when it's opened or closed :)

There's something very aesthetically pleasing, and Feng Shui about circuits lined up in the case:


And here's a shot of the TouchShield Stealth sitting inside the case:

In this shot, you can see the Lithium Backpack that I placed underneath. You can put two batteries underneath, and wire power from the batteries up to the prototyping space on top. It just works:




The only thing I haven't yet worked out is how to fit the Arduino underneath - since the USB type B port sticks out just a little too far. I'll keep experimenting, but in the meantime it's become my new favorite show-and-tell.

You can choose white, red, or black protoboards with the Ballistics pack, over at the store.

Introducing the new TouchShield Stealth

By now, some folks have definitely found this on the store page already. It's the new, all blacked out version of the TouchShield, called the "Stealh" edition. I got a bunch of emails suggesting an all-blacked out version would look really cool on the Arduino, and since green is soooo old school 1980's hardware hacking. The new version also has quite a few new hardware trace route changes, firmware upgrades, and a new method of attaching the cable to the shield.

Here's a new picture of the TouchShield, sitting on top of the Arduino (and taken with my little homemade lightbox):

Here's a slightly different angle:


This picture makes me really jealous of robots... and automatic solder stations. I mean seriously... how does it get so close in there? Sure beats my hand soldering:

The ubiquitous "angled" shot, which seems to be how all the big boys (cough Apple cough Sony cough) take their product photos:

Anyway, the oldie but goodie hand-soldered TouchShield is still available, I've just renamed it to the TouchShield Classic. In the meantime, you can find the new robot-assembled, finely-tuned, perfectly soldered TouchShield Stealth over at the store.

Enjoy!

Keep on rollin' - thanks for writing in!

There are so many people out there to thank for support - I had no idea people would be so creative and helpful in their comments and solutions. Here's a summary of questions I got over the last few weeks. Keep them coming, and I'll keep trying to do my best (some of them are harder than others, mind you).


Can I compile on the Mac as well as Windows with Arduino.exe?
Now you can, thanks to all the help I got from Chris and Mike and even guys who sent in suggestions and debugging error messages. Now it works, and you can read more here.


Can I get a Mac OS X version of TSImageUploader.zip, the image uploading utility?
Yes absolutely, as soon as Mike (cough cough getonit) finishes writing it! All the code is open source, and the routines should be universal serial, so the translation to *nix OS's shouldn't be impossible. Let me know if you want to help...


Does the TouchShield work with the bluetooth Arduino version?
Well, I don't know why it wouldn't, but I've never tested it. In fact, (sadly), I don't even own a bluetooth one yet.... hmmm. Anyone else out there have a different experience? Let me know if you can test it.


Where can I get the TouchShield's screen hardware commands?
Right over here... (warning PDF alert): http://www.liquidware.org/uploads/idea74/SSD1339_1.7.pdf


What is the most fragile part of the TouchShield, so I don't break it when I put it on my vibration-mounted remote controlled robot?
The connector ribbon from the shield to the OLED screen. And good luck with that robot, sir! I can't wait to see what it looks like :)


What happened to your shipping costs? Why were they so high last month, and now like half as much?
Because liquidware is not a big company (and I don't want it to be one because that means using big words and being in meetings all day, which means less time just making stuff), Paypal doesn't give discounted shipping rates unless you break like $1M in monthly shipping sales. I was about $5 short last month :-), so I called them and convinced them to bend their policy a little. In reality, I decided to offer USPS for shipping, since one of my friends works at USPS, and drives by Chris' house every night to pick up packages for shipping the next day. We save $40 on all international shipping that way!


How can I access power on the battery shield? How do I make sure I don't plug into the wrong port?
Simple! Just flip the board over, and you'll see I printed out the markings on the back of the board, in order. Same thing with the touchshield. I hate spec sheets more than anyone in the world, and I like to tinker with stuff in realtime (physical computing?). So I think all parts should be self-labeled and self-explanatory. The only thing I couldn't fit on the TouchShield is the rest of the software API (but I definitely tried).

TouchShield: Did you just touch my RECT?

It's a good question: Was a touch press inside a particular area?



Using a helper function,

pointInRect();

We now can do stuff if an area is touched.

But first, how do we make a rectangle? Let's introduce you to a new type on the TouchShield,

LCD_RECT button;

This creates a rectangle named button. It is initialized this way,

button.left = 0; button.top = 0;

button.right = 80; button.bottom = 60;

Or if you're more hardcore and like shorthand,
LCD_RECT button = {0,0,80,60};

Either way you chose to create it, the rectangle is 80 wide by 60 tall, and starts at location (0,0).

Don't believe it's that easy and still skeptical? Then lets prove it by drawing it on the screen. To do this, we first need to open the Crayola box and grab a color,

COLOR blue = {0,0,255};


You can now draw it,

lcd_rect(button, blue, blue);


Now that we've got that covered, lets do something with our fancy pointInRect function.

As the function name tends to suggest, pointInRect needs a POINT and an LCD_RECT. We've got the LCD_RECT covered, now B.Y.O.P. (bring you're own POINT).

POINT p;


And call pointInRect like this,

if ( pointInRect(p, button) )
//button pressed, do something!


Let's put it all together and paint the button if it was touched. We'll do this by polling the touchscreen. Here is the (complete) code,

COLOR blue = {0,0,255};
LCD_RECT button = {0,0,80,60}; //initialized hardcore style
POINT p;

void setup() { ; }

void loop()
{

if ( touch_get_cursor(&p) )
{
if ( pointInRect(p, button) )
{
lcd_rect(button, blue, blue);
}
}

} //loop



See how simple yet powerful the pointInRect function can be?

Friday, May 16, 2008

TouchShield: Text & Touch Example

Overview
So you have a bunch of strings already and now you want to loop through them on the Touchshield with a touch?

Once you're all done, you'll see how Mike make the sketch with some really corny jokes, and his video to prove it.



Initializing
We'll store the strings in RAM as opposed to FLASH to make it easier to understand.

char myStr[][200] = {

"1f u c4n r34d th1s u r34lly n33d t0 g37 l41d",
"Microsoft: You've got questions. We've got dancing paperclips.",
"There are 10 types of people in the world: those who understand binary, and those who don't.", "My pokemon brings all the nerds to the yard, and they're like you wanna trade cards? Darn right, I wanna trade cards, I'll trade this but not my charizard.",
"If at first you don't succeed; call it version 1.0", "I'm not anti-social; I'm just not user friendly", "Alcohol & calculus don't mix. Never drink & derive", "File not found. Should I fake it? (Y/N)",

};

If you use the helper function i've included at the end, you can print each string with word wrap by calling this,

print(myStr[0],0,10);

Which prints the first string starting at column and row (0, 10).


Touch Events
You can loop through the strings by polling the touchscreen. This is done by creating a POINT this way,

POINT myTouch;

And testing the return value of a called function,

if (touch_get_cursor(&myTouch))
{
print(myStr[1],0,10);
}


If the function returns TRUE, then the screen coordinates are stored in myTouch.x and myTouch.y For this example, we're not do anything with the coordinates beacause we're just polling for a press.

Main Loop
So putting it together, we have the code below which loops through the halarious (corny) jokes.

void loop()
{

if (touch_get_cursor(&myTouch))
{

lcd_clearScreen(black);
print(myStr[x],0,10);

if (x>7)
x= 0; //loop back around

x++;

}


}


And the entire code with the print() function,

//Global variables
char myStr[][200] = {

"1f u c4n r34d th1s u r34lly n33d t0 g37 l41d",
"Microsoft: You've got questions. We've got dancing paperclips.",
"There are 10 types of people in the world: those who understand binary, and those who don't.", "My pokemon brings all the nerds to the yard, and they're like you wanna trade cards? Darn right, I wanna trade cards, I'll trade this but not my charizard.",
"If at first you don't succeed; call it version 1.0",
"I'm not anti-social; I'm just not user friendly",
"Alcohol & calculus don't mix. Never drink & derive", "File not found. Should I fake it? (Y/N)",

};

COLOR txtColor = {100,255,255};
COLOR black = {0,0,0};
unsigned char x=0;
unsigned char row=0;
unsigned char col=0;

void setup()
{
;
}

POINT myTouch; //a point for the touchscreen press.

void loop()
{

if (touch_get_cursor(&myTouch))
{

lcd_clearScreen(black);
print(myStr[x],0,10);

if (x>7)
x= 0;

x++;
}

}


void print(char * s,unsigned char x, unsigned char y)

{

col = x;
row = y;
unsigned int len = strlen(s);
while(*s)
{
if (s[0] == '\r')
col = 0;

if (s[0] == '\n')
row +=8;

if (col > 120)
{
col = 0;
row +=8;
}

if (row > 127)
row = 0;

lcd_putc(s[0],col,row,txtColor,black);
col+=6;
*s++;
}

}

TouchShield: Bitmap Bouncing Ball

Simple motion on the TouchShield is easy with bitmaps. This is a short tutorial on how to do it.





I found this picture of a ball which is pretty nice because it has a black outline around it, the black helps make motion look much smoother, because you don't have to erase the whole image when moving it a small amount.



Remember: If your saving the image from the web, make sure it's saved in 24-bit color bitmap format.

We can then upload it to the TouchShield using the TSImageUploader program, read on for more.

Steps
1. Enable the TouchShield's image downloading interface
2. Open the image in TSImageUploader
3. Send the image
4. Call up the image in your TouchShield app


Step 1:
We enable the image downloading interface by calling this function on the TouchShield,

image_interface_begin();

This makes the device hold the Arduino in reset while it waits for images from TSImageUploader. Images are sent to the TouchShield at over at 1 MegaBits/sec, thanks USB!

I usually call this as the first thing I do in my setup() function.

Step 2:
The TSImageUploader PC app program does a couple of things, mainly it reformats and sends optimized bitmaps for display on the TouchShield.

Did you know... the TouchShield's OLED hardware connections were optimized for displaying 24-bit bitmaps?! Check out liquidware.org for schematics.

Make sure you remember the name of you bitmap so you can call it up later, duh.

TSImageUploader also can do tricky things to your filenames, so try and keep them to exactly 7 characters in length. If you don't just remember,

ball.bmp becomes "ball[space][space][space]"

and

myNiceBall.bmp becomes "myNiceB"

Allowing larger file names might be a feature supported later, but for now it's something you should remember.


Step 3:
This step is easy, as long as your program is executing the image_interface_begin(); function, then just press the "Burn Bitmaps" button on TSImageUploader. The output window will say when it's finished.

When it's finished uploading, the TouchShield brings the Arduino back out of reset and continues running your app.

Step 4:
Since I named my bitmap's filename ball.bmp, I would call the image up by sending the TouchShield a new app from the Arduino IDE calling this function,

bmp_draw("ball ",10,10);

Which draws ball at location (10, 10) on the screen.

Once your image is downloaded, it is stored in Flash which means it stays there after power cycles.

Remember: Make sure and comment out the image_interface_begin(); function call in subsequent sketches because we don't want to download bitmaps anymore, of course.


Thats it!

I have attached the code that bounces the ball around the screen below.

Also note that the image is a little messy and leaves a blemish when it's moved to the right. To fix this, you'll see an lcd_rectangle() painting black over a small portion of it's right side removing the blemish left behind after it moves.

Here is the code,

COLOR black = {0,0,0};
char imgSize = 32;
char dirx = 2;
char diry = 1;
char xPos=20;
char yPos=1;
unsigned char xPosPrev = 0;
unsigned char yPosPrev = 0;

void setup()
{
//calling the image downloader
// image_interface_begin();
}

void loop()
{
//move the img
xPos+=dirx;
yPos+=diry;

//off screen check
if ( (xPos > (126-imgSize)) (xPos <>
dirx*=-1;
if ( (yPos > (126-imgSize)) (yPos <>
diry*=-1;

//erase the blemish!
lcd_rectangle((xPosPrev+imgSize),yPosPrev, xPosPrev+imgSize+1,yPosPrev+imgSize, black, black);

//draw the image!
bmp_draw("ball ",xPos,yPos);

//save coordinates
xPosPrev = xPos;
yPosPrev = yPos;
}

Thursday, May 15, 2008

Use an Arduino, save a penguin!

A common question about the ExtenderShields we've been getting is asking whether the Arduino can be installed underneath the top OR bottom, left OR right. The answer is yes!


Just remember, on the DoubleTall ExtenderShield, the bottom Arduino area is rotated 180 degrees from the top. It's designed that way to allow future BackPack designs to exit wires cleanly.

As a suggestion, it's helpful to have something under the "other" area, like stand-offs,


or a Lithium Backpack (includes stand-offs) to support your device when it's on the table.

Playing around, but learning and building as we go

Whether you are an open source hardware (OSH) novice, or someone with a PHD in electrical engineering, I'd like to make "playing" with OSH not only fun for apt engineers, but also a learning experience for all us "newbies". I hope the videos I’ve posted over on youtube have been helpful, and there are definitely more to come....

Matt, Mike, Chris, Justin, and I have been crunching late into the night with all the great feedback we've received. Thanks to all the very motivated and helpful tinkerers out there, we've accomplished a great deal in just days! We have fixed Arduino core syntax errors on Mac OS, we've upgraded the firmware core, we've built more optimized serial transmission code for the whole Arduino community, and some especially cutting edge work has even started to push animation on the Arduino... crazy indeed.

This is so cool, and it's made even cooler by the fact that contributions have come flying in from England, Japan, Australia, and almost everywhere you can imagine in the US.

Thanks :)

Wednesday, May 14, 2008

Imagine an Extender Shield

On a boring New Years Day Matt uploaded a crazy picture to Liquidwar.org; this image represented an idea he envisioned. I first looked at the crappy 'MS Paint' image with a lot of confusion; all I saw was a black square with some white lines on it.


I read the title of the Liquid Post, "Arduino Pin Replicator Double Shield", and all of a sudden the ideas started flowing. I could imagine an Arduino with detachable protoshield on one side and an xbee shield on the other end.

After a week of thought I had to put my ideas on the liquidware site, a 'Double Wide' shield would be much better for my application.


So I uploaded another crappy paint image with a horizontal shield layout.


After a few months and lots of thought the Liqudware community came up with the Double Wide Extender Shield, which is shared with the community at Liquidware.com.

Check it out at Liquidware.org.

iPhone Interface

Here we have an example of a slick interface concept on the new TouchShield Stealth which I designed all by myself, haha yea right!

I really just grabbed an image off the web and uploaded it to the display!




One could imagine that it would be pretty easy to take this a step further and clip bitmaps of the buttons in the pressed state to recreate a replica of the beautiful iPhone interface.

Here is the picture I used for reference,

Airplane Arduino with ExtenderShields

Can Arduino's fly? Well Mike seems to think so judging by the suggestive shape of his ExtenderShield arrangement.


The Arduino's I/O connections are replicated out to the wing tips so that one day his GI Joe action figure can fly.

Lithium BackPack Hub

So your mad that you didn't drop the extra $300 on the 17" Powerbook to get an extra USB port?
Don't worry, you can use a $20 USB hub from walmart to charge 2 Lithium HighCap Bakcpacks's at once. Just be sure to bring a charged laptop :-)

Tuesday, May 13, 2008

The Long Tail of Consumers of Open Source Hardware

Back to the heavier side of things, here's something to think about. Who is the target consumer of open source hardware? In a sense, there are two types of consumers, the hardware developers and the end users, and they intersect to some degree. For example, the people using the product in the end may also contribute and customize the product, and vice versa.

To both types, the value proposition is customization. Customization is great for the so-called “long tail” of consumers whose needs are not entirely met by the specifications of general products. The concept is something like 80% of consumer needs can be met by 20% of the products (I’m just making up these numbers, but it’s something like that). Hence the long tail is the 80% of products that meet the remaining 20% of customer needs. Common sense tells most of us to go after the huge 80% chunk of consumer needs. The problem is that common sense talks to everybody, and now you have a ton of people competing to be in the same 20% niche of products.

What does this mean for the long tail? There may be more untapped opportunity in the long tail than there is in the upfront portion. Though the long tail only consists of 20% of consumer demand, it takes 80% of products to meet this demand. This 20% captures the diverse, quirky interests of consumers that don’t exactly align with the mainstream. Because it’s more diverse, it is easier to enter and target a niche in this area.

Another consideration is that some of those who fall in the steep, upfront portion of the curve are there because they compromise and are willing to settle for mainstream items that are already available. These items meet most of their needs, but there are just those one or two things that would be great to have, but since it’s not there, they’ll get over it. What if you could make customization a part of your product? It would be cheap and readily available. Some of these folks who compromised and went with the mainstream option will now have a compelling reason to purchase a customized option. Each customized option caters only to a relatively small number of consumers, which means it falls into the long tail. As more consumers purchase customized products, the long tail will increase, to encompass maybe 30% of overall consumer demand, rather than 20%. While the long tail may never grow to be as big as the mainstream, addressing the long tail presents an even greater opportunity than readily apparent. Due to its intrinsic property of customization, open source hardware presents an opportunity for the large, growing and unsaturated long tail market of consumers.

Monday, May 12, 2008

Touch the Tiger: TouchShield Apple OS X Support

The TouchShield is now supported under Mac OS X!


For some reason the Mac version of avr-gcc wasn't compiled with binary constant support. So a bunch of constant definitions later, you can now happily hack away on your Mac.



Downloading touch-007.zip, extracting the Arduino core, and updating boards.txt is still all that's needed.

Now for something on the lighter side!

All this talk of open source business models and collaboration rules has my head spinning! So I figured it might be nice to change the pace a little with a couple of videos I shot a few weekends ago. Enjoy!

Here's a spoof off the iconic beer commercial we all know and love:



And here's Justin demonstrating the TouchShield compared to other gadgets I own:



And finally, here are Mike and Chris having fun with a little program we wrote to show Geek quotes on the TouchShield:

Thursday, May 8, 2008

Inside the OLED

Have you ever seen inside an OLED?

Yesterday, Mike was looking at some PCBs under the microscope, and happened to scan over the OLED while it was displaying a white image. He snapped a cool microscope video which I thought was interesting,



When the microscope zooms in, notice the LED matrix of individual red, green, blue LEDs. I guess it's confirmed then: Red, Green and Blue, at full intensity, actually does make the color white!

Tuesday, May 6, 2008

The Non-Profit Business Model for Open Source Development

There are two schools of thought on the open source ecosystem. The first is the community, non-profit approach, where things are done for the common good, and in the name of overall progress. The second is the for profit venture that tries to develop a business model around open source components—so that providing the free open source services can also support those who keep it running and incentivize others to join the business.

Let’s start with the non-profit approach as it applies to open source generally. People collaborate in their spare time with a number of non-financial motives:

1) Working with others like themselves
2) Feeling of contributing to a greater shared interest
3) By inviting collaboration, they may receive a refined product serving their specific purposes
4) The size of the contribution can be marginal (e.g., on par with any other hobby or pastime)

Yochai Benkler puts forth a thorough analysis of this phenomenon, and how it could progress in the future. See his full treatise in HTML here (in particular, Chapters 2-4). Information serves greater societal purpose (and is more “efficient” in fueling the production of more information) when producers give the public free access to this information. The idea is that information begets information, and the fewer access barriers there are to information exchange, the more rapidly concept development will proceed. The same concept applies to open access to software and hardware—the underlying information is shared with the public, allowing for more rapid progress.

The natural response is something like this: “I’ve got to keep my work proprietary so I can sell it and feed my family!” This is the productivity problem. Why would someone work for free? And even if they are willing, they’ve got to pay the rent.

In light of this, Benkler proposes a model that takes advantage of the Web 2.0 phenomenon of distributive co-creation. If you take a task and break it down into modular units, each unit being small enough to be considered nominal work, you can farm it out to a large number of people, each of whom can contribute as much or as little as they are able. Spread one task across a large enough number of people, and the effort becomes trivial. As such, it becomes a hobby or side project for those who contribute. Contributors pay the rent with their day jobs, and their open source contributions do not detract from their lifestyles in any way, and may even add to it. So you don’t need to turn a profit or incentivize open source production, as it can be completed via non-market collaboration.

Still then, many argue that though Benkler’s model may work in theory, it is only suited to a very specific set of tasks, and that complex projects requiring higher degrees of organization that cannot be broken down into such granular components will inevitably require centralized direction.

Fair enough. So maybe a few people could be paid full time to provide the centralized direction necessary to organize the broader, decentralized community? These people would have to be funded somehow, but it may be a small, non-profit group funded through private donations. I’ll speak to the for-profit approach in a later article.

Monday, May 5, 2008

What is open source hardware? Part 2

In the first post, I set the stage by describing what appears to be an emerging reality – open source hardware (OSHW). Of course the concept has been around for a long time, but recent developments are finally making it relevant. To summarize, OSHW is yet undefined, though there are plenty of examples out there today. OSHW feels like a decent concept that should take off, but there are still many complicated problems to overcome. For instance, the:

Open source hardware productivity problem

The problem is that open source hardware costs too much for individuals. The initial and recurring investments to participate are too large, and it drives people away. I propose four primary “investment” problems:

Knowledge: it simply takes longer to learn hardware hacking than it takes to learn to code. How many people pick up a dummy/idiot/basic/beginner guide to circuitry and are off and running with a hello world (aka the ubiquitous LED blinker / flasher) circuit in less than 10 minutes? Very few. And fewer still can push to the next stage, because the theory underlying circuit design, including I/O, architecture, buses, directional current, parallel/series, etc. expands exponentially from the initial light-flasher to the more complex.

Physical skill: like it or not, you need stamina, dexterity, and coordination to assemble electronic circuits. Not everyone can learn to be a master watch-marker overnight. Circuits are a little easier than watch-making, but they both require fine motor control, and sharp vision. Attending my fair share of NYC hackfests, makefests, hacklabs, and the like, I can attest to the common sight of guys bent over in frustration, grasping tiny little red, white, blue, green, and black wires with large, frustrated fingers. Punching keys on a keyboard feels like child’s play in comparison!

Time: making physical, real devices take longer than making intangible, conceptual objects of code. Ideas come faster than finished gadgets, just as code compiles faster than real computers get assembled. It follows that making a real circuit takes longer than sketching up code and clicking compile. Worst yet, making real devices takes patience, a scarce modern asset.

Money: if you have the previous 3 bullet points, congratulations! You probably have an engineering or science background (knowledge), played a musical instrument growing up (physical), and are unemployed (time). Now you just need money. Somehow, this seems counter to the previous 3 points – ha! In the first post, you saw that real open source hardware design takes upwards of $10,000. Unfortunately, this amount is simply too large a hurdle for most independent hobbyist tinkerers to stomach. Most people already have the equipment needed to participate in the open source software movement (a computer), but how long will it take before anyone can whip together a soldering station, layered pcb boards, and surface mounted components from materials available around home?


So the real problem here is one of barriers to participation. The reason more people don’t get involved is because they can’t. The problem is that lone individuals typically cannot achieve a sufficient level of knowledge, skills, time, and money to pull it off themselves. Most of them just give up after basic experimentation.

The rest will have to hope that by ganging together in groups, they can achieve a sufficient level of productivity, skill, knowledge, and money to pull it off. But if you invest that much in grouping together, why not just start a company? Why would you give it all away to the open source hardware community?

Part 3… collaboration rules for an open source hardware community

Thursday, May 1, 2008

Lithium Backpack: Charging it


The Lithium backpack not only is a heap of coulombs powering your Arduino based [____ ] but according to the orange status LED, it can also be charged too!



This is how you charge it from 5v...



Plug the Lithium Backpack into the Arduino through the red and black wires (shown above) while the Arduino is powered by USB. The Lithium Backpack automatically senses a power source and charges the battery. Optionally, you can charge through it's USB mini plug.

1000mAH provides a nice helping of juice for a mobile project.

Charging is completed when the orange LED shuts off, making a completely dead battery ready to go in just a couple of hours, which is perfect during your afternoon nap.