Tuesday, December 29, 2009

The First 10 Things Everyone Does with their New Arduino

A lot of people got Arduinos for Christmas (and holiday) presents. Welcome to the world of Open Source Hardware, DIY electronic tinkering, and learning physical computing and programming... it's a long journey, and I started on it about 2 years ago, and it's been a pretty fun adventure.

As an aside, this is my favorite week of the year, because I have just enough time off from the day job to do some serious hacking. And that's what I'll be doing over the next couple days, getting ready for some serious fun in January.

I don't usually write beginner's guides, because I'm not that good at it, and also because I try to do harder and harder stuff with my Arduino every time, and try to push the limits. There are lots of Arduino tutorials and startup and setup guides, but most of them assume the read has tons of wires, sensors, and - most importantly - a few years of programming experience and are comfortable doing some DIY tinkering. Few of them assume you just have an Arduino, just the Arduino, and only the Arduino... which is what lots of people get and give as Christmas presents (if this past couple of weeks is any indication!)...

So this is my top ten list of fun things to do with a newly-acquired Arduino - I do quite a bit of tinkering with the Arduino, Arduino MEGA, and Illuminato Genesis boards, in fact these days I carry them in my travel bag pretty much everywhere I go, just to play around. The Arduino is like my swiss army knife of electronics, and the Illuminato Genesis is my favorite board for when I want to hack devices, reverse engineer protocols, or do generally "hackier" things.

1 - Make it blink

This one is pretty obvious... just download the Arduino IDE (or the Antipasto Arduino Aardvark IDE for Windows or Mac if you want to play around with some extra features), and then download this code into the main section, run it, and download it to the Arduino board.

2 - Make it blink faster (or slower)

This is almost universally the first thing anyone tries to do immediately after the blinky sketch is up and running... get comfortable with the settings by screwing around with the blink settings, by tampering around with the delay and timer settings. Whenever I'm teaching someone or showing someone else how to use an Arduino, I always suggest changing the timing, or copying and pasting the digitalWrite() and delay() lines several times to get comfortable with the programming language, and to see your code reflected in real time instantly...

3 - Make a function to make the Arduino blink

This is almost like the step above, except that now you're getting comfortable with putting your blink inside a real C function wrapper. The major difference is that I made the void myBlink( void) function. As soon as people get the hang of functions, usually a light goes off in their heads as they figure out the power of modern programming languages: code modularity (a fancy term for little chunks of reusable code):

4 - Send stuff over the serial port from the Arduino to your PC

You can blink an LED, and you can put code inside functions. That means you've now mastered about 90% of the hardest parts of using an Arduino. Now, you want to have the Arduino communicate with the computer. This is a tiny little program that sets a variable, called "counter", sets it to the number 0, then prints a little message "Hello over Serial" from the Arduino to the PC, and then loops the counter from 1 to 25, printing the number over the serial connection. Just type this code into the Arduino IDE window, download it to the Arduino, and then open up the Serial Monitor (that's one of the little blue buttons underneath the menu bar):

5 - Merge the LED blinking with the Serial

I think it's pretty cool how quickly things can add up when you have the basics down. This is basically the same thing as the previous sketches, only added together. Every time the counter reaches past 25 and resets to 0, it calls the blink-LED function, which is the same one we wrote up above - so the functions really are re-usable...

6 - Send something from the computer to the Arduino... and back...

Now we want to send something from the PC to the Arduino. Put this code onto the Arduino, then open the Serial Monitor again, and this time in the little box next to the send button that shows up, type a character, and press the Send button. The character will get echoed back. For instance if you type and send "a", you'll see the "> a" come back. This is literally the same thing as the serial read example except with no comments, which get in the way. By the way, I also encourage anyone new to Arduino to type this out by hand, instead of just copying and pasting, because it seems to give a better idea for what each line of code does.

7 - Combine the Serial sending with blinking

This time, we'll add the code function for the LED blinking, and a couple lines of code that basically say, if the character we sent from the PC to the Arduino is the letter "a", then blink the LED light in the myBlink() function:

8 - Put everything together in one big mega program - count, blink, echo, and blink again

This one's pretty self-explanatory. Now, we've just added all the components together. All the variables get defined up at the top, the serial connection gets initialized in the setup() function, the counter cycles from 1-25 over the serial connection, blinks every time it reaches the top, checks to see if the PC sent a character, if we did, the Arduino will echo the character back to the PC, and if that character is the letter "a", the Arduino will blink again.

9 - Copy and paste the following code:

The Arduino is all about copying and pasting code. This is hugely helpful, because it speeds up hacking, but it's kind of like how word-checker is destroying my abaility to spell words :-) If you always just copy and paste stuff, it's no fun because half of feeling comfortable programming and hacking with the Arduino is feeling comfortable pulling code out of thin air, and experimenting with the syntax... but that's just my opinion!

int counter = 0;
int ledPin = 13;
int incomingByte = 0;

