This is a general purpose input / output board that has three interface options. A USB option that presents itself as a COM port. A serial interface using escape commands and an I2C interface. All three interfaces can control the various I/O devices.
- Data Sheet
- User Guide
- Zip file containing VB Demo (may be a bit old now)
- How to upgrade firmware
Further information on interfacing with the RPI
The BV4626 can be operated from a serial, I2C or USB interface. As this device operated from 5V, the I2C and serial interfaces are not suitable for the RPi without some form of level translation. However the USB option will work with a simple Python program or even sending information directly to the device driver.
There is no setting up involved, simply plug the device into the RPi USB and because it uses and FTDI chip is is detected as the next serial port, this will more than likely be ttyUSB0, this can be verified with dmesg:
By way of a simple demonstration of how to potentially use this device, the following software below is available. There is a BV4626.py class that will make it easier to interface with the device. This has been updated (February 2013)
wget http://www.byvac.com/download/py/bv4626/BV4626.py wget http://www.byvac.com/download/py/bv4626/demo.py
BV4626 is a class that is used by demo.py, so download them both into a suitable directory and type the following:
python demo.py '/dev/ttyUSB0'
Windows users type:
python demo.py 'COM3'
The actual COM port may need adjusting to suit your system. All being well the device ID and firmware should be displayed and the relays should click. This is now a suitable software platform for other projects.
It is also possible to use the I2C interface instead of the USB, if you write any software for this please let me know via the Contact page.
For this to work properly the python serial will need installing:
sudo apt-get install python-serial
The initialisation routine expects that to be the first bytes sent to the device and so can only be used once. It may be better to fix the Baud rate and ACK character then there will be no need for the initialisation routine.
Click to enlarge
This document covers the procedure for upgrading or reloading the firmware onto the BV4626 via USB. The BV4626 has been designed to be upgradable by the use of a special boot loader which is activated on reset. The bootloader program will reset the device and upload the existing or new firmware as required.
This will only work on the Windows operating system
This also applies to putting back the existing firmware for whatever reason and also it may need re programming if some settings are causing trouble, an incorrect Baud rate for example. Putting the firmware back will establish the factory reset condition. Use this as a last resort as the described situation is very unlikely.
Unzip the [Upgrade zip] file. This may be an updated version so if you have done this before then do it again to get the new files. Place the contents of the zip file into a temporary folder, say c:\temp for example.
There should be the following files:
bv4626_V11.hex (or later release)
Plug the BV4626 into the USB and make a note of its COM port, say port 4 for this example.
Edit the file "loadV11.cmd". This is just a text file and so note pad will do. It has one line in it:
byvacbl 4 115200 bv4626_v11.hex
The '4' is the com port which must be changed to suit your system. The other items will be fine (assuming upgrade to release 11) provided the above 3 files are in the same directory. Save the file.
If the box briefly appears and then disappears check the following:
- Is the COM port already in use, have you opened it to check the number in BV-COMM and forgot to disconnect (red icon)?
- Check that the device is working okay and on that COM port
- Are the 3 files present in the same directory as the loadV11.cmd file?
- Have you saved the loadV11.cmd file after editing.
The BV4626 is a multi-i/o board with several interfaces.
A to D
Getting consistent results form an AD convertor is not as easy as first thought. The main problem is that when a reading is taken it is taken at a very brief point in time. If the input is fluctuating even a small amount then the results will be inconstant. Another factor is the power supply, if this is fluctuating then because the reference is taken from that, it will also effect the results.
The BV4626 has a small amount of smoothing when powered from the USB and so this effect should be small but non-the less present. The inconstant results should be tackled in two ways:
1) Using hardware
In the above sketch an LM35 is used which is a low cost analogue temperature device. The power input to this device should be smoothed as much as possible by using a low pass filter as shown. The resistor value should be as high as possible but still give the required voltage to the LM35 and the capacitor should also be as high value as possible.
The output from the LM35 is also fed through a low pass filter and here the consideration when choosing values is the time it will take for a reading to be obtained. The larger the values of resistor and capacitor the longer it will take to get a new reading, smaller values will give inconsistent results. In all circumstances the resistor should not exceed 10k which is the maximum input resistance for the ADC.
The LM35 will take a second or so to respond to any temperature changes so these values can be quite generous, start with a 4k7 resistor and a 10uF capacitor.
Always take more than one reading and average the values out over a number of readings. The best way to do this is to keep a running average but the simplest way is to take say 10 readings and then divide by 10. Even after doing all of this the results will still fluctuate but hopefully within acceptable limits.