alfem / usb-relay-control

Python script to switch on/off an usb relay board from CFSunbird
GNU General Public License v3.0
0 stars 0 forks source link

hidapitester --vidpid 5131:2007 --open --send-output 0xA0,01,01,A2 --close #1

Closed wlan4you closed 7 months ago

wlan4you commented 8 months ago

Hello,

i see you have absolutly the same module like me. I also read that you tryed to bring them work under windows.

hidapitester --vidpid 5131:2007 --open --send-output 0xA0,01,01,A2 --close

I need also an easy solution to run it under windows like a batch file.

You find more? or a solution without to use python?

With the original tool i find out which is goning on and off. I put it into a excel sheet.

Excel Micro USB 1_2_4 Kanal HID Relais Modul OrigTestTool Output

This has i found on a webpage. It has the same information what i found out with my test. But it will not going with a batch file

Protocolo de interruptor USB LC:

Datos (1) --- identidad inicial (el valor predeterminado es 0xA0) Datos (2) --- Código de Dirección del interruptor (el valor predeterminado es 0x01, identificando el interruptor del primer canal) Datos (3) --- Datos operativos (0x00 a "Off", 0x01 "On") Datos (4) --- suma de comprobación

Ejemplo: Interruptor USB abierto: A0 01 01 A2 Cerrar interruptor USB: A0 01 00 A1

alfem commented 8 months ago

I do not use windows, and I finally switched to another solution (arduino board + relay shield) because I needed feedback from some sensors (and relay control as well).

But I guess you can do something like:


echo A00101A2 > command.txt
certutil -decodehex command.txt command.bin

MODE COM8:115200,n,8,1
copy command.bin \\.\com1 /b
wlan4you commented 8 months ago

These module use no comport. It is the same module what you have used here:

https://github.com/darrylb123/usbrelay/issues/103

alfem commented 8 months ago

Yes, it is the same. USB is a com port

wlan4you commented 8 months ago

Hmmm.... if i type MODE COM8.... Then comes error that com port

Illegal device name - COM8 Nombre de dispositivo ilegal - COM8

If i take a look in my Win11 when the relay is connected. there is no COMPORT. Only the HID Device

alfem commented 8 months ago

COM8 is only an example. In your computer It could be COM1, COM2...

Check Windows Device Manager.

wlan4you commented 8 months ago

There is no COM, if i connected them to windows. It is a HID Device. They have no COM.

You have not the same module ?

alfem commented 8 months ago

Perhaps you don't have the USB drivers for CH340 installed. It is included in Linux, but not in Windows.

You can find that drivers in many web pages:

https://learn.sparkfun.com/tutorials/how-to-install-ch340-drivers/all

wlan4you commented 8 months ago

On my Module is no CH340 I have a CH554E installed

alfem commented 8 months ago

I have a CH554E installed

And you have the proper windows drivers installed?

wlan4you commented 8 months ago

They don't need a driver. They can talk as a HID device.

OK. Close it here. I have first uinderstand you have the same RELAY MOdule like me. See Screenshot from first post.

Here are sam Macro PICS from the chip. IMG_9002 IMG_8999 IMG_8998

Thanks for your help to try and your time.

mpfdetroit commented 8 months ago

@wlan4you I also have the HID version of this piece of shit. Did you end up finding a solution to make it work with a bat file?

I tried using hidapitester to send output, but the relay did not actuate. Have you found a way to actuate it using the hidapitester? Or have you found a solution?

mpfdetroit commented 8 months ago

image

mpfdetroit commented 8 months ago

also, program is not writing?

mpfdetroit commented 8 months ago

@alfem Do you think you could point me in the right direction? Similar to @wlan4you I have the HID-type relay. I'm think though they use the same integrated circuits as the ch340's the configuration inside the USB protocol is different. But I have no clue how to get this thing to work, all I know is that it can work under windows because it came with the lc_usb.exe that actuates the relay.

I've tried to wireshark the usb to some success, but I don't have to knowledge to send the same data to the relay that the .exe file is sending.

wlan4you commented 8 months ago

Hello, NO i didn't find a solution with this piece of shit (LOL). I search hours in the web. I testet a lot of... nobody has this module running over a batch file.

Please if you find a way, write to me or here in this part here. THANKS !

maciejbudzyn commented 7 months ago

.\hidapitester.exe --vidpid 5131:2007 --open --send-output 0x0,0xA0,0x01,0x01,0xA2 --close

works

wlan4you commented 7 months ago

.\hidapitester.exe --vidpid 5131:2007 --open --send-output 0x0,0xA0,0x01,0x01,0xA2 --close

works

Jaaabbbaaaddaaaabbbaaadddduuuuuuuuu !!! It goes ! Your the best. I was on the way, but i didn't now about the "Ax" before

Great. Many Thanks

mpfdetroit commented 7 months ago

It works! You are the man. Thank you so much.

onur-akaydin commented 1 month ago

.\hidapitester.exe --vidpid 5131:2007 --open --send-output 0x0,0xA0,0x01,0x01,0xA2 --close

works

It works on Windows! I would never have thought of adding an extra 0x0 at the beginning. Thanks!