Diana Khalipina
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 hour2,011
Comparison of Sensor Precision Taking External and Body t°

Things used in this project

Hardware components

DS18B20 Programmable Resolution 1-Wire Digital Thermometer
Maxim Integrated DS18B20 Programmable Resolution 1-Wire Digital Thermometer
×1
DHT11 Temperature & Humidity Sensor (3 pins)
DHT11 Temperature & Humidity Sensor (3 pins)
×1
Resistor 10k ohm
Resistor 10k ohm
×3
Jumper wires (generic)
Jumper wires (generic)
×10
Adafruit Waterproof DS18B20 Digital temperature sensor
Adafruit Waterproof DS18B20 Digital temperature sensor
×1
Test Probe Connector, Crocodile Clip
Test Probe Connector, Crocodile Clip
×3
USB-A to Mini-USB Cable
USB-A to Mini-USB Cable
×1
Arduino UNO & Genuino UNO
Arduino UNO & Genuino UNO
×1
BBC micro:bit board
BBC micro:bit board
×1

Software apps and online services

Arduino IDE
Arduino IDE
Vittascience platform for micro:bit

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

Diana Khalipina

Diana Khalipina

11 projects • 44 followers
Je suis une ingénieure, je passe maintenant du temps à développer des projets de santé basés sur des arduinos et à créer des sites.

Comments

Add projectSign up / LoginAbout BBC micro:bit