https://github.com/charkster/relay_usbtmc
Two relay channels are controlled with an Adafruit QT PY running USBTMC
https://github.com/charkster/relay_usbtmc
qt-py relay-board tinyusb usbtmc
Last synced: 12 months ago
JSON representation
Two relay channels are controlled with an Adafruit QT PY running USBTMC
- Host: GitHub
- URL: https://github.com/charkster/relay_usbtmc
- Owner: charkster
- License: mit
- Created: 2021-12-31T20:15:10.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2023-07-07T03:45:18.000Z (over 2 years ago)
- Last Synced: 2025-01-13T19:26:53.244Z (about 1 year ago)
- Topics: qt-py, relay-board, tinyusb, usbtmc
- Language: C
- Homepage:
- Size: 3.99 MB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# relay_usbtmc
**--> UPDATE: 8 Channel board version added (with same Adafruit QT PY SAMD21) <--**
**Two relay channels** are controlled with an Adafruit QT PY SAMD21 board running **USBTMC**

I bought a five-pack of single channel AC/DC relays which can be controlled with a 3.3V level. I then glued 2 of them together and then glued an Adafruit QT PY microcontroller board to the top. The QT PY's **STEMMA QT** connector is used with a **STEMMA QT** cable to physically connect power, ground and control to the two relays. I modified the **TINYUSB** project's USBTMC device example to control the SDA and SCL pins of the QT PY as GPIOs. The relays are powered and controlled with the USB connection to the QT PY board through the **STEMMA QT** cable. The cool part of this new device is that it is a **USBTMC** device, which can be controlled and queried with simple **SCPI** commands.
**No soldering needed!!** (just hot glue)
Here are the SCPI commands which can be used:
**RELAY1:EN 1** # relay 1 on, blue STEMMA wire
**RELAY1:EN 0** # relay 1 off
**REALY1:EN?** # this query returns the state of RELAY1
**RELAY2:EN 1** # relay 2 on, yellow STEMMA wire
**RELAY2:EN 0** # relay 2 off
**RELAY2:EN?** # this query returns the state of RELAY2
***RST** # set both relays off
***IDN?** # returns valid commands and this URL
Here's my parts list:
https://www.adafruit.com/product/4600
https://www.adafruit.com/product/4210
https://www.amazon.com/Channel-Optocoupler-Isolated-Control-Arduino/dp/B07XGZSYJV
Feel free to test the **UF2** on any **QT PY SAMD21** board, as you can observe the SDA and SCL pins and see that they are controlled by the **SCPI** commands as GPIOs (blue wire is relay 1, yellow wire relay 2, black wire is ground, red wire is 3.3V). When wiring the dual relays, I used two short wires (light blue in picture) to share the PWR and GND with the second relay.
A simpler approach could be to just purchase a USB powered relay which has serial control of the relays. 1, 2 and 4 channel boards are sold on Amazon. I have used these boards and they work just as well as the USBTMC version. The downside is that the operating system determines the COM or TTY device name, and they can not be queried to check their presence or status.
I have used this board from Amazon:
https://www.amazon.com/NOYITO-2-Channel-Module-Control-Intelligent/dp/B081RM7PMY