How to read port #2 of 4-20mA interface board RAK5801

Hello, I am working with the RAK5801 4-20mA interface board attached to Wisblock.

According to the documentation, it provides two 4-20mA inputs.
The top pin (Pin #8) maps to the A1 analog input, and the next pin (Pin #7) maps to the A0 input.

When I read these inputs, I am getting expected values from A1, but when I read A0, it is always approximately 600 (integer), no matter what is connected, or disconnected.
A1 goes to zero when disconnected, but A0 stays at ~600.

Is there some sort of additional initialization necessary to enable this input?
In the setup() function I initialize both pins like this:

pinMode(WB_A1, INPUT);
pinMode(WB_A0, INPUT);

I ensure to power on the RAK5801 by this:

pinMode(WB_IO1, OUTPUT);
digitalWrite(WB_IO1, HIGH);
delay(1000); // Give peripherals time to stabilize before reading

Thank you for any assistance.

Hi @thegpx ,

The RAK5801 has 2 analog channel available.

AN1 is useable by default. But if you need to use AN0, there are few hardware modifications needed to configure it correctly because AN0 is being used by default to measure the battery voltage.

Btw, on using Analog Input, you don’t need to configure the pinMode.

@carlrowan Thank you so much for your reply. Can you please elaborate on how to do the hardware modifications? I need to monitor two 4-20mA process loops with the single Wisblock unit (pressure and temperature) and this would be incredibly helpful.

Thank you

Hello @thegpx

Very simple solution I just found. Please test.
The A0 of the 4-20mA interface is connected to IO4 of WisBlock.
The RAK4631 has IO 4 connected to GPIO P0.04/AIN2.
It should be possible to read A0 (4-20mA) on Ain2 of the RAK4630.


Just make sure you don’t use IO4 for anything else.

1 Like

Hi @thegpx ,

To enable AIN0 as additional channel.

  1. Remove R7 on RAK5005-O to disconnect Vbat sensing.
  2. On RAK5801, remove the 0 ohms resistor in R94 and put it to R95. This section is on the upper left of the module