Skip to content

Two relay channels are controlled with an Adafruit QT PY running USBTMC

License

Notifications You must be signed in to change notification settings

charkster/relay_usbtmc

Repository files navigation

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

picture

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

About

Two relay channels are controlled with an Adafruit QT PY running USBTMC

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published