Author Topic: Communication only works one way regardless of device  (Read 11056 times)

kolaf

  • Newbie
  • *
  • Posts: 30
  • Country: no
Communication only works one way regardless of device
« on: April 16, 2016, 04:54:49 PM »
Hi guys,

I have been using moteinos as sensors using the MySensors library for some time. However, I have lately experienced that the nodes have become a bit unstable. In order to test this thoroughly I decided to jump out of the sensor library and use the Gateway and node example sketches provided on the main moteino site.

I have one R4 moteino usb, one r5 moteino usb, and one regular r4 moteino that I am testing with. All of them are equipped with the RFM69HW radio at 868 MHz. I downloaded the latest IDE (1.6.7), added the URL to the board manager and select the moteino board in the IDE.

The very first time I installed the Gateway sketch on one node and the node sketch on another node things appeared to go quite well. It looked like a few packets were dropped, but otherwise messages seem to reach the Gateway, and acknowledgements seem to reach the node. However, every subsequent time I have tried this it has failed. The messages from the node to the Gateway seem to consistently reach the Gateway, but acknowledgements I never received by the node. I have tried to switch which device is the node and which is the gateway between all three devices, and the results are consistently the same. I have included a brief log from the node and Gateway device.  I have tried both with and without the HW and ATC switches in the sketch code at both ends in every combination. As far as I understand this should be the correct configurations for me:
Code: [Select]
#define FREQUENCY     RF69_868MHZ
#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!
#define ENABLE_ATC    //comment out this line to disable AUTO TRANSMISSION CONTROL

Node:
Code: [Select]

Transmitting at 868 Mhz...
SPI Flash Init OK ... UniqueID (MAC): D7 63 18 62 27 40 9E 2F
RFM69_ATC Enabled (Auto Transmission Control)

 nothing...
Sending[1]: 1 nothing...
Sending[2]: 12 nothing...
Sending[3]: 123 nothing...
Sending[4]: 123  nothing...
Sending[5]: 123 A nothing...
Sending[6]: 123 AB nothing...
Sending[7]: 123 ABC nothing...
Sending[8]: 123 ABCD nothing...
Sending[9]: 123 ABCDE nothing...
Sending[10]: 123 ABCDEF nothing...
Sending[11]: 123 ABCDEFG nothing...
Sending[12]: 123 ABCDEFGH nothing...
Sending[13]: 123 ABCDEFGHI nothing...
Sending[14]: 123 ABCDEFGHIJ nothing...
Sending[15]: 123 ABCDEFGHIJK nothing...
Sending[16]: 123 ABCDEFGHIJKL nothing...
Sending[17]: 123 ABCDEFGHIJKLM nothing...
Sending[18]: 123 ABCDEFGHIJKLMN nothing...
Sending[19]: 123 ABCDEFGHIJKLMNO

