Experiment 3 - Resistive Sensors I

Potentiometer

In this experiment, we want to check different potentiometer work.

Materials: two rotary potentiometers, two linear potentiometers, 1 Power supply, 1 voltmeter

Task:

Choose one of linear POT and make the following circuit for that by attaching positive and negative outputs of power supply to positive and negative ports of POT. Then connect the negative lead of the voltmeter to the negative port of POT and the positive lead to the jumper wire of the POT. Put DC power supply on 10 volts. When POT is in zero-length of the resistor, the potentiometer should show zero and when it is at the full length of the resistor it should show 10 volts.

Repeat these steps for other POTs.


One wire thermal sensor

In this experiment, we want to check how a thermistor works.

Materials: One Arduino board, DS18B20 temperature sensor, 4.7 K ohm resistor, Bread board, some wires

In DS18B20 temperature sensor, the black wire is GND, the red wire is  Vcc and the yellow wire is data. So you should connect the ground wire to the GND port of Arduino and  Vcc wire to 5 V of Arduino. Now you should connect the resistor to Vcc and the data pin. Connect the data pin to pin number 2 of Arduino.

For implementing the code in Arduino you should download two libraries.

The first library is the Dallas temperature library, which you can download from below link:

https://github.com/milesburton/Arduino-Temperature-Control-Library

and the second one is Arduino one wire library.

https://github.com/PaulStoffregen/OneWire

Download the zip file for them and then from Sketch tab, Include Library, by pushing the “Add.Zip Library” you can add your libraries to Arduino.


Write the following code on your Arduino.


#include <OneWire.h>

#include <DallasTemperature.h>


// Data wire is plugged into digital pin 2 on the Arduino

#define ONE_WIRE_BUS 2


// Setup a oneWire instance to communicate with any OneWire device

OneWire oneWire(ONE_WIRE_BUS);


// Pass oneWire reference to DallasTemperature library

DallasTemperature sensors(&oneWire);


void setup(void)

{

  sensors.begin();     // Start up the library

  Serial.begin(9600);

}


void loop(void)

{

  // Send the command to get temperatures

  sensors.requestTemperatures();


  //print the temperature in Celsius

  Serial.print("Temperature: ");

  Serial.print(sensors.getTempCByIndex(0));

  Serial.print((char)176);//shows degrees character

  Serial.print("C  |  ");


  //print the temperature in Fahrenheit

  Serial.print((sensors.getTempCByIndex(0) * 9.0) / 5.0 + 32.0);

  Serial.print((char)176);//shows degrees character

  Serial.println("F");


  delay(500);

}


Now from the serial monitor, you can see the output of the temperature sensor.


Flexi force sensor

In this experiment, we want to use a Flexi force sensor.

Materials: One Flexi force sensor (Parallax Inc Flexiforce Entwicklungskit), 47 uf capacitor, 10 K ohm resistor, Breadboard, some wires, Arduino, a weight with a known amount

Make the following circuit. In this circuit, the resistor and capacitor are parallel to each other.

Then, write the following code on your Arduino. In this code, we converted the analog reading (0-1023) to a voltage (0-5v).


float cf = 19.5; // caliberation factor


int ffs1 = A0; // FlexiForce sensor is connected analog pin A0 of arduino or mega.


int ffsdata = 0;

float vout;

void setup()

{

  Serial.begin(9600);

  pinMode(ffs1, INPUT);

  

}


void loop()

{



 ffsdata = analogRead(ffs1);

vout = (ffsdata * 5.0) / 1023.0;

vout = vout * cf ;

Serial.print("Flexi Force sensor: ");

Serial.print(vout,3);

Serial.println("");

delay(100);

  

}



Now from the serial monitor, you can see the output of the sensor.

You can check the output with different weights and for calibration, you should change the cf value to reach the best value for this parameter.


Op-amp null adjustment

In this experiment, we want to do the Op-amp null adjustment.

Materials: Op-amp (Ic 741), Dual power supply, POT (10 k ohm), some wires, breadboard, Multimeter

1. Place IC 741 on the breadboard and connect pin number 7 to the positive voltage of the power supply and pin number 4 to the negative port of the power supply.

2. Connect both input terminals to GND

3. Connect POT to pin 1, pin 4 and pin 5 such that the jumper terminal of the pot is connected to pin number 4 of the op-amp and GND is connected to GND.

5. Connect multimeter leads to the output terminal of the op-amp (pin number6) and GND.

6. Rotate the POT jumper till the multimeter shows zero voltage.

7. Now offset null adjustment is finished and you can replace the inputs with your desired inputs.

Institut für Mechatronik im Maschinenbau (iMEK), Eißendorfer Straße 38, 21073 Hamburg