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 ;-)