Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Trouble controlling the H100 Inverter using RS485 Protocol
#1
I was following this video 

how to control VFD (Variable Frequency Drive) inverter by KC868-COLB - YouTube

And wrote this code to control my H100 Inverter ( How to: H100 VFD & 1.5KW Air-Cooled Spindle Setup - Zhong Hua Jiang - How To - Carbide 3D Community Site)

import serial

def calculate_crc(data):
    reg_crc = 0xFFFF
    for byte in data:
        reg_crc ^= byte
        for _ in range(8):
            if reg_crc & 0x0001:
                reg_crc = (reg_crc >> 1) ^ 0xA001
            else:
                reg_crc >>= 1
    return reg_crc

# RS485 port settings
rs485_port = 'COM12'
rs485_baud_rate = 115200
rs485_parity = serial.PARITY_NONE
rs485_stop_bits = serial.STOPBITS_ONE
rs485_data_bits = serial.EIGHTBITS

try:
    # Open the RS485 serial port
    ser = serial.Serial(
        port=rs485_port,
        baudrate=rs485_baud_rate,
        parity=rs485_parity,
        stopbits=rs485_stop_bits,
        bytesize=rs485_data_bits,
        timeout=1
    )

    # Send a command via RS485 in RTU mode
    command = [0x64, 0x01, 0x02, 0x20, 0x00, 0x00, 0x01, 0x43, 0xCA]  # Modify the command in hexadecimal format
    crc = calculate_crc(command)
    command.append(crc & 0xFF)  # Low byte
    command.append((crc >> 8) & 0xFF)  # High byte
    ser.write(bytes(command))

    # Read the RS485 response
    response_rs485 = ser.readline()
    hex_response_rs485 = ' '.join(hex(byte) for byte in response_rs485)
    print("RS485 Response:", hex_response_rs485)

    # Close the RS485 serial port
    ser.close()

except serial.SerialException as e:
    print("Error opening or accessing the serial port:", str(e))

This is the code I wrote. The checksum passes, and everything else is fine. But when I run the code, it doesn't reflect any changes on the Inverter/ Motor. Please help.

The connections on the RS485 can be found in the images attached below.

Please help! Thanks in advance.


Attached Files Image(s)
       
Reply
#2
do you use PC send RS485 command to Inverter ?
or use which board to send command?
Reply
#3
(06-23-2023, 12:12 AM)admin Wrote: do you use PC send RS485 command to Inverter ?
or use which board to send command?

I use just my laptop and the code I shared using the connections I showed.
Reply
#4
you can use a serial port debug tool on widnows PC, send command to check whether VFD can work well, need confirm your command whether is correctly. Then add to your own program software.
Reply
#5
(06-23-2023, 10:35 PM)admin Wrote: you can use a serial port debug tool on widnows PC, send command to check whether VFD can work well, need confirm your command whether is correctly. Then add to your own program software.

Thanks for your response. I do use a Serial Port Monitor and based on the commands that have been shown in the video, the packets are right. The register address, values being written, and checksum all make sense. Please refer to the attached images to gain an understanding of what I tried using the Serial Port Monitor. 

But still, somehow, the inverter is not responding to the commands. I also switched the J4 switch to ON to ENABLE RS485.

Here are the different fixes I tried so far:

- I have also rechecked the wire connections to make sure nothing is loosely connected.
- I have also tried using a different RS485 converter but that also didn't fix the issue. 
- I also made sure that all the FTDI drivers are up-to-date and compatible with my Windows 11 machine.

I can't really think of more ways to debug this problem.

If it helps, this is the RS485 converter by DTech I'm currently using:

https://www.amazon.com/Serial-Converter-...15671&th=1

Another question I have is:

I'm curious that in the video on KinCony IoT's YouTube channel ( how to control VFD (Variable Frequency Drive) inverter by KC868-COLB - YouTube ), although he checks the RS485, hex, types in the command, and presses send, something might be happening in the backend of the software that I'm missing out on in my code. Maybe a different way of passing the command or parsing the hex? 

Right now, as you can see in the code that I shared previously, I'm converting the hexadecimal command into bytes and writing it on the appropriate serial port.

Please let me know, thanks!


Attached Files Image(s)
               
Reply
#6
maybe you need to check VFD manual , how to enable use RS485 communication. if command is correctly, just need confirm with VFD manual and supplier technical support.
Reply
#7
(06-25-2023, 10:17 PM)admin Wrote: maybe you need to check VFD manual , how to enable use RS485 communication. if command is correctly, just need confirm with VFD manual and supplier technical support.

I have reached out to the technical support. Maybe they'll be able to provide something. I'll wait till then.

In the meantime, is there any way to get access/ buy this software in the video? Or any GitHub repo I could refer to in order to establish RS485 control over the inverter using my laptop?

how to control VFD (Variable Frequency Drive) inverter by KC868-COLB - YouTube

Thanks,
Shaolin
Reply
#8
in video use by your KC868-COLB logical controller PC software, if you no our product, software can't work.
Reply
#9
(06-26-2023, 10:11 PM)admin Wrote: in video use by your KC868-COLB logical controller PC software, if you no our product, software can't work.

If I wanted to buy this product, how to do that? 

I can't find any "buy now" or "request quote" option on the website.
Reply
#10
here is KC868-COLB logical controller order link: https://www.aliexpress.us/item/325680179...4itemAdapt
Reply


Forum Jump:


Users browsing this thread:
1 Guest(s)