LowPowerLab Forum

Hardware support => Moteino => Topic started by: sketchy on December 17, 2013, 05:02:17 PM

Title: wiring RFM69HW + Arduino Uno
Post by: sketchy on December 17, 2013, 05:02:17 PM
I am "exploring" different configurations for a base station (RFM69 + WiFi + Persistent Storage) -> I'm finding I need more SRAM than the Uno (i.e.: Moteino) has.  So I've been looking at the ATMega 1284p.
I apologize - but my experience with electronics is new.  I am hoping you can validate that I am doing the right wiring.  I have attached the rFM69HW  pinout.

The RFM69HW:
- (I'M CONFUSED HERE) has 2 GND pins and one NC (Connect to GND).  Q1: WHY 2 GND PINS?  Q2: I ASSUME I USE THE NC AND CONNECT TO ARDUINO'S GND (my normal circuit building procedure)
-  talks to the Arduino using SPI.  So I'll need to wire up the MISO, MOSI,NSS (Their acronym for Chip Select), and SCK.
- is 3.3V, so I'll have a wire running from the 3.3v, but will need a level shifter to go from 5v(Arduino) to 3.3V (RMF69HW)

(I'M NOT SURE ABOUT THIS...) from looking at RFM69.cpp, it seems to me that the writes use SPI so if I only wire up the above, I should be able to TX/RX (with a moteino) using the RFM69 library within a sketch.  Is this correct?

Thank you!

Title: Re: wiring RFM69HW + Arduino Uno
Post by: KanyonKris on December 17, 2013, 06:17:17 PM
A Raspberry Pi or Beagle Bone Black work very well as a base station (see the Mailbox Notifier and other examples on the blog).

But perhaps you need to run low power, in which case you could do as you propose - stick a RFM96HW on an ATMega1284 Arduino. For your circuit questions, I'd wire up the RFM96HW like Felix did for the Moteino, have you looked at the Moteino schematics (on Github)?
Title: Re: wiring RFM69HW + Arduino Uno
Post by: sketchy on December 17, 2013, 06:48:03 PM
Thank you VERY much.  I have not looked at the schematic.  Will do that now.

Question on the Raspberry Pi.  Seems many recommend for a base station.  Yet, as I understand it, the Raspberry Pi makes a pretty good web server/Linux like environment.  At the most, I need to open a socket and pump data through or use REST to send data to a cloud service (which is easy to do on the Arduino).  It seems like overkill. What am i missing?
Title: Re: wiring RFM69HW + Arduino Uno
Post by: Felix on December 17, 2013, 07:31:42 PM
At ~$25-30 for an Arduino UNO, and $40 for a RaspberryPi .. I'd go with the Pi just cause you get to learn Linux and it's a great little computer that can do a lot more than just mentioned. I mean I really don't need to introduce the Pi here, just look around the web - countless projects and tutorials. It can however be a steep learning curve to get from reading sensor data to Pi to cloud. Very worth it in my opinion. I think it's reasonable to assume we're gonna see more of these linux based computers as the maker movement takes off, so it's a good skill to learn. Thank God Microsoft is not polluting this market with their garbage yet. Oh wait .. they got the .net Microframework. But never mind that hopeless attempt, it sucks just as bad as everything else from Redmond.
Title: Re: wiring RFM69HW + Arduino Uno
Post by: tve on December 17, 2013, 07:44:20 PM
Nitpick: I'd recommend the BBB over the Pi from the point of view that it is really designed for I/O. So you get up on the learning curve with a device that you can use for more ambitious hardware interface projects...

WRT why not use an arduino... I have a couple of JeeNodes with the EtherCard and I've hacked up the ethercard library for my purposes. If you look at the TCP code you'll see that it's very bare-bones and by no means supports the full TCP protocol. You're crossing fingers that the box on the far ends doesn't send the "wrong" packet. I wrote my gateway to use UDP and even then I had to make some changes. For example, the library can only do ARP for one IP address and I needed to talk to the UDP service on one box, my default router on another box, and my NTP server on yet another (I broadcast time packets from the gateway so all the JeeNodes can get the time-of-day). If anything isn't working or ceases to work it becomes pretty painful to troubleshoot, you can't "log in" to the JeeNode and type some debug commands.

Or you end up on both sides of RF12B and RF69HW and need a gateway for both, ah, maybe you can cram all that into one Arduino but most likely you're now looking at 2x Arduino + 2x Ethernet + 2x RF00 radio vs. 1x BBB + 2x RF00. Oh did you want to put your gateway on WiFi by any chance? Etc...

Of course YMMV!!!
Title: Re: wiring RFM69HW + Arduino Uno
Post by: Felix on December 17, 2013, 07:51:34 PM
Hey BBB might be awesome and from what I gather it is speedier than the Pi, also more pricey, I have yet to give it a try.
If you want to bridge your arduino network on the web, then making every node web connected is not really a good way to go, as pointed by tve. You really want a single point of failure and one that you can do some real debugging on if you need to.
Title: Re: wiring RFM69HW + Arduino Uno
Post by: KanyonKris on December 17, 2013, 11:51:11 PM
I have 2 Raspberry Pi boards, done a few projects with them, liked them a lot - but I'm intrigued by the Beagle Bone Black (BBB). Cost is about a wash since the BBB has 2GB flash on board (need an SD card for the Pi) and includes a USB cable. I like the huge amount of IO of the BBB, but a bit turned off by the stripped down Angstrom linux (more full-featured distros are available but will most likely require an SD card for more space).

Here's a good comparison that also serves as an intro to each board - http://makezine.com/magazine/how-to-choose-the-right-platform-raspberry-pi-or-beaglebone-black/

These linux boards open up so many possibilities and usually make it easier to get stuff done. You can write code in whatever language you want (even interpreted languages like Python, which is what I use most). You've got a clock, full network services including web, a file system or databases, shell scripting for automating tasks or gluing stuff together, terminal, easily install new software and upgrade (i.e. apt-get), and more. It's crazy that you can get essentially a desktop computer in a tiny, low-power board for $35.

I've got a Pi in the garage as my sprinkler controller. Overkill? Certainly. But for $35 (cheaper than you can buy a sprinkler controller at the store), why not? Now I can control it from my phone or any browser and hack on it to my heart's content.
Title: Re: wiring RFM69HW + Arduino Uno
Post by: camdenl on December 19, 2013, 01:59:01 PM
OP have a look at this thread for the logic conversion:

I used a bi-directional level shifter to receive data, but it only works if I transmit every few seconds, using the default sketches it seems to hang.

I am testing different voltage divider configs right now, will report back with what works best for me.
Title: Re: wiring RFM69HW + Arduino Uno
Post by: camdenl on December 19, 2013, 02:55:55 PM
As suggested in the linked thread, a 2.2/1k resistor combo works just fine for me with an Arduino Uno.  Next step is on a Mega 2560.
Title: Re: wiring RFM69HW + Arduino Uno
Post by: sketchy on December 19, 2013, 06:19:53 PM
Thank you for the link.  I looked at that.  Anyone - should this work?  (i.e.: otherwise, the chip is most likely not functioning?).  I think this should work.  Advice appreciated

Here is what I have done:
on RFM69HW for SPI need pins CS(Chip Select),CLK,MOSI,MISO,IRQ,GND,3.3V

CS,CLK, MOSI will go from 5V Arduino GPIO to 3.3V RFM69HW.  For each of these, I set up a voltage divider: R2 = 3.3K  R1 = 2.2K.  When I tested with a multimeter, the voltage at the 1/2 way point was 3 V.  So this should work to convert a Arduino HIGH of 5V to an RFM69HW HIGH of 3.3V.

The MISO, IRQ I plugged directly into the pins on the Arduino (IRQ -> pin 2, MISO -> pin 11)
I use the Arduino's 3.3V and GND to power the RFM69HW.

I then load struct_send sketch.  The sketch can't get through radio.initialize().  It hangs on
     do writeReg(REG_SYNCVALUE1, 0xaa); while (readReg(REG_SYNCVALUE1) != 0xaa);

Title: Re: wiring RFM69HW + Arduino Uno
Post by: camdenl on December 19, 2013, 09:56:37 PM
Maybe try lower resistor values? 
Title: Re: wiring RFM69HW + Arduino Uno
Post by: NixHydra on December 20, 2013, 12:39:31 AM
Hi Sketchy,

   Just something to consider, the UNO can only supply 50mA @ 3.3 volts. The Hope RFM69HW requires 130mA when transmitting at maximum power. Also, if you look at the following link, it provides an Arduino shield footprint  circuit diagram and board design ( please see RFM69HW v1.3 zip file), which has already been built and tested. Instead of using resistive dividers, it uses a 74HC4050 buffer.


   Hope this helps!

Title: Re: wiring RFM69HW + Arduino Uno
Post by: Felix on December 20, 2013, 08:49:55 AM
I think you got it right, it should work even with 10K & 4.7K, but I'd try 5V instead of 3.3V as NixHydra has noted
Title: Re: wiring RFM69HW + Arduino Uno
Post by: camdenl on January 07, 2014, 11:07:20 AM
I didn't think therfm's could handle 5 volts?
Title: Re: wiring RFM69HW + Arduino Uno
Post by: Sirocco on February 26, 2014, 12:17:03 PM
Hello people. I have already read all the posts, but could not exactly understand- how to get started with  RFM69HW and  Arduino Uno. I have already RFM69HW and  Arduino Uno. Can somebody explain me, how to test the module with uno. Which pins of RFM69HW should be wired to Uno.
Best regards.
Title: Re: wiring RFM69HW + Arduino Uno
Post by: sketchy on February 26, 2014, 03:50:48 PM
Hello Sirocco,
I'm hoping a blog post I just posted (and actually is ongoing): http://bitknitting.wordpress.com/2014/02/22/making-an-rfm69-breakout-board (http://bitknitting.wordpress.com/2014/02/22/making-an-rfm69-breakout-board)  will help you better understand using an Arduino Uno with an RFM69HW.  There are two issues that I ran into:
1) the Arduino digital out pins use 5V to indicate HIGH/LOW whereas the RFM69HW uses 3.3V (explained in more detail in the blog post - see level shifting)
2) the RFM69HW has a pin spacing (pitch) of 2mm - more the spacing of a PCB than a breadboard, which has a spacing of 2.54mm.

