This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

ANT nrf51422 Proximity

Hi all,

I would like to trigger some actions on difference devices communicating with the ANT protocol based on the distance they are from each other. A simple example would be to light an LED via PWM with a duty cycle depending on the distance from master to slave.

I though that the proximity search function of the ANT protocol would support that but after having read the documentation and seen this thread devzone.nordicsemi.com/.../ I think that the best way is to use the RSSI value of the extended data messge format. Am I right? Did someone do something similar and could provide a code example?

Best regards

Parents
  • ok, so I just did a test in which I modified the broadcast receiver example for the SoftDevice s210 in order to read the RSSI values. I simply added this line before opening the ant channel:

    		/* Enable RSSI level for received messages */ 
    	// This function sets the ANT Messaging Library Configuration used by Extended messaging.
    	sd_ant_lib_config_set(ANT_LIB_CONFIG_MESG_OUT_INC_RSSI);
    

    Afterwards, in my channel handler I read the RSSI value and light up two LEDs depending on the value I get. This seems to work fine. One or the other LED lights up depending on the distance (and orientation) of my two ANT devices.

    Now I would like to read the values on my computer via UART connection. I just added the UART to my code with an event handler that sends the RSSI data to the computer. For some reason, that does not work. I do not know if I did something wrong here by having the ANT channel and the UART peripheral run in parallel.

    I will try to debug that...

Reply
  • ok, so I just did a test in which I modified the broadcast receiver example for the SoftDevice s210 in order to read the RSSI values. I simply added this line before opening the ant channel:

    		/* Enable RSSI level for received messages */ 
    	// This function sets the ANT Messaging Library Configuration used by Extended messaging.
    	sd_ant_lib_config_set(ANT_LIB_CONFIG_MESG_OUT_INC_RSSI);
    

    Afterwards, in my channel handler I read the RSSI value and light up two LEDs depending on the value I get. This seems to work fine. One or the other LED lights up depending on the distance (and orientation) of my two ANT devices.

    Now I would like to read the values on my computer via UART connection. I just added the UART to my code with an event handler that sends the RSSI data to the computer. For some reason, that does not work. I do not know if I did something wrong here by having the ANT channel and the UART peripheral run in parallel.

    I will try to debug that...

Children
Related