New MoteinoM0 Released!

If you’ve watched the forum, it’s been suggested to develop a new Moteino board featuring new/more powerful/more flexible or even ARM microcontrollers. Mentioned candidates were the Atmega328PB, STM32, SAMD from Microchip and perhaps others were mentioned over time as well.

Say hello to MoteinoM0 – it features the popular SAMD21G ARM Cortex M0+ 32bit processor (48Mhz, 256kb FLASH, 32kb SRAM). It’s quite an awesome bit of silicon brains and after months of playing with it, tweaking libraries and sketches, testing peripherals and designing add-ons for it, and developing an Arduino package for it that is oriented on LowPowerLab‘s most important points of interest, it is now available to the public.

But SAMD21 has been offered by others for years you say. How is this exciting and why did this take so long? I didn’t want to spam the market with a new clone and claim this is the best thing since Arduino Zero. Here are a few highlights that I think will make MoteinoM0 different and interesting:

  • long range wireless programming enabled just like all the other current AVR Moteinos!
  • Got low power? You bet! How about 6µA in standby sleep? MoteinoM0 yields the real low power mode achievable by the SAMD21, 7µA in watchdog periodic sleep, +1µA for the external 4MBIT FLASH-MEM chip and radio module
  • supports RFM69HCW and LoRa radios, plus secondary radios and add-ons, see below
  • a modular design enables compact platform for I2C/SPI/GPIO add-ons, just a few examples to mention:
    • SD-card logger ( with “zero” power control)
    • weather node
    • multi DOF accelerometer/gyroscope/magnetometer
    • secondary RFM transceiver (say you want an FSK and LoRa Gateway to listen concurrently or combine different concurrent frequencies)
  • break out as many useful and Arduino supported pins as possible in a symmetric and compact board layout
  • ease of side castellated mounts allow these add-ons to be mounted directly flat on the PCB without additional headers, here’s a simple weather-node add-on board that only requires one sided soldering and can be easily removed and reused:
  • you may also stack above/below using extra headers or solder extension wiring to the side half-holes for quick removal and re-use later:

Here is a quick pin reference and schematic:

A few things about similarity to the standard Arduino Zero:

  • this board was designed to be as compatible with Arduino Zero as possible in terms of available MCU functionality
  • GPIO and core package is adapted from Arduino Zero, all GPIO is accessible the same way, except PA28 (USB_HOST_EN) which is not connected
  • as seen in the reference above, some pins are hardwired to the radio transceiver and SPIFlash (A2/SS for radio, D8 for FLASH-MEM) and used by these modules
  • you should be able to use most Arduino examples with MoteinM0 without a lot of hassle. If you’re already familiar with Arduino Zero this board should feel right at home

Read below for why this took “so long”.
Continue reading

New Moteino packages released for Arduino IDE

There is a new Moteino Arduino core package release (v1.4.0). If you’ve used the Moteino package so far with the Arduino IDE, you should get a little notice next time you start it up. By the way the link to the LowPowerLab package definition JSON is the same and should be pasted in your Preferences dialog under Boards Manager URLs:

Then you can either install or upgrade to the latest AVR package. Notice there is a brand new Moteino SAMD package with a new MoteinoM0 board as well, more on that in a separate post. Install/upgrade these in your Boards Manager:

These two packages includes a refined selection of taget boards:

  • [ Moteino / Moteino-USB ] – use this to send your sketch to a Moteino or MoteinoUSB
  • [ Moteino (8Mhz) ] – for 8Mhz Moteinos 
  • [ MightyHat ] – technically identical definition to Moteino but use this to target a MightyHat
  • [ MoteinoMEGA / MoteinoMEGA-USB ] – use this to program MoteinoMEGA or MoteinoMEGA-USB
  • [ MoteinoM0 ] – a new Moteino based on SAMD21 Cortex M0+!

Once the packages are installed or upgraded you should see these new boards in your Tools>Boards menu:

And if you’re using my custom IDE board/port shortcut bar add-on, you can quickly add and access them directly from a click of a button, no more searching in the mile long Boards submenu of doom:

Some notable changes in these new packages:

  • added standard LED_BUILTIN pin macro definitions for all boards, you can simply use this macro to address the onboard LED of any Moteino, no more need for specific checks of what board it is you’re targeting, the LED_BUILTIN will just work. This macro references D9 on 328P Moteinos and MightyHat, D15 on MoteinoMEGAs, and D13 on MoteinoM0, simply use this macro directly in your sketch:
  • added board macro definitions for all Moteino boards:
  • added SS_FLASHMEM macro pin definitions for all Moteinos, again this is to ease the use of the SPI CS/SS selection pin across all Moteino boards:

I hope you find these changes useful. There’s lot of work to be done to upgrade all the sketches in the RFM69 and SPIFlash libraries to make use of these new macros. Please report any issues and stay tuned for the coming updates on MoteinoM0!

Wireless Programming GUI v1.6

The WirelessProgramming GUI is now at v1.6. You can find and download it here. Please note it is no longer part of the RFM69 library, but has been moved into its own WirelessProgramming repository. Here are some changes:

  • protocol improved to support variable HEX record length
  • various other minor bugs fixed
  • removed the logging delay in v1.5 since it was causing some glitching

