Friday, July 25, 2014

Designing a Brew Chamber Controller (Update 2)

I'll be researching parts, mostly electric relays, to use for turning the freezer and heating device on and off.  I'll need to find parts that will handle the current load requirements.

See you then.


Friday, July 18, 2014

Designing a Brew Chamber Controller (Update 1)

I've added some code to check the last time the cooler shut off.  This will stop the cooler from cycling which is not good for the compressor.

Don't forget to add TIME_LAST_COOLER and COOLER_TIME to the global variable section near the top of bcc.py

Then replace the cooler function with the code below.

Again, the complete updated code is available on github - https://github.com/cyberlord8/bcc

TIME_LAST_COOLER = 0 #variable to track when cooler was last turned off
COOLER_TIME = 5 * 60 #5 minutes * 60 seconds
#cooler control function
def cooler_control(current_temperature):
    global COOLER_ON, DESIRED_TEMP, DWELL, TIME_LAST_COOLER, COOLER_TIME
    if current_temperature > DESIRED_TEMP + DWELL:
      if time.time() - TIME_LAST_COOLER > COOLER_TIME:#has it been more than 5 minutes?
        if not COOLER_ON:
          COOLER_ON = True
          print "Turning cooler on\n\n"
          GPIO.output("P9_23",GPIO.HIGH)
      else: print "Cooler can't turn on yet", 300 - (time.time() - TIME_LAST_COOLER),"seconds left\n\n"
    elif COOLER_ON:
      COOLER_ON = False
      print "Turning cooler off\n\n"
      GPIO.output("P9_23",GPIO.LOW)
      TIME_LAST_COOLER = time.time()#reset cooler timer
    return

Sunday, July 13, 2014

Designing a Brew Chamber Controller (Part 6)

In the previous post we created some python code based on some formulae to determine temperature from a thermistors internal resistance.

We are now going to paste that code into a file on the BBB so we can run it.

First we need to connect our BBBs client USB port to our computer.

After a minute or so we can now use PuTTY SSH client to log into the BBB.

We'll be using nano text editor on the BBB as it displays a menu at the bottom so we know the editor commands and also has a nice colorful display that highlights different parts of our code.  It doesn't do any syntax checking however, so we will look at using an Integrated Development Environment (IDE) later that will check our code as we write it and also provide a way to run and debug our code.

At the BBB SSH prompt type:

nano bcc_test.py

Now copy the code from the previous post (or from your notepad session) and in the PuTTY client terminal right click with your mouse to paste the code into nano.

Press CTRL-X to exit nano and press Y <enter> to save your file.

From the BBB SSH command prompt type:

python bbc_test.py

After a second you should see something similar to the following:

adcValue:  0.922  | res_therm:  47613.8813  | temp_kelvin:  299.2657  | temp_celsius:  26.1157  | temp_fahren:  79.0083

If the output is a lot different or your temperature reading doesn't correlate to your room temperature then check your thermistor voltage divider network.

If all looks OK, it's time to start designing our brew chamber controller program.

We'll be addressing the core essential specifications in this post:
  • Monitor ambient brew chamber air temperature
  • Turn on heating if needed
  • Turn on cooling if needed
Hopefully you have the following items:
  1. Beaglebone Black (BBB) with Adafruit BBB IO library installed
  2. Breadboard populated with the required components (see Part 3 and Part 4)
  3. Micro USB cable (came with BBB)
  4. Computer or laptop with PuTTY Client.
The goals of this experiment are to create a python script that accomplishes the following:
  1. Setup Program
    • Import libraries
    • Initialize global variables
    • Initialize constants
    • Initialize GPIO and ADC pins
    • Perform self test
  2. Main Program Loop
    • Call Calculate Temperature function
    • Call the heating function and pass the current temperature
    • Call the cooling function and pass the current temperature
  3. Calculate Temperature
    • Read AIN0 voltage (monitor ambient temperature)
    • Calculate thermistor resistance
    • Calculate thermistor temperature
    • Return current temperature
  4. Heating Function (current temperature)
    • Turn on the Red LED if the temperature is less than a certain level
    • Turn off the Red LED if the temperature is greater than a certain level
  5. Cooling Function (current temperature)
    • Turn on the Green LED if the temperature is greater than a certain level
    • Turn off the Green LED if the temperature is less than a certain level