Both can be overcome.  For example, I soldered wires to an RFM69HW and put in voltage dividers on the breadboard (to address the 5V -> 3.3V challenge)...now I am moving on to create a breakout board.
Title: Re: wiring RFM69HW + Arduino Uno
Post by: jra on February 27, 2014, 01:19:34 PM
uChip has created a breakout board for the RFM69W that you can order from Oshpark http://lowpowerlab.com/forum/index.php/topic,330.msg1794.html#msg1794, see https://github.com/uChip/RFM69W_BOB for details.  You can populate it to work on either 3.3V or 5V.  I was going to cobble something up but decided his boards were a better solution, looks like it should work with either the RFM69W or the RFM69HW. I've received the boards but unfortunately haven't had the time to play with them yet :(
Title: Re: wiring RFM69HW + Arduino Uno
Post by: Sirocco on February 28, 2014, 04:07:10 AM
Hi, sketchy.
Thank you for the reply. I a part of your post. It gave me a little bit light in the darkness, but not enough for wiring of uno and RFM69HW. Could you write here just by a few sentences that, which pins should be connected, and where should the voltage regulator put? I dont have time to learn carefully these devices, because the boss gave me a lot of devices to test. So it would be great if you just wrote for me only connections. After that i will just upload sketch and test it.
Thank you for attention.