K8055 Thermistor project

This thread is just about finished and I have 2 working thermistor circuits so I thought I would sum up.

I hope this thread helps anyone trying something similar, so …

In conclusion…

  1. Mostlyharmless is a very helpful person, and I would buy them a drink if they were here.
  2. Temperature can be captured with either a simple Voltage divider or using an opamp
  3. A temperature reading at normal temperatures certainly works, I have been able to test the circuits from 8degC up to 28DegC and both circuits work fine, and certainly within ±1degC.

Voltage divider v Op amp circuit
The voltage divider is a simple circuit, but you do have to take into account ATT1 (or att2 depending on which analogue input you are using), which gives 100kOhms to ground even when turned to fully open (no resistance). This means that in your calculations the resistance of the balance resistor becomes :-

Total balance resistor Resistance ® = 1/((1/your actual balance resistor)+(1/100))

So for a 3k9Ohm balance resistor

R= 1/((1/3.9)+(1/100))

Which is

R=1/(0.25641+0.01)

Or

R=1/0.26641

Which equals

3.75360924 kOhms Or 3753.60924Ohms

In the software we use the values in Ohms rather than kOhms but the effect is the same

           [b]Dim decBalanceResistorOhms As Integer = 1 / ((1 / 3900) + (1 / 100000))[/b]

If you use the op-amp circuit you don’t need to work this out at all. The op-amp circuit doubles the voltage which reaches the analogue input so more of the 0-255 range of the input is used and although value for the voltage then needs to be halved for the maths to work, the result is a better scale. For example, the voltage divider steps from 23.3C to 23.7 but the op-amp circuit goes 23.3 to 23.5 to 23.7.

Doing the maths…

You need the following values to do the maths.
• The supply voltage, I have powered this project from the positive side of the SK2 or SK3 jumpers. By taking the jumper off then reattaching it over just the powered pin you can use it as a plug by attaching a wire to it (there is a picture of this on the website) for me this is 4.95v but it is whatever the USB supply voltage is.
• The value of the balance resistor, for the op-amp circuit this is the R1 Value and for the Voltage divider you have to work it out taking into account of ATT1 (or ATT2, see above)
• The beta value for your thermistor, which can be found on the datasheet for the thermistor which you can usually get from the supplier’s website
• R infinity for your thermistor which is calculated by

