Hello everyone! I have a couple of RF69HCW. I've gone to basic testing by pairing two of them by following the tutorial from adafruit website. Next I'm planning to use it to this following setup...kindly check attached image.
Based on their setup my questions are the following and assuming they are almost line of sight.
1. From Node#1 can I send the same data to Node#2, Node#3 and Node#4 only?
2. From Node#1 can I send the same data to all nodes?
3. Based on the Image is it possible that Node#1 can it directly send data to Node#5?
I appreciate your time helping.
Best regards,
waraytek
Sounds like a range and packet filtering question. The answer is yes to everything, ie yes it's possible.
With the default settings in Felix's library, at power level 31, the HCW should be able to get a signal 300m+ easily. If you drop the bitrate down, you can push that transmit distance up well over 1km. Each of your nodes will not have any problem talking to the gateway unless you environment is extremely noisy.
Thanks Felx and ChemE for the valuable feedback.
@ChemE, I wanted to test it on the streets and see how it performs.
I will try to start my mini project and feedback my progress here.
If possible can you provide a link similar setup what I'll be doing?
Kind regards,
waraytek
I don't currently have any simple code to do this since I've been working on an alternative RFM69W library but this is what I would do:
1) Have the node send a small 16-byte payload with CRC on every 0.5s or so
2) The last 2 bytes should be a 16-bit counter so 0x00 0x00, then 0x00 0x01, ..., 0x00 0xFF, 0x01 0x00, ..., 0xFF 0xFF
3) I wouldn't bother requesting an ACK
4) The Gateway meanwhile should be displaying a few statistics regarding the stream of packets; I'd show the RSSI of the last 10 to 20 packets or so. Also any gap in the counter indicates a missed packet so display the % of packet error rates which is missed/conter.
You can then fool around with different radio settings and get pretty rapid feedback on how stable the link still is. An RSSI of -70 to -80 is pretty reliable and you should shoot for PER of much less than 1%.
Untested code since I'm traveling, but something like this for the node:
#include "LowPower.h"
#include <SPI.h>
#include <RFM69.h>
#include <RFM69registers.h>
//*********************************************************************************************
// *********** IMPORTANT SETTINGS - YOU MUST CHANGE/ONFIGURE TO FIT YOUR HARDWARE *************
//*********************************************************************************************
#define NETWORKID 100 //the same on all nodes that talk to each other
#define RECEIVER 1 //unique ID of the gateway/receiver
#define SENDER 2
#define NODEID SENDER //change to "SENDER" if this is the sender node (the one with the button)
#define FREQUENCY RF69_915MHZ
#define ENCRYPTKEY "sampleEncryptKey" //exactly the same 16 characters/bytes on all nodes!
#define IS_RFM69HW //uncomment only for RFM69HW! Leave out if you have RFM69W!
RFM69 radio; //Create an instance of the object
static uint8_t data[16];
void setup() {
radio.initialize(FREQUENCY,NODEID,NETWORKID);
radio.sleep();
radio.setPowerLevel(31);
radio.encrypt(ENCRYPTKEY);
// Make the test packet
for (uint8_t i = 0; i<14; i++) {
data[i] = i;
}
}
void loop(){
uint16_t counter;
// Increment the counter within the test packet
counter++;
data[14] = counter & 0xFF; // LSB first, mask off the MSB
data[15] = counter>>8; // MSB second, shift off the LSB
// Send the data
radio.send(RECEIVER, data, 16, 0); //target node Id, message as string or byte array, message length, ack requested
radio.sleep();
LowPower.powerDown(SLEEP_500MS, ADC_OFF, BOD_OFF);
}
Hello ChemE, I will try your example code.
Thank you again for the effort and have a great day!
Kind regards,
waraytek
Hi, I have tested couple of nodes with sending text ("From Node#xx") to the receiver, but want to ask in advance if it can to talk to 8,000 nodes and what would be the advisable number of bytes when sending data and ideal way of sending data to the receiver(target node) with this big number of nodes? I appreciate any guide or link to my queries?
BTW I'm very interested with Moteino, planning to make it as my main devices for my projects.
Thank you and kind regards,
waraytek
8,000 unique nodes? The answer is yes in theory. You can set your network in software to be 0 to 255 and you can set your target node ID in software to be 0 to 254 (255 is reserved for everyone) so you can talk to 64,770 different nodes as far as addressing them goes. Depending on how much traffic needs to flow back and forth you may need additional gateways just because one might not have enough time to handle 8,000 (why would you need this btw?).
As far as timing goes, it takes a node around 1ms to send a 6-byte payload. If each of 8,000 nodes wants to send something every second, your gateway will not be able to keep up. I would also imagine there will be massive amounts of collisions since a population that large almost guarantees that two or more nodes might want to talk at the same time. How often will your nodes need to relay data to the gateway? Is the gateway going to be sending commands/data out to the nodes?
Quote(why would you need this btw?).
I was thinking this will be a great idea for monitoring pollution utilizing sensors on devices in the city. I just want to make an advance study to find out the benefits using this existing technology.
Quote
How often will your nodes need to relay data to the gateway? Is the gateway going to be sending commands/data out to the nodes?
I think it will be best if the gateway will be the one getting the info to avoid great percentage of collision..but I'm not sure if this is the only way. But it also possible to let the node(s) send data to the command center when a particular threshold of the sensor is triggered. The format of data might be like in the following order [xxxx][xxxx][xxxx][xxxx] that I think will be manageable...
1. SensorType - [xxxx]
2. SensorValue - [xxxx]
3. CodeType - [xxxx]
4. CodeData - [xxxx]
I'm really thankful I found this great community...thanks for the inputs.
Okay so using a very low bitrate to communicate you could in theory canvas a 2km x 2km area with 8,000 nodes. This lets you place your sensors 22.36m on-center. With that many sensors at such a low bitrate I think you would need more than one gateway. Even just keeping 254 nodes on the same network you might want to put a RTC on each node so they can arrange to talk to the gateway at a predefined time slot in order to eliminate collisions. Each gateway would then probably be connected to a rPi3 which could stream the data out onto the web and or log it. At very low bitrates (which give the largest range) you will need to implement temperature correction on your nodes to compensate for frequency drift with temperature.
Personally I think the regulations are going to bite you with the RFM69HW, 915MHz for example is going to mandate frequency hopping for you to get the kind of range you want. I'd look at LoRa technology, that has got excellent range and they are designed to have multiple radios co-existing in the same radio spectrum.
Mark.
QuotePersonally I think the regulations are going to bite you with the RFM69HW
Definitely true. The HW's are great modules, but if you want to put 8000 of those in a city you better follow the regulations to the letter. In the US that means frequency hopping for the maximum TX power levels the HW supports. In Europe you can do quite a bit at 868 mhz without hopping. Where do you want to deploy this?
You need less range if you do a mesh style implementation - but that's more complicated to do.
Joe
Hello Perky -I'm not familiar with regulations yet...is there a link where I can read it? The average distance between nodes will be around 120m.
Hi joelucid - I'm proposing in a small city (in the Philippines).
Hi, my setup consist of 3 nodes and a receiver in my case the maximum good signal is at distance 150m between nodes(3) and the receiver. The sample program I have it running on them is like broadcasting, what I need to do is to arrange 3 transmitter(150m apart) have a distance stretch total to 450m to pass the message "HelloWorld" from the first transmitter to the second...till it reached the receiver. Is there a similar sample program that I can test or study?
Thank you and best regards,
waraytek
Hello everyone, I think I have a working prototype. The following is how the program works.
1. Node#1 transmits ("FROMNode1-2#") to Node#2, when received blinks an LED.
2. Then Node#2 transmit ("FROMNode2-3#") to Node#3
3. Then Node#3 blinks an LED if the message arrived from Node#2.
I think I have a simple prototype of relaying the message, but I noticed Node#2 LED blinks faster than Node#3. Could this mean that Node#3 have delays twice of that from Node#2?
Below is what I'm using..
Node#1(Transmitter)
delay(1000); // Wait 1 second between transmits, could also 'sleep' here!
char radiopacket[20] = "FROMNode1-2#";
itoa(packetnum++, radiopacket+13, 10);
Serial.print("Sending "); Serial.println(radiopacket);
if (radio.sendWithRetry(RECEIVER, radiopacket, strlen(radiopacket))) { //target node Id, message as string or byte array, message length
Serial.println("OK");
}
Node#2(Transmit and Receive) same with Node#3
//check if received message contains message
if (strstr((char *)radio.DATA, "FROMNode1-2#"))
{
char radiopacket[20] = "FROMNode2-3#";
itoa(packetnum++, radiopacket+13, 10);
Serial.print("Sending "); Serial.println(radiopacket);
if (radio.sendWithRetry(2, radiopacket, strlen(radiopacket))) { //target node Id, message as string or byte array, message length
Serial.println("OK");
}
Just want to ask if there is a better way to test in relaying messages to all nodes.
Thanks,
waraytek