As I'm writing this, I'm waiting at Narita Airport in Tokyo for my flight to Delhi. How I ended up here is kind of interesting.
New Year's resolution for 2013 was to travel less so that I could get
more work done. As soon as the new year started, I was on a plane to
Shenzhen to help Bunnie run factory tours of Shenzhen for MIT Media Lab.
That was an amazing adventure but when I got back to Tokyo, I was far
behind schedule on a lot of projects I was working on. On top of that,
my funds were running low since I hadn't released a new product in a
while. That's another weird story since, looking back at 2012, I
actually had close to 20 PCB designs fabbed. None of them were for my
webshop though. Apparently all of them were either collaborations (some
of those are really interesting and will be saved for another blog post)
or made for my own amusement. Ha ha ha.
After returning from Shenzhen, I basically swore off travel until some time around May or June for a summer visit to my family in the US. That would give me ample time to catch up on all my designs, write up some tutorials, release some projects, and work on the shop. A few days after I returned, I got an email from Marco at the International Center for Theoretical Physics in Trieste, Italy. He's part of UNESCO and we're working together on a weather monitoring project. He was asking about the weather monitoring project schedule and also mentioned that he'll be teaching a workshop in the Himalayas if I was interested to join. I laughed it off and didn't think anything more about it.
A few weeks later, he asked again and at that time, I was a bit drunk. The thought kind of stuck in my head. I said no, but as I was going to sleep, I had a sudden vision of myself as a National Geographic explorer in the Himalayas, with the full khaki outfit and safari hat. I decided to do it. What the hell, I thought. It's not every day you get a chance to teach a workshop and do a sensor network deployment in the Himalayas.
The location was actually Dharamsala in India, a Tibetan refuge in India and also the location of the Tibetan government-in-exile. The Dalai Lama also resides there. It's actually a cool location and I casually mentioned it to my friend Jacinta who's a writer and does freelance work for magazines. She immediately assumed she was invited too :)
The project consisted of a weeklong workshop focused on sensor networks and a sensor network deployment. In these types of workshops, the organizers work with the locals to identify a problem in the area that can be tackled with sensor network technology. The workshop material is then structured in a way that culminates in the attendees applying the workshop material to try and solve that problem. Itís quite an effective way to teach actually and Iíll probably start doing the same for workshops that I teach locally in Japan. In this case, we were asked to measure water levels in river fed storage tanks in remote locations and have the data sent to a server on the internet. Marco mentioned that the links would probably be on the order of 10 km. I figured it was a stretch but it shouldnít be too bad. We could just use an amplified 900 MHz node with high gain directional antennas. I just happened to have some prototypes sitting on my lab bench for the past few weeks or soÖ*sigh*.
Unfortunately, when discussing it with the organizers, 900 MHz was out of the question. Although India does allow 868 MHz for RFID, the law is a bit murky and powered nodes would likely be out of the question. They wanted 2.4 GHz radios to be used. This was a significant complication to the problem because I didnít have any 2.4 GHz nodes capable of 10 km links. For 2.4 GHz, I was mainly using naked radios which put out a max of 2 mW. This was okay for a local sensor network but definitely not enough juice for long links like what I was hearing.
At this point, the workshop was basically a month away so in that span, I started prototyping a 2.4 GHz radio and an RF front end for it. An RF front end is an IC that goes in between the antenna and the radio. It consists of a power amplifier for the transmitter, a low noise amplifier for the receiver and a Tx/Rx switch so it turns on the correct amplifier when needed. By amplifying the signal both on the transmit and receive side, the link budget is increased significantly which improves the transmission range. In case youíre wondering, I used the Atmel AT86RF231 which is a 2.4 GHz radio compliant with the IEEE 802.15.4 spec. The RF front end was a TI CC2591 with a +22 dBm power amp (160 mW) for the transmit side and a +13 dB gain low noise amp for the receive side. Unfortunately, since Atmel and TI are competing companies, they donít put out any documentation on how to pair the two devices together. In my case, it was mainly trial and error. Luckily, Iím able to mill prototype circuit boards on my CNC machine so it was possible to do a few iterations quickly rather than waiting for a full PCB fab cycle to see if my design would work. Ahhh, wireless development. The secret is that its all trial and error.
Anyways, I finally got the prototype circuit working and within the next few days put together a schematic and PCB around it. Since this was a new design, I added a lot of things on my wishlist for a wireless sensor node. One of the main things was a larger MCU. I wanted to keep the Arduino platform but I was constantly running into the 2kB RAM limit on the ATMega328P MCUs. The ATMega1280 or ATMega2560 were a bit more expensive than I had the appetite for, mainly because theyíre based on an older process technology which means the die sizes are larger. I decided to use the ATMega1284P which is a more recent MCU based on the AVR line. There was an existing port of the Arduino environment for this MCU and it sported 128 kB of flash and a glorious 16 kB of RAM.
Another goodie I put on the node was the NXP PCF2127 temperature compensated real time clock. There are quite a few choices for real time clocks and the Maxim DS series (Dallas Semiconductor) of RTCs are quite nice. But the PCF2127 had temperature compensation, timestamping, watchdog, power supervisor, and a bunch of other features that makes it one of the sexier RTCs in my opinion. Iíve been secretly in love with it ever since @microbuilder (ie: K-TOWN) introduced the part to me a while back.
One of the most important features of a wireless sensor node is the power management circuitry and if I had more time, I would have gone crazier with the power management. Unfortunately, I probably had less than one day to decide on something as important as this. I decided to go with a solar rechargeable system based on Lithium Ion Polymer batteries (LiPo). The solar cell would be fixed at ~5V and the input would go to a LiPo battery charger IC (MCP73831, 500 mA LiPo charger). For the workshop hardware, I went with a 3W solar cell that puts out 550 mA at 5.5V. This should put it in the sweet spot so that it could charge the LiPo battery for a few hours on sunny days. When I received the solar cells, I characterized them to see what the real output was. I used a programmable DC load device in constant current mode and set it for different loads to see what the maximum power point was for the cells, ie: the breaking point. This would determine the maximum current I could expect from them.
The day I tested was slightly overcast, which probably reflects real world non-ideal conditions quite well. Some other things that affect real solar output is latitude and time of year (ie: distance from the sun). There are different resources that can tell you insolation for a given time of year and latitude but I wanted to see real output. My measurements showed that I could expect a solid 5-6V output up to about 300 mA. At 310 mA, the voltage drops to basically 0, as does the power. If I had more time, I would have put together a maximum power point tracking circuit or used a recharging IC that had this feature. Since I didnít I had to statically set the maximum charge current. I used a max charge current of 200 mA which gives margin to take into account usage in other parts of the world. The idea is that this device would be used for workshops in other places as well. The reason why its important to set the maximum charge current under the maximum load the cell could bear is that if the solar cell is overloaded, it would never build up enough voltage to charge the battery.
And finally, I tried to design the board to be as low power as possible. Low power design is kind of weird to describe. Itís kind of like wireless in that its trial and error, but you make a lot of ďeducated guessesĒ. You mainly design according to how things are supposed to behave, but finally, you have to measure and tweak everything by hand in real life because the theory never quite pans out. When I got the boards back, I had to do quite a bit of tweaking to the board components, but eventually, I got the current consumption down to 70 uA in sleep mode. This is mainly limited by the regulator Iím using so Iím quite satisfied. For those that arenít low power nerds, at 1 mA of average current consumption, charging the battery at 200 mA for one hour would power the circuit for over a week. Iím pretty sure that its possible to get at least one hour of usable sunlight per week to charge a battery. To top things off, I added separate voltage dividers that could be used to monitor both the voltage at the solar cell and the voltage at the battery. This should allow us to monitor battery level as well as how much energy we can expect from a given place. I suspect this would be a nice feature for site surveys as well to see how much power we can expect from a given location to run a node.
Well, apparently I diverged from the main topic which is the Dharamsala workshop and geeked out. In any case, this design would be the main sensor node for the workshop and I decided to call it Saboten which means cactus in Japanese
I also designed a companion board for Saboten which has the same radio and also a Wiznet W5100 ethernet IC. This IC is the official/unofficial Ethernet/TCP/IP chip for Arduino and works with the Arduino Ethernet library. This node would serve as the bridge between the local sensor network and what we in the sensor network community like to call ďthe information superhighwayĒ.
The board design was actually not the hardest part of preparing for this workshop. As is always the case, design is actually pretty easy. The really painful parts are bringing the boards up, validating them, writing the software, and the logistics involved in acquiring all the parts for the boards, enclosures, enclosure modifications, cabling, antennas, etc. Doing all this for a volunteer workshop and within a few weeks nearly killed me.
About a week before the workshop, I got an urgent email from Marco. He was unable to obtain a visa to India due to a sudden change and stricter visa regulations between Italy and India. There was suddenly talk about cancelling or postponing the workshop. Needless to say, I was pissed after putting myself through contortions to get the design finished in time. Luckily, Marco was much more level headed and asked me if it were possible to run the weeklong workshop myself. Itís definitely not an ideal situation, but I was okay with it and so the workshop was back on again. I secretly imagine Marco giggling after that Skype callÖ
In summary, what originally seemed like a simple sensor network workshop plus a fun trip to see the Himalayas turned out slightly more complicated. I canít complain though. Itís a great chance for me to see and go somewhere I normally wouldnít and also experience deploying a sensor network in a remote area. Itíll also be a fun adventure so Iíll be attempting to document this trip and whatever I learn out of it. I suspect itíd be interesting to the sensor network community at large out there as well as other electronics nerds. Also, big thanks to Marco, Jane, and Mikey for putting things together and letting me tag along :)