These are the core requirements to make the BBB function as a temperature controller that you could use to control any device that needed heating and or cooling. You could control your house heating/cooling (with added code you could adjust desired temperature based on time of day etc) or a chicken egg incubator.

So let's start with section 1, setting up the program.

#############################################################################
#!/usr/bin/python
#import the libraries we will use in our program
import Adafruit_BBIO.ADC as ADC

import Adafruit_BBIO.GPIO as GPIO
import time
import math


#set Celsius to kelvin constant
c2kelvin = 273.15


#set the variables we'll use in our calculations

#global variables used when reading AIN0
r_bias = 50000 #resistor value used in the thermistor voltage divider
VDD_ADC = 1.8 #voltage divider input voltage

AIN_MIN = .7 #minimum voltage used during self test - will adjust as needed
AIN_MAX = 1.3 #maximum voltage used during self test - will adjust as needed


#thermistor constants used in polynomial equation
T_a = 7.602330993E-4
T_b = 2.313331379E-4
T_c = 7.172007260E-8


#setup the BBB IO pins
ADC.setup() #setup ADC pins

GPIO.setup("P9_15", GPIO.OUT) #setup pin P9_48 as output pin HEATER
GPIO.setup("P9_23", GPIO.OUT) #setup pin P9_49 as output pin COOLER
 

#self test function to check AIN0 voltage is w/in normal range and GPIO pins/LEDs are working
#we use a function so we can call this code at a later time if we want
def self_test():
  print "Performing self tests"
  time.sleep(1) #sleep for 1 second to slow down test sequence - remove if desired
  #turn on heater LED
  print "Turning on RED LED"
  GPIO.output("P9_15",GPIO.HIGH)
  time.sleep(1)
  print "Turning off RED LED"
  GPIO.output("P9_15",GPIO.LOW)
  time.sleep(1)
  print "Turning on GREEN LED"
  GPIO.output("P9_23",GPIO.HIGH)
  time.sleep(1)
  print "Turning off GREEN LED"
  GPIO.output("P9_23",GPIO.LOW)
  time.sleep(1)

  adcValue = ADC.read("AIN0") * VDD_ADC
  if adcValue > AIN_MIN and adcValue < AIN_MAX: print "adcValue OK: ", adcValue
  time.sleep(1)
  print "Test complete"
  time.sleep(1)
  return


self_test()
##############################################################################

Copy and past the above code into a file on the BBB.

nano bbc.py
<copy><paste>
CTRL-X
y
<enter>

Now let's turn this file into an executable so we don't have to keep calling the python interperter.

chmod +x bbc.py

Now we should be able to run the program by typing:

./bbc.py <enter>

The output should be similar to the following:

root@beaglebone:~# ./bbc.py
Performing self tests
Turning on RED LED
Turning off RED LED
Turning on GREEN LED
Turning off GREEN LED
adcValue OK:  0.941000032425
Test complete
root@beaglebone:~#

Now we'll start to work on the section 2, the Main Program Loop.

##############################################################################
while True:
    #call the calculate temperature function and assign the results to current temperature
    current_temperature = calculate_temperature()

    #call the heater function and pass the current temperature
    heater_control(current_temperature)

    #call the cooler function and pass the current temperature
    cooler_control(current_temperature)

    time.sleep(5) #sleep for 5 seconds and repeat while True loop
##############################################################################

So now we have the beginning of the main program loop but we still need to define the calculate_temperature, heater_control, and cooler_control functions.

#############################################################################
#calculate temperature function
def calculate_temperature()
    #define global variables
    #make sure to add USE_CELSIUS to the global variables section at the top of the file
    global VDD_ADC, res_therm, c2kelvin, T_a, T_b, T_c, USE_CELSIUS

    #read AIN0 pin and calculate voltage 
    Vout = ADC.read("AIN0") * VDD_ADC

    #calculate thermistor resistance R1
    res_therm = r_bias * (Vin-Vout)/Vout

    #calculate temperatures
    temp_kelvin = 1/(T_a + T_b * math.log(res_therm) + T_c * pow(math.log(res_therm),3))
    temp_celsius = temp_kelvin - c2kelvin
    temp_fahren = (temp_celsius * 9/5) + 32

    if USE_CELSIUS: return temp_celsius
    else: return temp_fahren

############################################################################

