# UD85C08 — USB board with 8 relay outputs and 8 optocoupler inputs

Eletechsup UD85C08 (8DI-8DO). Eight SPDT relays and eight optically isolated
inputs, controlled over a USB serial port.

Sources: the product page
(<https://eletechsup.com/products/ud85c08-8di-8do-industrial-grade-multi-function-usb-relay-board-pc-uart-com-switch-module-with-input-indicator-light-dc-12v-24v>,
captured in `website.md`) and the vendor's *UD85C08 8DI-8DO USB Relay command*
and *Manual* documents from `UD85C08 8DI-8DO USB Relay.rar`. Statements marked
*not documented* or *interpretation* are not covered by those sources.


## 1. Overview

| Item | Value |
|------|-------|
| Outputs | 8 relays, SPDT (COM, NO, NC), each with an indicator LED |
| Inputs | 8, optically isolated, NPN (active low), each with an indicator LED |
| Host interface | USB-B, CH340 USB-UART bridge; appears as a serial port |
| Protocols | ASCII (AT) commands and 8-byte binary commands, detected automatically per command |
| Supply | 12 V DC or 24 V DC, chosen when ordering |
| Dimensions | 115 × 63 × 19 mm |
| Weight | 124 g |


## 2. Electrical characteristics

### 2.1 Supply current (12 V version)

| Relays energized | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
|------------------|---|---|---|---|---|---|---|---|---|
| Supply current (mA) | 12 | 40 | 68 | 96 | 122 | 148 | 174 | 199 | 223 |

Roughly 26 mA per energized relay. Figures for the 24 V version are not
documented.

### 2.2 Relay contacts

| Load | Maximum |
|------|---------|
| AC | 10 A at 250 V or 125 V |
| DC | 10 A at 30 V, 28 V or 12 V |

### 2.3 Inputs

NPN, active low: an input is **active** when it is pulled to the input common,
and the board then reports it as `ON`. Input voltage range, switching
threshold and input current are not documented.


## 3. Terminology

The vendor names relay states after the action rather than after the contact.
This is the opposite of usual contact terminology:

| Vendor term | Coil | Contacts |
|-------------|------|----------|
| **Open** / ON | energized | COM connected to NO, NC open |
| **Close** / OFF | released | COM connected to NC, NO open |

So `Open1` means relay 1 is **energized**.


## 4. Serial interface

| Parameter | Value |
|-----------|-------|
| Baud rate | 9600, fixed |
| Format | 8 data bits, no parity, 1 stop bit (8N1), fixed |
| Flow control | none |

The ASCII and binary protocols share the port and are recognized per command;
there is no mode to switch.


## 5. ASCII (AT) protocol

Commands are ASCII and **must be uppercase**; lowercase commands are ignored.
In the tables, *n* is a channel number 1–8.

### 5.1 Commands

| Command | Function | Reply |
|---------|----------|-------|
| `AT+Rn` | Read the state of relay *n* | `Openn` or `Closen` |
| `AT+On` | Energize relay *n* | `Openn` |
| `AT+Cn` | Release relay *n* | `Closen` |
| `AT+Tn` | Toggle relay *n* | `Openn` or `Closen` ¹ |
| `AT+Ln` | Interlock: energize relay *n*, release all others | `Openn` ¹ |
| `AT+Mn` | Momentary: energize relay *n* for 0.5 s | `Openn` ¹ |
| `AT+Dn=XXXX` | Delay: energize relay *n*, release it after XXXX s | `Openn` ¹ |
| `AT+AO` | Energize all relays | `OpenA` |
| `AT+AC` | Release all relays | `CloseA` |
| `AT+In` | Read input *n* | `ONn` (active) or `OFFn` (inactive) |
| `AT+Gm` | Set the input-to-relay relationship, see 5.3 | `OKm` |

¹ The vendor gives one reply form, `OpenX` / `CloseX` (X = 1–8 or A), for
the whole relay command group. The exact reply to each of these commands is an
interpretation of that.

### 5.2 Command details

**Delay (`AT+Dn=XXXX`).** XXXX is exactly four digits, 0000–9999, in seconds.
A release command (`AT+Cn`) during the delay releases the relay at once. The
delay function exists in the ASCII protocol only.

**Interlock (`AT+Ln`).** Energizes relay *n* and releases every other relay,
so at most one relay is energized.

**Momentary (`AT+Mn`).** Energizes relay *n* and releases it after 0.5 s.

### 5.3 Input-to-relay relationship (`AT+Gm`)

By default each input drives its own relay directly. `AT+Gm` sets this for all
eight channels at once:

| Command | Relationship | Behaviour | Reply |
|---------|--------------|-----------|-------|
| `AT+G0` | Unrelated | Inputs do not drive the relays; they can only be read | `OK0` |
| `AT+G1` | Self-locking (default) | Input *n* toggles relay *n*, as `AT+Tn` ² | `OK1` |
| `AT+G2` | Interlocking | Input *n* energizes relay *n* and releases the others, as `AT+Ln` ² | `OK2` |
| `AT+G3` | Momentary | Relay *n* follows input *n* ² | `OK3` |

