0

Part of a project I'm working on requires sending bytes to an 8-channel relay board. I've identified the board as /dev/ttyUSB0. I've found some tutorials on the internet, but they're either out of date, for Windows, or looking at a different device than I'm looking at. The device I'm looking at is one like this:

enter image description here

Is there something I've missed? How do I send data to this?

  • 1
    Solutions would be greatly accelerated if you edit your question to include a part number or, better yet, a link to a data sheet. – goobering Sep 26 '16 at 17:30
  • At least provide the output of lsusb though even that might not be giving the necessary details to identify the board, e.g. if it is using some kind of a generic USB-to-whatever bridge. Since you bought it one would guess you know make and model... – Ghanima Sep 26 '16 at 18:02
2

Assuming this is the product you have, have a look this customer comment who has graciously left some breadcrumbs on how to control the device. As some other customers have noted, the product cycles (ON/OFF) the relays on power up and also malfunctions in certain cases you might want to take the right precautions when using it in your application.

There is download link below the comments to a rar file that contains some documentation and device drivers for windows

Here is an extract from the documentation

Characteristics:

8 SPDT relays SRD-12VDC-SL-C

Relay specification – 10A 250VAC/10A 125VAC/10A 30VDC /10A 28VDC

Power Supply - 12 VDC

Current consumption - 300 mA

FT245RL. Datasheet –( http://www.ftdichip.com/)

Led for each relay output

Power Led

USb led

Size - 93mm / 70mm / 16mm

Supported by DRM Software

Windows software examples: VB6, BCB6, Java (netbeans), VB.NET 2010 Express, C++.NET 2010 Express

PCB parameters: FR4 / 1.5mm / two layers / metalized holes / HAL / white stamp / solder mask

Extra PCB openings for better voltage isolation

Doubled high current tracks

Important:

When the board is connected to the PC and the PC is restarted, the relays will be toggled several times. This is because of the structure of the FTDI chip.

The device must be supplied with 12 VDC or order to work.

There is no protection against reversed voltage! If the VCC(+12V) and GND are reversed the board will be damaged!

The board can not work without computer

Briefly (incase the link(s) go dead sometime) the relay board appears to use a FTDI chip (USB => USART) and therefore should be simple to control by writing to the serial port like so (taken from a customer's comment on amazon and modified to include more examples)

import serial
s = serial.Serial(port='COM15', baudrate=9600, bytesize=serial.EIGHTBITS, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE, timeout=None)
s.isOpen()
s.write([b'\00',b'\00'])  # all off
s.write([b'\xFF',b'\xFF']) # all on

the protocol appears to be <mask> <value> where

<mask> is a 8 bit number, with relays corresponding to bits set 1 get affected by the value

<value> is a 8 bit number, 0 turns off, 1 turns on

so talking in hex, 0f, 0a should affect the first 4 relays (0f), turning relays 4 and 2 on and 3 and 1 turned off.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.