Jump to content

Logging from DS18B20s


TerryE

Recommended Posts

I've just done anothe glide with a mixed bad of the themos and slope / intercept corrections from my calibration runs and getting a 1-sigma of 0.02°C compared to the basket averages of the measures on the glide.  I can live with that :)  And yes, I know I should multiply this by 8/7 since its a sample variance but this is just a ball park -- they are really accurate.

Link to comment
Share on other sites

On 29/03/2017 at 23:04, SteamyTea said:

 ... If they are made under license ...

 

I don't know, but if we start on that line of argument then we would have to empty most of the content of the British Museum.  Did we really have a licence for taking the Elgin Marbles or our sack of the Imperial Summer Palace? ... US (and UK) copyright law is bizarre, IMO.  We see patents for the bleeding obvious.  I've seem so many huge abuses of this system over my career -- the situation where knowledge has been widely circulating for years and that has been picked up by someone who dots the i's and and then files a patent.  Case in point: Penicillin, initially discovered by a Brit, all of the main development work by an Australian leading a British development team, but the patents were all held by the US pharmaceutical company that did  the production work.  I don't want to belittle what Pfizer achieved, but it benefited because it was building on knowledge created / identified by people who felt this work was sufficiently important that it belonged to the commons.

 

All of computing; the existence of the technology and sciences is based on the work of a young undergrad at Kings Cambridge who basically invented the formal foundation of the whole domain in the early 1930s.  Has Kings, the UK or even Turing's family ever benefited from this -- financially that is?

 

OK, the OW protocol is a nice protocol.  The DS18B20 is a nice use, but not "rocket science".  Do I think that the Chinese clones have pinched any engineering know-how from Maxim? No, IMO.  What they have done is to manufacture silicon which does the same job using the same S/W interface for compatibility.  So I will happily use the Chinese versions.  This is a commercial not a moral issue, and Maxim has commercial mechanisms available to it, if it feels wronged.  Not my job.

 

PS.  Nick, I've just pulled out my last tongue stitch and had one glass too many of wine!  Sorry.

Edited by TerryE
Grammitcal edits to keep jack happy
Link to comment
Share on other sites

I thought it was Ada Lovelace that was the mother of computing.

I am personally not interested about the legalities of copyright and patents, that is for people that lack imagination.  I developed a plastics system that overcame a problem, tried to sell it, no one was interested. So quite happy to take that to the grave. Not as if it is life changing, unless your boat or aeroplane fails.

Much more interesting what you can do with 'others' inventions.

 

I once bit a chunk out of my tongue, took about 3 weeks to sort itself out. I am still careful when I eat anything chewy.

Edited by SteamyTea
Link to comment
Share on other sites

7 hours ago, TerryE said:

I don't know, bu f the start one that line of argument ...

 

PS.  Nick, I've just pulled out my last tongue stitch and had one glass too many of wine!  Sorry.

 

Ha!  Given the number of typos in your opening line and the time you posted, I did wonder whether there'd been a wee dram involved! :D  Definitely worth doing now and then!

 

Glad to hear the stitch is out.  How's it looking (no pics, please!)

 

7 hours ago, TerryE said:

We see patents for the bleeding obvious.  

 

Most smart people consider most patents in their industry obvious.

 

7 hours ago, TerryE said:

Case in point: Penicillin, initially discovered by a Brit, all of the main development work by an Australian leading a British development team, but the patents were all held by the US pharmaceutical company that did  the production work.  I don't want to belittle what Pfizer achieved, but it benefited because it was building on knowledge created / identified by people who felt this work was sufficiently important that it belonged to the commons.

 

I don't know the history of penicillin patents, but if a patent was available, Fleming (or those who developed the production processes) should have pursued one.  Universities didn't really "do" patents back then though.

 

The penicillin story is fascinating.  I think people assume Fleming did a load of work, but he actually did very little beyond the initial discovery and journal article.

 

7 hours ago, TerryE said:

OK, the OW protocol is a nice protocol.  The DS18B20 is a nice use, but not "rocket science".  Do I think that the Chinese clone have pinched any engineering know-how from Maxim? No, IMO.  What they have done is to manufacture silicon which does the same job using the same S/W interface for compatibility.  So I will happily use the Chinese versions.  This is a commercial not a moral issue, and Maixm has commercial mechanisms available to it if it feels wronged.  Not my job.

 

Maxim may also have rights in things like the circuit layout or the copyright in the code that runs on the device.  If those weren't copied, then they haven't infringed anyone's rights (assuming no patents).

Link to comment
Share on other sites

I've just kicked off an overnight calibration run with my Wemos ESP module logging 15 thermometers in parallel.  The cooling glass trick is very useful to produce a nice temperature glide for relative calibration purposes.

Link to comment
Share on other sites

Should really be repeated about 20 times though (not that I think it actually matters for these).

Until an experiment has been repeated several times, it is hard to know if a run was a fluke, or a true reading.

20 runs and you can get a confidence of about 5%.

Link to comment
Share on other sites