Any other value of *m* is ignored, without a reply.

² Interpretation, from the matching relay command names; the vendor gives
the names only.

Whether this setting survives a power cycle is not documented. A host that
relies on it should send it again after every power-up.

### 5.4 Framing

Line terminators are not documented for commands or replies. In practice the
board accepts commands sent without a terminator. Replies may be surrounded by
line breaks, so a host should search the received data for the expected reply
rather than rely on a terminator.

### 5.5 Examples

| Send | Reply | Result |
|------|-------|--------|
| `AT+O1` | `Open1` | Relay 1 energized |
| `AT+R1` | `Open1` | Relay 1 reads as energized |
| `AT+D1=0010` | `Open1` | Relay 1 energized, released after 10 s |
| `AT+L2` | `Open2` | Relay 2 energized, all others released |
| `AT+I1` | `ON1` | Input 1 is active |
| `AT+I2` | `OFF2` | Input 2 is inactive |
| `AT+G0` | `OK0` | Inputs no longer drive the relays |


## 6. Binary (8-byte) protocol

Every command and every reply is one 8-byte frame. There is no delay command
in this protocol.

### 6.1 Frame format

| Byte | 1–2 | 3–5 | 6 | 7 | 8 |
|------|-----|-----|---|---|---|
| Command frame | `55 56` | `00 00 00` | Channel | Command | Checksum |
| Reply frame | `33 3C` | `00 00 00` | Channel | Status | Checksum |

- **Channel:** `01`–`08` for a relay or input, `00` for all relays. For
  command `0A` this byte carries the relationship instead, see 6.2.
- **Checksum:** the low byte of the sum of bytes 1–7. This holds for all 94
  frames the vendor lists.

### 6.2 Commands

| Command | Function | Channel byte | Reply status |
|---------|----------|--------------|--------------|
| `00` | Read relay state | `01`–`08` | `01` or `02` |
| `01` | Energize relay | `01`–`08` | `01` |
| `02` | Release relay | `01`–`08` | `02` |
| `03` | Toggle relay | `01`–`08` | `01` or `02` |
| `04` | Interlock: energize this relay, release all others | `01`–`08` | `01` |
| `05` | Momentary: energize for 0.5 s | `01`–`08` | `01` |
| `07` | Energize all relays | `00` | `01` |
| `08` | Release all relays | `00` | `02` |
| `09` | Read input | `01`–`08` | `81` or `82` |
| `0A` | Set input-to-relay relationship | `00`–`03`, as `AT+G0`–`AT+G3` | not documented |

Command `06` is not used.

### 6.3 Reply status byte

| Status | Meaning |
|--------|---------|
| `01` | Relay energized (COM–NO) |
| `02` | Relay released (COM–NC) |
| `81` | Input active |
| `82` | Input inactive |

### 6.4 Examples

| Function | Command frame | Reply frame |
|----------|---------------|-------------|
| Read relay 1 | `55 56 00 00 00 01 00 AC` | `33 3C 00 00 00 01 01 71` (energized) |
| Energize relay 1 | `55 56 00 00 00 01 01 AD` | `33 3C 00 00 00 01 01 71` |
| Release relay 8 | `55 56 00 00 00 08 02 B5` | `33 3C 00 00 00 08 02 79` |
| Energize all relays | `55 56 00 00 00 00 07 B2` | `33 3C 00 00 00 00 01 70` |
| Release all relays | `55 56 00 00 00 00 08 B3` | `33 3C 00 00 00 00 02 71` |
| Read input 1 | `55 56 00 00 00 01 09 B5` | `33 3C 00 00 00 01 81 F1` (active) |
| Read input 2 | `55 56 00 00 00 02 09 B6` | `33 3C 00 00 00 02 82 F3` (inactive) |
| Inputs unrelated (`G0`) | `55 56 00 00 00 00 0A B5` | not documented |


## 7. Not documented

- Line terminators in the ASCII protocol (see 5.4).
- Reply to the binary relationship command `0A`.
- Whether the input-to-relay relationship is retained after a power cycle.
- Response time, and relay operate and release times.
- Input voltage range, switching threshold and input current.
- Supply current of the 24 V version.
- Behaviour on unknown or malformed commands, other than invalid `AT+Gm` values.


## 8. Errata in the vendor documentation

- The binary command summary table gives the read-status checksums as
  `AB`–`B2`. That is one too low: the vendor's own frame list gives `AC`–`B3`,
  which matches the checksum rule.
- The same table shows the relationship value as a two-byte field (`0x0000`–
  `0x0003`). The frame list puts it in byte 6 alone, which again matches the
  checksum rule.
