View Single Post
Old 10-09-14, 02:00 AM   #14
SDMCF
Apprentice EcoRenovator
 
Join Date: Jul 2014
Location: Finland
Posts: 125
Thanks: 5
Thanked 35 Times in 34 Posts
Default

Quote:
Originally Posted by jeff5may View Post
Im working on a sketch for a universal heat pump and temperature controller in another thread. I'm having issues with the way to read and store multiple one wire sensors. Can you elaborate on the method you're using? I'm trying to save as much memory as possible.
If you are trying to save as much memory as possible you are probably more advanced than I am because I am not concerned with optimising anything yet. So I can't claim any memory efficiency for my code.

I tried (and failed) with a couple of different approaches to the 1-wire stuff before I found Arduino 1-Wire Tutorial which I was able to use.

The libraries I use are OneWire.h version 2.1 and DallasTemperature.h version 3.7.2

A sketch called Multiple.ino supplied with the DalasTemperature library works as expected with 0, 1 or 2 sensors. I have not tried using more than 2 sensors.

The supplied sketch has hard-coded device addresses which is not ideal, but it will get you started.

I am currently using code that finds the device addresses and resolutions of all sensors attached to the 1-wire bus, which is better. I can post that code at the weekend if you want it.

However, I still have the names of my devices hard-coded, so I have to know which one will be found first in order to correctly identify them as fridge or freezer. Eventually I will make it possible to assign temperature sensor locations via the user interface, but I am not at that stage yet.
SDMCF is offline   Reply With Quote