Tuesday, December 13, 2016

AdaFruit Feather 32u4 / RFM69HCW Setup

Hardware: Adafruit Feather 32u4 Radio (RFM69HCW)

Software:  Windows 10, Arduino Sketch App 1.6.11

The two Feather 32u4 units/batteries next to an oDroid C2

I picked up a couple of these to test for a long distance heartbeat style application to use in a more industrial/retail environment.  I'd done a bit of testing with some components and finally just stepped back and decided to test directly with a board off the shelf and then see if I wanted to dig down into something simpler.  I'm sure glad I did.


I picked up two of these:  

That's essentially a programmable Arduino-style (32u4)  board with an 868/915mhz radio added.  

I also picked up a few different batteries to test duration:
I can already say that I'm fairly pleased with even the 350mAh one.  I left it running it's "out of the box" blink code for a few days and it was still doing fine when I decided enough was enough.  I think with the right configuration of shutting down the radio & LEDs and sending the unit into low power mode should give a good life to these units.

As well, the nice thing about these is that they're already set up to charge the batteries if/when USB power is supplied.  So you could attach the battery, deploy it somewhere and just expose a USB cable that could be plugged into recharge the unit.  This means that access to the internal unit would not be necessary until the battery eventually stops holding a charge.  If you're trying to keep things simple on yourself, then I can't imagine a simpler configuration for low-power and long-distance small packet communications.

Basic Setup

The instructions provided by Adafruit are pretty good.  
When I followed along it almost all worked fine.  The main thing I ran into was not being able to compile the example code they provided for the transmit/receive.  I got the following error message:

In file included from C:\Users\John\Documents\Arduino\libraries\RFM69\RFM69_OTA.cpp:33:0:

C:\Users\John\Documents\Arduino\libraries\RFM69/RFM69_OTA.h:51:22: fatal error: SPIFlash.h: No such file or directory

 #include <SPIFlash.h>

This had everything to do with the library I chose (LowPowerLab) and some files that were not included by default.  Although I will say that the folks doing the LowPowerLab library did a nice job of documenting their own code so it really was fairly straightforward on following the path down figuring out what was wrong as soon as I opened their RFM69_OTA.h file.  Essentially I needed to download another library:
Once I downloaded that and placed it similarly to the RFM69 library downloaded per the documentation (by default on Windows at ..\Documents\Arduino\libraries\SPIFlash), then I was able to compile the sketches and upload them without issue.

UPDATE:  Later, apparently some of the Feather code was updated w/ the Arduino IDE and this all stopped working.  I had to finally delete RFM69_OTC.cpp and RFM69_OTC.h from ..\Documents\Arduino\libraries\RFM69 as they simply would not compile.

Watch the right-hand "receiver" closely to see it responding to the broadcasts

One thing worth noting with the sample code if you install it "as is" is that it pauses certain aspects of it from running until the unit is plugged into a serial monitor.  So you'll need to plug it into your PC, start up the serial console and then you can disconnect it to move around and test.



Antenna

Initially, I did not attach an antenna to either board.  Without them, you can pick up the signals about 2-3 meters direct line of sight but no further.

After soldering a 3.25" (since I'm using 868mhz this is optimal) piece of stranded wire to the ANT position on each board, the range was notably greater.  I tested inside our brick/plaster home with lots of electronics without issue.  I also left one inside our home and walked around the far edges of our neighbors' properties and perhaps missed a beat or two but it really kept working fairly consistently.  So that was around 100 meters with brick walls and other homes in the way.  Not too shabby.

We also tested at another location and couldn't get more than 50 feet away without losing connections.  Changing over to 915mhz was much better even though we did not change the antenna length to reflect that.  As these are "open" frequencies interference can occur.  When in doubt, try to change the frequency before you do anything crazy.


2 comments:

  1. Are there any limitations on the kind of embedded applications discussed here? I have done some imbedded stuff that might be of use to those who needing very low-level components, such as things implemented in highly "resource-constrained" controllers, on bare metal, in assembly and sometimes a little C.

    ReplyDelete
  2. Not really. If you're interested in controbuting you're welcome to. I finished a lot of my embedded work and now work primarily on o365 Architecture vs. embedded endpoints. Although occasionally I show off and build out a button to cause something "magical" to happen in Azure AD (e.g. remove a co-worker from one of the Teams I own simply to annoy him - then press the button to re-add him and make him think he's going insane). I keep this up mainly as a reference and guide for anything relating to more embedded and Linux projects that might connect to embedded boards, but haven't been that active working on the form factor of late.

    ReplyDelete