Hi everybody
I have bought a Numato Lab 16ch USB relay
Link: Numato 16ch USB relay
The setup should be fairly simple, but I seem to be missing something, so I hope you can help me
Link to relay connections: relay connections
First the basics:
The relay is connected to Raspberry with a USB cable of course
Jumper is set between 1 & 2 (External power) + 5v connected (polarity checked)
It is the model with 24v coil voltage so 24v connected (polarity checked)
On the code side:
I’ve made a module called Relay with a Method called RelayControl
Here the code in RelayControl:
Dim s As New SerialConnection
If s = Nil Then Returns.Baud = Serial.Baud9600
s.Bits = Serial.Bits8
s.Parity = SerialConnection.Parities.None
s.StopBit = SerialConnection.StopBits.One
s.XON = False
s.CTS = False
s.DTR = FalseTry
s.Device = SerialDevice.At(1)
s.Connect
//MessageBox(“The serial connection is open.”)
Catch error As IOException
MessageBox(“The serial connection could Not be opened.”)
Return
End TryDim outString As String = "relay "
Dim nextString As StringSelect Case relayNumber
Case 1
If state Then
nextString = “on 0”
Else
nextString = “off 0”
End If
Case 2
If state Then
nextString = “on 1”
Else
nextString = “off 1”
End If
Case 3
If state Then
nextString = “on 2”
Else
nextString = “off 2”
End If
End Selectdim finalString As String
finalString = outString + nextString
//MessageBox(finalString)
s.Write (finalString)
s.XmitWait
s.Close
Then I made a simple button with the following code to test it:
RelayControl(1, true)
But I get absolutely no response so hope you can help me in the right direction?
Here the documentation: https://numato.com/docs/16-channel-usb-relay-module/
Thanks in advance