BV4205 ADC with LM35 Temperature Sensor  
 

Contained within this html page are scripts that will work in conjunction with the VB4221. The BV4221 is a USB to I2C converter so that by connecting the BV4221 to the PC and also to one or more I2C devices, it is possible to control them from this browser document.

There are several documents in the series all of which concentrate on one particular I2C device, the first green and second blue forms are for communicating with the BV4221 and any form or text that follows is for the particular device in question. This text uses BV scripts and so depending on how the browser is configured there may be security warnings. Feel free to view the scripts and use as you like in your own applications.

Because VBScript is used then an IE (Microsoft) compatible browser is required. VBscript can also be made to run stand alone and within Microsoft applications such as Excel and Word. The script in this file should run with little modification.

 
     
  Open COM Port  
  The 'Open Port' button opens the COM port and checks the BV4221 is connected, it will not show an error if the wrong com port is chosen but will indicate if the correct port has been chosen and the BV4221 is connected.
Open COM Port
Com Port Number 1-5:      Port Settings:

   
 
     
  I2C System Commands  
  The next section is common to all I2C BV devices and can be used to interrogate the EEPROM and change the address etc. You will see that address 0 of the EEPROM is the device address.
Common BV, I2C System Functions
<< set device address Firmware version >>
From #Bytes Results
When writing separate hex with comma, e.g. 0a,9,fd,0,3
 From Data
The reset button will just reset but the factory button installs defaults ** Note the address is set back to 0x42 as well.
<< new address EVEN numbers only
 
     

  BV4205 Analogue to Digital Converter  
 

The BV4205 is an I2C two wire compatible integrated circuit with a 10 channel 10 bit A to D converter. The IC works independently of the microcontroller and can acquire analogue signals continuously until required.

The following is a 'working' version of a temperature gauge based on the BV4221, USB to I2C converter, the BV4205 A to D IC and an LM35 temperature IC. By working I mean that all the scripts and software are included in this file.  There are three components and they will be described below in turn along with the circuit diagram.

This is how the physical set up looks, for convenience a bread board has bee used which leans itself to experimentation, it is easy to do 'what if' type experiments and ideal for this illustration.

The newer versions of the BV4221 have a socket that can be used whereby a wire can be directly connected from its socket to the breadboard. The power supply is of course from the USB.

 

 

 

The LM35 has been connected to a bit of wire so that it can be waved around, warmed up and cooled down. it can just as easily be mounted straight on to the breadboard.

The LM35 is a low cost analogue temperature gauge whose output voltage varies with temperature. For every 1 degree C change in temperature gives a 0.1mV change in voltage. In its simplest configuration the voltage begins at 0 for 0 degrees C so that 22 degrees C for example will give 0.22V

They come in several different types for Fahrenheit and Celsius and some others, they normally have differing postfixes the the LM35 but as they are made by various manufactures they all differ. The one that is used for this text is a Celsius type even though the data sheet specified centigrade which is in fact an angular measure.

 

 

 

 

The circuit diagram for the whole set up is shown here and at first the circuit may seem more complex than it needs to be but this is not so. All the capacitors are needed as A to D conversion is notoriously 'jittery' and without all of the above the temperature reading would quite easily swing a whole degree or two for no reason at all. This actually could be handled in software by taking an average, but this approach is to get it right at the source.

How it works

C3,D1 and R2 supply a voltage reference of about 0.56V, this depends on the diode used, R2 limits the current through the diode and also forms part of a smoothing circuit along with C3. The reference voltage needs to be as stable as possible and this circuit seems to do the trick. The reason for such a low reference is because we are only measuring 0.22V for 22 degrees C and we need to get a reasonable count out of this. If higher temperatures were needed then an LED can be used instead of the small signal diode, this will increase the reference voltage to about 2.

The output of the LM35 could be taking straight into the A to D however in practice it was found that noise caused the reading to vary sufficiently to give quite a range of temperatures even when rounding to half a degree so R1 and C4 form a low pass filter which does help considerably. Something to watch is the value of R1, this must not be too big (less then 10k) as it will effect the conversion time.

 
     
  ADC Form with Temperature Reading  
 

Reading Temperature

All 9 channels can be seen here if needed but for now set the reference voltage and make sure that the 'Vref from pin 18' is checked, if you use Auto Scan this will stop the temperature working and so this must be checked 'off'.

 

BV4205 ADC IC 
Start Auto Scan  Vref from pin 18 Voltage >> 0-2
Channel 0        Channel 1        Channel 2  
Channel 3        Channel 4        Channel 5  
Channel 6        Channel 7        Channel 8  
Channel 9  

Channel <<    Temperature Degrees C

 
     
  Trouble Shooting  
 

Trouble Shooting

The Temperature text box should show the room temperature and not vary much. Warming the LM35 up with the fingers should show a marked change. If this is not the case then work through the exercise slowly as follows:

1) Just connect up the BV4221 and nothing else. Now use the green form and open a the port, the text box next to the open port button should say  'BV4221 Connected'. If not the chances are that you have selected the wrong com port. Look at the bottom left of explorer for a yellow shield saying problem on page, or done, click this and it will give you more information.

2) If this is okay connect up the circuit to the BV4221, go to the blue box, set the address and click on the check button. If there is an error here then check that the address matches with the device, if necessary set it back to the factory defaults (see datasheet). Check the connections particularly the SDA and SCL that they are the right way round. There is no need for pull up resistors as these are built into the BV4221.

3) If 1 and 2 are okay check the channel corresponds to the one you are using, make sure that the Vref box is checked and the reference voltage matches the one measured on your circuit. It is sometimes necessary to check on and off Vref in order to get it to use the Vref from pin 18.