Gateway:
Code: [Select]
Listening at 868 Mhz...
SPI Flash Init OK. Unique MAC = [D7:64:90:B4:C7:33:8B:2E:]
RFM69_ATC Enabled (Auto Transmission Control)
#[1][2] FLASH_MEM_ID:0xEF30   [RX_RSSI:-24] - ACK sent. Pinging node 2 - ACK...nothing
#[2][2] FLASH_MEM_ID:0xEF30   [RX_RSSI:-23] - ACK sent.
#[3][2] 1   [RX_RSSI:-25] - ACK sent.
#[4][2] 1   [RX_RSSI:-24] - ACK sent. Pinging node 2 - ACK...nothing
#[5][2] 12   [RX_RSSI:-24] - ACK sent.
#[6][2] 12   [RX_RSSI:-25] - ACK sent.
#[7][2] 12   [RX_RSSI:-29] - ACK sent. Pinging node 2 - ACK...nothing
#[8][2] 123   [RX_RSSI:-23] - ACK sent.
#[9][2] 123   [RX_RSSI:-25] - ACK sent.
#[10][2] 123    [RX_RSSI:-24] - ACK sent. Pinging node 2 - ACK...nothing
#[11][2] 123    [RX_RSSI:-23] - ACK sent.
#[12][2] 123 A   [RX_RSSI:-24] - ACK sent.
#[13][2] 123 A   [RX_RSSI:-24] - ACK sent. Pinging node 2 - ACK...nothing
#[14][2] 123 AB   [RX_RSSI:-23] - ACK sent.
#[15][2] 123 AB   [RX_RSSI:-24] - ACK sent.
#[16][2] 123 AB   [RX_RSSI:-24] - ACK sent. Pinging node 2 - ACK...nothing
#[17][2] 123 ABC   [RX_RSSI:-23] - ACK sent.
#[18][2] 123 ABC   [RX_RSSI:-25] - ACK sent.
#[19][2] 123 ABCD   [RX_RSSI:-24] - ACK sent. Pinging node 2 - ACK...nothing
#[20][2] 123 ABCD   [RX_RSSI:-23] - ACK sent.
#[21][2] 123 ABCDE   [RX_RSSI:-25] - ACK sent.
#[22][2] 123 ABCDE   [RX_RSSI:-24] - ACK sent. Pinging node 2 - ACK...nothing
#[23][2] 123 ABCDEF   [RX_RSSI:-23] - ACK sent.
#[24][2] 123 ABCDEF   [RX_RSSI:-24] - ACK sent.
#[25][2] 123 ABCDEF   [RX_RSSI:-24] - ACK sent. Pinging node 2 - ACK...nothing
#[26][2] 123 ABCDEFG   [RX_RSSI:-23] - ACK sent.
#[27][2] 123 ABCDEFG   [RX_RSSI:-23] - ACK sent.
#[28][2] 123 ABCDEFGH   [RX_RSSI:-24] - ACK sent. Pinging node 2 - ACK...nothing
#[29][2] 123 ABCDEFGH   [RX_RSSI:-23] - ACK sent.
#[30][2] 123 ABCDEFGHI   [RX_RSSI:-24] - ACK sent.
#[31][2] 123 ABCDEFGHI   [RX_RSSI:-24] - ACK sent. Pinging node 2 - ACK...nothing
#[32][2] 123 ABCDEFGHIJ   [RX_RSSI:-23] - ACK sent.
#[33][2] 123 ABCDEFGHIJ   [RX_RSSI:-24] - ACK sent.
#[34][2] 123 ABCDEFGHIJ   [RX_RSSI:-25] - ACK sent. Pinging node 2 - ACK...nothing
#[35][2] 123 ABCDEFGHIJK   [RX_RSSI:-23] - ACK sent.
#[36][2] 123 ABCDEFGHIJK   [RX_RSSI:-24] - ACK sent.
#[37][2] 123 ABCDEFGHIJKL   [RX_RSSI:-24] - ACK sent. Pinging node 2 - ACK...nothing
#[38][2] 123 ABCDEFGHIJKL   [RX_RSSI:-23] - ACK sent.
#[39][2] 123 ABCDEFGHIJKLM   [RX_RSSI:-24] - ACK sent.
#[40][2] 123 ABCDEFGHIJKLM   [RX_RSSI:-24] - ACK sent. Pinging node 2 - ACK...nothing
#[41][2] 123 ABCDEFGHIJKLMN   [RX_RSSI:-23] - ACK sent.
#[42][2] 123 ABCDEFGHIJKLMN   [RX_RSSI:-24] - ACK sent.
#[43][2] 123 ABCDEFGHIJKLMN   [RX_RSSI:-23] - ACK sent. Pinging node 2 - ACK...nothing
My guess is that I have to be doing something wrong, but I have no idea what.

« Last Edit: April 16, 2016, 05:02:05 PM by kolaf »

WhiteHare

  • Hero Member
  • *****
  • Posts: 1297
  • Country: us
Re: Communication only works one way regardless of device
« Reply #1 on: April 16, 2016, 05:23:40 PM »
I've encountered the "ACK...nothing" issue, and it relates to:  https://lowpowerlab.com/forum/index.php?topic=1750.0 (which unfortunately no one ever answered).  At least in my case, increasing the delay to 4ms solved that issue.

Also, things seem to run a little differently if compiled and uploaded using some of the later IDE releases.  They seem to break  some things that worked OK using earlier IDE's.
« Last Edit: April 16, 2016, 05:28:46 PM by WhiteHare »

kolaf

  • Newbie
  • *
  • Posts: 30
  • Country: no
Re: Communication only works one way regardless of device
« Reply #2 on: April 17, 2016, 02:23:41 AM »
Thanks for the suggestions. I have now tried both increasing the delay on the Gateway and rolling back to the 1.0.6 release of the IDE. This did not affect my problem in anyway, it seems.

However, I did notice something else. When I moved the device (moteino USB as both node and Gateway), sometimes the acknowledgement would get through. If I took hold of the USB cable and quickly waived (shook) the device back and forth the node reported "ok" for a lot of it's messages, but not all. This sometimes happen when I waved either the node or the Gateway device. At the same time, quite often the node started sending its messages much more rapidly while waving, even if it reported "nothing". I guess this has something to do with some kind of interrupt being triggered, something weird happening with the timer?

Since I'm using the USB devices there are no loose connections (apart from the antenna which I have verified does not interfere with any other connections on the board when I wave). I have therefore failed to find any physical reason (apart from the USB connection itself) that should be affected by the waving.

I also tried operating either node or the Gateway from a battery source instead of a USB port, but the results are the same.

In case it is relevant (since there is another thread on the subject), I should also mention that all my devices have flash memories installed.

