CWX-1 External DS18B20 Temperature Sensor


The CWX 1 –  STEM SDK IoT (Compact Weather Station),, includes on-board digital temperature sensor, however it would be great to also add an external temperature sensor, such on a greenhouse or room.

Using the I2C connector and sharing the I2C bus, it is very easy to add one to test, or more, one-wire digital temperature sensors as they only require one data line (3V3 and GND) to communicate with CWX.

The I2C interface on the CWX SDK already has a 10K resistor fitted to 3V3, so all you need to do is connect the sensor as shown below. A dedicated GPIO16 connection was added on PCB revisions 1.2204-106, which also has a 4k7 to VCC.

  • Red = Power = 3V3
  • Yellow = Data = SDA or GP16
  • Black = Ground = GND

Features of the DS18B20

  • Easy to interface and control
  • Wide temperature range: -55 to 125°C
  • Accuracy +/-0.5 ºC (between the range -10ºC to 85ºC)
  • Temperature Limit Alarm Thresholds
  • Multiple sensors can share one pin
  • Unique 64 bit ID burned into each device
  • Cable is jacketed in PVC
  • Although not IP rated, these are Waterproof, Moisture Proof and Rustproof.
  • Usable with 3.0-5.0V supply.


Example code

To be added

Example Output 

Temperature for external DS18B20 Sensor: 0 23.81°C

Leave a Reply

This site uses User Verification plugin to reduce spam. See how your comment data is processed.