Difference between revisions of "8-way temperature sensor"
Line 13: | Line 13: | ||
== Hardware == | == Hardware == | ||
− | The sensor has 3 pins: gnd, Vcc and data. When powered on, it starts spitting out | + | The sensor has 3 pins: gnd, Vcc and data. When powered on, it starts spitting out 11-bit values every second or so. For each data-byte, a 10-bit frame is used: a start-bit, used to indicate start-of-byte, and to allow the receiver to measure 1/2 of the bittime, which is used to sample subsequent bits. After 8 bits of data comes a parity-bit. Everything is nicely explained in datasheets I am currently too lazy to dig up. |
All sensors share a Vcc, directly supplied one of the MCU's I/O pins, while each sensor has a dedicated MCU I/O-pin for data. | All sensors share a Vcc, directly supplied one of the MCU's I/O pins, while each sensor has a dedicated MCU I/O-pin for data. | ||
Line 27: | Line 27: | ||
# power on all sensors | # power on all sensors | ||
# read value from sensor #2 | # read value from sensor #2 | ||
+ | # validate and format value, and send to host | ||
# power off all sensors | # power off all sensors | ||
# ... | # ... |
Latest revision as of 18:25, 3 July 2011
Introduction
For work I built a small temperature-sensor box, with 8 TSIC506 sensors - very accurate (about +/-0.1 degC) and digital.
Although this thing was used (once), it's not very useful for higher temperatures, since sensors have max readout at 60 degC. Then again, sensors were my own, and I just plopped them in there because they were collecting dust here.
Hardware
The sensor has 3 pins: gnd, Vcc and data. When powered on, it starts spitting out 11-bit values every second or so. For each data-byte, a 10-bit frame is used: a start-bit, used to indicate start-of-byte, and to allow the receiver to measure 1/2 of the bittime, which is used to sample subsequent bits. After 8 bits of data comes a parity-bit. Everything is nicely explained in datasheets I am currently too lazy to dig up.
All sensors share a Vcc, directly supplied one of the MCU's I/O pins, while each sensor has a dedicated MCU I/O-pin for data.
Software
The software is too simple to discuss; main loop is as follows:
- sleep
- power-on all sensors (shared Vcc)
- read value from sensor #1 (ignore the rest)
- validate and format value, and send to host through UART
- power off all sensors
- power on all sensors
- read value from sensor #2
- validate and format value, and send to host
- power off all sensors
- ...
- redo from start
User can read each sensor's temperature using a terminal-emulator or script; basic error-checking is done so that parity-/communication-errors and 'missing sensor' issues are indicated as well. That's all!
Have fun -- Michai