WhiteHare

  • Hero Member
  • *****
  • Posts: 1297
  • Country: us
Re: Communication only works one way regardless of device
« Reply #3 on: April 17, 2016, 02:46:37 AM »
Have you tried a different USB cable?  On he face of it, it sounds like a loose or faulty connection in your wiring. 

kolaf

  • Newbie
  • *
  • Posts: 30
  • Country: no
Re: Communication only works one way regardless of device
« Reply #4 on: April 17, 2016, 03:11:21 AM »
Yes, and the serial communication to the serial port monitor works flawless on every cable, so I assume the power supply also does.

kolaf

  • Newbie
  • *
  • Posts: 30
  • Country: no
Re: Communication only works one way regardless of device
« Reply #5 on: April 17, 2016, 07:23:17 AM »
I have done some more testing. I hacked the node example to add a third device in promiscuous mode to capture everything that goes on between the node and the Gateway. The output of this is included below. The first two numbers is the source and destination. After this comes the payload of the data captured, and whether an acknowledgement is requested or if the packet is an acknowledgement. It is clear from the trace below that the gateway actually sends the acknowledgement. So the problem is in the receiving end for the node.

Code: [Select]
Promiscuous at 868 Mhz...
SPI Flash Init OK ... UniqueID (MAC): D7 64 90 B4 C7 33 8B 2E
RFM69_ATC Enabled (Auto Transmission Control)

[2, 1] FLASH_MEM_ID:0xEF30   [RX_RSSI:-9] - ACK Requested
[1, 2]    [RX_RSSI:-17] is ACK!
[2, 1] FLASH_MEM_ID:0xEF30   [RX_RSSI:-11] - ACK Requested
[1, 2] ACK TEST   [RX_RSSI:-17] - ACK Requested
[2, 1] FLASH_MEM_ID:0xEF30   [RX_RSSI:-10] - ACK Requested
[1, 2] ACK TEST   [RX_RSSI:-18] - ACK Requested
[2, 1] 1   [RX_RSSI:-9] - ACK Requested
[1, 2] ACK TEST   [RX_RSSI:-18] - ACK Requested
[2, 1] 1   [RX_RSSI:-9] - ACK Requested
[1, 2]    [RX_RSSI:-17] is ACK!
[2, 1] 1   [RX_RSSI:-10] - ACK Requested
[1, 2]    [RX_RSSI:-18] is ACK!
[2, 1] 12   [RX_RSSI:-10] - ACK Requested
[1, 2]    [RX_RSSI:-18] is ACK!
[2, 1] 12   [RX_RSSI:-10] - ACK Requested
[1, 2] ACK TEST   [RX_RSSI:-17] - ACK Requested
[2, 1] 12   [RX_RSSI:-10] - ACK Requested
[1, 2] ACK TEST   [RX_RSSI:-17] - ACK Requested
[2, 1] 123   [RX_RSSI:-10] - ACK Requested
[1, 2] ACK TEST   [RX_RSSI:-17] - ACK Requested
[2, 1] 123   [RX_RSSI:-10] - ACK Requested
[1, 2]    [RX_RSSI:-17] is ACK!
[2, 1] 123   [RX_RSSI:-10] - ACK Requested
[1, 2]    [RX_RSSI:-18] is ACK!
[2, 1] 123    [RX_RSSI:-10] - ACK Requested
[1, 2]    [RX_RSSI:-18] is ACK!
[2, 1] 123    [RX_RSSI:-11] - ACK Requested
[1, 2] ACK TEST   [RX_RSSI:-17] - ACK Requested
[2, 1] 123    [RX_RSSI:-11] - ACK Requested
[1, 2] ACK TEST   [RX_RSSI:-17] - ACK Requested
[2, 1] 123 A   [RX_RSSI:-10] - ACK Requested
[1, 2] ACK TEST   [RX_RSSI:-19] - ACK Requested
[2, 1] 123 A   [RX_RSSI:-17] - ACK Requested
[1, 2]    [RX_RSSI:-18] is ACK!
[2, 1] 123 A   [RX_RSSI:-12] - ACK Requested
[1, 2]    [RX_RSSI:-17] is ACK!
[2, 1] 123 AB   [RX_RSSI:-12] - ACK Requested
[1, 2]    [RX_RSSI:-17] is ACK!
[2, 1] 123 AB   [RX_RSSI:-11] - ACK Requested
[1, 2] ACK TEST   [RX_RSSI:-17] - ACK Requested
[2, 1] 123 AB   [RX_RSSI:-11] - ACK Requested
[1, 2] ACK TEST   [RX_RSSI:-18] - ACK Requested
[2, 1] 123 ABC   [RX_RSSI:-11] - ACK Requested
[1, 2] ACK TEST   [RX_RSSI:-18] - ACK Requested
[2, 1] 123 ABC   [RX_RSSI:-11] - ACK Requested
[1, 2]    [RX_RSSI:-17] is ACK!

