SAMD21 LoRa Development Board with GPS

Project source code at GitHub: samd21-lora-gps

I’ve been doing some LoRa projects lately in order to learn as much as I can about this exciting new radio technology (see this LoRa mesh networking project and this LoRa weather station). ATmega328-based Moteino modules work great for a lot of projects, but I wanted a LoRa node with more processing power, more memory, and an onboard GPS receiver. The ATmega328 is just too constrained with memory — I’ve outgrown it. I really wanted a LoRa board with an ARM Cortex microcontroller like the SAMD21. This is the microcontroller used on the Arduino Zero. So, my ideal board is a SAMD21 with LoRa radio module and GPS receiver, all programmable with the Arduino IDE.

But, where is such a board? I could not find one so I decided to design and make one myself.

Hardware Design

Microchip/Atmel makes a SAMD21 chip and there are several variants. Most designs use the ‘G’ variant, but I wanted to use the simpler ‘E’ variant because it comes in a TQFP-32 package that I can very easily solder in my reflow oven without any trouble, or even by hand if I have to.

The GPS module is a cheap Quectel L80 with a MTK3339 chipset. It is easy to use but the backup power circuit requires a charging circuit, so I don’t have battery backup for quick startup. I mainly chose this module because it has big soldering pads with 2.54mm spacing for easier prototyping.

The LoRa radio module is a HopeRF module soldered to the bottom of the board.

Here is the schematic and image of the board design. The Eagle files are in the hardware directory of the samd21-lora-gps GitHub repo.

Burning a Bootloader

To make this board work with Arduino, I had to burn the Arduino bootloader onto the chip using an Atmel-ICE programmer. My board has 5 test points on the bottom for this purpose. The Atmel-ICE needs connections for VTG (3.3V), SWDIO, SWCLK, RESET, and GND. The board has to be powered over USB during the programming procedure. In the Arduino IDE, I selected Tools->Board = Arduino/Genuino Zero (Programming Port), Tools->Programmer = Atmel-ICE, and then just clicked Tools->Burn Bootloader. In a few seconds, my board had a bootloader and is now programmable as an Arduino Zero!

Programming the Board

I was careful in my design to allow this board to be used as an ordinary Arduino Zero even though it uses a different variant of the SAMD21 chip. The downside of this is that the default SPI pins defined for the Arduino Zero board use pins that are not present in the ‘E’ variant of the SAMD21. Luckily the design of the Arduino system is flexible enough that we can define a different SPI interface on different pins. There is a great article by Adafruit on this topic but it may be pretty hard to understand. The bottom line is that by using these lines in your Arduino sketch:

SPIClass SPI1(&sercom1, 12, 13, 11, SPI_PAD_0_SCK_1, SERCOM_RX_PAD_3);
pinPeripheral(11, PIO_SERCOM);
pinPeripheral(12, PIO_SERCOM);
pinPeripheral(13, PIO_SERCOM);

You can now use interface SPI1 to communicate with the LoRa module. I wrote a simple test sketch that reads the GPS module and broadcasts the GPS coordinates on the radio every 15 seconds. See the samd21-lora-gps GitHub repo.

This test code uses the RadioHead library to control the LoRa radio. The RadioHead library is flexible so I was able to use the SPI1 interface by defining a couple of new files, RHHardwareSPI1.[cpp,h].

Published by Michael, on October 27th, 2018 at 7:57 am. Filed under: IoT,LoRa. | 12 Comments |

12 Responses to “SAMD21 LoRa Development Board with GPS”

  1. More memory? So, this might be able to plug a gap in the lorawan/gps market nobody seems to be bothered about, or bothered enough about anyway.

    use case : At “base” there is lorawan gateway. When “tracked item” leaves base, connectivity is lost. When item returns to base, it sends that days’ gps coords to the gateway (think: 1 coord per hour).

    Seems a simple enough request, but nobody wants to make such a thing – I know I can get a quite a few coords (albeit a greatly reduced “sentence”) into the flash mem of pro-minis, so this should be a better candidate, no?

    Comment by PaulG on November 7, 2018 at 3:14 AM

  2. Could you please break out any unused I/O pins somewhere? That would make this much more useful.

    Comment by Mike Donovan on November 8, 2018 at 2:56 PM

  3. If it were a product, I would break out pins. But for my own use, I wanted it small.

    Comment by Michael on November 8, 2018 at 4:01 PM

  4. How much did this cost to build? There’s another product that uses this setup called Lynq on Indiegogo. They were $220USD for 2.

    Comment by Denis on November 15, 2018 at 5:57 AM

  5. About $30 in parts to make it. LoRa module is $8, GPS receiver $11, PCB, microcontroller, etc. Not cheap, but not as expensive as the Lynq on Indiegogo. I’m skeptical of the Lynq. It doesn’t say that it uses LoRa technology at all. It must be some proprietary protocol on an ISM band. I only pay attention to crowdfunding campaigns if they actually deliver, and Lynq is not delivered.

    Comment by Michael on November 16, 2018 at 2:12 PM

  6. I might try to build one. I can’t wait for the Lynq to ship sometime next year. I saw somewhere that they said they are using LoRa. It might be in the FCC report for their test units.

    Comment by Denis on December 16, 2018 at 5:14 PM

  7. Where did you get the lora and gps modules?

    Comment by Denis on December 26, 2018 at 8:46 AM

  8. The GPS modules are from AliExpress. They are Quectel L80 modules.
    The LoRa modules are HopeRF RFM95W 915MHz modules. A company called Anarduino sells them. They have an EBay store:

    Comment by Michael on December 29, 2018 at 1:48 PM

  9. I want 4! please can you sell it in Tindie or similar or publish full BOM and instructions to make it at jlcpcb or … something? I really need this, but i can’t pay for the indiegogo thing. And other questions, the usb charges the battery?

    Comment by Juanmol on March 1, 2019 at 1:58 AM

  10. I’m afraid I don’t have time now to produce this as a product. The design files are available:
    No, there is no charging circuit for battery.

    Comment by Michael on March 1, 2019 at 8:08 AM

  11. Me again :) ok, i suppose that i have to do is:
    1- upload the eagle file to an online service that develop the board
    2- Solder the radio and gps modules
    3- solder the other components (where are them?)
    4- flash arduino on it
    can you confirm it? Thanks!

    Comment by juanmol on March 19, 2019 at 7:01 AM

  12. Yes, that would be the steps. If you are in the US, I can send you a few boards already made. You would need to add the components. You also need an Atmel ICE programmer to flash the Arduino bootloader. An ICE programmer is expensive, I’m afraid.
    If you are in the US, contact us over email.

    Comment by Michael on March 19, 2019 at 11:54 AM

Leave a Reply