Skip to content

Displaying temperature from DS18B20 on S65 Shield

2014 Januar 23
by Jan

Hey Folks,

in somewhat of a building spree i took the code for reading the DS18B20 digital temperatur sensor and built a thermometer to display the temperature outside. It´s cold in Berlin.

Here´s the code:

int ledPin1 = 3;

#define ONE_WIRE_BUS 7

OneWire oneWire(ONE_WIRE_BUS);

DallasTemperature sensors(&oneWire);

S65Display lcd;

DeviceAddress VL;

void setup(void)
Serial.println(“Dallas Temperature IC Control Library Demo”);

Serial.print(“Locating devices…”);
Serial.print(“Found “);
Serial.print(sensors.getDeviceCount(), DEC);
Serial.println(” devices.”);

Serial.print(“Parasite power is: “);
if (sensors.isParasitePowerMode()) Serial.println(“ON”);
else Serial.println(“OFF”);

if (!sensors.getAddress(VL, 0)) Serial.println(“No address for D 0″);

Serial.print(“Device 0 Address: “);

sensors.setResolution(VL, 9);

Serial.print(“Device 0 Resolution: “);
Serial.print(sensors.getResolution(VL), DEC);





void printTemperature(DeviceAddress deviceAddress)

float tempC = sensors.getTempC(deviceAddress);
//Serial.print(“Temp C: “);

char Vorlauf[30];

lcd.drawText(15, 10, “Temperatur aussen”, 1, RGB( 0,255, 0), RGB(0, 0, 0));
lcd.drawText(15, 20, Vorlauf, 9, RGB( 255, 255, 255), RGB(0, 0, 0));

//lcd.drawTextPGM(5,10,PSTR(“VL Temp:=”),RGB(0,0,255),RGB(255,0,0));


void loop(void)

Serial.print(“Requesting temperatures…”);

digitalWrite(ledPin1, HIGH);
digitalWrite(ledPin1, LOW);


void printAddress(DeviceAddress deviceAddress)
for (uint8_t i = 0; i < 8; i++)
if (deviceAddress[i] < 16) Serial.print(“0″);
Serial.print(deviceAddress[i], HEX);


and here´s a picture of the system running:

Foto am 23.01.14 um 21.29

Code updated for Arduino 1.0.1

2013 Mai 16
by Jan

Hey all, just wanted to say that i updated the code so it compiles and uploads in the 1.0.1 IDE. The Arduino guys changed the function name “Client” to “EthernetClient” in the ethernet libraries, and i had to get the updates library for the Dallas Temperature sensors. Miles Burton is doing a good job with this:

Here’s the Code. It reads the sensor data, connects to the server and sends the data nicely.

#include //library for ethernet functions
#include //library for temperature sensors
#include //library for the onewire bus

#define Client EthernetClient
#define ONE_WIRE_BUS 7


New Arduino Code for DS18B20 and MySQL

2010 Juli 20
by Jan


I just cleaned the code a little bit. Here´s the new code which will work better. It stops somehow after ~18h, and i think it has something to do with an overflow in the variable which stores the “delay”…will work this out later. Here´s the code:

#include <Ethernet.h>           //library for ethernet functions
#include <Client.h>             //library for client functions
#include <DallasTemperature.h>  //library for temperature sensors
#include <OneWire.h>            //library for the onewire bus

Drawing of the system

2010 Juli 5

Hey People,

Had no time to really get into the code, especially because i have to do some html/php and i´m not yet very experienced. But the project is in my thougths every day. I should be learning very hard but i only make 4-5hrs a day… In the remaining time i´m thinking about concepts for new projects (beside sports and friends) , like a giant 8×8 RGB-Matrix like Richard Kline did here (seen on

I really would like to use an rainbowduino for this, but i didn´t found anything about “external” RGB-matrices in the rainbowduino-sphere…

read more…

Sending temperature data from the arduino to a server

2010 Juni 24

Hey, folks.

Today i finished somewhat of a 0.8 version of my attempt to read temperature data from several DS18B20 temperature sensors with the arduino and to send them to my “kitchenserver”. Why kitchenserver? Because its running all night long and therefore had to go to kitchen.

What is my goal?

To read temperature data and store it in a database for further processing.

My father always says: “Die Sprache des Ingenieurs ist die Zeichnung” what means as much as ” the language of an engineer is drawings” so i made a little “graphic”:


Edit: I found out that my first code is only working for one sensor, due to some Arduino->PHP inconsistencies (Arduino called the script for every temperature, but script wants to write all data in one call) So I rewrote the code to send all temperatures in one call. I have now 5 sensors up and running and storing data to my database. I would try the setup with more sensors but i have only 5 of them so i first have to buy some. If you want to build a system like this, use the newer code, the old code is only for educational purposes now ;)

read more…