The Adafruit Feather 32u4 RFM9xW LoRa is a versatile and powerful development board that combines the functionality of the ATmega32u4 microcontroller with the long-range communication capabilities of the RFM95W LoRa radio module. This board is part of the Feather ecosystem, designed by Adafruit for portability, ease of use, and interoperability with a wide range of FeatherWings (add-on boards). It is ideal for Internet of Things (IoT) projects, remote sensor networks, and any application requiring efficient wireless communication over long distances.
Pin Number | Function | Description |
---|---|---|
1 | GND | Ground |
2 | 3V3 | 3.3V output from the regulator |
3 | AREF | Analog reference voltage for ADC |
4 | A0-D5 | Analog input 0 or Digital I/O pin 5 |
... | ... | ... |
20 | BAT | Battery voltage (for battery-powered applications) |
Note: This is a partial representation of the pin configuration. Please refer to the official datasheet for the complete pinout.
Powering the Board:
Programming the Board:
Connecting the LoRa Radio:
#include <SPI.h>
#include <RH_RF95.h>
// Singleton instance of the radio driver
RH_RF95 rf95;
void setup() {
// Initialize the RFM95W module
if (!rf95.init()) {
Serial.println("LoRa radio init failed");
while (1);
}
Serial.println("LoRa radio init OK!");
// Set the frequency appropriate for your region (e.g., 915.0 for North America)
if (!rf95.setFrequency(915.0)) {
Serial.println("setFrequency failed");
while (1);
}
// Optionally, increase the transmitter power for longer range
rf95.setTxPower(18, false);
}
void loop() {
// Send a message every 3 seconds
const char *msg = "Hello, world!";
rf95.send((uint8_t *)msg, strlen(msg));
// Wait for a reply (optional)
uint8_t buf[RH_RF95_MAX_MESSAGE_LEN];
uint8_t len = sizeof(buf);
if (rf95.waitAvailableTimeout(3000)) {
// Should be a reply message for us now
if (rf95.recv(buf, &len)) {
Serial.print("Got reply: ");
Serial.println((char*)buf);
} else {
Serial.println("Receive failed");
}
} else {
Serial.println("No reply, is another RFM95W module running?");
}
delay(3000);
}
Note: This example assumes that you have the RadioHead library installed in your Arduino IDE. The code comments are wrapped to limit line length to 80 characters.
Remember to replace the frequency in the setFrequency
call with the appropriate value for your region (e.g., 868.0 for Europe). Always test your setup in a controlled environment before deploying it in a real-world application.