Both works, you can supply 12V from the WisBlock (I used our RAK19002 Boost which can deliver 50mA.
Or you can use an external 12V supply.
The first option allows you to shut down the power of the sensor, with the second option your sensor is either always powered up or you need a relay to control the 12V.
Awesome, but in no case I can expect the sensor device to provide this power right? It’s my duty, either thru the 5801 or thru an external power supply, to provide this voltage right?
Thanks again
It depends on your sensor I guess. I never tried a 4-20mA sensor.
There are 20mA sensors that have a separate power supply input, others expect the 12V from the 4-20mA connector.
Maybe RAK5801 Typical Application helps. There are 2 wire, 3 wire and 4 wire sensors.
Ok it looks pretty clear, I guess this device doesn’t provide power by itself, but I will check voltage presence before I connect anything to it to make sure
Thanks!
Good day everyone.
I was recently using the same library, Modbus-ESP8266, and although in the sniffer 485 there is a conversation between the requests of the RAK11300 and the sensor, it is not possible to receive any data. In the example that Arduino IDE counts, it is observed that the RAK5802 module has its TX, RE and DE pins, but how do you know if there is any pin or way for the module to change from transmitting a message to receiving it?.
"’
#include <ModbusRTU.h>
#Define SLAVE_ID 2
#Define FIRST_REG 0
#Define REG_COUNT 10
#Define MB_BAUDRATE 9600
#defines MB_CONFIG SERIAL_8N1
uint16_t res[REG_COUNT];
ModbusRTU g_mb;
Bool cb (Modbus::ResultCode event, uint16_t transactionId, void* data) { // Callback to monitor errors
if (event != Modbus::EX_SUCCESS) {
Serial.print (“Request result: 0x”);
Serial.println (event, HEX);
}
return true;
}
void setup () {
/*
- WisBLOCK RAK5802 Power On
/
pinMode (WB_IO2, OUTPUT);
/ - WisBLOCK RAK5802 Power On
*/
pinMode (WB_IO1, OUTPUT);
time_t timeout = millis ();
Serial.Begin (115200);
While (! serial)
{
If ((Millis () - Timeout) < 5000)
{
delay (100);
}
Else
{
Break;
}
}
Serial1.begin (MB_BAUDRATE,MB_CONFIG); //Data bit 8, check bit None, Stop bit 1
While (! Serial1);
g_mb.begin (&Serial1);
g_mb.master ();
Serial.println (“MODBUS RTU-Master Init Succeed”).
}
Void Loop () {
if (!g_mb.slave ()) //Returns slave ID for active request or 0 if no request in-progress.
{
g_mb.readHreg (SLAVE_ID, FIRST_REG, res, REG_COUNT, cb);
}
digitalWrite (WB_IO1, HIGH);
digitalWrite (WB_IO2, HIGH);
g_mb.task ();
delay (1000);
}
"’
Knowing if the @RAK-admin team knows about this flaw, as well as if using the Arduino-designed RS485 and Modbus library, when compiling, it presents errors, despite the fact that this library is presented in the documentation of the RAK5802 module.
Can you try attached code? You might need to adjust baud rate, but it reads 4 bytes over Modbus from a device with address 1.
But no guaranty that it works, I don’t have a setup atm to test it.
It is not using any Arduino library, instead it is using a ModBus implementation we made for our RUI3 based devices. Worked well for me, but I did not use it for a long time.
RAK11310-Modbus.zip (10.7 KB)