Learn how to get Free YouTube subscribers, views and likes
Get Free YouTube Subscribers, Views and Likes

Bluetooth Relay connect to PC Command Line IoT Smart Home 5V/12V Single-Channel Bluetooth

Follow
mikeatyouttube

I bought a 5V/12V SingleChannel Bluetooth Relay Module APP Switch IoT and operated it from a Windows 10 PC. I also bought a Baseus Dongle Adaptor for Bluetooth

There is very little info on how to get these devices to connect, especially via a PC. As usual, once you know, it's quite easy.

After paring and connecting, the PowerShell code I used to operate the relay was:
To turn ON: (your COM port number might be different)

This file is called BTon.ps1
[Byte[]] $On = 0xA0,0x01,0x01,0xA2
$port = newObject System.IO.Ports.SerialPort COM8,9600,None,8,one
$port.Open()
$port.Write($On, 0, $On.count)
$port.Close()

I called the PowerShell (.ps1) code from a command line CMD command window:
powershell ExecutionPolicy Bypass File .\BTon.ps1

Turning the relay OFF use
[Byte[]] $Off = 0xA0,0x01,0x00,0xA1
$port.Open()
$port.Write($Off, 0, $Off.count)
$port.Close()

posted by faussetx4