Well, I finally did it. I mentioned before that I was working on something when I was in the US to while away the time at the coffee shops. That something was an ultra-simple, ultra-small wireless stack that could just be used to transmit and receive data. It’s something that came out of working with the people at Tokyo Hackerspace . A lot of them were interested in being able to control things wirelessly, but I didn’t really have an answer for them. I felt that Zigbee was too complex, and even 802.15.4 had a fairly steep learning curve, due to the need to do passive/active scans and associate with other nodes.
What most of them were looking for was just something that they could transmit and receive data with. I’ve been thinking about how to implement something like that for a while because wireless stacks, even simple ones, can get complicated due to wireless being an unreliable medium. Hence you have to build in complexity to handle timeouts, retries, acknowledgements, etc.
So without further ado, I’d like to introduce “chibi”, a simple wireless protocol stack for openhardware hackers and enthusiasts to control their projects. Chibi is slang for “midget” in Japanese and is a popular term used frequently in anime.
The software stack requires approximately 3 kB of flash memory and about 150 bytes of RAM. Its completely open source and is licensed under modified BSD, which means that you can use it, modify it, and do whatever you’d like to it and it won’t require attribution in the documentation.
The operation of the stack is pretty simple. There are only three commands: init, write, and read. Each wireless node that runs the stack needs to have a 16-bit address which can be stored in an EEPROM, toggled via DIP switches, etc. I already added hooks to use the internal EEPROM on AVR controllers, but others can modify it to read GPIO for DIP switches, or handle any other way to identify a node.
Once a node has an address, then you just talk to it by using the “write” function with the address of the target node and the data you want to send to it. The size of the data payload is limited by the maximum frame size used by the 802.15.4 protocol (127 bytes) minus the MAC headers so you get about 100 bytes for the payload.
When a message is received, it will set a flag. You would normally poll the flag in the main loop of your system and when it shows that data was received, then you just call the “read” function and retrieve the data.
All of the other parameters such as the PAN ID, channel, etc are hard coded, but may be changed later on depending on how the requirements of the stack evolves.
As for the network topology, any node can communicate with any other node as long as its within listening range. Also, you can use the special broadcast address (0xFFFF) to send data to all nodes simultaneously.
That’s pretty much about it for the operation of the stack. There isn’t much commercial application since it’s a pretty barebones stack with no encryption, but it should fit the bill for people that want to create cool, new projects that interact with each other wirelessly. Or if you just want to add something simple like updating firmware wirelessly, this would also work as well. All of the source code can be found in the zip file at the end of this post. Also included in the zip file is the FreakUSB stack which I'm using to interface my development boards to my PC.
I’ll be adding documentation soon and should be releasing some open hardware designs and finished boards for people to play around with the stack. I’ll also be doing a port to the AVR Raven USB stick since the hardware that I’m currently using is very similar to it and the USB stick is cheap and has an 802.15.4 radio.
Good luck with your wireless projects. Let me know about any cool designs using this stack. I’d really love to hear about them!
Here's the link to v0.1 of the source code:
And here's some pics of my setup: