Adafruit Feather M0 Radio with RFM69 Packet Radio Created by lady ada Last updated on 2018-11-15 05:21:38 PM UTC
Guide Contents Guide Contents Overview Pinouts Power Pins Logic pins RFM/SemTech Radio Module Other Pins! Assembly Header Options! Soldering in Plain Headers Prepare the header strip: Add the breakout board: And Solder! Soldering on Female Header Tape In Place Flip & Tack Solder And Solder! 2 5 9 10 10 11 12 14 14 17 17 17 18 20 20 20 22 Antenna Options Wire Antenna uFL Antenna Power Management Battery + USB Power Power supplies Measuring Battery ENable pin Radio Power Draw Arduino IDE Setup 24 24 25 2
I can't get the Itsy/Feather USB device to show up - I get "USB Device Malfunctioning" errors! 43 I'm having problems with COM ports and my Itsy/Feather 32u4/M0 43 I don't understand why the COM port disappears, this does not happen on my Arduino UNO! 44 I'm trying to upload to my 32u4, getting "avrdude: butterfly_recv(): programmer is not responding" errors 44 I'm trying to upload to my Feather M0, and I get this error "Connecting to programmer: .
Radio Range F.A.Q. 71 Which gives better range, LoRa or RFM69? What ranges can I expect for RFM69 radios? What ranges can I expect for RFM9X LoRa radios? I don't seem to be getting the range advetised! Is my module broken? How do I pick/design the right antenna? Downloads Datasheets & Files Schematic Fabrication Print © Adafruit Industries 71 71 71 71 71 72 72 72 73 https://learn.adafruit.
Overview This is the Adafruit Feather M0 RFM69 Packet Radio (433 or 900 MHz) - our take on an microcontroller with a 433 or 868/915 MHz radio module cooked in! Great for making wireless networks that can go further than 2.4GHz 802.15.4 and similar, are more flexible than Bluetooth LE and without the high power requirements of WiFi. We have other boards in the Feather family, check'em out here (https://adafru.
Here's some handy specs! Like all Feather M0's you get: Measures 2.0" x 0.9" x 0.3" (51mm x 23mm x 8mm) without headers soldered in Light as a (large?) feather - 5.8 grams ATSAMD21G18 @ 48MHz with 3.3V logic/power No EEPROM 3.
The Feather M0 Radio uses the extra space left over to add an RFM69HCW 433 or 868/915 MHz radio module. These radios are not good for transmitting audio or video, but they do work quite well for small data packet transmission when you ned more range than 2.4 GHz (BT, BLE, WiFi, ZigBee) SX1231 based module with SPI interface Packet radio with ready-to-go Arduino libraries Uses the amateur or license-free ISM bands (https://adafru.
Comes fully assembled and tested, with a USB bootloader that lets you quickly use it with the Arduino IDE. We also toss in some header so you can solder it in and plug into a solderless breadboard. You will need to cut and solder on a small piece of wire (any solid or stranded core is fine) in order to create your antenna. Lipoly battery and USB cable not included but we do have lots of options in the shop if you'd like! © Adafruit Industries https://learn.adafruit.
Pinouts Note AREF in the diagram should be marked PA03 not PA02 The Feather M0 Radio is chock-full of microcontroller goodness. There's also a lot of pins and ports. We'll take you a tour of them now! Note that the pinouts are identical for both the Feather M0 RFM69 and LoRa radios - you can look at the silkscreen of the Feather to see it says "RFM69" or "LoRa" Pinouts are also the same for both 433MHz and 900Mhz.
the chip or crystal of the radio, green/blue is 900MHz & red is 433MHz Power Pins GND - this is the common ground for all power and logic BAT - this is the positive voltage to/from the JST jack for the optional Lipoly battery USB - this is the positive voltage to/from the micro USB jack if connected EN - this is the 3.3V regulator's enable pin. It's pulled up, so connect to ground to disable the 3.3V regulator 3V - this is the output from the 3.
This is the general purpose I/O pin set for the microcontroller. All logic is 3.3V Nearly all pins can do PWM output All pins can be interrupt inputs #0 / RX - GPIO #0, also receive (input) pin for Serial1 (hardware UART), also can be analog input #1 / TX - GPIO #1, also transmit (output) pin for Serial1, also can be analog input #20 / SDA - GPIO #20, also the I2C (Wire) data pin. There's no pull up on this pin by default so when using with I2C, you may need a 2.2K-10K pullup.
Since not all pins can be brought out to breakouts, due to the small size of the Feather, we use these to control the radio module #8 - used as the radio CS (chip select) pin #3 - used as the radio GPIO0 / IRQ (interrupt request) pin. #4 - used as the radio Reset pin Since these are not brought out there should be no risk of using them by accident! There are also breakouts for 3 of the RFM's GPIO pins (IO1, IO2, IO3 and IO5).
© Adafruit Industries https://learn.adafruit.
Assembly We ship Feathers fully tested but without headers attached - this gives you the most flexibility on choosing how to use and configure your Feather Header Options! Before you go gung-ho on soldering, there's a few options to consider! The first option is soldering in plain male headers, this lets you plug in the Feather into a solderless breadboard © Adafruit Industries https://learn.adafruit.
Another option is to go with socket female headers. This won't let you plug the Feather into a breadboard but it will let you attach featherwings very easily © Adafruit Industries https://learn.adafruit.
We also have 'slim' versions of the female headers, that are a little shorter and give a more compact shape © Adafruit Industries https://learn.adafruit.
Finally, there's the "Stacking Header" option. This one is sort of the best-of-both-worlds. You get the ability to plug into a solderless breadboard and plug a featherwing on top. But its a little bulky Soldering in Plain Headers © Adafruit Industries https://learn.adafruit.
Prepare the header strip: Cut the strip to length if necessary. It will be easier to solder if you insert it into a breadboard - long pins down © Adafruit Industries https://learn.adafruit.
Add the breakout board: Place the breakout board over the pins so that the short pins poke through the breakout pads And Solder! Be sure to solder all pins for reliable electrical contact. (For tips on soldering, be sure to check out our Guide to Excellent Soldering (https://adafru.it/aTk)). © Adafruit Industries https://learn.adafruit.
Solder the other strip as well. © Adafruit Industries https://learn.adafruit.
You're done! Check your solder joints visually and continue onto the next steps Soldering on Female Header Tape In Place For sockets you'll want to tape them in place so when you flip over the board they don't fall out © Adafruit Industries https://learn.adafruit.
Flip & Tack Solder After flipping over, solder one or two points on each strip, to 'tack' the header in place And Solder! © Adafruit Industries https://learn.adafruit.
Be sure to solder all pins for reliable electrical contact. (For tips on soldering, be sure to check out our Guide to Excellent Soldering (https://adafru.it/aTk)). © Adafruit Industries https://learn.adafruit.
You're done! Check your solder joints visually and continue onto the next steps © Adafruit Industries https://learn.adafruit.
Antenna Options Your Feather Radio does not have a built-in antenna. Instead, you have two options for attaching an antenna. For most low cost radio nodes, a wire works great. If you need to put the Feather into an enclosure, soldering in uFL and using a uFL to SMA adapter will let you attach an external antenna Wire Antenna A wire antenna, aka "quarter wave whip antenna" is low cost and works very well! You just have to cut the wire down to the right length.
That's pretty much it, you're done! uFL Antenna If you want an external antenna, you need to do a tiny bit more work but its not too difficult. You'll need to get an SMT uFL connector, these are fairly standard (http://adafru.it/1661) You'll also need a uFL to SMA adapter (http://adafru.
Check the bottom of the uFL connector, note that there's two large side pads (ground) and a little inlet pad. The other small pad is not used! © Adafruit Industries https://learn.adafruit.
Solder all three pads to the bottom of the Feather Once done attach your uFL adapter and antenna! © Adafruit Industries https://learn.adafruit.
Power Management Battery + USB Power We wanted to make the Feather easy to power both when connected to a computer as well as via battery. There's two ways to power a Feather. You can connect with a MicroUSB cable (just plug into the jack) and the Feather will regulate the 5V USB down to 3.3V. You can also connect a 4.2/3.7V Lithium Polymer (Lipo/Lipoly) or Lithium Ion (LiIon) battery to the JST jack. This will let the Feather run on a rechargable battery.
The above shows the Micro USB jack (left), Lipoly JST jack (top left), as well as the 3.3V regulator and changeover diode (just to the right of the JST jack) and the Lipoly charging circuitry (to the right of the Reset button). There's also a CHG LED, which will light up while the battery is charging. This LED might also flicker if the battery is not connected.
#define VBATPIN A7 float measuredvbat = analogRead(VBATPIN); measuredvbat *= 2; // we divided by 2, so multiply back measuredvbat *= 3.3; // Multiply by 3.3V, our reference voltage measuredvbat /= 1024; // convert to voltage Serial.print("VBat: " ); Serial.println(measuredvbat); ENable pin If you'd like to turn off the 3.3V regulator, you can do that with the EN(able) pin. Simply tie this pin to Ground and it will disable the 3V regulator.
reduce to amost nothing with proper sleep modes and not putting the module in active listen mode! Here is a transmit with radio.setPowerLevel(0) to set +5dBm power You still have the 25mA average, but during transmit, it only uses another 20mA not 100mA If you put the radio to sleep after transmitting with radio.
© Adafruit Industries https://learn.adafruit.
Arduino IDE Setup The first thing you will need to do is to download the latest release of the Arduino IDE. You will need to be using version 1.8 or higher for this guide https://adafru.it/f1P https://adafru.it/f1P After you have downloaded and installed the latest version of Arduino IDE, you will need to start the IDE and navigate to the Preferences menu. You can access it from the File menu in Windows or Linux, or the Arduino menu on OS X. A dialog will pop up just like the one shown below.
We will be adding a URL to the new Additional Boards Manager URLs option. The list of URLs is comma separated, and you will only have to add each URL once. New Adafruit boards and updates to existing boards will automatically be picked up by the Board Manager each time it is opened. The URLs point to index files that the Board Manager uses to build the list of available & installed boards.
Here's a short description of each of the Adafruit supplied packages that will be available in the Board Manager when you add the URL: Adafruit AVR Boards - Includes support for Flora, Gemma, Feather 32u4, Trinket, & Trinket Pro.
Using with Arduino IDE The Feather/Metro/Gemma/Trinket M0 and M4 use an ATSAMD21 or ATSAMD51 chip, and you can pretty easily get it working with the Arduino IDE. Most libraries (including the popular ones like NeoPixels and display) will work with the M0 and M4, especially devices & sensors that use I2C or SPI. Now that you have added the appropriate URLs to the Arduino IDE preferences in the previous page, you can open the Boards Manager by navigating to the Tools->Board menu.
Next you can install the Adafruit SAMD package to add the board file definitions Make sure you have Type All selected to the left of the Filter your search... box You can type Adafruit SAMD in the top search bar, then when you see the entry, click Install Even though in theory you don't need to - I recommend rebooting the IDE Quit and reopen the Arduino IDE to ensure that all of the boards are properly installed. You should now be able to select and upload to the new boards listed in the Tools->Board menu.
Install Drivers (Windows 7 & 8 Only) When you plug in the board, you'll need to possibly install a driver Click below to download our Driver Installer https://adafru.it/AB0 https://adafru.it/AB0 Download and run the installer Run the installer! Since we bundle the SiLabs and FTDI drivers as well, you'll need to click through the license © Adafruit Industries https://learn.adafruit.
Select which drivers you want to install, the defaults will set you up with just about every Adafruit board! Click Install to do the installin' Blink Now you can upload your first blink sketch! Plug in the M0 or M4 board, and wait for it to be recognized by the OS (just takes a few seconds). It will create a serial/COM port, you can now select it from the drop-down, it'll even be 'indicated' as Trinket/Gemma/Metro/Feather/ItsyBitsy/Trellis! © Adafruit Industries https://learn.adafruit.
Now load up the Blink example // the setup function runs once when you press reset or power the board void setup() { // initialize digital pin 13 as an output.
If you get an alert that looks like Cannot run program "{runtime.tools.arm-none-eabi-gcc.path}\bin\arm-non-eabi-g++" Make sure you have installed the Arduino SAMD boards package, you need both Arduino & Adafruit SAMD board packages Manually bootloading If you ever get in a 'weird' spot with the bootloader, or you have uploaded code that crashes and doesn't auto-reboot into the bootloader, click the RST button twice (like a double-click)to get back into the bootloader.
made to configure modem manager not to touch the Feather board and will fix the programming difficulty issue. Follow the steps for installing Adafruit's udev rules on this page. (https://adafru.it/iOE) © Adafruit Industries https://learn.adafruit.
Feather HELP! Even though this FAQ is labeled for Feather, the questions apply to ItsyBitsy's as well! My ItsyBitsy/Feather stopped working when I unplugged the USB! A lot of our example sketches have a while (!Serial); line in setup(), to keep the board waiting until the USB is opened. This makes it a lot easier to debug a program because you get to see all the USB data output.
I can't get the Itsy/Feather USB device to show up - I get "USB Device Malfunctioning" errors! This seems to happen when people select the wrong board from the Arduino Boards menu. If you have a Feather 32u4 (look on the board to read what it is you have) Make sure you select Feather 32u4 for ATMega32u4 based boards! Do not use anything else, do not use the 32u4 breakout board line.
When the user COM port disappears, Arduino will not be able to automatically start the bootloader and upload new software.
Adapting Sketches to M0 The ATSAMD21 is a very nice little chip but its fairly new as Arduino-compatible cores go. Most sketches & libraries will work but here's a few things we noticed! The below note are for all M0 boards, but not all may apply (e.g. Trinket and Gemma M0 do not have ARef so you can skip the Analog References note!) Analog References If you'd like to use the ARef pin for a non-3.
AnalogWrite / PWM on Feather/Metro M0 After looking through the SAMD21 datasheet, we've found that some of the options listed in the multiplexer table don't exist on the specific chip used in the Feather M0. For all SAMD21 chips, there are two peripherals that can generate PWM signals: The Timer/Counter (TC) and Timer/Counter for Control Applications (TCC). Each SAMD21 has multiple copies of each, called 'instances'. Each TC instance has one count register, one control register, and two output channels.
TX and SDA (Digital pins 1 and 20) analogWrite() PWM range On AVR, if you set a pin's PWM with analogWrite(pin, 255) it will turn the pin fully HIGH. On the ARM cortex, it will set it to be 255/256 so there will be very slim but still-existing pulses-to-0V.
You can't be guaranteed that this will work on a 32-bit platform because mybuffer might not be aligned to a 2 or 4byte boundary. The ARM Cortex-M0 can only directly access data on 16-bit boundaries (every 2 or 4 bytes). Trying to access an odd-boundary byte (on a 1 or 3 byte location) will cause a Hard Fault and stop the MCU. Thankfully, there's an easy work around ...
There's a lot of registers on the SAMD21, and you often are going through ASF or another framework to get to them. So having a way to see exactly what's going on is handy. This library from drewfish will help a ton! https://github.com/drewfish/arduino-ZeroRegs (https://adafru.it/Bet) © Adafruit Industries https://learn.adafruit.
Using the RFM69 Radio This page is shared between the RFM69 breakout and the all-in-one Feather RFM69's. The example code and overall functionality is the same, only the pinouts used may differ! Just make sure the example code is using the pins you have wired up. Before beginning make sure you have your Arduino or Feather working smoothly, it will make this part a lot easier. Once you have the basic functionality going - you can upload code, blink an LED, use the serial output, etc.
correction so you can be sure the whole data set was transmitted correctly, automatic re-transmit retries and returnreceipt when the packet was delivered. Basically, you get the transparency of a data pipe without the annoyances of radio transmission unreliability Arduino Libraries These radios have really great libraries already written, so rather than coming up with a new standard we suggest using existing libraries such as LowPowerLab's RFM69 Library (https://adafru.
Before uploading, check for the #define FREQUENCY RF69_915MHZ line and comment that out (and uncomment the line above) to match the frequency of the hardware you're using These examples are optimized for the Feather 32u4/M0.
This code will receive and reply with a small packet of data. Open up the example RadioHead -> feather -> RadioHead69_RawDemo_RX Load this code into your Receiver Arduino/Feather! Before uploading, check for the #define FREQUENCY RF69_915MHZ line and comment that out (and uncomment the line above) to match the frequency of the hardware you're using These examples are optimized for the Feather 32u4/M0.
And, on the transmitter side, it is now printing Got Reply after each transmisssion because it got a reply from the receiver That's pretty much the basics of it! Lets take a look at the examples so you know how to adapt to your own radio network Radio Freq. Config Each radio has a frequency that is configurable in software. You can actually tune outside the recommended frequency, but the range won't be good. 900 MHz can be tuned from about 850-950MHz with good performance.
#if defined (__AVR_ATmega32U4__) // Feather 32u4 w/Radio #define RFM69_CS 8 #define RFM69_INT 7 #define RFM69_RST 4 #define LED 13 #endif If you're using a Feather M0, the pinout is slightly different: #if defined(ARDUINO_SAMD_FEATHER_M0) // Feather M0 w/Radio #define RFM69_CS 8 #define RFM69_INT 3 #define RFM69_RST 4 #define LED 13 #endif If you're using an Arduino UNO or compatible, we recommend: #if defined (__AVR_ATmega328P__) // UNO or Feather 328P w/wing #define RFM69_INT 3 // #define RFM69_CS 4 //
void setup() { Serial.begin(115200); //while (!Serial) { delay(1); } // wait until serial console is open, remove if not tethered to computer pinMode(LED, OUTPUT); pinMode(RFM69_RST, OUTPUT); digitalWrite(RFM69_RST, LOW); Serial.println("Feather RFM69 RX Test!"); Serial.
Basic Transmission Code If you are using the transmitter, this code will wait 1 second, then transmit a packet with "Hello World #" and an incrementing packet number, then check for a reply void loop() { delay(1000); // Wait 1 second between transmits, could also 'sleep' here! char radiopacket[20] = "Hello World #"; itoa(packetnum++, radiopacket+13, 10); Serial.print("Sending "); Serial.println(radiopacket); // Send a message! rf69.send((uint8_t *)radiopacket, strlen(radiopacket)); rf69.
void loop() { if (rf69.available()) { // Should be a message for us now uint8_t buf[RH_RF69_MAX_MESSAGE_LEN]; uint8_t len = sizeof(buf); if (rf69.recv(buf, &len)) { if (!len) return; buf[len] = 0; Serial.print("Received ["); Serial.print(len); Serial.print("]: "); Serial.println((char*)buf); Serial.print("RSSI: "); Serial.println(rf69.lastRssi(), DEC); if (strstr((char *)buf, "Hello World")) { // Send a reply! uint8_t data[] = "And hello back to you"; rf69.send(data, sizeof(data)); rf69.
This demo code shows how you can listen for packets and also check for button presses (or sensor data or whatever you like) and send them back and forth between the two radios! Addressed RX and TX Demo OK so the basic demo is well and good but you have to do a lot of management of the connection to make sure packets were received. Instead of manually sending acknowledgements, you can have the RFM69 and library do it for you! Thus the Reliable Datagram part of the RadioHead library.
Because the data is being sent to address #1, but #1 is not acknowledging that data. If you have the server running, with no clients, it will sit quietly: Turn on the client and you'll see acknowledged packets! © Adafruit Industries https://learn.adafruit.
And the server is also pretty happy The secret sauce is the addition of this new object: // Class to manage message delivery and receipt, using the driver declared above RHReliableDatagram rf69_manager(rf69, MY_ADDRESS); Which as you can see, is the manager for the RFM69. In setup() you'll need to init it, although you still configure the underlying rfm69 like before: if (!rf69_manager.init()) { Serial.
if (rf69_manager.sendtoWait((uint8_t *)radiopacket, strlen(radiopacket), DEST_ADDRESS)) { on the 'other side' use the recvFromAck which will receive and acknowledge a packet // Wait for a message addressed to us from the client uint8_t len = sizeof(buf); uint8_t from; if (rf69_manager.recvfromAck(buf, &len, &from)) { That function will wait forever. If you'd like to timeout while waiting for a packet, use recvfromAckTimeout which will wait an indicated # of milliseconds if (rf69_manager.
CircuitPython for RFM69 It's easy to use the RFM69HCW radio with CircuitPython and the Adafruit CircuitPython RFM69 (https://adafru.it/BjE) module. This module allows you to easily write Python code that sends and receives packets of data with the radio.
Board 3V to radio VIN Board GND to radio GND Board SCK to radio SCK Board MOSI to radio MOSI Board MISO to radio MISO Board D5 to radio CS (or any other digital I/O pin) Board D6 to radio RST (or any other digital I/O pin) Usage with All-In-One Feather M0 Alternatively you can use the Feather M0 RFM69 board but be sure you've loaded the adafruit-circuitpythonfeather_m0_rfm69-*.bin (https://adafru.
Adafruit Feather M0 RFM69HCW Packet Radio - 433MHz $24.95 IN STOCK ADD TO CART Module Install Next you'll need to install the Adafruit CircuitPython RFM69 (https://adafru.it/BjE) module on your CircuitPython board. Before you do that make sure you are running the latest version of Adafruit CircuitPython (https://adafru.it/Amd) for your board too (again be sure to the load the Feather M0 RFM69 version if you're using that board and want to use its built-in radio module).
However if you're using the Feather M0 RFM69 board with a built-in RFM69 radio (and you've loaded the special version of CircuitPython just for this board as mentioned above), you instead want to use these pins for the CS and RST lines: cs = digitalio.DigitalInOut(board.RFM69_CS) reset = digitalio.DigitalInOut(board.RFM69_RST) You're ready to import the RFM69 module and create an instance of the RFM69 class inside it.
If you have another RFM69 on the same frequency and modulation waiting to receive messages (like another CircuitPython module running receive code below) you should see it receive the message.
One thing to note in Python byte strings aren't exactly like text strings and you might not be able to do all the text processing (like find, replace, etc.) as you expect. However you can convert a byte string into text by assuming a specific text encoding like ASCII. For example to receive a packet and convert the contents to an ASCII text string you can run code like: packet = rfm69.receive() # Wait for a packet to be received (up to 0.
Here's a complete example of sending a message and waiting to receive and print any received messages. Save this as main.py on your board and open the serial REPL to see it print data and any received messages. If you have two boards and radios setup to run this code at the same time they'll send each other a message on start up! # Simple example to send a message and then wait indefinitely for messages # to be received.
# Optionally change the receive timeout from its default of 0.5 seconds: #packet = rfm69.receive(timeout=5.0) # If no packet was received during the timeout then None is returned. if packet is None: print('Received nothing! Listening again...') else: # Received a packet! # Print out the raw bytes of the packet: print('Received (raw bytes): {0}'.format(packet)) # And decode to ASCII text and print it too.
Radio Range F.A.Q. Which gives better range, LoRa or RFM69? All other things being equal (antenna, power output, location) you will get better range with LoRa than with RFM69 modules. We've found 50% to 100% range improvement is common. What ranges can I expect for RFM69 radios? The RFM69 radios have a range of approx. 500 meters line of sight with tuned uni-directional antennas.
Downloads Datasheets & Files For the LoRa version: SX127x Datasheet (https://adafru.it/oBm)- The RFM9X LoRa radio chip itself RFM9X (https://adafru.it/mFX) - The radio module, which contains the SX1272 chipset For the RFM69 version: SX1231 Transceiver Datasheet (https://adafru.it/mCv) RFM69HCW Datasheet (https://adafru.it/mFX) FCC Test Report (https://adafru.it/oC0) RoHS Test Report (https://adafru.it/oC1) RoHS Test Report (https://adafru.it/oC2) REACH Test Report (https://adafru.
Fabrication Print Dimensions in Inches.