void setup() {
Serial.begin(9600); delay(100);

void loop()
if(counter == 25) { counter = 0; myBlink(); };

if (Serial.available() > 0) {
incomingByte = Serial.read();
Serial.print("> ");
if (incomingByte == 'a') { myBlink(); };


void myBlink( void) {
digitalWrite(ledPin, HIGH); delay(500);
digitalWrite(ledPin, LOW); delay(500);

10 - Meet people on the web who use Arduinos

Arduino is about the interweb, and forums, and chat rooms, and blogs, and twitters, and youtube instructables and vimeo facebook wallposts and all kinds of "social media" that I have no idea how to use, but am trying to learn.

It's also about being an open community, and instead of so many types of technologies and new things that are inaccessible and hard to learn, Arduino is about sharing and hacking with other people. So in that spirit, please email me, or twitter me, or whatever!

2010 is going to be a year filled with Arduino hacking for me, and my goal is to meet as many other fellow hackers as possible, and to show off more cool Arduino hacks :-)

inthebitz at gmail

Thursday, December 24, 2009

Smart grid meets ... cake?

Dave sent me a photo of the coolest cake I've ever seen. Of course I'm partial. This is a DIY hand-made cake (something that if far beyond my abilities), made in the form of an Illuminato X Machina.

The resemblance is ridiculously amazing. The details, even down to the exposed solder pads that hold the advanced "weapons-grade" power sensory chips, has been replicated. Using large slabs of chocolate, the chef of this cake replicated the quad connectors too.

Totally ridiculous. Dave is checking with the chef to see who it is that I can give proper attrition (nutrition? ha) to for this work of art.


Sunday, December 13, 2009

Open Source Licenses and Business Models

Recently, I’ve been a bit disturbed by the quality of discussion on Open Source Hardware, and I want to do something about it. I want to up the ante :-) I’ve seen people who aren’t lawyers, and who aren’t experts in law, making comments about Open Source licenses, and I’ve seen a handful of people who don’t run businesses and don’t understand business models writing about Open Source business models. This is funny to me. I want to try things that are different, but I want to be thoughtful about them, because if Open Source Hardware is really going to become something new, and if it really stands for something different and creative, then it should be treated that way! I’m not trying to be discouraging, actually I think it’s great that people write and do Open Source Hardware. Instead, I want to address people like consultants and writers who make money by following trends rather than contributing to them – Open Source Hardware means something important to me, and I don’t want it to be trivialized by some newspaper editor looking to boost his struggling paper’s sales... oh well, I guess everyone needs a good rant from time to time :-)

So here’s what I’m going to do about it:

Over the next couple of months, I’m going to interview friends of mine that are lawyers, especially intellectual property and contract lawyers, and I’m going to talk to professors of law and business here in Boston. My goal will be to understand, really, what the issues are behind Open Source Hardware as far as intellectual property and legal strategy are concerned. On the business side, I’m going to try to categorize and model, analytically, the economic and business operating models that have sprung up for Open Source Hardware. That way, I’ll be able to compare and contrast Open Source Hardware business models with traditional ones, to understand what, if anything, is the same or different about them.

I did something like this last time, and it turned into the Open Source Hardware Bank project, which currently has over $90,000 "invested" in various Open Source hardware projects (a lot more than I ever expected!) And all but one of those projects came from the internet, from people reading about the Open Source Hardware Bank, and who liked that Justin and I were trying to think about really new models for financing a small set of Open Source hardware products, especially in the middle of the Great Depression 2.0.

I’m going to try to follow the Socratic process, and ask questions as I go. Like all my research projects, I'm going to start with a list of questions, and expand them and develop them over time. This is definitely not a definitive list, but a starting point. I want to address questions like:

Open Source Hardware Licenses

  • What is an Open Source Hardware license?
  • What licenses are people currently using, what are they trying to protect, what are they giving away?
  • What are the major components of an Open Source Hardware license?
  • How is it similar and different from Open Source Software, or from traditional hardware licenses?
  • What is the relationship between Open Source Hardware and intellectual property? Patents?
  • How would the District Court and Supreme Court rule if they found someone Infringing an Open Source Hardware license?
  • How would a legal team establish precedent for OSHW violations and protections?
  • What are the community and internet expectations for an Open Source Hardware license?
  • Which freedoms and liberties in usage of OSHW projects and products previously protected or covered by other forms of intellectual property protection, e.g. “trademark”, “copyright” law?
  • What are the major trends in intellectual property protection, and how do they apply to the sharing of tangible projects online?

Open Source Hardware Business Models

  • How are people making money in Open Source Hardware today?
  • What’s the market size for Open Source Hardware?
  • Who’s participating in Open Source Hardware?
  • What is the role for companies vs. individuals in the OSHW “market”?
  • What are the major OSHW platforms and how are they different?
  • When is a business’ products Open Source Hardware?
  • What is the relationship between today’s Open Source Hardware movement and the traditional electronics and semiconductor industry?
  • Where does Open Source Hardware profit come from, how is it generated, what mispricing is it taking advantage of?
  • Do traditional business strategy concepts apply to Open Source Hardware?
  • Innovation in business models is a term thrown around often, how do those concepts apply to hardware?
  • What are the major trends in hardware production business models? Especially in the internet age of advertising and link and connection-based payment models?
  • Does Open Source Hardware work best on or off the internet? Who are the companies or entities most threatened by Open Source Hardware? Who is most advantaged?

This is an Open Source research project, and I want to involve as many people as I can. I’m going to start with interviews, then do some analysis and research of my own, and finally publish everything in a report in the new year. If you want to be a part of the research project, just let me know at inthebitz at gmail…

Also, if you want to add questions to my list, just shoot me an email!

Here goes nothing :-)