############################################################################
def heater_control(current_temperature):
    global HEATER_ON, DESIRED_TEMP, DWELL
    if current_temperature < DESIRED_TEMP - DWELL:
      if not HEATER_ON:
        HEATER_ON = True
        print "Turning heater on\n\n"
        GPIO.output("P9_15",GPIO.HIGH)
    elif HEATER_ON:
      HEATER_ON = False
      print "Turning heater off\n\n"
      GPIO.output("P9_15",GPIO.LOW)

    return
############################################################################

############################################################################
def cooler_control(current_temperature):
    global COOLER_ON, DESIRED_TEMP, DWELL
    if current_temperature > DESIRED_TEMP + DWELL:
      if not COOLER_ON:
        COOLER_ON = True
        print "Turning cooler on\n\n"
        GPIO.output("P9_23",GPIO.HIGH)
    elif COOLER_ON:
      COOLER_ON = False
      print "Turning cooler off\n\n"
      GPIO.output("P9_23",GPIO.LOW)

    return
############################################################################

We now have a rudimentary functioning temperature controller.  In case you had trouble piecing the code together, here is the complete code to copy/paste.  Also this code is written so beginners can follow along and could do with some variable reduction and other optimization.

In future sessions we'll work on selecting and automating the temperature control for different beers and wines.

############################################################################
#!/usr/bin/python
#import the libraries we will use in our program
import Adafruit_BBIO.ADC as ADC
import Adafruit_BBIO.GPIO as GPIO
import time
import math

#set Celsius to kelvin constant
c2kelvin = 273.15

#set the variables we'll use in our calculations
#global variables used when reading AIN0
R_BIAS = 52000 #resistor value used in the thermistor voltage divider - actual measurement w/ ohm meter
VDD_ADC = 1.8 #voltage divider input voltage
AIN_MIN = .7 #minimum voltage used during self test - will adjust as needed
AIN_MAX = 1.3 #maximum voltage used during self test - will adjust as needed

#other global variables
USE_CELSIUS = 0 #set to 0 to use Fahrenheit
HEATER_ON = 0 #initialize HEATER_ON to False
COOLER_ON = 0 #initialize COOLER_ON to false
DESIRED_TEMP = 78 #set initial desired temp
DWELL = 2 #set initial dwell temp range

#thermistor constants used in polynomial equation
T_a = 7.602330993E-4
T_b = 2.313331379E-4
T_c = 7.172007260E-8

#setup the BBB IO pins
ADC.setup() #setup ADC pins
GPIO.setup("P9_15", GPIO.OUT) #setup pin P9_48 as output pin HEATER
GPIO.setup("P9_23", GPIO.OUT) #setup pin P9_49 as output pin COOLER

#self test function to check AIN0 voltage is w/in normal range and GPIO pins/LEDs are working
#we use a function so we can call this code at a later time if we want
def self_test():
  print "Performing self tests"
  time.sleep(1) #sleep for 1 second to slow down test sequence - remove if desired
  #turn on heater LED
  print "Turning on RED LED"
  GPIO.output("P9_15",GPIO.HIGH)
  time.sleep(1)
  print "Turning off RED LED"
  GPIO.output("P9_15",GPIO.LOW)
  time.sleep(1)
  print "Turning on GREEN LED"
  GPIO.output("P9_23",GPIO.HIGH)
  time.sleep(1)
  print "Turning off GREEN LED"
  GPIO.output("P9_23",GPIO.LOW)
  time.sleep(1)

  adcValue = ADC.read("AIN0") * VDD_ADC

  if adcValue > AIN_MIN and adcValue < AIN_MAX: print "adcValue OK: ", adcValue

  time.sleep(1)
  print "Test complete\n\n"
  time.sleep(1)
  return

#calculate temperature function
def calculate_temperature():
    #define global variables
    global VDD_ADC, R_BIAS, c2kelvin, T_a, T_b, T_c, USE_CELSIUS

    #read AIN0 pin and calculate voltage
    Vout = ADC.read("AIN0") * VDD_ADC

    #calculate thermistor resistance R1
    res_therm = R_BIAS * (VDD_ADC - Vout) / Vout

    #calculate temperature in kelvin
    temp_kelvin = 1/(T_a + T_b * math.log(res_therm) + T_c * pow(math.log(res_therm),3))
    temp_celsius = temp_kelvin - c2kelvin
    temp_fahren = (temp_celsius * 9/5) + 32

    if USE_CELSIUS: return temp_celsius
    else: return temp_fahren

