.. index:: temperature:sensor simple .. _temp.sens.simple: Temperature Sensor Simple ========================= This is a simpler version of my first :ref:`LMT01 temperature sensor project` which used: 1. Two Interrupts 2. A Timer 3. Supported multiple LMT01 sensors This version uses a Blocking Delay instead of a Timer, one interrupt and it only supports a single LMT01 sensor. This is also my first project using two files where: 1. One file is for configuration only. Its filename ends in \*.includes.fs and must be loaded first. This file provides all prerequisites for the second file below 2. The second file contains Words pertaining to the higher level functions of the program itself. I'm trying this strategy to separate the two functions of any embedded program, namely "configuration" and "program" in order to make the project more readable. Downloads --------- These are all the project files including a ready to flash binary for a :ref:`STM32F0 Discovery Board`. 1. :download:`f0-lmt01-temp-sensor-simple-version.fs` 2. :download:`f0-lmt01-temp-sensor-simple-version.includes.fs` 3. :download:`Standalone binary file containing everything needed for this project which will run on powerup` 4. :download:`Binary file README` 5. :download:`List of Words in the Binary above` .. warning:: The Standalone Binary has RTS/CTS handshaking. Connect to a 3.3v/usb dongle which supports them for correct operation. Terminal should be set to 460800 baud.Connect PA11 (CTS) to 0V (ground), ignore PC7 (code-error). PA12 (RTS) connects to the dongle CTS. PA10 (RX) connects to dongle TX, etc Operation --------- Flash the board with the standalone binary file above, connect the FOUR parts to the Discovery Board as shown in the schematic below and type "t" in the terminal to read the temperature in Degrees C. :: t 23.2C ok. Schematic --------- .. image:: /projects/simple-lmt01-sensor/pics/f0-lmt01-temp-sensor-simple-version-schematic.png .. note:: All parts (including wiring) in the big green rectangle are INSIDE the Discovery Board, you do not add them. This project has only 4 parts to be connected and they are on the left of the rectangle. How Does It Work ? ^^^^^^^^^^^^^^^^^^ 1. PC1 is raised high which provides power to the LMT01 temperature sensor. 2. The LMT01 sensor a. Powers up and determines the temperature. b. Sends the temperature as a series of current pulses representing digital "high" and "low". c. Q1 converts the current pulses into digital "1" and "0" voltage pulses. 4. PCO, configured as a INPUT triggers a interrupt on each falling edge of the received pulses. These pulses are counted by the interrupt handler. 5. After PC1 is raised high, a blocking delay of 105 milliseconds is initiated. 6. The 105 millisecond delay allows enough time for all the pulses to be counted. 7. When the 105 millisecond delay is finished, power to the LMT01 is removed and the temperature is calculated and displayed. Waveforms ^^^^^^^^^ The Scope picture below shows: 1. Waveform on channel 1 is the block of pulses from the LMT01 as received at PC0. 2. Waveform on channel 2 is the power to the LMT01 from PC1. Waveform Image ~~~~~~~~~~~~~~ .. image:: /projects/simple-lmt01-sensor/pics/f0-lmt01-temp-sensor-simple-version-waveform.png Scope settings ~~~~~~~~~~~~~~ .. literalinclude:: /projects/simple-lmt01-sensor/pics/f0-lmt01-temp-sensor-simple-version.txt