Here we try to set internal reference voltage of ADC to the 1.8V or 2.4V by using functions
udrv_adc_set_mode(UDRV_ADC_MODE_1_8);
OR
analogReference(AR_INTERNAL_1_8).;
When we read ADC mode back with function “udrv_adc_get_mode()” it gives UDRV_ADC_MODE_3_3 (ie. Mode value - 1)
It seems that internal voltage is not getting set to the desired voltage level.
Thank you for update.
I think it should get reflected in library files also. So that it will not be selected by the developer if RAK3172 board is selected.
So if you want to accurately measure the analog value you are better of using an external Vref connected on a ADC channel and then compensate for the unknown Vin ??
Hi @carlrowan , I have also a question about the ADC. iam trying to read the battery voltage. Iam using a voltage divider of 1M and 1.5M ohm as recommended. So my max voltage on the ADC pin is 2.29V when iam using a 3.6V battery. But when i change the value on the ADC pin the analog value is not changing. Iam using ADC2 → WB-A1 for reading. When i turn the power supply voltage to 2.3V its still the same value as before… Really strange. Do you have some suggestion what the problem would be?
Having external voltage rerference for the module will not the improve accuracy on the built-in ADC. If can have fixed VDD level on RAK3172, you can use its ADC (vdd as reference) else it might be worth considering to check for an externa one or use RAK4631 (with programmable ADC reference.)
Hello @carlrowan ,
My vdd is a battery (3.6V max). So when the battery is getting empty the Vref is getting lower. That means that i cant make a battery measurement?
This is an enlightening discussion. Thank you both.
Where I am having difficulty is how to read from A0 when using RAK5811 mounted on a RAK19001/RAK11310 device.
The published example, RAK5811_0-5V.ino, I think shows how to read from A1 and I have been able to calibrate voltage_sensor so that it approximates the actual voltage being input from a variable power supply.
How does one read from A0? Would very much like to understand that. Pointers to documentation on this subject would be appreciated too.
Carl… My thanks for your patience but I am even more confused now than ever. The example provided with RAK5811 for this hardware combination refers to WB_A1 but seems to not actually read from there. Someone with my background would assume WB_A0 for the other input so that one is reading from A0 and A1 on the RAK5811. These refer to pins 26 and 27, according to pins_arduino.h.
A thought on the orientation of two customer groups: The first group is deep into electronics and so can easily understand schematics. The second group is deep into software and looks for documented application programmer interfaces. Microcontrollers and their applications do require basic knowledge of electronics. However, the second group does not have deep knowledge in that arena. My own talent is in building logical constructs that computers can carry out.
I really think the example provided for the RAK5811 should be modified so that it clearly refers to A0 and A1.