@SteamyTea Nick, I've actually done a few runs now, including shuffling the cans in the bundle just to make sure that there aren't any material differentials for the probes on the outside of the bundles.  My test rig went through a number of refinement steps and I now have enough confidence that the test rig is working well.

  • Having the water in a heavy tumbler starting as ~35-40°C and naturally cooling to room temperature over 6hrs or so is enough to generate a stable temperature glide that allows you do fit linear regression curves to the XY plots.  Letting the water cool naturally at this ~1-2°C per hour is slow enough that the internal temperature gradients within the tumbler are smooth and there is no material internal convection.
  • Tying the probes in a tight bundle around the fat part of the sleeve overlapping the can keeps them at the centre of the water mass but with 1-2mm separation between cans
  • Sitting the bundle in a metal eggcup keeps it clear of the glass surfaces and at the centre of the slowly cooling water mass.
  • There is little point in over sampling, so I take one set of readings every 5 mins, and log the average reading, pus the error against average for each individual probe as a tab-separated listing.
  • I can then cut and past this log output directly into Calc (or Excel ...) for XY plotting and calculating linear fit using the slope and intercept functions.  These calibration results are stable to <0.02°C from run to run, so I have confidence that the readings adjusted by this calibration data are mutually accurate to this sort of precision.

And just for interest to give you a flavour of what coding this ESP8266 chip in Lua is like, here is the small program which logs the tab separated results to the USB serial comms port.  I could have logged this to a UDP listener socket on my PC  instead with another few lines of code, but USB was easier in this instance:

-- make the timers global so I can stop them from the IDE.
tmr1,tmr2 = tmr.create(), tmr.create()

local ds = require("ds18b20")
local to_string, print, gpio2 = ds.to_string, print, 4
local saddr, addrs = {}
local tmr1,tmr2 = tmr1,tmr2

ds.init(gpio2)
addrs = ds.get_addrs()

if addrs and #addrs > 0 then
  local n = #addrs
  for i = 1, n do saddr[i] = to_string(addrs[i]) end
  print("Avg", unpack(saddr))
  
  tmr1:register(1000, tmr.ALARM_SEMI, function()
    local t,avg  = {}, 0
    
    for i = 1, n do 
      t[i] = ds.read(addrs[i]) 
      avg = avg + t[i]
    end
    
    avg = avg / n
    
    for i = 1, n do 
      t[i] =  ("%8.3f"):format(avg - t[i])
    end

    print(("%8.3f"):format(avg), unpack(t))
    
    if avg < 20 then
      print(("Stopinng at %8.3f"):format(avg))
      tmr2:stop() 
    end
  end)
  
  tmr2:alarm(300000, tmr.ALARM_AUTO, function()
    ds.convert_T(true)
    tmr1:start()
  end)

else
  print("No OW thermometers found")
end

 

  • Like 1
Link to comment
Share on other sites

  • 7 months later...

As a footnote to this thread, I've now got my cheap Chinese DS18B20s installed in my heating system, so for example I monitor the UFH and the slab by using aluminium foil to wrap and secure the canned DS18B20s to the PexAlPex pipes about 10cm from the manifold fitting, and then secured the foil in place with aluminium tape.  I also cut an internal slots in the pipe lagging so that the Thermo is intimate the UFH pipe and surrounded by lagging.

 

When running the water on loop without heat the thermometers all stabilise to within 0.2°C of each other, so the thermometers seem more accurate than my calibration process, Using the delta from the average circulation temperature as a trim adjustment seems to give extremely consistent results with the thermometers being agreement to better than 0.1°C. 

  • Like 1
Link to comment
Share on other sites

On 3/31/2017 at 01:30, TerryE said:

I've just kicked off an overnight calibration run with my Wemos ESP module logging 15 thermometers in parallel.  The cooling glass trick is very useful to produce a nice temperature glide for relative calibration purposes.

 

With some form of multi-plexor? The D1 mini only has 11 digital inputs so I'm wondering how you did this.

Link to comment
Share on other sites

21 hours ago, readiescards said:

 

With some form of multi-plexor? The D1 mini only has 11 digital inputs so I'm wondering how you did this.

 

Yes. The onewire architecture used by the DS18B20s is a bus architecture. You can daisy chain dozens of thermometers off a single IO pin. The protocol enables the master to enumerate all device addresses and then it can send commands to all, e.g. "start a temperature measurement" or individually "thermometer XXX, give me your reading". Each thermometer has a unique address.

 

Likewise I²C is a bus architecture using 2 IO pins.  The ESP can only drive 3.3V @ 10mA, but the Crydom relays need a TTL level at a minimum (5V 40mA) so I use an MCP23008 IO multiplexor to generate these TTL level outputs. This hangs off in I²C bus so this is a 4 outputs (in case) for 2 pins as well. I could drive 32 IO pins off a single I²C bus this way, but I don't need to.

 

So yes, in fact a single ESP module easily has enough IOs to do what I need.

 

  • Like 1
Link to comment
Share on other sites

  • 7 months later...
On 24/03/2017 at 11:00, TerryE said:

usually use an esp8266 module called the Wemos D1 or pro variant

Are you out there Terry? Just got sorted on the sensors and the Wemos D1 Pro board is on its way, which Arduino IDE / bolt on do I need?

Link to comment
Share on other sites

You can set the Wemos up with a USB cable and a PC.

In Micropython all drivers for 1Wire and DHTs are already done.  I think there are quite a few more as well.

I keep meaning to get back to sorting mine out.  All that was left to do was to get it to save the data somewhere else.  Which should be fairly simple, but as it is Linux, it is probably not.

Link to comment
Share on other sites

29 minutes ago, SteamyTea said:

In Micropython all drivers for 1Wire and DHTs are already done.

 

And a lot more in Lua if you want to go that route ?  You can bread board  everything up, but as you have seen from earlier posts, I just use perfboard for my project boards, and a couple of headers to take my Wemos Module.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...