Cubecell RS485 Modbus

I am trying to read a rs485 sensor with heltec cubecell htcc-ab01, 5v StepUP and RS485 MAX module, but I can’t read the data correctly.
I am trying to use softSerial with GPIO1 and GPIO2 as Tx and Rx pin, but I can’t use write and readBytes with softSerial.
Because I need to interrogate the sensor, with a specific request, to get the data.

Here the code:

#include “softSerial.h”

#define RX GPIO2 //Serial Receive pin
#define TX GPIO1 //Serial Transmit pin
#define RTS_pin GPIO3 //RS485 Direction control
#define RS485Transmit HIGH
#define RS485Receive LOW
softSerial RS485Serial(RX, TX);
void setup() {

pinMode(RTS_pin, OUTPUT);

// Start the built-in serial port, for Serial Monitor
Serial.println(“sensor data”);

// Start the Modbus serial Port, for anemometer
pinMode(RTS_pin, OUTPUT);
pinMode(Vext, OUTPUT);

void loop() {


digitalWrite(RTS_pin, RS485Transmit);
digitalWrite(Vext, LOW); // init Transmit
byte data_request[] = {0x01, 0x03, 0x00, 0x1E, 0x00, 0x01, 0xE4, 0x0C}; // inquiry frame

RS485Serial.write(data_request, sizeof(data_request));

digitalWrite(RTS_pin, RS485Receive); // Init Receive
byte data_buf[8];
RS485Serial.readBytes(data_buf, 8);

Serial.print("data: “);
for( byte i=0; i<7; i++ ) {
Serial.print(data_buf[i], HEX);
Serial.print(” “);
Serial.print(” ==> ");

Serial.println(“data end*****”);


Can you help me to make the rigth request to the sensor?
Thank you for your help.


Could you compare this:

Tank you @jasonXu, I corrected softSerial variable as

softSerial RS485Serial(GPIO1 /TX pin/, GPIO2 /RX pin/);

but the problem still remain, because I can’t use “write” method and i can’t find other way to send byte array to inquiry the rs485 sensor and read the sensor response.

I am trying to do the same.
In my case the slave device is not configurable to 8N1 for serial communication, only 8E1 is available. the cubecell cant handle 8E1 for now.

as far i know, 8N1 is not the common way for modbus

I thought that CubeCell AB01 only has a hardware serial port, not softSerial, but I am not quite sure. Unfortunately it is hard to find in the documentation.
Regards Achim


we have some software example.