Introduction: Signal Code Communicators (RFM69)
These “2-bit” (digital) radio communicators provide a means to signal each other (as to where they are; if their done …) when shopping at opposite ends of a big box store; even where cell phones have no service or cell battery charge.
RFM69 915MHz radio modules are used. They are very efficient radios using digital packet communications. They can communicate over 100 meters using low power, on only 10s of milliamps, and as much as 1/2 kilometer or even 1/2 mile using about 120 ma.
The RFM69 radio modules are much more efficient and effective over greater distances then either a NRF24L01 or an RFM12.
For even greater reliable longer distant connections this project could be made to used LoRa radio modules just as well. There are a few LoRa devices (like a RFM95) out there that are of similar size and interface. But they cost much more, which for me was unwarranted.
The units support a set of, digital, 10-20 (location?) style question and answer codes (refer to wiki/Ten-code https://en.wikipedia.org/wiki/Ten-code ); as well as optional Morse code. The units do not support any voice (analog) communication.
They could also be used as pagers with 3 levels of attention requests, when someone is convalescing or working under the house.
Beyond that they can be a lot of fun, especially for kids or students.
Step 1: Gather Components
As the radio module can not handle a 5v supply or signal voltage, you must use 3.3v MCUs. Also note that I use the 'H' high power version of the radio modules.
This list is to build 2 units.
- qty. 2 Pro Mini 3.3v Arduino MCU http://www.ebay.com/itm/112025725033
- qty. 2 RFM-69HCW 915MHz modules http://www.ebay.com/itm/181425435597
- qty. 2 Case (was to be a battery compartment) http://www.ebay.com/itm/191907439885
- qty. 2 Li-ion 3.7v 200+mah batteries http://www.ebay.com/itm/311682151405 (7x20x30mm, ~Maximum size usable 9x24x36mm)
- qty. 4 Red-Green 5mm Common Cathode Bi-Color LEDs http://www.ebay.com/itm//112318970450 (wiring & breakdown voltage is important)
- qty. 4 6x6x7.5mm button switches http://www.ebay.com/itm/122067127683
- qty. 2 Piezo active buzzer http://www.ebay.com/itm/262135996404
- qty. 2 each resisters … 270 Olm, 1.5kOlm, ~5k http://www.ebay.com/itm/112138631847
- qty. 2 0.1 uf monolithic cap http://www.ebay.com/itm/252795781926
- qty. 2 3mm White (or Blue) LEDs http://www.ebay.com/itm/321464065222
- qty. 2 3.5mm Phono jacks http://www.ebay.com/itm/371589198827
- qty. 2 220uf power filter capacitor
- Popsicle stick
Other supplies you may be needing
26ga wire solid or 24ga stranded, for grounds and +V
22ga wire solid, for antenna
Misc: soldering supplies, tape, hot glue, prototyping tools.
USB to TTL converter http://www.ebay.com/itm/282348484946
A stereo jack to connect an ear piece, to be sure not to miss incoming communications. Also a portable speaker amp could be connected to it.
The small (3 mm) white LED is optional. I added it to serve as an ON indicator. It was simple to add as I wired it across Btn1 which is given some drive current from an internal resister (~37k). With such little drive this LED must be a high efficient one. A green or maybe a blue LED could be used but not yellow or red as their voltage drop is too low and would make it look like the button is pressed. I would not use green as that color is otherwise used for signaling information.
The phono jack may also be omitted. This device does not make a lot of noise, but if you are concerned about attracting the attention of others, then it provides the option of using an ear phone. Alternately a piece of scotch tape over the hole for audio is effective.
To make all the measurements easy and accurate, I really like this inexpensive caliper. http://www.ebay.com/itm/282154408804
Step 2: Built MCU-radio Subsystem
Connect short wires to MCU pins: 10, 11, 12, 13; a medium length wire to pin2.
Add long (4-5 inches) to the I/O pins, of the MCU, to be used (pins: 3-9). I used 30 AWG gauge and different colors for peripheral types. This small diameter wire is capable of handling the signals that are less than 100 milliamps, yet it is plenty small and pliable enough (& highly recommended) to ease tight assembly.
Also connect a grounds and a Vcc wires (I used 26ga, they are the blue ones in the photos). These wire carries more current so use a large gauge to reduce voltage drop (and potential noise signal radiation).
Connect the MCU with the RFM-69 board. All but the long wires go to it.
Fold the radio board down over the MCU board. There should be no shorts between the boards. If there appears to be a real potential of a short use an intervening piece of tape or plastic sheet.
Add the antenna wire (22-24ga. 80mm) onto the radio board, as seen in the photo.
Step 3: Development Testing
For your implementation of these units you can skip this section. For those that are interested this gives a little more information on how I got there.
A ¼ wave length for 915MHz is 82mm. The Sparkfun.com tutorial suggest using 78mm. I understand that antenna tech says when the antenna is within a ½ wave length of earth ground your antenna will act like it is ~5% longer than it is. As for 915Mhz that would be less than a foot and normally you operate this unit much higher from the ground than that, I dismiss this 78mm length. There are however other factors which could cause similar effects deeming it wise to use lesser than exactly ¼ wave-length. I have compromised and have cut my antenna wires to 80mm total (including the section going through the PCB). With the proper test equipment you could better optimize your antenna length for your unit, but I would expect only minor improvements.
After adjustments I got about 250m max range with some obstacles. Beyond say 150m the antenna's orientation and position became more and more important.
When I did use a full dipole type antenna configuration (a vertical 80mm active element opposite a down pointing 80mm ground wire element) for one unit I got, with trial and error positioning, up to 400 meters with several trees and a house in between, and solid 2-way comm at ½ that distance irrespective of the remote units position or orientation.
Step 4: Prepare Project Box
The construction of this project using a small box is quite challenging. I have the experience of building many many custom electronic gizmo for home, industry, and aerospace projects. Novice may rather use a larger container box, making construction much easier. After all it is enjoyment we are looking for, not frustration. BTW, you may notice minor differences in the photos of the units I built.
Clean out much of the inside of the box. Use a chisel or X-acto knife to cut off two ribs on the right and one on the left. (see the photo of the inside of a box before and after)
Heat up the end of an X-acto or paring knife (for ~15 seconds using a lighter) and cut off the one big post, inside the case, and lowered the other two to about 1/8 inch. Once I mounted the switch I melted those two post enough to hold the switch in place.
I used masking tape on the box to mark hole locations. See photos above.
In order to keep the drilling of the holes on mark, I first marked the spots with point of a dart, then drilled all locations with a 1/16th bit, then finally drilled each hole to its desired size.
Drill the holes for the buttons, audio and LEDs in the case. The two holes for the main LEDs, on top, are 13/64” (5mm) and are 10mm from the edge. The holes for the audio (beep-buzzer) and the optional “On” led are 1/8” (3mm). They are 10mm from the top. The small led is 7mm from the side. The audio hole is centered side to side. The holes for the buttons, on the side, are 9/16” (3.5mm). One button is 10mm from the top, the other 20mm. I beveled the inside of the button holes, by hand, with a 1/4” drill bit, to help ensure the buttons would not get stuck down when pressed.
If you're using a phono jack for external headphones or speaker, you need to open the pre-existing hole on the bottom to 15/64”. The material here is rather thick and simply trying to drill it out would result in a hole too close to the edge. So, first drill a 1/16 hole, with its center about one 16th inch from the edge of the existing hole. Then enlarge that hole with a 7/16” bit. With a sharp small blade (~Xacto) cut away material so that the two adjoining holes are roughly one. Use a Dremel spiral rasp or a rat tail file so that the holes forms a well round hole, that a drill bit will easily center in. The hole should almost be 15/64th at this point. (There is a photo of the hole at this point) Now drill it out with a 15/64” bit. It would not be 'Horrible' if you use a ¼ bit.
Step 5: Attaching Peripheral I/O Components
Be sure when soldering within the confines of the case that you don't inadvertently allow any part of the iron to touch and thus melt a portion of the box, especially along its outer edge.
Tack down the buttons with a small amount of glue while positioning them. Hot glue is OK, thin glue (like super glue) might make its way into the button making it inoperable. Note that I had removed one leg to each of the buttons (redundant ones, I was not connecting to); bent them so they did not stick out too much; and connected the two lower pin between the buttons. The buttons are situated such that the internally connected legs are horizontally opposite each other.
Bend the leads of 3mm “on/off” LED so that it can be connected across Btn1, its cathode going to the ground side. This is perhaps the trickiest assembly issue.
Mark the side of the LEDs next to the red anode. Cut the two anodes (outside) leads to about ¼ inch. orientate them with the marked (red) lead up. Leave the center lead long, They are later bent over to connect to the ground side of the buttons. Refer to photos.
Attach the resisters.
Don't simply use the value resisters that I did for the LEDs. I bought my LEDs more than a years ago, not exactly the ones listed above. As LED efficiency varies greatly, test resister values for use with your in hand LEDs. Pick resisters for the brightness you want with a drive voltage of 3 to 3.3 volts (3.2v preferred). For a test supply voltage you could use two 1.5v batteries in series, or a high digital output from a 3.3v powered Arduino chip. Verify that you get a good true Yellow when driving both the red and green elements. Trim and solder the resisters to the LEDs similar to as seen in the photos.
On one unit, I used a Popsicle stick as a spacer around the two main LEDs so that they did not stick out so much. This is strictly a personal preference. This does have a negative side effect of reducing the effective brightness / viewing angle of these LEDs.
Put some glue along the outer edge of the buzzer and stick it between the main LEDs (+ to the right). Adjust its position so it lines up with the hole in the case before it is fixed in place.
The on/off switch is held in place by melting down the mounting hole posts. I used the heated tip to a small screw driver for this.
The phono jack's nut does not attach, so use hot glue, at the opposite end to secure it.
Connect ground along buttons and LEDs.
Prepare a plus and minus lead (~24ga. Solid) by hammering the trimmed ends so they are twice as wide as they are thick. They ends should then go into the battery connector easily but snug. Of course if you have or can find a inter connect cable intended to mate with your battery then by all means use that.
Wire up the on/off switch, phono jack, buzzer and power wires. Refer to the earlier wiring diagram.
I have a small capacitor across the phono connections. This can be left out as it is quit a tight fit. Its purpose is to prevent low level hum in the output.
After the buttons (as well as the on/off switch and phono jack) are fully wired up and soldered, hot glue them in place so that won't budge even after extensive use.
Step 6: Final Complete Assembly
It's time to connect in the MCU-radio sub-system into the case with the I/O devices.
Connect up the MCU-Radio subsystem.
Trim the wires as needed, leaving just enough play in them so that the subsystem assembly can be out of the way enough to allow soldering the other ends of the wires.
Be sure to connect the wires to the main LED to the correct ones red/green and especially get the left/right relationship correct. The LEDs are reverse left to right as you are looking inside the case as to how you hold and use the communicator. (unless you intend to use the units with the opposite side facing you, as a left-handed person might care to do).
Move the MCU-Radio subsystem in place and Press it down, folding wires as needed, into the case; checking to see that there are no shorts being made. Put a piece of electrical tape below it if needed.
You can reprogram this unit while assembled as seen in the next section, with a temporarily attached FDDI via short cable. Be sure that the Vcc level from the USB download cable is 3.3v, Not 5v!
Attach the battery, slide the back on and test it out, given you have already downloaded software into it. Be careful not to let the battery be pressing on the reset button of the MCU board.
BTW, a 300mah battery should last for about 12 hrs worth of operation, before needing to be recharged.
Step 7: The Software and Device Features and Operation
The other major portion of this project, which its operation depends on, is the software programming. But I have worked that all out, so you don't have to.
You can easily find instructions for downloading a sketch to a Pro mini Arduino elsewhere. Be sure to use a USB-TTL converter with 3.3v (not 5v) The unit its self should be turned off. You can see that I put a right angle header on the end of the download cable and then inserted it into the associated holes on the MCU board and let the unit hang from it, maintaining a good enough, yet temporary, connection.
You also need to install the library for the RMF69; see "Installing the RFM69 Library" well down this page.
Edit appropriately (see code segment below), compile and download the attached Two_bit_Comm sketch.
// !!!! Addresses for this node. REVERSE THE IDs FOR THE SECOND NODE !!!! #define MYNODEID 1 // My node ID (0 to 255) #define TONODEID 2 // Destination node ID (0 to 254, 255 = broadcast)
The software take advantage of the 'H' high power version of the radio modules, by initially using a medium power, and then it can't get an acknowledgement back it tries with maximum power. I don't known but I would expect this operation to not present a problem if one was to use the non high power version of radios.
Initialization, on Power-Up:
When a unit restarts, it initializes all of its hardware and software and sends its Mode and Option settings to the other unit, keeping them in-sync. There is a single short beep and then if this initial communication succeeds there is another beep and a green light lit. If at this point the communication fails there is no second beep and a Red light is lit. If the communication fails its likely the other unit is out of range, powered off or out of battery. Multiple retries and an increase to maximum transmission power is attempted before failure is accepted.
Mode 1 – 10-20 Type Comm
- Need Assistance
- Done ? Ready to go ?
- Where are you ?
- Call me.
- Please REPEAT
Appropriate response conventions are also defined. Including "Area type" and "Section type" responses to "Where are you?" requests.
It should be noted that you need be patient when the unit is displaying a response, as button presses during that time will be ignored.
Mode 2 – allows a form of Morse Code Communication
Both single key and two-key style are supported.
The attached document "Two_bit_Comm_user_Manual" covers the full details of functional operation supported by the software.