How to use RS485 with node-red



  • Hello
    I bought M103.
    RS485 can be set with EVOK, but I do not know the data input / output method.
    Please tell me an example of description.

    Configuration
    http://127.0.0.1/rest/rs485/1_01
    parity_mode = None & speed_mode = 9600 bps & stopb_mode = One


  • administrators



  • Thank you for answering.

    I completed using the Evok to set the baud rate.

    However, I do not know how to write the code.
    I want to do communication from the RS485 terminal of Neuron to the sensor.

    http://127.0.0.1/-/extension-devices
    Is this the correct answer?

    Data you want to send
    buf = [0x01, 0x03, 0x00, 0x00, 0x00, 0x02, 0xC4, 0x0B];

    Please tell me the example code for Neuron M103 case.

    I am sorry for being a beginner.

    If I can not understand, use the USB RS485 converter.


  • administrators

    @mikami Evok supports only Modbus RTU as communication protocol on the RS485. First you have to define the variables(registers) using the example https://github.com/UniPiTechnology/evok/blob/master/etc/hw_definitions/CUSTOM MODBUS DEVICE.yaml (also check the other definitions - you can access ti via registers or using the DO/RO/... objects of evok).

    Once that is done, you have to modify to add it to evok.conf restart it and then you will be able to access the device either using the registers (https://evok-4.api-docs.io/1.04/json/get-register-state-json) or using the DO/RO/.. objects if you define.

    It will be available e.g. http://127.0.0.1/UART_[UART_ADDRESS]_[DEVICE_ID]/json/register/{circuit}
    UART_ADDRESS and DEVICE_ID are the same as defined in evok.conf
    circuit is the register defined in your .yaml definition



  • Thank you for answering. But the problem is not solved.

    What is [UART_ADDRESS]?
    What is [DEVICE_ID]?
    Where is it listed in evok.conf?

    [EXTENSION_1]
    global_id = 2                                                   ; Mandatory, REQUIRED TO BE UNIQUE
    device_name = xS10                                              ; Mandatory
    modbus_uart_port = /dev/extcomm/0/0     ; Mandatory
    neuron_uart_circuit = 1_01                              ; Optional, allows associating extensions with specific Neuron UART-over-Modbus ports (not possible for non-Modbus UART po$
    allow_register_access = True                    ; Optional, False default, is mandatory with third-party devices
    address = 15                                                    ; Optional, 15 default
    scan_frequency = 2                                      ; Optional, 1 default
    scan_enabled = True                                     ; Optional, True default
    baud_rate = 9600                                                ; Optional, NEEDS UNIPI IMAGE TO WORK! USE API TO CONFIGURE UART MANUALLY IF USING STANDARD RASPBIAN
    parity = N                                                              ; Optional, NEEDS UNIPI IMAGE TO WORK! USE API TO CONFIGURE UART MANUALLY IF USING STANDARD RASPBIAN
    stop_bits = 1                                                   ; Optional, NEEDS UNIPI IMAGE TO WORK! USE API TO CONFIGURE UART MANUALLY IF USING STANDARD RASPBIAN
    

    Please give me sample code of data transmission.
    Although it examined it considerably, I feel that there are few documents.


Log in to reply
 

Looks like your connection to UniPi.technology Forum was lost, please wait while we try to reconnect.