BV4626

Bv4626-angle-thumb.gif

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.

Raspberry Pi

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:

dmesg

RPi and I2C

Below is a small demonstration written in python, the full instructions are in the simple.py file, do the following:

wget http://www.byvac.com/downloads/py/easyi2c.py
wget http://www.byvac.com/downloads/BV4626/py/simple.py

python simple.py

Software

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.

Notes

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.

Circuit Diagram

Click to enlarge

How to Upgrade the Firmware

This version differs from V13 only in working with RPi I2C

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.

Step 1

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:
byvacbl.exe
bv4626_V11.hex (or later release)
loadV11.cmd

Step 2

Plug the BV4626 into the USB and make a note of its COM port, say port 4 for this example.

Step 3

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.

Step 4

Double click on loadV11.cmd and a black box should appear with a progression of dots similar to: Bv4626 upgrade.jpg
The box will disappear when the upgrade is completed.

Problems

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.

FAQ

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
Bv4626 lm35.jpg
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.

2) Software
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.