Edit: I suddenly got it to work quite well by putting in 200 as the retry value for the node. Suddenly every packet started going through at the first try. However, this was not the case when switching gateway and node devices. Also, I was not able to reproduce this when switching the devices back again. I've done quite a little playing around with timing values as well, without success.
« Last Edit: April 17, 2016, 09:34:17 AM by kolaf »

WhiteHare

  • Hero Member
  • *****
  • Posts: 1297
  • Country: us
Re: Communication only works one way regardless of device
« Reply #6 on: April 17, 2016, 12:44:31 PM »
You're RSSI numbers look extremely strong.  Is your gear positioned incredibly close together or something?

kolaf

  • Newbie
  • *
  • Posts: 30
  • Country: no
Re: Communication only works one way regardless of device
« Reply #7 on: April 17, 2016, 12:48:34 PM »
Yes, they are connected to the same computer, within 50 cm of each other. I tried reducing output power with setPower(1), but the numbers were still pretty high.

WhiteHare

  • Hero Member
  • *****
  • Posts: 1297
  • Country: us
Re: Communication only works one way regardless of device
« Reply #8 on: April 17, 2016, 01:33:41 PM »
Ah, well that opens a whole different can of worms.  If you have only one computer, try running just two nodes, but running one of them off a battery positioned at a more normal distance (let's say a minimum of 5 meters for testing purposes just to be sure).  Also, reboot the one that's connected to the computer, so that the ATC is reset.  What happens then?

kolaf

  • Newbie
  • *
  • Posts: 30
  • Country: no
Re: Communication only works one way regardless of device
« Reply #9 on: April 17, 2016, 01:45:11 PM »
I did as you suggested. I move them around 5 m apart (the other device in another room, inside the fuse cabinet with the door open), and reduce the power level to 0 (which is five dBm). The reported RSSI is now around -53 for the gateway. I tried moving both of the devices after each other, but the results were consistently the same. I still get no acknowledgements received.

WhiteHare

  • Hero Member
  • *****
  • Posts: 1297
  • Country: us
Re: Communication only works one way regardless of device
« Reply #10 on: April 17, 2016, 03:12:39 PM »
Uh, why put it inside a fuse cabinet?   ???  That sounds like another potential snakepit of electrical noise that you'd want to avoid.

kolaf

  • Newbie
  • *
  • Posts: 30
  • Country: no
Re: Communication only works one way regardless of device
« Reply #11 on: April 17, 2016, 03:14:21 PM »
Heh, it was the easiest available power supply at the time, and I need a sensor in there to read the power meter ☺️

kolaf

  • Newbie
  • *
  • Posts: 30
  • Country: no
Re: Communication only works one way regardless of device
« Reply #12 on: April 17, 2016, 03:26:48 PM »
Anyway, I have tested them further apart outside of the fuse cabinet (a distance of about 10 m) with different power settings (0 and 15) without significant improvements. I get some acknowledgements on some messages, but now we also loose a number of messages on the way from the node to the Gateway.I guess I can increase power, but that sort of negates the increase in distance :-)

WhiteHare

  • Hero Member
  • *****
  • Posts: 1297
  • Country: us
Re: Communication only works one way regardless of device
« Reply #13 on: April 17, 2016, 05:21:43 PM »
If you have no loose connections, and *if* you have removed your RFM69 gear from sources of electrical noise (it sounds as though you may have some rather contrarian ideas about how to accomplish that  ::)), then the only reason I can think of as to why frantically waving your gear around would improve receipt of packets is doppler shift.  That would suggest your Tx and Rx frequencies aren't adequately overlapped.  Do you have access to a spectrum analyzer (even a cheap SDR one) to check that?  If not, try setting your RFM69's to use a much larger  FDEV and much wider Rx bandwidth to match it, and see if that improves your percentage of received packets.  Does doing that make any difference?
« Last Edit: April 17, 2016, 05:25:41 PM by WhiteHare »

kolaf

  • Newbie
  • *
  • Posts: 30
  • Country: no
Re: Communication only works one way regardless of device
« Reply #14 on: April 18, 2016, 02:41:46 AM »
Thanks for the suggestion. Unfortunately, I do not have access to any kind of spectrum analyser, although this might be the perfect opportunity to get a cheap one :-). I tried to go from RF_FDEVMSB_50000 to RF_FDEVMSB_85000 both devices, but it did not seem to change anything. Changing the RX bandwidth does not seem as easy (i.e. I don't know how), so I haven't tried that.

Edit: I do not think we should focus too much on the waving. My guess is that this is more related to small interruptions or disturbances in the power supply or something.
« Last Edit: April 18, 2016, 02:50:42 AM by kolaf »