07-27-2024, 12:43 AM
it's not easy to change address, you can try to open the sensor, there is a tiny PCB, if you can weld, you can change the i2c address.
A8S and Modbus sensor
|
07-27-2024, 12:43 AM
it's not easy to change address, you can try to open the sensor, there is a tiny PCB, if you can weld, you can change the i2c address.
08-20-2024, 09:54 AM
In your e-shop you write that the address should be editable. So is it?
https://shop.kincony.com/products/rs485-...e-by-sht30
08-20-2024, 12:12 PM
use PC software to config the RS485 address. after click "set" button, then power off the sensor and power on again.
PC software download: ![]()
08-21-2024, 06:47 AM
Finally, it is working. Thank you very much.
For anyone else trying to set an address without the provided software. You should set the address to registry `0x0a`.
08-21-2024, 07:42 AM
ok, thanks share your result.
07-09-2025, 06:51 AM
Do you have all info about this sensor? https://shop.kincony.com/products/rs485-...e-by-sht30 I need to calibrate the sensor, as the temperature and humidity are very off (about 5°C higher than real values and 20% lower than real values). Is there a way to send commands via Modbus to recalibrate the sensor so it can be read correctly later? The goal is to be able to perform certified calibration and supply pre-calibrated sensors to customers.
07-09-2025, 07:20 AM
I tried this buy can't be able to set calibratión with modbus parameters: from pymodbus.client import ModbusSerialClient
import struct import time # --- CONFIGURACIÓN DEL SENSOR --- PUERTO_COM = 'COM9' # ⚠️ Cambiar según tu puerto (Windows: COMx, Linux: /dev/ttyUSB0) BAUDRATE = 9600 DIRECCION_MODBUS = 1 # Dirección del sensor (normalmente 1) # --- VALORES DE CALIBRACIÓN --- CALIBRACION_TEMP = 10.0 # °C → valor que se forzará como temperatura CALIBRACION_HUM = -10.0 # %RH → valor que se forzará como humedad OFFSET_TEMP = 20.0 # °C → offset de corrección aplicado a temperatura # --- FUNCIONES AUXILIARES --- def float_to_2regs(value): """Convierte un float IEEE-754 a 2 registros Modbus (32 bits)""" raw = struct.pack('>f', value) # Big-endian float hi, lo = struct.unpack('>HH', raw) return hi, lo def read_float_from_registers(regs, index): """Convierte 2 registros consecutivos a float IEEE-754""" hi = regs[index] lo = regs[index + 1] raw = struct.pack('>HH', hi, lo) return struct.unpack('>f', raw)[0] # --- INICIO DEL PROGRAMA --- client = ModbusSerialClient( port=PUERTO_COM, baudrate=BAUDRATE, stopbits=1, bytesize=8, parity='N', timeout=1 ) if client.connect(): print("✅ Conectado al sensor\n") # --- Escribir calibraciones --- print("✏️ Enviando parámetros de calibración...\n") registros_calibracion = { 0x000C: float_to_2regs(CALIBRACION_TEMP), # Temp en 0x000C–0x000D 0x000E: float_to_2regs(CALIBRACION_HUM), # Hum en 0x000E–0x000F 0x0010: float_to_2regs(OFFSET_TEMP) # Offset en 0x0010–0x0011 } for reg_base, (hi, lo) in registros_calibracion.items(): response = client.write_registers(address=reg_base, values=[hi, lo], slave=DIRECCION_MODBUS) if response.isError(): print(f"❌ Error escribiendo en registros 0x{reg_base:04X} y 0x{reg_base+1:04X}") else: print(f"✅ Registros 0x{reg_base:04X}-{reg_base+1:04X} ← [{hi}, {lo}]") print("\n⌛ Esperando 2 segundos para aplicar calibración...\n") time.sleep(2) # --- Leer temperatura y humedad --- result = client.read_holding_registers(address=0, count=6, slave=DIRECCION_MODBUS) if not result.isError(): regs = result.registers temp_int = regs[0] / 10 hum_int = regs[1] / 10 temp_float = read_float_from_registers(regs, 2) hum_float = read_float_from_registers(regs, 4) print("? Lectura del sensor:") print(f"?️ Temperatura (int): {temp_int:.1f} °C") print(f"? Humedad (int): {hum_int:.1f} %RH") print(f"?️ Temperatura (float): {temp_float:.3f} °C") print(f"? Humedad (float): {hum_float:.3f} %RH") else: print("❌ Error al leer los registros del sensor.") client.close() else: print("❌ No se pudo conectar al sensor.") |
« Next Oldest | Next Newest »
|
Users browsing this thread: |
1 Guest(s) |