A field team faces an unresolved physical question: What Raw Code 2361 Means They must answer it before changing raw twelve-bit code on the real device. Predict the direction first.
See the relationship before changing it
The figure reads from left to right. The blue card is raw twelve-bit code. The middle card applies this page's relationship. The green card is tmp36-style reading. Walk the arrows once: set the input, apply the rule, then read the result with its unit.
The retained audit below checks several chapter fixtures. This added model holds every other chapter fixture fixed, so the numeric fixture does not switch without explanation.
Derive the baseline in four named moves
- 1
Name the input. The chapter baseline for raw twelve-bit code is 2361.
- 2
Name the relationship. V = code x V_ref/2^N; T_sensor = (V - V_0)/S; T_scaled = code/100
- 3
Substitute the chapter fixture. Set raw twelve-bit code to 2361. The page ledger gives tmp36-style reading as 140.2 degrees C.
- 4
Read the result. Keep degrees C beside the value. Use it only inside the technical boundary on this page.
Predict, then change raw twelve-bit code
Try Predict the direction of tmp36-style reading. Move one control, calculate, then check your prediction.
Observe The outputs use V = codexV_ref/2^N, T = (V-V_0)/S, and T = code/100, the same conversion steps derived above. Reset the control to 2361 and compare tmp36-style reading.
Explain Only raw twelve-bit code moves here. The other chapter fixtures remain fixed.
Check yourself
What should you do before trusting a moved-control result?
What does this small model leave out?
1. A code is an address, not a temperature
A 12-bit converter can write 4,096 different code addresses. Code 2361 tells you which address was selected. It does not tell you the voltage range, sensor law, scale, offset, or unit. Those belong to the measurement contract.
2. Put the contract beside the bits
| Contract item | Rule used here |
|---|---|
| bit depth | 12 bits, so 2¹² = 4,096 levels |
| reference | 3.3 V across the full code range |
| sensor rule | V_out = 0.5 + 0.01T |
| payload rule | scaled temperature = code/100 |
3. Derive both readings
Count the levelsFor N = 12, 2^N = 4,096.
Find one code stepq = 3.3 V/4,096 = 0.806 mV per code.
Convert code to voltageMultiply code by the step: V = code × 3.3/4,096.
Undo offset and sensitivityFrom V = 0.5 + 0.01T, subtract 0.5 and divide by 0.01.
Try the other contractA scale-by-100 payload simply gives T = code/100.
4. Reproduce the chapter's code 2361
The TMP36-style rule gives T = (1.90 − 0.5)/0.01 ≈ 140 °C. The scale-by-100 rule gives T = 2361/100 = 23.6 °C. Rounded as the chapter does, the disagreement is 140 − 23.6 = 117 °C. Both calculations are valid; only the declared contract tells the receiver which one applies. Separately, the chapter's 600 Hz component sampled at 1,000 Hz aliases to 400 Hz, showing another upstream limit that processing cannot undo.
5. Try the same formulas
TryMove the raw code around 2361 and compare the two temperatures produced by two honest but incompatible contracts.
ObserveThe same slider position produces two changing temperatures because each decoder applies a different scale and offset.
ExplainThe outputs use V = code×V_ref/2^N, T = (V−V_0)/S, and T = code/100, the same conversion steps derived above.
The widget compares exactly the chapter's two illustrative contracts.
- It does not claim that code 2361 really came from a TMP36 or that 140 °C is valid for a particular installation
- Needs separate evidence
Use field evidence or a deeper model before release.
6. What the result buys you
A payload must name schema version, units, scale, offset, signedness, width, byte order, and invalid-value rules. A golden payload should prove that device, gateway, and cloud all decode the same bytes to the same engineering value.
7. Check yourself
1. How many codes does 12 bits provide?
Answer: 2¹² = 4,096 codes, numbered 0 through 4,095.
2. What voltage does code 2361 represent at 3.3 V full scale?
Answer: 2361×3.3/4096 = about 1.90 V.
3. Why can two correct calculations disagree by 117 °C?
Answer: They apply different contracts. The bits alone do not select a scale, offset, or unit.
These are the chapter inputs, worked results, and named teaching assumptions.
- Code 2361
- Sensor scale, pressure, or digital result
- 12 bits
- Digital resolution or converter setting
- 4,096 levels
- Sensor scale, pressure, or digital result
- 3.3 V
- Voltage or voltage-step value
- 0.806 mV
- Voltage or voltage-step value
- 1.90 V
- Voltage or voltage-step value
- the TMP36-style 0.5 V offset
- Voltage or voltage-step value
- 0.01 V/°C sensitivity
- Voltage or voltage-step value
- 140 °C
- Temperature or angle value
- 23.6 °C
- Temperature or angle value
- 117 °C
- Temperature or angle value
- the separate 600 Hz to 400 Hz alias reproduce the companion chapter
- Frequency, sample rate, or event rate
The sensor law is illustrative, not proof of the hardware behind an unknown payload; the chapter's deeper contract and calibration evidence remains required.
Phoebe guides