Lecture 33 Signal Processing III (tempterature data collection and curve fitting)

****Be careful about the polarity of the pins of the temperature sensor!! The VS+ pin must be connected to +5 V, the GND pin must be connected to GND, the Vout pin must be connected to A0. Inversely connect the VS and the GND will burn the sensor and generate lots of heat, which will burn your finger if you touch it!!!!

The safe way to connect the circuit: Do not power up your board (hook it to the USB port) before you have the circuit connected and double checked!! Let your neighbors to check your connection for you before you power up your circuit.

1. Use the temperature sensor in the box. Connect the circuit like the following:

The datasheet of the sensor can be found at here.


Use the following code to collect the temperature data, and then save them on your harddrive.

(Please note the 'core algorithm' I used to convert the voltage into tempterature. 0.5 V represent 0 celsius degree. Every 10 mV change represents 1 celsius degree change, so 1 V represents 100 celsius change.)

Use polyfit and polyval to do the curve fitting. Plot the raw data and the fitted data in the save figure. (Again, adjust the font/line/color/.... to make it presentable):

2. Use polyval to find the temperature at time point 4s.

3. Make a user interface to let the user type a time point, your script must return the corresponding temperature at that time point. If the input from the user is out of the recorded range, the script must return a warning or let the user know it is out of the range.

4. Finally, use subplot, have the raw data and the fitted data on the left side, and have the fitted data and the marker on the right side. The marker must mark the highest temperature in your data.

Submit an electronic version of your report to the email. Again, have figures, captions, title, explanations, and your code as the appendix. Due Wednesday.