Tottillo Healthkits
Published © GPL3+

Comparison of Sensor Precision Taking External and Body t°

The values of t° sensors DS18B20, waterproofed DS18B20, AM2302 will be compared with micro:bit temperature sensor and standard thermometer.

IntermediateFull instructions provided1 hour7,963
Comparison of Sensor Precision Taking External and Body t°

Things used in this project

Story

Read more

Schematics

Circuit diagram for arduino board

Code

Code for arduino and temperature sensors

C/C++
#include <SoftwareSerial.h>
#include <cactus_io_AM2302.h>
#define AM2302_PIN 3
#include "cactus_io_DS18B20.h"
#include <OneWire.h>
#include <DallasTemperature.h>
#define ONE_WIRE_BUS 2

OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
AM2302 dht(AM2302_PIN);
int DS18B20_Pin = 4;
DS18B20 ds(DS18B20_Pin);

void setup() {
  Serial.begin(9600);
  ds.readSensor();
  dht.begin();
  sensors.begin();
  Serial.println("18B20  |  AM2302  |  DS18B20");
  Serial.println("Temp (C) | Temp (C) | Temp (C)");
}

void loop() {
  ds.readSensor();
  sensors.requestTemperatures();
  dht.readTemperature();
  
  if (isnan(dht.humidity) || isnan(dht.temperature_C)) {
    return;
  }
  
  Serial.print(sensors.getTempCByIndex(0)); Serial.print("      "); Serial.print(dht.temperature_C); Serial.print("      "); Serial.println(ds.getTemperature_C()); 

  delay(1500);

}

Code for micro:bit

Python
from microbit import *

uart.init(baudrate=9600, bits=8, parity=None, stop=1, tx=pin8, rx=pin14)


while True:
  if button_a.is_pressed():
    uart.write(str(temperature()))

Credits

Tottillo Healthkits

Tottillo Healthkits

21 projects • 91 followers
I am e-health engineer Diana. Interested in general wellness and awareness of what parameters affect our well-being and health.

Comments