[Waterproof DS18B20 Sensor Kit Tutorial_2] a BATHING CAT FOR YOUR BATHING

Picture of 
[Waterproof DS18B20 Sensor Kit Tutorial_2] a BATHING CAT FOR YOUR BATHING

I have to admit that taking a bath can greatly help relax. And I prefer hot tubbing, no matter it’s summer or winter season. But that can be annoying when you can not estimate whether the temperature is proper. What's more, I bag most of us need a timer when you enjoy yourselves in the tub.So I decided to deal with such a BATHING COMPANION.The anime character is from RIPNDIP one of my favorite brands.

Step 1: Material List

RGB LED module 5050

DFRduino Nano 3.0

# LR44 cell battery(with a case) [for independent power supply]

USB Cable

Waterproof DS18B20 Sensor Kit

some PMMA, and some wire

Step 2:

Picture of

Step 3: Circuit Logic & Code

Picture of Circuit Logic & Code

#include <OneWire.h>

#include <RGBLED.h>

RGBLED myled = RGBLED(9,10,11);

int DS18S20_Pin = 2; //DS18S20 Signal pin on digital 2

//Temperature chip i/o

OneWire ds(DS18S20_Pin); // on digital pin 2

int ledPin = 9; // Connect LED on pin 9, or use the onboard one

int KEY = 3; // Connect Touch sensor on Digital Pin 3

void setup(){


pinMode(ledPin, OUTPUT); // Set ledPin to output mode

pinMode(12, OUTPUT);

pinMode(KEY, INPUT); //Set touch sensor pin to input mode


void loop(){

float temperature = getTemp();


delay(100); //just here to slow down the output so it is easier to read

if(temperature >= 40) { //Read Touch sensor signal

digitalWrite(12, LOW);

digitalWrite(ledPin, HIGH); // if Touch sensor is HIGH, then turn on


else if(digitalRead(KEY)==HIGH){ //start the timer


digitalWrite(12, LOW);

digitalWrite(10, HIGH);




digitalWrite(ledPin, LOW); // if Touch sensor is LOW, then turn off the led



float getTemp(){

//returns the temperature from one DS18S20 in DEG Celsius

byte data[12];

byte addr[8];

if ( ! {

//no more sensors on chain, reset search


return -1000;


if ( OneWire::crc8( addr, 7) != addr[7]) {

Serial.println("CRC is not valid!");

return -1000;


if ( addr[0] != 0x10 && addr[0] != 0x28) {

Serial.print("Device is not recognized");

return -1000;



ds.write(0x44,1); // start conversion, with parasite power on at the end

byte present = ds.reset();;

ds.write(0xBE); // Read Scratchpad

for (int i = 0; i < 9; i++) { // we need 9 bytes

data[i] =;



byte MSB = data[1];

byte LSB = data[0];

float tempRead = ((MSB << 8) | LSB); //using two's compliment

float TemperatureSum = tempRead / 16;

return TemperatureSum;


Step 4: Structure

Picture of Structure

I wanted to make it as simple as possible, so I did some laser-cutting stuff.

And then screw on.

Step 5: Assembling

Picture of Assembling

Step 6: Adjust the Screw to Make Sure the Case Can Hold ‘the Cat Tail’

Picture of Adjust the Screw to Make Sure the Case Can Hold ‘the Cat Tail’


About This Instructable




Bio: a maker
More by Juncheng:Desktop Weather Station With WIFII_NEED_SPOTLIGHTCAT-BOT
Add instructable to: