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. | 5 Comments |





5 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



Leave a Reply

*