Moteino Framework architecture decisions
My vision for Moteino was to create an affordable/open/ideal/easy hardware platform that would fuel a new generation of wireless internet-of-things, and I think it came out pretty decent. My Hackaday Prize entry even made it in the top 50 semifinalists (out of 800+). More devices are being added to the Moteino Framework and existing ones are being improved to make it fun for those makers who like to DIY and solder their internet-of-things from easy to assemble kits. The end users have maximum freedom as far as using/building stuff with Moteino. They can build absoltely everything from scratch, as some have done, but some prefer to just save time and buy building blocks. Hence I funded my way through this adventure by selling ready made Moteinos and kits in mywebshop.
People have asked many times why the Moteino was designed the way it was, and why not use this and that and the other type of MCU, transceiver type, radio band, or wireless technology. The number one reason why Moteinos are what they are today is because in the end they need to be designed to manufacture, work well, be reliable, license free, easy and fun to use in a friendly board format, cheap to buy or make, achieve long open air range or excellent indoor obstacle penetration when used with transceivers, etc. Here is my reasoning behind all these decisions and the answers to some frequently asked questions.
MCU choice – “Why not use ATTiny chips? They are cheaper!”
How about ARM and other platforms?
Because it makes no sense, economically and practically. They are very memory challenged, are not widely supported in the Arduino IDE, don’t have real dedicated SPI/i2c/serial hardware support (except serial I think on the larger ones). If you ever used an Arduino UNO you know you can run out of I/O pretty quick even on that if you have several devices hooked up. They cost less than an ATMega328 but the savings would never justify the features tradeoff unless for projects where all you need is a few I/O and you program it once and never have to touch it again. In fact the “larger” ATTinys are getting very close in price to ATMega328 so why bother?!
I didn’t go the ARM route because I had very little experience with ARM, the tools are a steep curve to learn to say the least (not to mention most were expen$$$ive last time I checked). For me the ATMega328 was the obvious choice because of how widely used, accessible, supported and robust it is. I didn’t have to spend a year just to learn ARM or something else. Maybe an overstatement but it works for 95% of projects that need some kind of electronic brains. For those in need of more I/O and memory there is the ATMega1284p (MoteinoMEGA) which loads more flash and RAM. Porting code from one to another with ease is another major requirement. Porting to ARM or ATTiny is a major pain and in most cases it won’t work either because the set of features is vastly different (ARM) and requires significant rewrite or the set of features is too limited (ATTiny).
Could be much smaller with ATTiny or with other board layouts/set of hardware
Really? I could shrink the Moteino to the size of a fingernail (I actually did a project where the diameter of the circular board was 10mm with a QFN-28 ATMega328 on it, no kidding, the ICSP was on a header that would snap off after programming, leaving the circular 10mm finished board). You can do almost anything you can put your mind to. The big question is are they designed for manufacturability? Are they easy to use to the average electronic hobbyist as well as for the experienced maker? Are they a building block for greater things or are they a stumbling block?
I see all these projects that go as small as possible, maybe with ATTiny MCUs to save even more space and have some kind of ridiculous spaced set of I/O headers and I’m wondering how long they have to sit there under the microscope to solder those to anything without creating a million shorts and a huge mess (forget breadboard). Oh wait I forgot … there are 999 other types of “shields” with everything you can think of on them that just plug in to each other and everything just works. Ok, good luck building your new Trump world tower. That’s why I disliked everything that was out there and I started from scratch with making the Moteino. It’s the size of an SD card, has all the ATMega328 I/O broken out in a breadboard friendly layout so you can use it bare or with your radio of choice (well almost), a simple set of components that deliver the required 3.3V while keeping it low power in sleep mode. You can make your own “shields” and stack them the Moteino if you really need to. Get a mile range if you are really eager to. Program them wirelessly using the FLASH chip addition. All for around $20 ready made or you can make them yourself. Anything else?
Why not use CC1101/NRF24l01 or other radios?
I’ve done my own testing with these before I moved on to RFM69. They are simply hopeless in terms of range. They have higher power versions (the +) but those are hopeless in terms of size and power consumption and cost several times more than a RFM69. Most versions I’ve seen have a 2×4 header that was a challenge to fit flat/tight anywhere. They work in the 2.4ghz band which gets “interesting” because all your other devices in the house work in the same band, and all of your neighbors too, getting crowded in there, more chances for lost packets. Enough said, moving on.
Why not use “inexpensive off the shelf” transmitter and receiver pairs? After all, they are just $1 on ebay!
Wow, I’m not impressed. They are inexpensive and you get what you pay for. You can do it but you will be sorry the first project you build where you want to get an ACK back. Or both transmit and receive. Or transmit through an extra wall or from across the street. They have no hardware packet engine, encryption or CRC or anything close to what I want in terms of features. Sure you can do all that in software but I’d rather code my sensors than spend my energy on reinventing the wheel only to save a few bucks. Also I don’t consider ebay a reliable stream of component sourcing. I have interesting stories about that, more notably I got some OLED screens for prototyping and the pinout in the ebay photo was reversed of what I received. Thank you china. Running out of time I ended up buying several just to make sure one will fit my PCB prototype in time for THP demo/photos.
Why not bluetooth or wi-fi? They are getting low power and small too!
This is an area I have not fully discarded yet because I have not fully investigated yet. I like bluetooth but from all I know it requires pairing and won’t allow the distributed topology I’m looking for. So at least for now bluetooth is ignored. Wifi is a different story because it can hook into the home wireless wi-fi directly. It may make sense at some point or could be useful in certain applications. Adafruit and others have done a nice job integrating the CC3300 which is small, but unfortunately not so affordable, it’s about a magnitude more in price compared to RFM69 type radios. Also wi-fi is 2.4ghz which can get crowded with lots other devices using that band. I think I’ll wait for a while and hopefully price goes down too.
How about Xbee/Zigbee?
Not much to say here except my very first experiments were with XBees which were about half the range of RFM12B and about 4X the price and power consumption was not nearly ideal. Quickly became obvious this is not the way to go.
Fun fact: on the side is a user submitted photo in which he is testing a Moteino+RFM69 with tweaked RFM69 Lib settings for low bitrate/bandwidth and tweaked antenna to achieve an impressive 1.75Km range. This is fantastic and it means Moteinos are great for long range telemetry where bluetooth, wifi and other alternative technologies would be impossible to use and cost prohibitive. When I get stories like these about my product this makes my day. The full story and details are in the forum.
The choice of RFM69
So I’ve gone from RFM12B (which is still supported on all Moteinos) to RFM69 (W and HW). The reasons are many, and it worked out as a great trasceiver, affordable, and the RFM69 library I’ve created for it has become very widely used. Meshing is also possible for special applications. But in most cases meshing is not needed because by tweaking the settings, ranges of over a mile is achievable. The out of box RFM69 lib settings will give you several hundred meters in open air and should easily cover a 1 acre typical residential property/home. By contrast RFM12B could barely get from one end to the other in my home, with dead spots and dropped packets, unless I seriously decreased the bitrate. It’s also the right size, fits perfectly on the belly of all Moteinos and is the right price. The end product is a very compact node that can fit in almost anything, can be easily powered from a range of sources, and doesn’t require twisty weird assembly and microscopical soldering to bring it to life.
Design for manufacture
This is very important if anything you make is ever meant to scale. I see a lot of projects that are cool, but have more of an artisan feel to them, and in terms of making 100 or 1000 of them, it would require an army of people or countless hours to solder and custom fit/bend/twist/test. I hope the THP judges will see these issues and take them into account when judging between the good and great THP semifinalists. PCB making is affordable and anybody can do it with all the open/free PCB layout programs out there, but once you move from individual boards to panelized designs that need to be assembled into a pick and place it’s a whole different story, and a lot more things come into play. EEVBlog and others have done a good job explaining some of the challenges of designing for manufacture. This factor alone will make the difference between a good or bad design in the long run. With Moteino I tried to think of manufacturability from the start. I knew if my design was bad it would never get past a revision or two and nobody would want it. If it was good then I would eventually end up requiring machine assembly and rapid testing. Currently all Moteinos are assembled on my new real pick and place and reflowed in a real reflow oven. Then they are bootloaded and tested manually using a jig I made for them similar to this. It goes very fast but it was a long journey to get here, nevertheless quite rewarding and fulfilling one.
That’s all dear reader, have a nice day/evening/night/morning wherever you might be.