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

Send notification from Nrf51 dongle to cell phone over bluetooth ?

Hi

i am doing a prosject to get notification on cell phone when i get mail in my postbox (postbox outside the house)
I am using a nRF51 dongle, and want it to connect to cellphone (bluetooth), and send notification if a variable value have been changed

we are using a srf05 ultra sound detector to notify when the post box areal have been changed (post inside the postbox)


how can we use the 5 gpios on the nrf51 dongle and connect / send message to the cell phone ?
The ultra sound device have 2 pins for TX/RX


Thanks

Parents
  • Hello,

    As far as I understand, the device works by that it waits for a trigger pulse from the controller, then it does it measurements, and then it sends a pulse back through the "echo" pin. So you will need to connect at least these two.

     

    I have not tested this sensor, but it looks like you can connect these pins to any of the gpios. Let us say that you set Trig to 16 and Echo to 17.

    Since this is very short intervals, I would look into using the PPI.

    Here is a case where I recently posted an example using the PPI with the nRF51. It only controls pins using the timer, but it is possible to reverse it for one of the pins. And use the pin as a trigger/task to start/stop and measure the pulse on the echo pin. 

     

    This can be done something like this:

        NRF_PPI->CH[SOME_CHANNEL_1].TEP = (uint32_t)&NRF_GPIOTE->EVENTS_IN[GPIOTE_CONFIG];
        NRF_PPI->CH[SOME_CHANNEL_1].EEP = (uint32_t)&NRF_TIMER0->TASKS_START;
        NRF_PPI->CH[SOME_CHANNEL_2].TEP = (uint32_t)&NRF_GPIOTE->EVENTS_IN[GPIOTE_CONFIG];
        NRF_PPI->CH[SOME_CHANNEL_2].EEP = (uint32_t)&NRF_TIMER0->TASKS_CAPTURE[2];

    Then you can read the capture register using

    uint32_t captured_ticks = NRF_TIMER0->CC[2];

    from your application.

    You will also have to stop and reset the timer after the CC register is written, so that it starts from 0 the next time you send a trigger pulse.

     

    Play around with it, and see if you manage to get some readings from your application.

     

    For the BLE part, you have many options. You can e.g. check out the ble_app_uart example from our SDK.

     

    Note: To use the nRF51, you will have to use SDK12.3.0 or older. I recommend using 12.3.0.

     

    Best regards,

    Edvin

     

  • Any good example of get the GPIOs on the nrf51-dongle to work ?

    thanks

  • You should be able to use any of the examples, and change the pin numbers to the pin numbers that are marked on the dongle.

    what you need to do is to change the define in the preprocessor defines that decides what board you are working on. Start with an example for the PCA10036, and change the define BOARD_PCA10036 to BOARD_PCA10031. If you get any errors when compiling, it will probably tell you what you have to change. Typically it is due to the number of LEDs or buttons on the board. 

     

    Best regards,

    Edvin

Reply
  • You should be able to use any of the examples, and change the pin numbers to the pin numbers that are marked on the dongle.

    what you need to do is to change the define in the preprocessor defines that decides what board you are working on. Start with an example for the PCA10036, and change the define BOARD_PCA10036 to BOARD_PCA10031. If you get any errors when compiling, it will probably tell you what you have to change. Typically it is due to the number of LEDs or buttons on the board. 

     

    Best regards,

    Edvin

Children
No Data
Related