((Resistance in ohms at 25 Deg C) * (e^((minus (the beta value for the thermistor))/ (25 Deg C as Kelvin))

For this project this was
Rinfinit = 10000 * (e^((-3977) / 298.15)) =0.0161056846

First calculate the voltage in at the A1 or A2 pin (these examples are in VB, I use very descriptive variables hope you can understand them)

Dim intValueOfA1 As Integer = ReadAnalogChannel(1)
Dim decVoltageAtA1 As Decimal = (decVoltageSupply * (intValueOfA1)) / 256

If you are using the op-amp circuit then this must be halved so that line becomes :-

Dim decVoltageAtA1 As Decimal = ((decVoltageSupply * (intValueOfA1)) / 256) / 2

Then you can calculate resistance of your thermistor

Dim decResistance As Decimal = (decVoltageSupply * decBalanceResistorOhms) / decVoltageAtA1 - decBalanceResistorOhms

Now that you have a value for your thermistor you can calculate the temperature (in Kelvin)

Dim decTempKelvin As Decimal = intThermistorBetaValue / (System.Math.Log(decResistance / decRinfinit))

To get Celsius you can then

Dim decTempCelsius As Decimal = Math.Round(decTempKelvin - 273.15, 1)

Which will give you deg C to one decimal place.

so it all looks like [quote]
Public Class Form1
Public Declare Function OpenDevice Lib “k8055d.dll” (ByVal CardAddress As Integer) As Integer
Public Declare Sub CloseDevice Lib “k8055d.dll” ()
public Declare Function ReadAnalogChannel Lib “k8055d.dll” (ByVal Channel As Integer) As Integer

Const decRinfinit As Decimal = 0.0161056846
Const decVoltageSupply As Decimal = 4.95
Const intThermistorBetaValue As Integer = 3977 'The beta value of the thermistor

'TIMER 1 IS THE ROUTINE YOU WOULD USE FOR A VOLTAGE DEVIDER CIRCUIT
Private Sub Timer1_Tick(sender As System.Object, e As System.EventArgs) Handles Timer1.Tick

    Dim decBalanceResistorOhms As Integer = 1 / ((1 / 3900) + (1 / 100000)) 'the ohms of the balance resisitor for the voltage divider
    'Read the analog port 0 and convert the value to volts.
    Dim intValueOfA1 As Integer = ReadAnalogChannel(1)
    Dim decVoltageAtA1 As Decimal = (decVoltageSupply * (intValueOfA1)) / 256


    'Calculate the Resistance
    Dim decResistance As Decimal = (decVoltageSupply * decBalanceResistorOhms) / decVoltageAtA1 - decBalanceResistorOhms
    'the next line calculates the temp in Kelvin
    Dim decTempKelvin As Decimal = intThermistorBetaValue / (System.Math.Log(decResistance / decRinfinit))


    'Display temp on Form
    tbxDigitalValue1.Text = intValueOfA1
    tbxVoltage1.Text = decVoltageAtA1
    tbxResistance1.Text = decResistance
    tbxC1.Text = Math.Round(decTempKelvin - 273.15, 1)

End Sub

'TIMER 2 IS THE ROUTINE YOU WOULD USE IF YOUR CIRCUIT WAS USING AN OPAMP
Private Sub Timer2_Tick(sender As System.Object, e As System.EventArgs) Handles Timer2.Tick

    Dim intBalanceResistorOhms As Integer = 3900
    'Read the analog port 0 and convert the value to volts.
    Dim intValueOfA2 As Integer = ReadAnalogChannel(2)
    Dim decVoltageAtA2 As Decimal = ((decVoltageSupply * (intValueOfA2)) / 256) / 2


    'Calculate the Resistance
    'Dim r1a As Decimal = (decVoltageSupply * intBalanceResistorOhms) / decVoltageAtA2
    Dim decResistance As Decimal = (decVoltageSupply * intBalanceResistorOhms) / decVoltageAtA2 - intBalanceResistorOhms
    'the next line calculates the temp in Kelvin
    Dim decTempKelvin As Decimal = intThermistorBetaValue / (System.Math.Log(decResistance / decRinfinit))


    'Display temp on Form
    tbxDigitalValue2.Text = intValueOfA2
    tbxVoltage2.Text = decVoltageAtA2
    tbxResistance2.Text = decResistance
    tbxC2.Text = Math.Round(decTempKelvin - 273.15, 1)

End Sub


Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
    OpenDevice(0)
End Sub

Private Sub Form1_FormClosing(sender As Object, e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
    CloseDevice()
End Sub

End Class[/quote]
And that should be all…

Thank you for all the help…

Chris

I finally found the time to build a permanent circuit for the 10K Thermistor: Here are a few pictures of the process and the result.

This is the final schematics used. Since the board is powered from the 5V on the K8055(N), an MCP6002 works here. If you have another OP-AMP like a 272 at hand, it will work just fine.

Here is the corresponding PCB design and black and white versions of the bottom layer and slikscreen. The images of the bottom layer and silkscreen are to scale for printing. I printed the bottom layer with a laser printer onto high gloss inkjet photo paper and transferred it to blank PCB with a regular iron. This method only works with laser printers. It cannot be done with inkjet printers.

Here are pictures of the PCB after transferring the layout and after etching and drilling.

And the finished project:

Sorry to bump an old post but now stuck, I copied MostlyHarmless (top bloke) circuit on to veroboard and have connected a 10k thermistor but after checking several times I get no change to A1 value regardless of the temp of the thermistor, can anyone give me a simple circuit to connect a 10k thermistor to a K8055N?

I cant use the velleman board as I have to use the supplied thermistor due to where it is being fitted - I need to measure 15c to about 50c

I am using vba in access to control the board as this is what I know (this is not my normal job)

thanks in advance

Dean

Do you have a jumper on SK2?
Have you adjusted RV1?

[quote=“hardyd44”]Sorry to bump an old post but now stuck, I copied MostlyHarmless (top bloke) circuit on to veroboard and have connected a 10k thermistor but after checking several times I get no change to A1 value regardless of the temp of the thermistor, can anyone give me a simple circuit to connect a 10k thermistor to a K8055N?

I cant use the velleman board as I have to use the supplied thermistor due to where it is being fitted - I need to measure 15c to about 50c

I am using vba in access to control the board as this is what I know (this is not my normal job)

thanks in advance

Dean[/quote]

maybe you could post a picture of it so we could have a look?

Chris

Thanks for your replies

No did not have a jumper on skt 2 (using the 5v to power a relay board that works fine), will try on Monday - the board is at work

adjusting RV1 changes the value in the demo program, but no effect on thermistor

I can send photos, someone modified my board whilst I was out, but electrically it is still the same

Will try the jumper on skt 2 on monday and report back

thanks guys

I have put the jumper back on skt 2 - no change

apologies for the poor soldering - not my best work

Front of board

Back of board

is there anyway of testing the opamp?

the connections are as follows:

from the top

Connector 1 (black) - A1 on 8055
Connector 2 (yellow) - 5v on 8055
Connector 3 - N/C
Connector 4 (white) - Gnd on 8055

right hand connector to thermistor

I have tested the thermistor with a multi meter and the resistance changes with a temperature change, I have also tried a different thermistor, no difference

I am getting 5v on between one side of the thermistor and Gnd approx. .5v on the other, these values do not change with temperature

thank you for your help guys

Sussed it,

did not break a track off input 2 - what a wally

2 of us have checked the board against the circuit diagram at 5 times, I have just spotted it - broke the track and now getting a different value when the thermistor is heated/cooled down

so annoyed with myself