Skip to the content
PCBKitNew board
2 layers45.7 × 30 mmHIDRelayController, the printed circuit board in 3D

HIDRelayController

JPEWdev/hid-relay1

Open source design for HID controlled relay

Size
45.7 × 30 mm
Copper layers
2
Thickness
1.6 mm
Parts
19
Nets
33
Pads
96
Tracks, vias
140, 14
Pours
1
Routed
Yes
KiCad
KiCad 6 (file 20211014)
Created
23 Mar 2023
Updated
20 May 2024

Overview

HIDRelayController is an open-source printed circuit board by JPEWdev, from the JPEWdev/hid-relay repository on GitHub, published under the GPL-2.0 licence. It is a 2-layer board of 45.7 × 30 mm with 19 parts on 33 nets, routed with 140 tracks and 14 vias.

It is built around the ATTINY261A-SU, ULN2803A and MBRX120LF. Its parts include 5 resistors, 4 capacitors, 4 connectors, 3 diodes and 2 ICs. It belongs with the home automation and IoT boards and the AVR (ATmega, ATtiny) boards of this library.

Main components

3

README

README.md

hid-relay

Open source design for HID controlled relay

This project provides an Open Source and Open Hardware implementation of the HID Relay board. These boards can be found for purchase from various vendors, and appear as a USB HID device. They can be controlled using either pyhid-usb-relay or usb-relay-hid.

The software aims to be 100% compatible with the board that can be purchased, allowing custom designed boards to be interchanged with the same host side control software (and possibly to even control things other than relays).

The main controller for the relay boards is some sort of Atmel AVR chip. The software uses the V-USB project to implement the USB protocol, and should be able to run on any chip that V-USB supports.

Quick Install

  1. Install avrdude (e.g. sudo apt install avrdude)
  2. Go to the releases page and download the flash.hex, eeprom.hex and fuses.txt files for the device you want to program
  3. Connect your AVR In System Programmer (ISP) to the relay device, and it with the command:
text
avrdude -P <MY_PROGRAMMER> $(cat fuses.txt)
  1. Write the main program code and eeprom to the device by using the command:
text
avrdude -P <MY_PROGRAMMER> -p <MY_DEVICE> \
  -U flash:w:flash.hex:i \
  -U eeprom:w:eeprom.hex:i

Compiling

meson is used as the build configuration system for this project. In order to start compiling, you must first define a meson cross file to tell meson about the board you are targeting. The project comes with cross files for the included hardware designs and other platforms which can be found in the cross/ directory. If you are using a custom hardware design, look at these as a reference for how to define your own board.

Once you have a cross file that describes your board, configure the build with the command:

text
meson setup --cross-file path/to/my_cross.txt build

Once this is complete, the main program can be built with:

text
ninja -C build

Flashing Software

The meson configure for this project contains several convenience commands to help program a board after the software is built. The commands use the avrdude program to interact with the board. By default, meson assumes you are using a USB AVRISP MKII programmer, but this can be changed with the avrdude_programmer and avrdude_port meson options, for example:

text
meson configure build -Davrdude_programmer=buspirate

The helper targets defined in meson are all invoked using the meson compile command, like:

text
meson compile -C build COMMAND

Or with ninja:

text
ninja -C build COMMAND

The included commands are:

CommandDescription
writeflashWrite program and EEPROM memory to the device
writefusesWrite the fuse configuration to the device
readfusesDisplay the current fuse configuration from the device
readeepromDump the current contents of the EEPROM to the file eeprom.hex
readflashDump the current contents flash (program memory) to the file flash.hex
statsShow static memory usage
fuses.txtGenerate fuses.txt file which contains the avrdude arguments to program fuses
hidrelay.asmCreate hidrelay.asm file which contains interleaved disassembly

The writefuses command can be particularly useful to provision a new fresh AVR, as it runs at a slow speed so it can correctly program a device even if it is still running slowly on the internal oscillator (the default from the factory).

Thus, to program your board after compiling, run:

text
# Uncomment this line if this is a fresh chip that has never been programmed before
# ninja -C build writefuses
ninja -C build writeflash

