I’ve doing some tests with RAK11720 on my custom board, and I have a couple of questions regarding RAK11720 compatibility with:
VBat measurement:
Currently I’ve used the same resistor divider 1M/1.5M that RAK boards uses, but it’s not clear to me which port to use currently I have it on ADC3/PIN26/IO4 (probably incorrect). Also I see on another topic that probably I need to adapt the resistor divider.
Analog Input RAK5801
Is this module compatible with RAK11720? Appears to use ADC5/PIN31/AIN1_IN and ADC6/PIN32/AIN2_IN Correct?. Maybe here is neccessary to adapt the opamp resistors too?
As you can see in the schematic, due to range limitations of the internal ADC, there is a second resistor divider with 300k/1M in addition to the 1M/1.5M.
RAK5801 will use AIN1, which is connected to ADC5 and WB_IO4, which is connected to ADC3.
I see some imprecission on voltage readings and I think that my resistor dividers are maybe very large. Can you point me the recommended resistor values without sacrifice a lot of power consumption?
Many thanks for your time, I’ve soldered 100nF capacitor to both inputs and now the values appears spot on
I have another question related to analog reading…
My application is fully event driven so the only thing I have on loop() is the typical api.system.sleep.all();
I’ve done the analog tests with this line commented (so no sleep) but as soon as I enabled it, the analog readings are of very low value.
Tried to do a for loop to get 10 sampling values, and also discarding another 10 values before entering this loop. Appears to improve, but still very low.
I’m suspecting that with sleep enabled the MCU appears to turn off the ADC and maybe doesn’t have enough time to charge the caps?
Do you see a difference in the power consumption with api.system.sleep.all() active or not?
The loop is called by a scheduler of RUI3, if it is empty, RUI3 should go into sleep by itself if it is empty and if you enabled automatic sleep before with api.system.lpm.set(1)
Hello Bernd, today I’m testing your suggestions and show you the results as detailed as possible:
With loop() empty and api.system.lpm.set(1):
Analog values reading: GOOD
PPKII power consumption: 2.38mA
I’ve tried to send AT+LPM=0 and AT+LPM=1 and no changes are observed regarding power consumption.
As soon as I put AT+SLEEP=120000 the MCU goes to sleep and power consumption drops to ~96uA on my board, but the next analogRead gets wrong values (near 0volts).