def heater_control(current_temperature):
    global HEATER_ON, DESIRED_TEMP, DWELL
    if current_temperature < DESIRED_TEMP - DWELL:
      if not HEATER_ON:
        HEATER_ON = True
        print "Turning heater on\n\n"
        GPIO.output("P9_15",GPIO.HIGH)
    elif HEATER_ON:
      HEATER_ON = False
      print "Turning heater off\n\n"
      GPIO.output("P9_15",GPIO.LOW)
    return

def cooler_control(current_temperature):
    global COOLER_ON, DESIRED_TEMP, DWELL
    if current_temperature > DESIRED_TEMP + DWELL:
      if not COOLER_ON:
        COOLER_ON = True
        print "Turning cooler on\n\n"
        GPIO.output("P9_23",GPIO.HIGH)
    elif COOLER_ON:
      COOLER_ON = False
      print "Turning cooler off\n\n"
      GPIO.output("P9_23",GPIO.LOW)
    return

self_test()

while True:

    #call the calculate temperature function and assign the results to current temperature
    current_temperature = calculate_temperature()

    print "Current temperature:",round(current_temperature,1)

    #call the heater function and pass the current temperature
    heater_control(current_temperature)

    #call the cooler function and pass the current temperature
    cooler_control(current_temperature)

    time.sleep(5) #sleep for 5 seconds and repeat while True loop


############################################################################

Click designing-brew-chamber-controller-part-7.html for the next part in the series.



Designing a Brew Chamber Controller (Part 5)

In the previous sessions we established our Brew Chamber Controller specifications, built a mockup of the device, and tested it.  Now it's time to design the software to control it.

The first thing we need to do is figure out how to calculate our unknown value, temperature.

In order to calculate the temperature we first need to determine the resistance of the thermistor.  Once we determine the resistance of the thermistor we can use a formula to calculate the temperature.

But the problem is we can't directly measure resistance with the BBB IO pins, we can only measure voltage.  But knowing the input voltage, output voltage, and one resistance value in a voltage divider circuit we can calculate the missing resistance. The formula to calculate the unknown resistance in a voltage divider network is:

      R1 = R2*(Vin-Vout)/Vout
 
Where we are solving for R1, the thermistor resistance, R2 is the known resistance of the resistor in our divider network, and Vin and Vout are the input and output voltages.

Now that we know how to calculate the resistance of the thermistor we need to calculate the corresponding temperature.

The function of a thermistor's resistance over temperature is not linear, in other words the resistance is much greater at one end of the temperature range than the other.  This forms an exponential curve.

The formula to calculate temperature from a thermistors resistance is:

    T = 1 / (a + b * (ln R) + c * (ln R)^3)

Where T is in degrees kelvin, R is the resistance of the thermistor and a, b, and c are values obtained from the thermistor datasheet.

For my 503 thermistor the values are:

    ‘Grade 1’, 50KΩ (1H503 parts)
    a = 7.602330993 X 10-4
    b = 2.313331379 X 10-4
    c = 7.172007260 X 10-8

OK, so now we know how to calculate the temperature in kelvin, we need to convert it to units that we relate to more, Celsius and Fahrenheit.

    Celsius = kelvin - 273.15

and

    Fahrenheit = (9/5) * Celsius + 32


And finally all the formulae together:

    R1 = R2*(Vin-Vout)/Vout
    T = 1 / (a + b * (ln R) + c * (ln R)^3)
    Celsius = kelvin - 273.15
    Fahrenheit = (9/5) * Celsius + 32

So the first thing we need to do is figure out what our known variables are:
  • We know the ADC power rail on the BBB is 1.8 volts, so we know that Vin will be 1.8 volts
  • We know the resistor in our divider network needs to match the thermistor so we choose 50k ohm
  • We don't know right off what Vout is, but we read that from the BBB ADC AIN0 pin
  • We know a, b, and c for use in our polynomial equation to calculate temperature in kelvin
  • We know how to convert kelvin to Celsius
  • We know how to convert Celsius to Fahrenheit
So let's write some python code to do all these calculations.

Open notepad on your computer and type copy/paste the following:


#!/usr/bin/python
#import the libraries we will use in our program
import Adafruit_BBIO.ADC as ADC
import time
import math


#set celsius to kelvin constant
c2kelvin = 273.15


#set the variables we'll use in our calculations
r_bias = 50000 #resistor value used in the thermistor voltage divider
VDD_ADC = 1.8 #voltage divider input voltage


