Saturday, October 11, 2014

RFduino / BLED112 / DS18B20 Temperature Demo

This is another simple temperature monitor.  It uses a DS18B20 sensor which is connected to the RFduino over a 1-Wire bus.  It also adds red and blue LEDs that supply status. 

The red LED blinks unless an error is detected at which time it turns on solid.  The blue LED turns on when a connection is made to the temperature monitor and blinks 5 times if a new temperature is detected.

Below is a mock up of the breadboard temperature monitor and a circuit diagram produced using the fritzing package.

TemperatureDS18B20Project_bb

TemperatureDS18B20Project_schem

If you don’t already have the OneWire library information on it can be found here on the Arduino site which directs you to Paul Stofffregen’s site.  To install download the zip file and then copy to your RFduino libraries directory.  On my system this directory is located at C:\Program Files (x86)\arduino-1.5.7\hardware\arduino\RFduino\libraries.  On your system this will be dependent on where your Arduino IDE with RFduino support is located.

The files for the DS18B20 demo are located here.  This demo uses the same windows program as the TMP007 demo which can be found here in the dhRFduino repository on GitHub.

The LEDs are controlled by setting that are located in the RFduinoBLE_onConnect and RFduinoBLE_onDisconnect routines.  These routines are called when a connection is established to the RFduino and when that connection is terminated.

2 comments:

Anonymous said...

Hi,
really nice tutorial! I tried to reproduce it but I can't compile the code. Did you somehow modify the OneWire.h. In some forum people to suggest that it needs some fixing, but that did not help either.

http://forum.pjrc.com/threads/25673-Teensy-3-1-and-OneWire-library-issue-errors-when-compiling-new-user

Thanks,
Jens

Arduino: 1.5.7 (Mac OS X), Board: "RFduino"

In file included from DS18B20Demo.ino:1:0:
/Users/jens/Documents/Arduino/libraries/OneWire/OneWire.h:108:2: error: #error "Please define I/O register types here"
#error "Please define I/O register types here"
^
/Users/jens/Documents/Arduino/libraries/OneWire/OneWire.h:115:5: error: 'IO_REG_TYPE' does not name a type
IO_REG_TYPE bitmask;
^
/Users/jens/Documents/Arduino/libraries/OneWire/OneWire.h:116:14: error: 'IO_REG_TYPE' does not name a type
volatile IO_REG_TYPE *baseReg;
^

Temperature Monitor said...

This is another simple temperature monitor. It uses a DS18B20 sensor which is connected to the RFduino over a 1-Wire bus. It also adds red ... tempmonitor.blogspot.com