Since v1.5 (release notes here) you may know  that this OTA GUI can also invoke the OTA.py script which is included with it. This way you may customize the OTA.py script to your own needs, the windows GUI uses the same algorithm. The GUI includes the IronPython runtime and libraries required to invoke this python script right from the app. You may of course simply use the OTA.py script independently if you’re so inclined.

I spent a few days doing testing and I would like to invite Moteino users to try this new version and report any bugs via the contact form.

For those interested in future releases – last year I developed a new OTA algorithm which cuts the upload time dramatically. I mentioned this briefly in the forum but I got distracted in many other directions and it’s not finalized. It is more complex and needs a lot of testing and fine tweaking. It was originally intended for transferring small files via non-wifi subGhz transceivers (RFM69) and would need porting and adjustments for OTA purposes. I would like to hear feedback and see the level of interest about wireless programming of Moteinos (aka OTA programming). Feel free to drop a line and share your experience so far and change requests.

DIY Moteino guide

I posted a short illustrated guide for making your own Moteino from SMD components. It also includes details how to burn the bootloader and fuses. Check it out here. Thanks and credit goes to forum user LukaQ for his contribution of the images and test sketches in this guide!

Introducing the no-LDO 8Mhz Moteino

From popular demand, there is now a Moteino 8Mhz variant which has the following differences to the regular Moteino:

  • no LDO linear regulator
  • the VIN and 3v3 pins are connected via a 0ohm resistor (including FTDI header VIN)
  • must be powered from 3.6v or less when RFM radio and/or FLASH-MEM are installed onboard, otherwise without radio/external flash the board will work up to 5V
  • 16mhz resonator is still installed but not used with the 8Mhz fuses. This means you can still change the fuses yourself and use it if you’d like, but this will only be safe down to about 3V
  • The fuses are: LOW: 0xD2, HI: 0xDC, EXTENDED: 0xFE
  • even more ultra low power – 2uA less current than the regular Moteino
  • Runs DualOptiboot compiled for 8mhz
  • 57600baud upload programming speed (vs. 115200)
  • you will need to install the latest Moteino definition (v1.3 or newer) in your Arduino IDE Board Manager to gain the new Moteino (8Mhz) target board:

For the latest updates and specs on this board, always check the official Moteino guide.

To program this Moteino the FTDI-Adapter offered in the shop can be modified to pass a safe 3.3V to the 8Mhz LDO-less Moteino – cut the *5V Output Voltage jumper and solder the 3.3V one:

Note that this mod will make the FTDI-Adapter regulate power, but it can only supply about 50mA to the Moteino, if you draw more power, the adapter might drop and reconnect to your computer

Alternatively, you can build a dedicated adapter that takes the 5V from the USB and regulates it to 3.3v, here’s such an example which uses the LDO from the Moteino itself (MCP1703) along with a 1uF and 0.1uF caps, all other connections are passed through and assumed to be 3.3v levels:

You would then use it in between your stock unmodified FTDI-Adapter (or equivalent board, providing 5V VIN power and 3.3V TX/RX/DTR signals), and the no-LDO Moteino which requires 3.3V when radio/flash are present:

These types of Moteinos are ideal for ultra low power coin cell and other micro power powered nodes – power them from 3.6V or less. Of course, when you have such tiny power supplies, you must choose your transceiver carefully, as you likely cannot transmit at full 20dBm power from a tiny coincell. The W/CW 13dBm radios running the auto-power-dial RFM69_ATC library extension would be recommended for running on coin cells or small solar cells.

I can’t wait to see what you guys will make with these!

WeatherShield + supercapacitor + tiny solar cell

There were some interesting discussions in the Low Power Techniques forum about solar power, running motes on super capacitors, and running motes without batteries. I had some tiny solar cells I got long ago from ebay, and I wondered if these could run a low power stock Moteino+WeatherShield node, without any assistance.

Update: the shop now has an offering for a 7.5F SuperCap and a 1W mini Solar Cell which can be used in a similar project as this shown here.

For the experiment I added this 7.5F low-ESR supercap to charge from the solar cell during the day, and keep the mote going at night. To avoid discharge I added a shottky diode from the cell to the cap. The solar cell is actually composed of three tiny cells wired in parallel, the combined capacity is around 0.7W. Here’s the “schematic”:

I initially charged the cap from a 5V source to get it going, and then I attached the cell to a basement blurred glass block window which hardly gets a ton of light:

Note that the shottky does drop 0.2V from the actual capacitor voltage. Even so this worked surprisingly well. Here is the new node in my Gateway UI:

The node transmits temp/hum/pressure/voltage data every minute. Below is a look at a few weeks of the voltage readings. The solar cell charges every day to about 4.25v (actual voltage is ~4.45V b/c of the diode) and discharges to just below 4V.

Quite encouraging, I was pretty sure this would work since the WeatherShield and Moteino sleep at under 7uA, I just wasn’t sure how these old small cells would behave with the supercap. I recon if this node would be placed outside and facing direct sunlight, the charge voltage and overnight dips would be even higher values.