#thermistor constants used in polynomial equation
T_a = 7.602330993E-4
T_b = 2.313331379E-4
T_c = 7.172007260E-8


#setup the BBB IO pins
ADC.setup() #setup ADC pins


#read the voltage on pin AIN0 and store it in variable adcValue 
#the ADC AIN pins read a value from 0 to 1, in other words they read the voltage level
#as a percentage of the ADC voltage rail (1.8V) so we need to convert the percentage
#value to an actual voltage by multiplying the percent with the ADC rail voltage
adcValue = ADC.read("AIN0") * VDD_ADC

#now calculate the thermistor resistance
res_therm = r_bias*(VDD_ADC-adcValue)/adcValue

#now calculate the corresponding temperature in kelvin
#you will notice the formula looks different because we need to use python syntax
temp_kelvin = 1/(T_a + T_b * math.log(res_therm) + T_c * pow(math.log(res_therm),3))

#now convert kelvin to Celsius

temp_celsius = temp_kelvin - c2kelvin

#and also convert to Fahrenheit
temp_fahren = (temp_celsius * 9/5) + 32

#now let's display the results
#make sure this next part is all on one line
print "adcValue: ", round(adcValue,4)," | res_therm: ", round(res_therm,4)," | temp_kelvin: ",round(temp_kelvin,4)," | temp_celsius: ",round(temp_celsius,4)," | temp_fahren: ",round(temp_fahren,4)

In the next session we'll paste this code into a file one the BBB so we can run it.

See you then.

Saturday, July 12, 2014

Designing a Brew Chamber Controller (Part 4)

In this post we'll be testing out the breadboard we built in the previous post.

For this session you will need the following items:
  1. Beaglebone Black (BBB)
  2. Laptop, netbook, or computer
  3. Micro USB cable for the BBB
  4. breadboard populated with components (see previous post)
  5. SSH client like PuTTY installed on the computer
Before we actually hook things up to the BBB and power it on let's look closer at the expansion headers.

Image from BBB System Reference Manual

As you can see there are two expansion headers labeled P8 and P9.  The pins we're interested in for this experiment are the GPIO_XX pins (light blue), the AINX pins (purple), the VDD_ADC pin (P9-32) and the GNDA_ADC pin (P9-34) (red).  For now we'll need to choose two of the GPIO pins to drive the red and green LEDs and one of the ADC pins to read the voltage from our thermistor voltage divider network.  We'll also need to use one of the DGND pins to provide gound to our breadboard ground rail so the LEDS have a complete circuit.

Let's choose GPIO_48 (pin P9_15) for the Red LED and GPIO_49 (pin P9_23) for the Green LED.  Take the red jumper wire and connect it to P9_15 and take the green jumper wire and plug it into P9_23.

We'll choose AIN0 (pin P9_39) to read the thermistor voltage divider so plug the yellow wire from the center of the voltage divider into P9_39.

Take the black wire from the resistor side on the voltage divider and plug it into P9_32 to provide 1.8V to one side of the voltage divider.

Take the red wire from the thermistor side of the voltage divider and plug it into P9_34 to provide ground to the other side of the voltage divider.

Finally take a black wire and connect the ground rail on the breadboard to pin P9_1.

This completes the breadboard to BBB interface and the wires should look similar to this:

BIG NOTE HERE - Swap the red and black wires on the breadboard at the thermistor, they are backwards!!!

Breadboard to BBB Interface

Before we apply power to the BBB we need to understand something critical with how the BBB operates.  It is VERY important to not apply any voltage to the expansion headers until the BBB has been powered on.  In our case we're using voltages supplied by the BBB itself, but if any project you are building uses power from an external source you have to make sure the BBB is powered on and the SYS_RESET signal goes HIGH.  If you apply voltage to the expansion header I/O pins before this happens you will damage the processor.

Since we're using voltages provided by the BBB itself we do not need to worry about this warning.

All GPIO pins operate at 3.3 volts maximum and the ADC pins operate on 1.8 volts maximum.  If you are using external power sources for your project make sure the voltages provided to the BBB IO pins do not exceed these levels.

Again, since we're using voltages provided by the BBB we will be within the voltage tolerance range.

Take the mini USB cable that came with the BBB and connect the mini plug into the BBB's mini USB client port located on the underside of the BBB next to the Ethernet connection.

Here is what it should look like:

Mini USB Client Cable

