BV4111

New Project: wifi - relay

This is a serial relay controller that uses the SV3 protocol. It can control up to 8 relays with either high on or low on. The output is either instant or timed from 1mS to 48 days.

Typical Relays:

[*] This code will work with Windows (providing python and pyserial is installed) and Unix. The only difference is the port selected in the initialisation function. This will also work on the Raspberry Pi.

 

Python

There is some demonstration code for this device written in Python. It will work on both Linux and Windows providing python and pyserial is installed. The code has been updated for firmware version 1.5 and so some parts will not work for previous versions. This is manly the discovery part that uses the new 'H' command.

Windows

Download and extract the zip files above. Place the extracted files in the same directory and open a command window, called a terminal in Linux. Connect the BV4111 to as serial device, BV101, BV104 or similar.
In the command window type

>>>python bv4111_demo.py COM2

This assumes that the serial device is COM2, the first two relays will click on and off.

Raspberry Pi

The device is connected to the RPi as follows:
Bv4111 pi connect.jpg
The serial interface is connected to the BV4111 as shown with TX and RX crossed over. The BV4111 can operate from 3.3V and should do so in this case. The relays should be supplied from 5V, the Pi's 5V line may be able to supply this depending on how many relays are involved, although if the supply is directly from the USB then it should be able to handle it. The important point is that the BV4111 itself should be powered from the 3.3V supply.

*Important* Make sure the RPi is ready to accept serial information on those pins, this is described in the Connecting to Serial Devices guide

Software
The easiest way to get the code is to use wget on the Pi, do the following after connecting the BV4111 to the RPi

wget http://www.byvac.com/download/py/bv4111/sv3clV2_2.py
wget http://www.byvac.com/download/py/bv4111/BV4111.py
wget http://www.byvac.com/download/py/bv4111/bv4111_demo.py
python bv4111_demo.py "/dev/ttyAMA0"

Any problems see the Troubleshooting Guide on the RPi page.

History

Release 1.5 As from 24 July 2013, this uses the updated SV3 version 2.2 that incorporates the following differences:

  • Command 1 and 2 have been removed
  • There is a new H command
  • The Baud rate is no longer Automatic but fixed (user changeable) at 115200

September 2013 There is also a twin relays board BV4601

Release 1.6 February 2014

  • Added command 'i' that returns the relay status
  • Command 'o' used to return 8 ACK, it now only returns 1 ACK
  • Updated data sheet