Week 11_Input devices

During this week I started working on some temperature sensor I want to involve in my final project.

Thermistors

The cheapest sensors used to misure temperature.

They are able to change them resistance proportionally (not that linear) to the tempeatre they are subjected.
Here you can find thermistor page on playground.arduino.cc
In order to translate the value we get from those sensors I found this formula to apply:

R0 is the resistance at the T0 temperature (usually 25° C = 298.15 K), B is beta coefficient, R is the resistance value of the thermistor at the T temperature (°K) that we want to detect.
At this point the only data we are missing is the value of R, which is foundable thanks to a voltage divider.

The value of the unknown resistance R2 will be:

Coding

I started using termistor with an Arduino Uno and this code I found on google.

 {

			void setup() {
		  Serial.begin(9600);
		}


		void loop() {
		  Serial.println(Thermister(analogRead(A2)));

		}

		double Thermister(int RawADC) {
		  double Temp;
		  // See http://en.wikipedia.org/wiki/Thermistor for explanation of formula
		  Temp = log(((10240000/RawADC) - 10000));
		  Temp = 1 / (0.001129148 + (0.000234125 * Temp) + (0.0000000876741 * Temp * Temp * Temp));
		  Temp = Temp - 273.15;           // Convert Kelvin to Celcius
		  return Temp;
		}

		} 

Printing temperature value wasn't correct so I tryed many times more and I came out with this working formula:

 {

			void setup() {
  Serial.begin(9600);
}


void loop() {
  Serial.println(Thermister(analogRead(A2)));

}

double Thermister(int RawADC) {
  double Temp;
  Temp=46+RawADC/10*(-1);
    return Temp;
}

		} 

Board design

I made the board with the same process of the past weeks, drawn by Eagle and export the gcod for milling with the PcbGcode PlugIn. Than I produce the board with the roland machine.

I started placing the ATTINY plus the L298N and than all other pin for the sensor.

Here the source file!

Milling and soldering

After I solded and flashed the first Firmaware through one atmel AVRISP.