Temperature Sensor Sample

Temperature/Force Sensor Sample

This sample uses SPI communication. A temperature/force sensor is connected to a ADC, then ADC is connected to raspberry Pi2 through SPI Pins. Raspberry Pi2 reads the sensor analog input data and output it to the screen. This is basically a simplified version of Potentiometer sensor sample, which has a LED light as an extra output. You can also use a Force sensor in this sample. Try to press the Force sensor gentle or hard to see the data output difference. This sample only has C# version.temperature sensor sample

Read before start

This sample assumes that RaspBerry has been pre-setted up with below:

  • Pi2 has been connected to HDMI monitor
  • A SD image card has been plugged to Pi2
  • An Ethernet cable has been plugged to Pi2
  • Pi2 has been powered on

Parts needed

Parts Review

  • MCP3002

The below lists the pin Layout of MCP3002, and also it is the A/D converter that we are using in this sample.

You can also use MCP3208 which are 16 pins. We will list its connections with Raspberry Pi2 as well in later section.

Parts Connection

  1. Connects the temperature Sensor to MCP3002; Sensor output pin (the mid pin) should be connected to CH0 on MCP3002;

If you are using a Force sensor which only has two legs, set the left leg to 5V, and connect the other Leg to CH0 on MCP3002

With each model of RaspBerry Pi2, the pin layout might be a little different. But the pin connection with MCP3002 should be as below:

  • MCP3002: VDD/VREF – 5V on RaspBerry Pi2
  • MCP3002: CLK – “SPI0 SCLK” on RaspBerry Pi2
  • MCP3002: Dout – “SPI0 MISO” on RaspBerry Pi2
  • MCP3002: Din – “SPI0 MOSI” on RaspBerry Pi2
  • MCP3002: CS/SHDN – “SPIO CS0” on RaspBerry Pi2
  • MCP3002: DGND – GND on RaspBerry Pi2
  • MCP3002: CH0- Sensor Output Pin

schematic temperature sensor sample

2.Alternative: If you are using MCP3208Connect the temperature Sensor to MCP3208; Sensor output pin (the mid pin) should be connected toCH0 on MCP3208.

For more detail: Temperature Sensor Sample

About The Author

Ibrar Ayyub

I am an experienced technical writer with a Master's degree in computer science from BZU Multan University. I have written for various industries, mainly home automation, and engineering. I have a clear and simple writing style and am skilled in using infographics and diagrams. I am a great researcher and is able to present information in a well-organized and logical manner.

Follow Us:
Scroll to Top