Author Topic: Comparing sensors BME280 DS18b20 (code samples)  (Read 963 times)


  • Sr. Member
  • ****
  • Posts: 301
  • Country: si
Comparing sensors BME280 DS18b20 (code samples)
« on: March 21, 2017, 02:49:28 AM »
Here is what you would need to test and compare different sensors to each other. For time being, only BME280 and DS1820's

Addresses for DS's were set once, for that you run first "test" sketch to obtain all addresses on 1wire. Then you copy those into main sketch at the top, where you have DeviceAddress ...
I have two sensors, so
Code: [Select]
DeviceAddress dsaddr1
DeviceAddress dsaddr2
If you have more, then add more.
Than in void setup() you set resolution with dssetresolution(myds, dsaddr, resolution);
in my case
Code: [Select]
    dssetresolution(myds, dsaddr1, resolution);
    dssetresolution(myds, dsaddr2, resolution);
If you have more sensors, then add more lines.

in void loop() you have dsconvertcommand(myds, dsaddr); and Serial.println(dsreadtemp(myds, dsaddr1, resolution));

Same deal as above, for more sensors, more lines to match

What you should get is something like
Code: [Select]
Temp (C): 23.87
Temp (C): 23.94
Elapsed time (ms): 1046
Temperature: 24.50 degrees C
Temperature: 76.10 degrees F
Pressure: 961.63 mBar
Altitude: 453.83m
Altitude: 1488.95ft
%RH: 37.43 %
« Last Edit: March 21, 2017, 10:14:08 AM by LukaQ »


  • Administrator
  • Hero Member
  • *****
  • Posts: 6608
  • Country: us
    • LowPowerLab
Re: Comparing sensors BME280 DS18b20 (code samples)
« Reply #1 on: March 21, 2017, 08:07:49 AM »