1
\$\begingroup\$

SystemI would like to receive data from E95-DTU-433L20-485 via Modbus RTU. I could not read data properly. Could you help me figure out what the problem with my configuration is?

#include "LoRa_E32.h"
#include <SoftwareSerial.h>

int8_t temperature;  

SoftwareSerial mySerial(3, 2);
LoRa_E32 e32(&mySerial);

void setup() {
  Serial.begin(9600);
  e32.begin();
}

void loop() {
  
  temperature = 22; 

  Serial.println(temperature, BIN);  
  
  struct Message {
    int8_t temperature;  
  } message;

  message.temperature = temperature;  

  ResponseStatus rs = e32.sendFixedMessage(0, 63, 23, &message, sizeof(Message));
  Serial.println(rs.getResponseDescription());
  delay(1000); 
}

Modubs Simulator

\$\endgroup\$
5
  • 1
    \$\begingroup\$ We don't know how you have connected it and if you are using correct parameters for the device. Have you got a manual how to connect it and how to communicate with it? \$\endgroup\$ Commented Nov 23, 2024 at 18:42
  • \$\begingroup\$ It could be a hardware issue too. Please, provide the schematic of your setup. \$\endgroup\$ Commented Nov 23, 2024 at 19:12
  • \$\begingroup\$ You seem to be using Arduino libraries for the modem and software serial. Also there seems to be no control for RS-485 transmit enable. Like I said, we don't know how you have connected this in hardware and will it ever work. For the software, this is a pure Arduino library usage question. For the electronics part, it's "how do I use my electrical device" if it's not about how to interface with it in hardware. \$\endgroup\$ Commented Nov 24, 2024 at 10:20
  • \$\begingroup\$ I am using SH-U10 usb to RS-485 converter I connected A to A, B to B for both devices. I don't know what the problem is coming from hardware or software.I have only user manuel document. (cdebyte.com/products/E95-DTU(433L20-485)-V8/4#Downloads) \$\endgroup\$ Commented Nov 24, 2024 at 10:51
  • 1
    \$\begingroup\$ @Mehmet So there's many potential problems already. RS-485 is not a two-wire interface. It is a three-wire interface with common ground reference and two data wires between devices. You mention no termination either. And you can never be sure if devices label A and B correctly, but you can try swapping or use oscilloscope to be sure. \$\endgroup\$ Commented Nov 24, 2024 at 11:03

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.