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

Hi guys. I have two question about BLE for nrf52832.

I have a potentiometer of which one end I have connected to gnd other one to VDD and 3rd one to AIN7. I wish to calibrate it in such a way that output voltage ranges between 1.2 to 2.0 volts. I am new to programming as well as nordic blinky. Could someone provide insights on same.

Parents
  • Hello,

    I am new to programming as well as nordic blinky.

    Welcome!
    When you say that you are new to programming, do you mean programming in general, or embedded programming in particular?
    I only ask so that I can adjust my answers accordingly :)  

    I have a potentiometer of which one end I have connected to gnd other one to VDD and 3rd one to AIN7. I wish to calibrate it in such a way that output voltage ranges between 1.2 to 2.0 volts.

    To achieve this I recommend that you start out with the SAADC peripheral example from the nRF5 SDK. This example demonstrates how to setup and use the SAADC, and uses it to measure a the voltage on a AIN0 by default. Its measurements is taken each 400 ms, and the measurements can be seen in the logger output (serial terminal) every time the buffer fills up. You may then modify this example to instead measure AIN7, and see your measurements directly in a serial terminal.

    What is the range of your potentiometer? Have you calculated that its range will give you a voltage of between 1.2 V and 2.0 V (or, how you may divide your voltage, to achieve this)?
    If your potentiometer goes all the way down to 0 ohm, you will need to add a resistor in series to avoid a short circuit.

    Please do not hesitate to ask if anything should be unclear, or if you have any other questions!

    Best regards,
    Karl 

  • Hello,

    By new to embedded programming I meant I am a bit better than a beginner .

    As suggested by you I already tried the SAADC peripheral example provided by making the required changes I am also getting the values from ranging from 0 to 834. I have used the default channel config setting. My potentiometers range is 0 to 220k. How do I get the values converted to voltage is my question.

    The voltage at Vdd is 2.85 so how do I get voltage values within the range 0 to 2.85. 

    I appreciate the time you took out to reply to my question.

    Kind Regards,

    NSS

  • Hello NSS,

    NSS said:
    By new to embedded programming I meant I am a bit better than a beginner .

    Thank you for clarifying.

    NSS said:
    As suggested by you I already tried the SAADC peripheral example provided by making the required changes I am also getting the values from ranging from 0 to 834. I have used the default channel config setting.

    The default SAADC configuration uses 10 bit resolution - meaning you will get output values between 0 and 1024 - with internal reference 600 mV and 1/6 gain - giving an input range of 0 - 3.6 V.
    This means that the 0 - 1024 values will map to the 0 - 3.6 V range, so that the output value 1024 is equal to a 3.6 V measurement.

    NSS said:
    My potentiometers range is 0 to 220k. How do I get the values converted to voltage is my question.

    In this case the potentiometer will act as a voltage divider, so you may calculate the voltage drop accordingly. You may then add resistors in series before and after the potentiometer, to get the range you are interested in measuring.
    If power consumption is a concern in your application, you should use sufficiently large resistors to avoid draining your battery through this circuit.

    Please make sure to heed my previous warning about the potential short circuit if you turn your potentiometer all the way down to 0 ohm. This may damage the device.

    Best regards,
    Karl

Reply
  • Hello NSS,

    NSS said:
    By new to embedded programming I meant I am a bit better than a beginner .

    Thank you for clarifying.

    NSS said:
    As suggested by you I already tried the SAADC peripheral example provided by making the required changes I am also getting the values from ranging from 0 to 834. I have used the default channel config setting.

    The default SAADC configuration uses 10 bit resolution - meaning you will get output values between 0 and 1024 - with internal reference 600 mV and 1/6 gain - giving an input range of 0 - 3.6 V.
    This means that the 0 - 1024 values will map to the 0 - 3.6 V range, so that the output value 1024 is equal to a 3.6 V measurement.

    NSS said:
    My potentiometers range is 0 to 220k. How do I get the values converted to voltage is my question.

    In this case the potentiometer will act as a voltage divider, so you may calculate the voltage drop accordingly. You may then add resistors in series before and after the potentiometer, to get the range you are interested in measuring.
    If power consumption is a concern in your application, you should use sufficiently large resistors to avoid draining your battery through this circuit.

    Please make sure to heed my previous warning about the potential short circuit if you turn your potentiometer all the way down to 0 ohm. This may damage the device.

    Best regards,
    Karl

Children
No Data
Related