Control AHU with modbus

Hi guys!

Im working on a project where i need to read data from an AHU, like fresh air temp, extraction temp and so on.

I got a Arduino UNO wifi rev2 and a TTL to RS485 converter, see attached wiring diagram.

at first im trying to read the temperature from register 21 which is a temperature that has a offset of -300 regarding documentation.
Im using the TX0 and RX0 on the Arduino UNO wifi rev2.

I got this code:

#include <ModbusMaster.h>

ModbusMaster node;

void setup() {
  Serial.begin(9600);
  Serial1.begin(9600);

  node.begin(20, Serial1);
}

void loop() {
  uint8_t result;
  uint16_t rawTemperature;
  float temperature;

  result = node.readHoldingRegisters(21, 1);
  if (result == node.ku8MBSuccess) {
    rawTemperature = node.getResponseBuffer(0);

    temperature = (float)rawTemperature / 10.0 - 300.0;

    Serial.print("Temperature: ");
    Serial.println(temperature);

    delay(1000);
  }
}

I will also opload the data from the manufacture.

I will really appriciate if someone could point me in the right direction, as i cannot read anything in the serial monitor.


This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.