1. day at the office

First of all we would like to introduce to the problem.

The case is to make a device capable of monitoring temperature i cold room facilities in Ethiopia. In these cold stores is often kept life saving immunization vaccines. The vaccines are, besides being life saving, as well very expensive to why Unicef wishes these to be kept in the right temperature condition.

We have spent the first working day in the “workshop” creating a simple but working mock-up with tree independent temperature sensors pushing data to a computer.

Below is a block diagram of the setup

Arduino: Arduino UNO
Temperature sensor: DS18B20

Skærmbillede 2013-02-08 kl. 16.20.52foto

The arduino based code


#include <OneWire.h>
#include <DallasTemperature.h>

// Data wire is plugged into pin 2 on the Arduino
#define ONE_WIRE_BUS 3
#define TEMPERATURE_PRECISION 12
// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
OneWire oneWire(ONE_WIRE_BUS);

// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);
DeviceAddress ther1, ther2, ther3;

void setup(void)
{
 // start serial port
 Serial.begin(9600);

// Start up the library
 sensors.begin(); // IC Default 9 bit. If you have troubles consider upping it 12. Ups the delay giving the IC more time to process the temperature measurement
 sensors.setResolution(ther1, TEMPERATURE_PRECISION);
 sensors.setResolution(ther2, TEMPERATURE_PRECISION);
 sensors.setResolution(ther3, TEMPERATURE_PRECISION);
}
void loop(void)
{
 // call sensors.requestTemperatures() to issue a global temperature
 // request to all devices on the bus
 Serial.print("Requesting temperatures...");
 sensors.requestTemperatures(); // Send the command to get temperatures
 Serial.println("DONE");

 Serial.print("Temperature for Device 1 is: ");
 Serial.print(sensors.getTempCByIndex(0)); // Why "byIndex"? You can have more than one IC on the same bus. 0 refers to the first IC on the wire
 Serial.println();
 Serial.print("Temperature for Device 2 is: ");
 Serial.print(sensors.getTempCByIndex(1));
 Serial.println();
 Serial.print("Temperature for Device 3 is: ");
 Serial.print(sensors.getTempCByIndex(2));
 Serial.println();

 delay(5000);

}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s