Relay via USB serial port CP2102

Others (MiLight, Hue, Toon etc...)

Moderator: leecollings

Post Reply
geotravel
Posts: 4
Joined: Sunday 07 May 2017 13:35
Target OS: Linux
Domoticz version:
Contact:

Relay via USB serial port CP2102

Post by geotravel »

Hello,

I have relay as attached picture and USB<->serial port base on CP2102 . Is it possible use together these devices with domoticz ?? How to create
this software switch in domoticz to switch On/OFF relay via USB serial port ??

Regards

Waldek
Attachments
CP2102.png
CP2102.png (275.78 KiB) Viewed 2389 times
relay.png
relay.png (196.19 KiB) Viewed 2409 times
Last edited by geotravel on Sunday 07 May 2017 19:16, edited 2 times in total.
SweetPants

Re: Relay via USB serial port CP2102

Post by SweetPants »

geotravel wrote:I have relay as attached picture and USB<->serial port base on CP2102 . Is it possible use together these devices with domoticz ?? How to create this software switch in domoticz to switch On/OFF realy via USB serial port ??
No you cannot connect the CP2102 to the Relay. The CP2102 is a serial port adapter unless it has RTS/DTR pins, then it might be possible.
geotravel
Posts: 4
Joined: Sunday 07 May 2017 13:35
Target OS: Linux
Domoticz version:
Contact:

Re: Relay via USB serial port CP2102

Post by geotravel »

Hi,

As attached picture USB serial converter have output RTS (in bottom output pins). So I can connect RTS pin to IN in board relay and send
command under linux to SET HI or LOW RTS line ???
SweetPants

Re: Relay via USB serial port CP2102

Post by SweetPants »

geotravel wrote:Hi,

As attached picture USB serial converter have output RTS (in bottom output pins). So I can connect RTS pin to IN in board relay and send
command under linux to SET HI or LOW RTS line ???
It's DTR/RST not RTS.

Name Pin # Type Description
...
RST 9 D I/O Device Reset. Open-drain output of internal POR or VDD monitor. An
external source can initiate a system reset by driving this pin low for
at least 15 μs.
SweetPants

Re: Relay via USB serial port CP2102

Post by SweetPants »

Take a look at the FF32 (FlyFish) http://www.flyfish-tech.com/FF32/index.php
geotravel
Posts: 4
Joined: Sunday 07 May 2017 13:35
Target OS: Linux
Domoticz version:
Contact:

Re: Relay via USB serial port CP2102

Post by geotravel »

Please find attached picture where I marked green square DTR/RTS and this converter have output RTS line marked by red square
or it is mistake description on board
Attachments
CP2102.png
CP2102.png (275.43 KiB) Viewed 2375 times
geotravel
Posts: 4
Joined: Sunday 07 May 2017 13:35
Target OS: Linux
Domoticz version:
Contact:

Re: Relay via USB serial port CP2102

Post by geotravel »

Ok by if I have usb/serial converter with RTS line how to create bash or python script to send /dev/ttyUSB0 to set HI or LOW RTS line?
DoubleHP
Posts: 1
Joined: Saturday 21 October 2017 15:57
Target OS: Linux
Domoticz version:
Contact:

Re: Relay via USB serial port CP2102

Post by DoubleHP »

I have published a detailed answer here: https://forums.gentoo.org/viewtopic-p-8 ... ml#8132756

Here is the short version:

Code: Select all

#!/bin/bash
MySerialPort="/dev/ttyUSB0"
MyLatency="2"
echo "#include <fcntl.h>
#include <sys/ioctl.h>
main()
{ int fd; fd = open(\"${MySerialPort}\",O_RDWR | O_NOCTTY );
int RTS_flag; RTS_flag = TIOCM_RTS;
ioctl(fd,TIOCMBIS,&RTS_flag);
sleep (${MyLatency});
ioctl(fd,TIOCMBIC,&RTS_flag);
close(fd); } " | tcc -run -
Note that sending data on TX will probably mess RTS; see the Gentoo forum for details.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest