Task: Well in this week we have to measure something: add a sensor to a microcontroller board that we have designed. Satshakit So for this week I have decided to use a a Thermistor, as an input device, because i will need it for my Final Project. For this week, I have decided to make a new board, I have taken a Satshakitboard as a layout and modified it a bit, so that i need only to connect a Thermistor. You can see the Schmatic of the board below. So this is actually what I have added to the Satshakitboard, it a a 100 k Resistor, connected to the VCC at PC1 and some additional pins for the input and the output. This is how my board layout looks like And this is my board, after I have milled and soldere it. I will not explain here, how I did this, because it was the topic of the previous weeks. Arduino I have used a RepRap 100k(104GT-2) Thermistor, that can read up to 300 C Connection Here how you have to connect your board to the arduino You can see the arduino code below, that I have used to read fro the Thermistor. I have taken the code from Adafruit Platform(It is very well documented) and modifed it a bit, so that the led at PB5 powers on, if the temperature is higher that 100 C. Ofcourse you have to define some values at the beginnig of the script, according to the Thermistor
          // which analog pin to connect
          #define THERMISTORPIN A0         
          // resistance at 25 degrees C
          #define THERMISTORNOMINAL 100000      
          // temp. for nominal resistance (almost always 25 C)
          #define TEMPERATURENOMINAL 25   
          // how many samples to take and average, more takes longer
          // but is more 'smooth'
          #define NUMSAMPLES 5
          // The beta coefficient of the thermistor (usually 3000-4000)
          #define BCOEFFICIENT 4267
          // the value of the 'other' resistor
          #define SERIESRESISTOR 100000    
           
          uint16_t samples[NUMSAMPLES];
          
          int pin = 13;
          
          void setup(void) {
            Serial.begin(9600);
            pinMode(pin, OUTPUT);
          }
           
          void loop(void) {
            uint8_t i;
            float average;
           
            // take N samples in a row, with a slight delay
            for (i=0; i< NUMSAMPLES; i++) {
             samples[i] = analogRead(THERMISTORPIN);
             delay(10);
            }
           
            // average all the samples out
            average = 0;
            for (i=0; i< NUMSAMPLES; i++) {
               average += samples[i];
            }
            average /= NUMSAMPLES;
           
            //Serial.print("Average analog reading "); 
            //Serial.println(average);
           
            // convert the value to resistance
            average = 1023 / average - 1;
            average = SERIESRESISTOR / average;
            //Serial.print("Thermistor resistance "); 
            //Serial.println(average);
           
            float steinhart;
            steinhart = average / THERMISTORNOMINAL;     // (R/Ro)
            steinhart = log(steinhart);                  // ln(R/Ro)
            steinhart /= BCOEFFICIENT;                   // 1/B * ln(R/Ro)
            steinhart += 1.0 / (TEMPERATURENOMINAL + 273.15); // + (1/To)
            steinhart = 1.0 / steinhart;                 // Invert
            steinhart -= 273.15;                         // convert to C
          
            //Serial.print( analogRead(THERMISTORPIN));
            //Serial.print("------------------\n");
            //Serial.print("Temperature "); 
            Serial.println(steinhart);
            if (steinhart > 100){
              digitalWrite(pin,HIGH);
            }else{
              digitalWrite(pin,LOW);
            }
            //Serial.println(" *C");
           
            delay(200);
          }
        
It's Working Downloads input.sch input.brd