NOTE: Be careful when programming fuses as incorrect fuses can cause the AVR to be unprogrammable, which can only be corrected using High Voltage Serial Programming.

Parts

19
QtyValueFootprintReferences
210uFCapacitor_SMD:C_0603_1608Metric_Pad1.08x0.95mm_HandSolderC1, C4
220pFCapacitor_SMD:C_0603_1608Metric_Pad1.08x0.95mm_HandSolderC2, C3
2240Resistor_SMD:R_0603_1608Metric_Pad0.98x0.95mm_HandSolderR1, R2
268Resistor_SMD:R_0603_1608Metric_Pad0.98x0.95mm_HandSolderR3, R4
2LEDLED_SMD:LED_0603_1608Metric_Pad1.05x0.95mm_HandSolderD2, D3
11.5KResistor_SMD:R_0603_1608Metric_Pad0.98x0.95mm_HandSolderR5
112MHzCrystal:Crystal_SMD_HC49-SD_HandSolderingY1
1ATtiny261A-SPackage_SO:SOIC-20W_7.5x12.8mm_P1.27mmU2
1AVR-ISP-6Connector_PinHeader_2.54mm:PinHeader_2x03_P2.54mm_VerticalJ4
1Conn_01x04_FemaleConnector_PinHeader_2.54mm:PinHeader_1x04_P2.54mm_VerticalJ1
1Conn_01x11_FemaleConnector_PinHeader_2.54mm:PinHeader_1x11_P2.54mm_VerticalJ2
1MBRX120LFDiode_SMD:D_SOD-123D1
1ULN2803APackage_SO:SOIC-18W_7.5x11.6mm_P1.27mmU3
1USB_B_MicroConnector_USB:USB_Micro-B_Wuerth_629105150521J3

Questions

How big is the HIDRelayController PCB?

It measures 45.7 × 30 mm and has 2 copper layers, 1.6 mm thick.

What parts does the HIDRelayController use?

19 parts, built around the ATTINY261A-SU, ULN2803A and MBRX120LF. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.

Where can I download the HIDRelayController KiCad files?

From the JPEWdev/hid-relay repository on GitHub, at the commit this page was made from: the board is Hardware/HIDRelayController/HIDRelayController.kicad_pcb and its schematic Hardware/HIDRelayController/HIDRelayController.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the HIDRelayController design in my own project?

Its repository publishes it under the GPL-2.0 licence: you may reuse it on that licence's terms (keep the author's notice, and for a copyleft licence share your changes alike).

Similar boards

  • 2 layers48.7 × 44.9 mmEsp32-crystal ball, the printed circuit board in 3D

    Esp32-crystal ball

    atomic14/esp32-crystal-balls

    This PCB is now supporting two of my projects: Crystal Balls and my Flame Lamp.

    54 parts10
  • 2 layersLM80C R6, the printed circuit board in 3D

    LM80C R6

    leomil72/LM80C

    A Z80-based homebrew computer withTMS9918, AY-3-8910, Z80 CTC, Z80 PIO, and Z80 SIO

    153 parts123GPL-3.0
  • 2 layers128.6 × 81 mmAfterglow, the printed circuit board in 3D

    Afterglow

    bitfieldlabs/afterglow

    Pinball retro afterglow

    203 parts32
  • 4 layers132 × 84.5 mmHamodule, the printed circuit board in 3D

    Hamodule

    crgarcia12/electronics-homeassistant-lightscontroll

    A smart lighting controller PCB that integrates seamlessly with ESPHome and Home Assistant while maintaining full compatibility with traditional mechanical switches.

    207 parts28
  • 2 layers73 × 113 mmFT817 buddy v4, the printed circuit board in 3D

    FT817 buddy v4

    g7uhn/ft817_buddy

    A companion display & controls for the FT-817

    76 parts28CC-BY-SA-4.0
  • 2 layers28 × 36 mmBlisplay driver, the printed circuit board in 3D

    Blisplay driver

    hzeller/blisplay

    A tactile display for the blind.

    17 parts21