Introduction
Last month I posted about a LoRa FeatherWing Development Breakout that I made for Feather. Please check out that post to learn more about LoRa, the HopeRF RFM95/96(W) modules and potential uses of the breakout.
The LoRa FeatherWing IOX (I/O eXpander) is a follow-up to that design. The RFM95/96(W) side of the board is exactly the same as on the earlier FeatherWing. The big difference on the IOX is that I have replaced the breakout header for the Digital IO, chip select, and reset lines from the RFM module with an MCP23008 8-bit I/O expander. This chip allows the Adafruit Feather to control all of those pins on the RFM module over I2C. It is a huge step forward in this project, because it eliminates the manual wiring required for the breakout. This FeatherWing does not tie up any of your digital I/O pins on the Feather, and it makes the board compatible with any Feather variant. This is particularly important for the Feather HUZZAH ESP8266 which has a limited number of GPIO available.
Current LoRa and LoRaWAN libraries can be modified to incorporate the simple MCP23008 I2C library to drive the RFM module. I have also developed example programs to turn a Feather HUZZAH ESP8266 into a LoRa gateway to Adafruit IO using Wi-Fi.
The LoRa FeatherWing IOX (I/O eXpander) is a follow-up to that design. The RFM95/96(W) side of the board is exactly the same as on the earlier FeatherWing. The big difference on the IOX is that I have replaced the breakout header for the Digital IO, chip select, and reset lines from the RFM module with an MCP23008 8-bit I/O expander. This chip allows the Adafruit Feather to control all of those pins on the RFM module over I2C. It is a huge step forward in this project, because it eliminates the manual wiring required for the breakout. This FeatherWing does not tie up any of your digital I/O pins on the Feather, and it makes the board compatible with any Feather variant. This is particularly important for the Feather HUZZAH ESP8266 which has a limited number of GPIO available.
Current LoRa and LoRaWAN libraries can be modified to incorporate the simple MCP23008 I2C library to drive the RFM module. I have also developed example programs to turn a Feather HUZZAH ESP8266 into a LoRa gateway to Adafruit IO using Wi-Fi.
A node with LoRa FeatherWing IOX, Feather M0, MCP9701 temperature sensor and a Li-Po.
The node transmits data bursts to a Feather HUZZAH acting as a gateway,
which then pushes the data to Adafruit IO over Wi-Fi.
Incorporating the I/O Expander
To incorporate the MCP23008 into my earlier example programs, I used the Adafruit library for the chip. I felt this was a good approach, because if you are using Feathers you are likely already familiar with downloading Adafruit libraries. The library is quite simple. You use the same digitalRead and digitalWrite commands you are familiar with in the Arduino IDE, but you call them as member functions to the MCP23008 object. For example, to drive DIO0 low on the RFM module you would type "iox.digitalWrite(DIO0, LOW)" instead of the normal "digitalWrite(DIO0, LOW)".
If you want to write your own code for driving the chip, that is certainly possible as well. I broke out the interrupt pin from the MCP23008 to solder jumpers to select one of five digital I/O pins on the Feather to send it to. This could be used to increase efficiency of your code and minimize delays in seeing pin state changes.
If you want to write your own code for driving the chip, that is certainly possible as well. I broke out the interrupt pin from the MCP23008 to solder jumpers to select one of five digital I/O pins on the Feather to send it to. This could be used to increase efficiency of your code and minimize delays in seeing pin state changes.
The Interrupt pin from the MCP23008 can be sent to a digital pin on the Feather if desired.
The I2C address of the chip is fixed as 0x20.
Example Programs
I have three example programs for this board. Two are very similar to my earlier example programs for the Development Breakout. One configures the Feather as a beacon node that sends periodic data bursts, while the other is a general-purpose Transceiver program that is set up to receive the data from the beacons and print it out to USB serial.
In these examples, I am sending temperature data from an MCP9701 temperature sensor. You can of course modify the programs to send any sensor data you like. I also send the battery voltage reading using the battery monitoring circuit built in to Feather M0 and 32U4.
The third program I have provided is a bit more interesting. It is intended for use with the Feather HUZZAH, and not only echoes the received data to USB serial, but also pushes it to Adafruit IO using the MQTT library. Being able to get data into the "cloud" from nodes several kilometers away using LoRa modules instead of cellular could be a great addition to your sensor monitoring project.
In these examples, I am sending temperature data from an MCP9701 temperature sensor. You can of course modify the programs to send any sensor data you like. I also send the battery voltage reading using the battery monitoring circuit built in to Feather M0 and 32U4.
Receiving data from two different Beacons and viewing it in a serial terminal.
The third program I have provided is a bit more interesting. It is intended for use with the Feather HUZZAH, and not only echoes the received data to USB serial, but also pushes it to Adafruit IO using the MQTT library. Being able to get data into the "cloud" from nodes several kilometers away using LoRa modules instead of cellular could be a great addition to your sensor monitoring project.
Feather HUZZAH with a LoRa FeatherWing IOX.
Push the data to Adafruit IO over Wi-Fi for monitoring, graphing, and logging.
Monitoring the data from the Beacon nodes on Adafruit IO.
Please note that these are very simple programs intended as templates to build in the full functionality your project requires. One issue you might need to solve is how to handle multiple beacons trying to transmit at the same time. The overlapping transmissions will cause un-reliable reception at the gateway. A fix for this is to poll the beacons for updates from the gateway node, and only allow them to transmit when they are polled. Another possible fix is to send a response from the gateway when it successfully receives a data transmission. If a beacon doesn't get an acknowledgment, it should wait a random amount of time and try again. This provides some amount of de-confliction on the wireless link.
Shared as Open Source Hardware (OSHW)
Example Program: LoRa FeatherWing IOX Beacon Mode
Example Program: LoRa FeatherWing IOX Transceiver Mode
Example Program: LoRa FeatherWing IOX Adafruit IO Gateway (for Feather HUZZAH)
Example Program: LoRa FeatherWing IOX Adafruit IO Gateway (for Feather HUZZAH)
LoRa FeatherWing IOX Schematic
LoRa FeatherWing IOX Board Layout
Assemble Your Own
Here is the information you need if you'd like to order PCBs and make your own LoRa FeatherWing IOX boards.
Parts List:
- LoRa Module: HopeRF RFM95W or RFM96W (pick the correct frequency for the ISM bands used in your country)
- I/O Expander: MicroChip MCP23008 18-SOIC
- RF Connector: SMA or RP-SMA Edge-Launch for 1.6mm/0.062" board thickness
- C1: 47uF 1410 Tantalum SMD capacitor, 10V rated minimum
- C2: 1uF 0603 Ceramic SMD capacitor
- C3, C4: 100nF 0603 Ceramic SMD capacitors
- LED: 0805, color of your choice
- R1: 680 ohm 0603, or adjust value to change brightness of LED
- R2, R3: 4.7k ohm 0603 resistors (I2C pullups)
- Headers to connect the FeatherWing to the Feather board
- Antenna suitable for the frequency range supported by your RFM module
Going Forward
As to future LoRa boards, I would like to make one additional board with multiple sensors on it to be used as a ready-to-go Beacon node. I am also exploring ways to fit a U-Blox GPS module onto this FeatherWing.
Once I am done developing boards for the RFM95/96(W) modules, I may turn to a more sophisticated LoRaWAN module, such as the MicroChip RN2903. Wouldn't an actual Feather board with that module built in be cool? How about a FeatherWing Doubler with the microcontroller circuitry and a wireless module built directly onto it instead of prototyping area? That would give you two spots for FeatherWings and a huge amount of functionality.
As always, please post comments, corrections, and suggestions below.
Thanks for reading!
- Dan W.
wow ! nice piece of work.
ReplyDeleteThink I will start ordering parts for this..
@halifaxbigdog
Cool! The parts are pretty cheap, I tried to keep the bill of materials reasonable.
DeleteGreat job! And a Feather with a Microchip RN2483/2903 would be awesome. And the FeatherWing Doubler is also very cool.
ReplyDeleteGreat Work, could be a boon for our environmental sensor networks. We are going to make a few.
ReplyDeleteGreat, let me know if you need any additional info on assembly.
DeleteImpressed by your work. So professional and well described. Thanks for sharing this. Definitely I'll gonna make one LoRa Node based on your work. Well done.
ReplyDeleteHi, I found on thethingsnetwork you mocked up two RN2903/RN2483 featherwing boards. Would it be possible to upload these boards files to your github page?
ReplyDeleteHi, yes I will get them uploaded in the next few days. I cannot recommend the board, it's very difficult to solder due to the width of the module and the spacing of the Feather headers. That said I assembled two and RN2903 FeatherWings are really cool things to have.
DeleteHi Dan. Maybe you should do a quick blog post article just to let people know about this. Some people seemed to be really interested by your idea, here and on the TTN forums.
DeleteThis comment has been removed by a blog administrator.
ReplyDelete