Monitor for central heating system (e.g. 2zones+hw) Supports up to 15 temp probes (DS18B20/DS18S20) 3 valve monitors Gas pulse meter recording Use stand-alone or with nodeEnergyServer See http://robdobson.com/2015/09/central-heating-monitor

Dependencies:   EthernetInterfacePlusHostname NTPClient Onewire RdWebServer SDFileSystem-RTOS mbed-rtos mbed-src

Committer:
Bobty
Date:
Fri Oct 16 09:07:04 2015 +0000
Revision:
23:fd5a5a9f30bc
Parent:
20:7933076df5af
Added index.html file to project for completeness

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Bobty 8:5980547ae71c 1 // Handles OneWire temperature sensors DB18S20
Bobty 8:5980547ae71c 2 // Can handle multiple devices per pin
Bobty 8:5980547ae71c 3 // Rob Dobson, 2015
Bobty 8:5980547ae71c 4
Bobty 8:5980547ae71c 5 #ifndef RdDS18B20__H
Bobty 8:5980547ae71c 6 #define RdDS18B20__H
Bobty 8:5980547ae71c 7
Bobty 8:5980547ae71c 8 #include "mbed.h"
Bobty 8:5980547ae71c 9 #include "Onewire.h"
Bobty 20:7933076df5af 10 #include "Logger.h"
Bobty 8:5980547ae71c 11
Bobty 8:5980547ae71c 12 class DS18B20
Bobty 8:5980547ae71c 13 {
Bobty 8:5980547ae71c 14 public:
Bobty 20:7933076df5af 15 DS18B20(PinName mbedPin, Logger &logger);
Bobty 8:5980547ae71c 16 void ReqConvert();
Bobty 9:0e103c2f869a 17 double ReadTemperature(int addrIdx);
Bobty 20:7933076df5af 18 void DebugGetAddress(int addrIdx, char* buf);
Bobty 16:89778849e9f7 19 int SearchToGetAddresses();
Bobty 8:5980547ae71c 20 int GetNumAddresses()
Bobty 8:5980547ae71c 21 {
Bobty 8:5980547ae71c 22 return _numValidAddresses;
Bobty 8:5980547ae71c 23 }
Bobty 9:0e103c2f869a 24 uint8_t* GetAddress(int addrIdx, uint8_t* addrBufPtr);
Bobty 8:5980547ae71c 25 char* GetAddressStr(int addrIdx);
Bobty 9:0e103c2f869a 26 double GetLatestTemperature(int addrIdx, time_t& timeOfReading);
Bobty 9:0e103c2f869a 27
Bobty 9:0e103c2f869a 28 static const int ONEWIRE_ADDR_STRLEN = 3 * ONEWIRE_ADDR_BYTES + 1;
Bobty 9:0e103c2f869a 29 static const int MAX_BUS_DEVICES = 8;
Bobty 9:0e103c2f869a 30
Bobty 9:0e103c2f869a 31 static const int INVALID_TEMPERATURE = -1000.0;
Bobty 8:5980547ae71c 32
Bobty 8:5980547ae71c 33 private:
Bobty 8:5980547ae71c 34 int _numValidAddresses;
Bobty 8:5980547ae71c 35 uint8_t _addrTable[MAX_BUS_DEVICES][ONEWIRE_ADDR_BYTES];
Bobty 9:0e103c2f869a 36 double _temperatureTable[MAX_BUS_DEVICES];
Bobty 9:0e103c2f869a 37 time_t _timeOfReadingTable[MAX_BUS_DEVICES];
Bobty 8:5980547ae71c 38 Onewire _oneWire;
Bobty 9:0e103c2f869a 39 char _addrStr[ONEWIRE_ADDR_STRLEN];
Bobty 20:7933076df5af 40 Logger &_logger;
Bobty 20:7933076df5af 41 char* GetChipId(int val);
Bobty 20:7933076df5af 42
Bobty 8:5980547ae71c 43 };
Bobty 8:5980547ae71c 44
Bobty 8:5980547ae71c 45 #endif