This would also work with a LiPo battery instead of the super cap. Of course, if this was placed outside in the freezing cold, those cheap LiPos from china can die in the cold. But at just $6.50, the supercap is a cheap alternative, much safer and resilient to the cold, and shows how low power is not that complicated.

Moteino R6 released

After Moteino R4 has been the long running champion of its lineup, and R5 has had a brief period of glory, Moteino has now been shipping for the past week at revision R6!

Wait, what happened to R5 which was never announced you ask?
Well R5 was mainly a transceiver layout change from R4, it also added a u.FL RF connector (which is now offered in the shop) and SMA connector “helper” pads, and few other minor layout changes, nothing too significant and otherwise identical to R4. Customers were now getting HCW and LoRa radios on the same Moteino PCB instead of separate PCBs for HW and LoRa.

However in R6 there are more important changes:

  • CW transceiver layout has been added in addition to the RFM69/LoRa layout, which means that the whole spectrum of RFM69 and LoRa radios are supported. Note that W and HW, while still in the shop, are no longer available as an option for MoteinoR6 – they are replaced by CW and HCW (which are 100% equivalent from a software and features perspective, but smaller!)
  • supported transceivers: RFM69CW, RFM69HCW, RFM95/96/LoRa
  • in addition to this, RFM12B is now also usable (though not sold) with Moteino R6 because of the new CW pads. Note that the RFM12B library is still usable but no longer actively developed or supported
  • a delay cap was added to DTR to avoid situations where the Moteino never wakes from an ultra low power state – this has been mentioned and discussed in the forum
  • u.FL pads kept for those who want to connect a pigtail instead of straight coax or the provided monopole wire antenna
  • the Trace Antenna variant reflects all these changes as well except it’s connected to the onboard PCB antenna and does not require an external antenna

Here are RF connector options now possible on the Moteino, all these RF connectors are available in the shop for convenience:

 

Wireless Programming updates

In past times (see this and this post), wireless programming of a remote Moteino used to be done via a python script. This took a compiled Moteino sketch (hex file) and passed it to a programmer Moteino which would relay it to the target node . Later this python app was migrated to a windows desktop app (see release post and upload speed update). At which point non-windows folks were left with a somewhat out of date python script. I was asked about the status of the python app many times. So I decided to merge the python script and windows app so all platforms can use it. This was done via IronPython which can invoke a python script straight from a windows app. Hence wireless programming for Moteinos has gone through several changes:

  • the firmware part which used to be a separate library and has been merged into the RFM69 library, this is now called RFM69_OTA.h (vs: WirelessHEX.h) and all functions have the same name and parameters
  • the windows app now can run both natively (windows code) or invoke a new updated OTA.py python app which you can control and modify if you’d like

This is the best of both worlds. The new OTA.py script is cross platform and independent of the windows app, just needs to be invoked with the right parameters (run `python OTA.py -h` for details). Those on windows can just use the desktop app (runs the protocol in native C# code), or can click the “Run OTA.py” checkbox to instead invoke the OTA.py script dynamically. The parameters are passed from the desktop app into OTA.py and the desktop app conveniently remembers your programming parameters next time you open it.

Most significantly the WirelessProgramming.exe is now 3.8MB (vs 29KB) because it bundles all the required self contained IronPython runtime to run the OTA.py script. It also requires the pythonLibs.zip file that was added in the same directory.

Give this free tool a try and let me know if there are any issues or bugs. Enjoy!

 

Using PowerShield with Moteino & WeatherShield

John from John’s DIY Playground put together a nice video of setting up a Weather Node powered by a PowerShield from a LiPo battery, watch his assembly vide and demo below.

Although you could directly power the Moteino + WeatherShield from a LiPo battery, this is a good example of how you might assemble & use the PowerShield to get 5V from any lower voltage and power Moteino and other sensors for low power operation.

He also shows how to program it and configure it in his IoT Gateway software.

John mentions he made another video of a similar setup, this shows mating only the WeatherShield and a Moteino  with integrated antenna. Here it is:

Motorized blinds with Moteino

James from snorp.net looked into automated blinds but when he saw the eye watering prices he decided to make his own wireless motorized blinds. He posted a great detailed tutorial to do just that. The result is motorized blinds automation device that is wireless, low power and costs just $40 for the DIYer. This is a blast considering commercial devices can cost upwards of 10x or more. Here are the highlights of his project:

  • after experimenting with Bluetooth, he decided to use Moteino a try for it’s ability to use ListenMode and make the project very low power
  • the chosen motor was the 28BYJ-48 stepper motor for its low cost ($2), quiet operation and fine control ability
  • he used Fritzing to design a simple yet very elegant shield to host his motor driver and Moteino and posted the schematic, layout and BOM then fabbed the PCBs at MakerStudio:
  • the whole assembly is pretty compact, it uses a 4xAA pack to yield a consumption of just 46µA while running the motor an average 12s/day, that comes to a theoretical 7 years life on a set of high quality 4xAAs. In real life that should last at least 2 years. Here’s what it looks like assembled and installed:

And a demo of it in operation: