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 my webshop.

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?

NRF2I’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!

transmitterWow, 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.

13 thoughts on “Moteino Framework architecture decisions

  1. Yours is the most articulate and comprehensive explanation of why the choices were made that I have read in a long time. Keep up the great work!

  2. Most of your your points are about valid trade-offs, but when you start with bad assumptions you end up with bad decisions. Look at digistump and adafruit to see that the attiny85 is well supported, even if with the arduino ide. If you need more io, the tiny88 is even cheaper @50c/qty100 in the qfp. It also has “real” SPI
    The biggest hole on your logic is with the availability of the rfm69. I couldn’t find it on Mouser or Newark, and I could find only 3 sellers on aliexpress, with prices around $7. Not so easy for a hobbyist to make on his own. The nrf modules, with less, but enough range above 2480mhz to cover most households, are available for 1/10th the price of the rfm69 modules from hundreds of sources that supply the hacker community.

    • Bad assumptions? I don’t think so. I didn’t make up assumptions, I backed them with testing and data. I tried to illustrate how pointless it would have been to edge my main Moteino boards on attiny chips for many reasons that I will not repeat here. I think it’s plain an obvious and there is no debate about how much better of an overall choice an atmega328 is versus any tiny. Tinys are cheap for a reason, 8kb of memory will blink you some LEDs and print stuff on a display. Oh wait, there’s the bootloader too, a whopping 3KB in the case of Trinket, shave that off to see what you’re left with, a mere 5K that won’t get you beyond the “1 million *simple* projects using attinyXX”. Real SPI but no real serial? That sucks. Want to use a library or two? Try hard, or code in assembly to save another half KB. Forget complex libs. Also make sure you stay below that 5KB or you’re left with a disabled tiny that you have to bootload again. But, if it saves you two bucks, maybe that makes it affordable and hobbyist worthy.
      I wanted a usable chip, and 32KB of flash was a sweet spot for me, no twisty configs that people don’t understand and that generate months worth of support in the long run. I will stick with the mega328s for a little more $, it got me and a lot of folks a lot farther.
      RFM69 availability logic hole? I’m not sure either. I could make them if I want to. I just prefer to buy them and not deal with that extra headache. Guess what.. the maker is the same HopeRF which has supplied every electronic outlet on the web with RFM12Bs for many many years. RFM69 is just rising to the demand, a lot of which was generated with my own library, and more are coming. Yes HopeRF could fall of the face of the earth, but why would they when they’re making buckets of cash on these?
      Correction : “nrf with *much* less range”. Have you tried it? I did, it didn’t go through 2 walls and about 25 yards in open air. RFM12B is like 10 times better. RFM69 a magnitude more, out of box. Not sure what you’re saving those few bucks for but I don’t mind the extra difference for the luxury I get.

      • “I didn’t make up assumptions, I backed them with testing and data.”
        So you admit you made assumptions. You’ve certainly shown (with your range testing) that the rfm69 is sufficient for a (somewhat) modest cost IoT device. Your assumption is that something like the nrf modules are not sufficient. You’ve invested too much to change now, and your emotions seem to be driving you towards the sunk costs fallacy.
        Regarding the Attiny’s, if you’re stuck on using a usb bootloader, Tim has reduced micronucleus to <2KB.

        And yes, I have tried the nrf modules.
        http://nerdralph.blogspot.ca/2014/01/nrf24l01-control-with-3-attiny85-pins.html
        At 250kbps and using an interference-free channel (typically above 2480Mhz), getting through a few walls is easy. And from other people's posts, if you need more range you can use the PA version with an external antenna.
        I've also recently seen some clone chips like the BK2423 that can transmit at +7db vs. 0db for the original nrf chip.

        You've done a lot of good work, and if I'm right about BTLE becoming THE IoT protocol, then you're on the wrong bus… and seem to be too defensive to admit that picking a successful technology is often a crap shoot.

        • Look, I appreciate your drive but this is going nowhere really useful. I didn’t assume as you keep claiming, the regular nrf radios just aren’t enough and I tested them myself. The PA+LNA modules are much bigger and require a huge antenna, and don’t come even close to the RFM69 range. Yeah I know about finding the right channel and tweaking settings to get through the extra wall or get more range. Users have done that with RFM69 too and got 1.75KM or over a mile, I don’t need to stream music so don’t care about 300kbps, all I need is a few bytes.
          Regarding Attiny, I’ve used them, they are fine in small projects (like my ATXRaspi), but just don’t make sense for me in what I’m trying to do with IoT. And 2KB of bootloader is 25% of the whole memory, that’s like buying a $1 car with 4 seats but one is taken by the spare tire so only 3 seats are usable, I’ll pay two more bucks for a car with 10 more usable seats.
          Yeah I’m vested quite a bit, but if RFM69 dies, I have the means and I can just make it myself, or move on to something else.
          BTLE is interesting, but while you are waiting for that to get to the <$1 price range you're comfortable with, I will keep busy making Moteinos for the rest of the folk that find them useful as well. Still, the BTLE spec is <100m theoretical, folks will find ways to hack that to more with PAs etc. For now I love what the RFM69s can do and nothing ca get close in their price range. And in terms of the size of RFM69 and everything else ... the debate is over. Good talk.

  3. I investigated wireless solutions for microcontroller projects and came up with the same solution as Felix and Jean-Claude from JeeLabs fame. My wireless projects are all about sending bytes of data for sensors and commands with very simple packet types, doing so across the house, through many walls, and across the yard, and doing this cheaply and with low power. The goals for many of us coming from the Arduino world don’t benefit from many of the benefits BTLE provides and suffer from its packet complexities, range, and cost. RFM12’s and 69’s fit our goals beautifully and BTLE surely fits other goals much better. I also tried the nRF’s as well since they are in such great supply and very inexpensive, but like most have found the inexpensive and small version are more of 1 or 2 room away device (they work well in my single story 1400sq ft condo), but not in my buddy’s 3000sq ft house where the devices are 2+ rooms away from each other. The inexpensive and small nRF’s just didn’t have the range about all of my projects have needed so far while the RFM’s fit the small, inexpensive, low power goals beautifully.

    For the microcontroller I also experimented with ATtiny’s and found them good fits for nodes or endpoints (USI isn’t so bad and I even did a write up of getting around the limited set of GPIO pins on an ATtiny85 http://forum.arduino.cc/index.php?action=profile;u=243110;sa=showPosts). But I have found ATtiny’s are not well suited for controllers or devices with displays and buttons/knobs which have more complicated UI’s, the memory is simply too low for the types of projects I’ve created so far. If I was making 100’s of simple wireless endpoints an ATtiny seems like a great fit, but for the things I do and in hobbyist quantities, an ATmega328 has proven to be an excellent fit as the lowest common denominator micro controller.

    I have ATtiny’s and nRF modules that will work ok in some specific projects I’m planning and I will use them, but only because I bought them for experimentation. I’ve since found out that ATmega’s and RFM’s fit my projects in more situations and make things easier to do. For the design goals and business Felix is in, I also don’t see a better fit at this time and completely agree that ATtiny’s and BTLE and nRF modules are not the best solutions.

    • Thanks for adding your own confirmation to my “claims”. It seems like this stuff makes sense for at least one other person so I won’t feel so obtuse now.

      • I’m puzzled by the folks that want ATtiny. I find them too hard to use like you. I have two sitting here unused. Yup, they perhaps save $2 but when factoring all the costs for a finished node, including some case/housing, cables, sensors, etc those $2 just don’t make a difference anymore. Sure, if you’re producing some widget by the thousands then I agree, but that’s not your market anyway…

  4. Felix I think you have done a wonderful job of creating an Arduino/RF board that I
    along with many others find extremely useful right out of the box. The units are well
    designed and the RFM69 works great for long range communication. I wish there was
    a star topology lib for it like the RFDuino BTLE has, but your library is easy to work with and is serving me well. Thanks for what you have done and keep up the good
    work.

    • Thanks Ben, I appreciate your kind feedback. If by star topology you mean 1 gateway and many nodes, I believe Moteinos can already do that.

Comments are closed.