NordicPlayground / nRF51-ble-bcast-mesh

Other
324 stars 121 forks source link

Delayed Action #14

Closed srd1 closed 9 years ago

srd1 commented 9 years ago

Hey Trond,

I put one node coded with program LED_mesh (in examples) in every room of my house of two floors. The node with BLE_Gateway (in examples) is kept in the Hall (First Floor) which connects to my phone by Nordic Master Control Panel App.

Firstly, I had to keep a (extra) node at the stairs so that it is 'the one that connects' nodes at Ground Floor to the nodes at First Floor. Kind of acts as repeater. Firstly, can this be avoided? I know BLE range practically is quite suffocating.

Secondly, when I toggle LEDs on the nodes by sending 0/1 by Nordic's App, the nodes at First Floor respond instantly, but the nodes on Ground Floor take (randomly) 1 seconds to 5 seconds to show the effect. The problem could be that the nodes at Ground Floor are connected to nodes at First floor by the repeater at stairs because if I remove that node then Ground Floor won't respond. So, can I reduce this delay of 1 to 5 seconds by changing a parameter or doing a tweak? I tried changing init_params.adv_int_ms to 10 (earlier it was 100), but doesn't make any difference, lag still there.

trond-snekvik commented 9 years ago

Hi, I'm afraid this issue is mostly related to signal quality decay over distance, causing you to lose packets at longer distances. The LED_mesh-nodes are in RX-mode in 99.98% of the time, and would receive anything that's on air. There are a couple of things you could do, though:

NRF_RADIO->TXPOWER = ((RADIO_TXPOWER_TXPOWER_0dBm << RADIO_TXPOWER_TXPOWER_Pos) & RADIO_TXPOWER_TXPOWER_Msk);

to

NRF_RADIO->TXPOWER = ((RADIO_TXPOWER_TXPOWER_Pos4dBm << RADIO_TXPOWER_TXPOWER_Pos) & RADIO_TXPOWER_TXPOWER_Msk);

This boosts your transmissions somewhat, and your range should be extended.

If none of these things work, I would recommend that you try to reduce the distance between the devices until you get satisfactory delays. If you need to go below 1-2 meters, there might be other issues at play.

srd1 commented 9 years ago

That is very elaborate, I got it. Safe would be to keep every node at 50+ ms. Also changed the dBm and noticed slightly better range. The channel I am using is 38. Turned off all other BLE devices in vicinity. This works fine!