Sunday, 4 February 2018

Stress measurement using Raspberry Pi

Introduction:

The aim of this project is to measure the stress that a subject applies on a stress-ball and categorize it into three possible levels, i.e. high, medium or low, and the same is displayed on the thermometer on the screen.
The FSR-402 (force sensor) is mounted on a stress ball and the analog signal generated by it on the application of pressure is supplied to AD7705 which converts the same into a digital signal and feeds it to raspberry pi where the software classifies the pressure in any of the available 3 different categories and displays the output in the form of a graph and thermometer on the screen.

Set-up/Project in action


Software:

The Raspberry pi gets the digital sensor input on its GPIO pin from AD7705. The communication interface used is SPI with the device at /dev/spidev0.0. The file related to the same is accessed whenever a read/write has to be performed.

After initialization, a new thread is started which reads the ADC output continuously and stores it in a buffer. The window.CPP file reads the value from the adcreader, whenever a sample is present and a timer event will trigger to plot all the data collected during the 20ms refresh rate on the screen.

Code is available on Github: https://github.com/waffles1/stress_measurement

Hardware:

Hardware can be divided into two parts:
1. The Analog-Digital Converter (ADC) Circuit
2      2. Pressure sensor circuit
Analog-Digital Converter required the following components:
1 x MCP1525
1 x 0.1µF
2 x 1 µF
1 x AD7705
The pressure sensor circuit required the following components:
1 x FSR402
2 x 1kΩ
1 x 1MΩ



Implementation of the circuit diagram:
Circuit
The maximum resistance of the FSR is 10MΩ and the minimum is 300Ω (provided in the datasheet). Upon applying pressure on the FSR, the value of the resistance decreases which results in a voltage drop greater than 80mV and less than 1.9V (wheat-stone bridge was used). The 1kΩ resistors provide a voltage drop of 1.5V at Ain-. Using the 1MΩ resistor, the differential input range is 1.49-1.5Vwhich is well within the voltage drop range. The wheat-stone bridge provides a differential input to the AD7705.

Conclusion:

Application of pressure results in a change in the waveform. The thermometer of QT displays the amount of pressure. A full bar means maximum pressure while an empty bar means no pressure. The AD7705 A/D converter was used to change analog to digital values and was displayed on the monitor. Video will be made available soon on my YouTube channel, do subscribe to my channel for video explanations:



No comments:

Post a Comment