The other end of the USB cable connects to a USB port on your computer.  Once connected power is applied to the BBB and blue LEDs start to light up and flash.

We now need to start our SSH client (PuTTY) on the computer.




The default IP of the BBB is 192.168.7.2 so we enter that into the Host Name field.  In the Saved Sessions field type in Beaglebone Local and click the Save button. This saves the session so we don't have to enter the IP address every time we start PuTTY.

Now click on the Open button to connect to the BBB via SSH.

The first time you connect to the BBB you will get a warning about certificates and such.  Just click Yes to accept the BBB certificates.

Once the login prompt appears type 'root' (no quotes) and hit enter.  The default password for the BBB is blank so just hit enter again to continue.

The PuTTY SSH screen should look like this:



Now we need to do some quick tests to make sure we have all the components and jumper wires installed correctly.

To access the expansion header pins from the SSH client we need to change directories.

Type the following:

cd /sys/class/gpio <enter>

You should now be in the gpio directory where we will be performing our tests.

type:

ls <enter>

This will list all the contents of the gpio directory.

To tell the BBB that we want to use certain pins we need to initiate them.

Since we're using GPIO pins 48 and 49 to drive the LEDs we need to type:

echo 48 > export <enter>
echo 49 > export <enter>

now type:

ls <enter>

You should see some new directories that have been created, gpio48 and gpio49.

We need to enter these directories one at a time and perform some more typing.

Type:

cd gpio48 <enter>

Type:

ls <enter>

Your PuTTY terminal should now look like this:



Now we need to tell the BBB that we want pin 48 to be an output pin.


Type:

echo out > direction <enter>

Now that pin 48 has been initialized as an output pin we can tell the BBB to turn that pin on and off.  We do that by typing:

echo 1 > value <enter>

and

echo 0 > value <enter>

If everything has been hooked up correctly the Red LED should have turned on and off. If it doesn't work make sure the LED was inserted into the breadboard properly, the short lead should be connected to ground and the longer lead connected to the GPIO pin.

Now we need to do the same thing to GPIO49.

Type:

cd../gpio49

You should now be in the gpio49 directory.

Type:

echo out > direction <enter>
echo 1 > value <enter>
echo 0 > value <enter>

The Green LED should have turned on and off.

OK, so the circuits for the two LEDs are functioning properly, now let's test the thermistor circuit.

We need to enable the ADC pins, they are all enabled.

NOTE: This works on my version C.1 BBB running Debian Linux.  If you have an older version do a google search to see how to read the ADC AIN pins.  Also note there is a bug in earlier versions dealing with the results of the ADC AIN read.

Type:

echo cape-bone-iio > /sys/devices/bone_capemgr.*/slots <enter>

If no results are returned then the command was successful.

Now let's find the ADC pins. The BBB uses the name AINX for the respective pins.
Type:

find /sys/ -name AIN* <enter>



Now we need to change directory into the helper.xx directory.

Type:

cd /sys/devices/ocp.X/helper.XX <enter>

where XX is the value you got from the find command above.  It may be different on your BBB.

Now we can read the value of AIN0 which is what we are using for the thermistor

Type:

cat AIN0 <enter>

You should get a result somewhere close to 900, which is 900 milivolts or about one half of our 1.8 volt ADC power rail.  My reading was 850mV but my voltage divider resistor was 55k ohm (closest value found in my component box) instead of the required 50k ohm so I expected my voltage to be a little lower.

If you press the up-arrow key the last command you typed will be displayed at the command prompt then hit enter and the last command will be executed.  If you repeatedly hit up-arrow <enter> you can read the AIN0 value repeatedly and see that it does actually fluctuate.

Now using one hand to gently hold the thermistor between your finger and thumb and use the other hand to hit the up-arrow <enter> keys repeatedly you can see that your body temperature changes the thermistor resistance which upsets the balance of the voltage divider circuit and the voltage reading at AIN0 will change. Continue to hold the thermistor and press the up-arrow <enter> keys until the value doesn't change so much and hovers around the same value.

Voltage Drops as Thermistor Temperature Rises


Now let go of the thermistor and continue to press the up-arrow <enter> keys and you will notice that the reading will gradually change back to its initial state and hover around 900mV.



Voltage Rises as Thermistor Temperature Drops


This is the indication that the thermistor voltage divider network is functioning properly.

So that wraps this session up.  In the next session we'll actually start to write our program to automatically turn on off the LEDs depending on the value of AIN0.

See you then!