This article is part of my 1000² Smart Home project. Check out the Architecture and Software and then move on to Hardware. An most importantly, check the Lessons learned and why I did what I did. There are already some first results, connecting all parts of the system.
Some history
A picture says 1000 words!*
Which microcontroller?
When I began this project, I was long given up on the ATMega and ATTtiny micro, with some exceptions, as they are not really justified in a hobby environment. Therefore, I have initially intended to make my nodes using an ATXMEGA32E5, which I believe is an ideal device for sensor nodes, due to the various and low power peripherals. However, it soon turned out that for some devices I would need more flash, but the family stops at 32K and a package change is required for more memory. So I dropped it in favour of the new SAMD21, ARM cortex M0, which comes with more flexible package and flash options. This device burns a little bit more in sleep, but still tolerable. And a 128K flash and 16K RAM version costs on par with the lousy old atmega328 with tons of extra features (way better ADC, DAC, more PWM, more timers, more I/O, more flash, more RAM, faster core, lower uA/MHz, RTC, more SPI, mor UART, more I2C….i’ll stop here).
Below is a brief comparison between the 3 types of devices: the old 8 bit (MEGA), the new 8 bit (XMEGA) and ARM (SAMD21). I have compared the SAM with other ARM MCUs from ST, NXP, Freescale and concluded that the SAM is the best fitted for such low power applications in terms of performance/cost, with the benefit of being familiar already with Atmel’s Software Framework.
Therefore, welcome the “core 1” SAMD21 node and IOT board.
The top and bottom headers contain all the pins of the microcontroller, including power. The left side has an easy breakable micro USB and room for the antenna. On the right there is the “basics” header which contains power plus 7 other carefully chosen pins. For most nodes, the right header will cover all the connection needs. An anti-parallel red-green led can use 2 pins and no series resistor, while being able to display 3 colors. As mentioned in the lessons learned, there is a linear regulator, for the projects that need a regulated 3.3V supply.
And the back featuring the RFM69 radio:
The module is part of a bigger PCB, which contains 3 other modules. On the top, there is a prototype one with an additional USB connector. The middle one is a temperature, humidity and light module, while the one on the right is a 3 channel power driver for LEDs or other loads. Time will tell if this is a good approach.
The best way to see the power of this little beast is to look at one of the earlier test modules i built. At the same time, I was using : I2C, light sensor, ADC channel, battery monitor, motion sensor, contact, button and driving WS2812 and 3 PWM channels, red-green status LED and, of course, the radio. It’s not that a lower end microcontroller could not do it, but the flexibility and free memory I still have while doing this is of very high value. And, although I am not proud of it, I took the non elegant solution of driving the WS2812 LEDs by bit banging, because I totally can with a 48MHz clock.
Which radio?
The radio used to transmit the data between nodes is one of the crucial parts of the system. As mentioned in the Lessons learned, the NRF23L01 or RFM75 was a good candidate, but eventually failed to meet the needs, so I chose the RFM69. Truth be told, I believe the perfect radio is a combination between the two and some bonuses.
Here’s what I would like to have:
1. Integrated PCB antenna is generally better than an external one when designing a compact sensor node.
2. Decent power, 100mW or more, with the possibility to scale it down to 1mW.
3. High range of bit rates: the RFM69 can do 250:1 (300kbps to 1.2kbps) while the RFM75 is only 8:1. Lowering the bit rate allows for higher range when more power is not an option.
4. Automatic packet handling with automatic ACK and re transmission is gorgeous.
5. Automatic bit rate detection from the preamble: this would allow a gateway or any node to receive any packet without prior knowledge of what bit rate to expect.
6. Cost should be somewhere between the RFM75 and RFM69 (1 to 3 EUR/USD each).
7. Sub GHz band has quite some advantages, but for compactness 2.4GHz works too. Same module with integrated PCB antenna working at 433MHz or 868MHz or 2.4GHz would be gorgeous.
8. Encryption with nounce.
Pingback: Maximizing RFM69 Output Power: Optimizing Signal Strength
Pingback: RFM69 output power -Use Arduino for Projects
Pingback: 10002 Progress « Electro Bob
Pingback: 10002 Architecture and Software « Electro Bob
Pingback: 1000.1000 « Electro Bob
Pingback: 10002 Lessons learned « Electro Bob
Pingback: RFM69 output power « Electro Bob