Yeah, it's been a nice little vacation from the Zigbee stack for me. You wouldn't believe how fatiguing it is to focus on one thing for a year and a half. The stack became part of my life, like I was growing a third arm (or a third leg...*ahem*). So intead, I've been focusing on building hardware development boards that I can use to set up Zigbee networks for real-life testing of the stack. Although it's going to take some time, in the end, I'm sure it will pay off. There's nothing like having access to a large supply of development boards that you can use as wireless sensor nodes. At least it beats having to purchase something like ten raven kits.

However that's another story. I've been spending a bit of time getting the Tokyo Hackerspace boards up. There was some initial hardware flaws that I found but after they were fixed, I got the board up fairly quickly. I was worried about porting my USB stack on to it since the AT90USB16 USB controller is different from the ones on the Raven board (AT90USB128). As an engineer, I was expecting all types of things to go wrong and was ready to pull out the USB protocol analyzer. Lo and behold, after the initial register configuration, the USB icon popped on to my screen and it came up as a COM port.  It was probably one of the first times for me that bringing up a board went so smoothly.

I can't really say that I was testing the boards out. It was more like playing. Working on the stack for so long prevented me from messing around with smaller circuits and trying out fun things since I was putting pressure on myself to get it running. However being part of Tokyo Hackerspace gives me an excuse to explore different components and try things that might not necessarily be WSN related. In essence, it gives me permission to play with electronics which is great.

I was worried that the AT90USB16 might not have enough juice to do a lot (500 bytes RAM, 16kB flash) but I figured I might as well try. So the first thing I did was throw up a command line on the THS board. I just re-used the same one I'm using on FreakZ so it went pretty fast. Once I got the command line going, it was time to play. I wrote a command to toggle the various LEDs on the board, but that got boring pretty quickly.

I wanted a way to demonstrate to the Hackerspace members how it could be used for rapid prototyping of small circuits. That's always a big obstacle because people talk a lot about different things they want to design, but the bottleneck is always in implementation. If it were easy to do a proof of concept implementation, I think it would ease up the design juices and let people get more daring with what they attempt. So I figured that GPS might be a bit impressive. I just happened to have a GPS module given to me from my friend in France. It's quite a nice one and goes for $60 on Sparkfun. The specs are very impressive: it can track 32 satellites at one time, can track position info even in deep canyons and dense foliage, and can update position info up to 5 times a second. Just what you'd expect from a geek gift and something I'm definitely going to use the next time I'm trekking through the dense jungles in Southeast Asia. 

Well, since it was just collecting dust in my parts bin, I pulled it out, soldered some headers onto it and prayed that it still worked. Let me just say: 3 wires, 8 lines of code, and no soldering. It was totally sweet! I was getting raw GPS position data and dumping it to the console. The breadboard peripheral was even better than I had hoped. 

After that experiment, I decided to play with the RGB LED. This is all in preparation of doing a demo to the Hackerspace folks with the board. I wanted to generate some excitement so that people can get motivated to think of interesting projects. I had previously talked to one of the members about designing LED based jewelry. He had mentioned that most of the LED accessories blink which is harsh and gaudy. He wanted something that would slowly pulse which is a more subtle effect for an illuminated accessory.

So I took some time to write some PWM code to control the brightness of the LEDs on the RGB LED. I basically had a 100 Hz update rate (10 msec period) for the PWM and divided that up into 255 intervals of ~40 usec. It's easier than it sounds. After that, I just had a simple counter that kept track of the phase and would turn off each of the LEDs if it matched the counter. Basically, it was just standard software PWM. I implemented some commands to manually control the brightness and also commands that could pulse the red, blue, or green LEDs with a specified pulsing interval. I think I'll probably re-use the same code for the AC light dimmer that I'm going to be using to test my Zigbee Cluster Library implementation. 

So anyways, here's some pics of what I did. I also presented it to the group last night. I can't remember the reaction very well though because I was kind of drunk. Pretty typical for a hackerspace meeting...

And in case you're curious, the final memory footprint including USB stack, command line, PWM, LED pulsing, and GPS was slightly under 8kB flash and about 280 bytes RAM. Looks like the tiny machine can pack a bit of a punch...

You have no rights to post comments