Rui_voltage_get

Is there any example with this command? I am not able to get battery voltage with this command. Do I need to connect vcc to an ADC pin and then call this RUI command or it should work without any hardware modification/wiring?

Thanks

Hi,@Telekonix
Which module can you use? If RAK811 module you used,this RUI can’t support it. You should use the GPIO RUI in combination with external circuits.
Please refer to https://doc.rakwireless.com/developer-tools/developer-tools/rui-gpio-read-write

I am using Rak811, but i RUI documentaion it is mentioned that this command is supported by Rak811 too!?.
Anyway thanks for clarification

Hi @Telekonix
Because RAK811 is module not board,so there is no way to support Rui_voltage_get directly.
You should use the GPIO RUI RUI_RETURN_STATUS rui_gpio_rw(RUI_IF_READ_WRITE rw_status,RUI_GPIO_ST rui_gpio,uint8_t status) in combination with external circuits.

Hi Leopold,

Can it be done on any general GPIO or should done on those that support ADC ? How about if I directly connect VCC to an ADC pin and trigger read via downlink or another timer whenever needed ?
When you say combination with external circuit you mean for example considering 2 giant resistors and read voltage in between, right ?

Hi @Telekonix
Yes,considering 2 giant resistors and read voltage in between.
Sorry,I made a mistake,not use rui_gpio_rw,you need following API:

RUI_RETURN_STATUS rui_adc_init(RUI_GPIO_ST *rui_gpio);
RUI_RETURN_STATUS rui_adc_get(RUI_GPIO_ST *rui_gpio, uint16_t* value);

https://doc.rakwireless.com/developer-tools/developer-tools/rui-adc-initialize