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

Examples of ADC with temperature and battery voltage, SDK 10/11

Hi all, i'm trying to understand how to program my nrf51 DK in order to perform a temperature measurement with the onboard sensor, convert the battery voltage with the ADC and send it to, for example, my phone with MCP. I have read the three tutorials but now i think i need more example to understand these functions, so i looked on github but i found only a good example which works on SDK 5 or something like that, which of course doesn't work (it doesn't even advertise) when i load it on the board. Is there a way to implement it with SDK 10 or 11 and relative s110 or s130 softdevice, or have an updated code? Thanks in advance.

Parents
  • Hi Revo, I suggest you first try running one of the examples included in the SDKs to get familiar with the nRF5x framework and how to compile and run software. Don't forget that you have to program the SoftDevice first (using nRFgo Studio), and that you have to use a SoftDevice that is approved for use with your SDK version. For SDK v11.0.0, this would be S130 v2.0.0 for nRF51 and S132 v2.0.0 for nRF52. S110 and S120 are outdated and not supported anymore, they were replaced by S130.

    If you want to run a sample project that uses SDK v5 (which would be very old), you would need to use the corresponding (outdated) SoftDevice for that project.

    I really suggest getting familiar with the examples included in SDK v11 and run them on your DK:

    • An easy example would be Beacon (the ble_app_beacon) which shows how to send advertising data. You could use the main loop to periodically poll the temperature and battery voltage and update the advertising data (which you can see on MCP without establishing a connection to your BT device). Although you might have to remove the power management function call to prevent you device from sleeping and not updating the temperature and voltage values anymore. I think this would be the fastest and easiest way to send your data, especially if you're new to Bluetooth Smart / Bluetooth Low Energy.

    • A more sophisticated project would be the Heart Rate Sensor (ble_app_hrs). This implementation already implements the Battery Service Profile (BAS, see ble_bas.h). I'm not sure if the battery services currently measures the acutal battery voltage or uses simulated data, though. You could remove the services you don't need (especially the HRS) and add support for temperature measurements.

    Good luck!

  • Thanks really for your explanation. I'm really a novice and i'm still understanding the differences between the various methods to send data, in order to put together the pieces for my real project which i will do later; if i put the data in the advertising structure, i can see it without connecting and that's ok, but this way i can't store that data in the target device (in this case the phone just to try, in my future application i will need to receive with another nRF and send it to the PC via USB), correct?

Reply
  • Thanks really for your explanation. I'm really a novice and i'm still understanding the differences between the various methods to send data, in order to put together the pieces for my real project which i will do later; if i put the data in the advertising structure, i can see it without connecting and that's ok, but this way i can't store that data in the target device (in this case the phone just to try, in my future application i will need to receive with another nRF and send it to the PC via USB), correct?

Children
No Data
Related