]>
Commit | Line | Data |
---|---|---|
f68fd2bd KK |
1 | ------------------------------------------------------------------------------- |
2 | Dallas DS18B20 1-Wire digital temperature sensor | |
3 | ------------------------------------------------------------------------------- | |
4 | ||
5 | This is a set of example captures of the 1-Wire traffic from Maxim DS18B20 | |
6 | temperature sensors. | |
7 | ||
8 | Details: | |
9 | https://en.wikipedia.org/wiki/1-Wire | |
10 | https://datasheets.maximintegrated.com/en/ds/DS18B20.pdf | |
11 | ||
12 | ||
13 | Logic analyzer setup | |
14 | -------------------- | |
15 | ||
16 | The logic analyzer used was a MCU123 Saleae Logic clone (at 8 MHz): | |
17 | ||
18 | Probe DS18D20 pin | |
19 | ----------------------- | |
20 | 1 (brown) 2 (DQ) | |
21 | ||
22 | The sigrok command line used was: | |
23 | ||
24 | sigrok-cli -d fx2lafw:samplerate=1mhz --samples 2m --channels 0 -o <file> | |
25 | ||
26 | ||
27 | 2xds18b20.sr | |
28 | ------------ | |
29 | ||
30 | Two DS18D20 sensors are connected to the 1-Wire bus with following ROM codes: | |
31 | ||
32 | - 0x8d011627f794ee28 | |
33 | (family code: 0x28, serial number: 0x011627f794ee, CRC: 0x8d) | |
34 | - 0x330216255487ee28 | |
35 | (family code: 0x28, serial number: 0x0216255487ee, CRC: 0x33) | |
36 | ||
37 | The sensors have the same following marking: | |
38 | ||
39 | Dallas | |
40 | 18B20 | |
41 | 1619C4 | |
42 | +827AH | |
43 | ||
44 | The communication is initiated by a custom 1-Wire master software | |
45 | implementation for a STM32F103C8 using timers. | |
46 | ||
47 | The master performs the following actions: | |
48 | ||
49 | - Use Search ROM command to enumerate all 1-Wire devices on the bus so to | |
50 | count the number of DS10B20 sensors on the bus (two). | |
51 | - Restart enumeration of each device using the Search ROM command so to store | |
52 | their ROM code. After enumeration of each device: | |
53 | - Use Match ROM command to select device. | |
54 | - Use Read Scratchpad function command to read the 9 scratchpad bytes. | |
55 | - Use Write Scratchpad function command to write 3 bytes, setting the | |
56 | temperature conversion precision to 9 bits. | |
57 | - Use the Copy Scratchpad function command to copy the scratchpad into | |
58 | the device's internal EEPROM. | |
59 | - Use Skip ROM command to address all devices. | |
60 | - Use Convert T function command to start temperature conversion. | |
61 | - After one second use Match ROM and Read Scratchpad commands on each device | |
62 | to read the temperature stored in the scratchpad. | |
63 | - After 1 second use Skip ROM and Convert T commands to start next conversion. |