Temperature measurement on hahnodes

7 replies [Last post]
kim
Offline
Throwleigh, United Kingdom
Joined: 1 Dec 2010

Got my second hahnode working - I thought I would connect it to the hot water tank.

It works however I get a flip from +51degrees to -51 degrees as you can see from the 

24 hour track on https://cosm.com/feeds/13194?pachube_redirect=true

Feed number 6

The DS18B20 datasheet says it does -50 to plus 125 degrees celsius.

But the roomnode.lua refers to -50 to +50 so presumably I am going out of range.

I can also see in the change log the following:

 

Allow HAHnodes a temperature offset like
r376.  It does this with toff and toff2 as
part of the HAHnode endpoint
configuartion.  Wiki will need updating
after this has been released.


 So is the solution to put a toff entry somewhere (livebox.ini) to at least get the graph looking right
and then try and find a way to change the -50/+50 range to -20/+80 or somesuch?

Ideas in aid of my crude programming skills much appreciated.

Regards

Kim 

 

brett
Offline
Providence, United States
Joined: 9 Jan 2010
The are only 10 bits assigned

The are only 10 bits assigned to the temperature structure being sent over the RF.  A range of 10 bits [ -2^(n-1) to 2^(n-1)-1 where n in the number of bit ] will give -512 to 511 so our range is -51.2c to 51.1c

This code was not modifed  when forked from the JeeLabs  RoomNode sketch only the PIR logic was fixed.  Really the right solution would be to allocate 12 bits to the temperature giving a range of -204.8 to 204.7 which more than covers the dynamic range of the DS18B20 and them some.

There is no problem with me making the code changes BUT, and this is the big BUT, everybody will need to reflash every room node that they currently have operational at the same time as they upgrade to a later version of the HAH that has this change in the roomnode.lua code.

Hacking with toff and toff2 really isn't the right solution to this problem.

Brett

kim
Offline
Throwleigh, United Kingdom
Joined: 1 Dec 2010
but 11 bits of data?

I understand the point about managing the software for your customers.  I think I have read about this problem 

in other subjects.

So looking more closely at my data this morning - and bearing in mind it is a hot water tank - it seemed to be drifting down nice and slowly whether positive or negative - so I added 2x51.2 to the negative numbers and get the following at the time shown:

 

00:14:24 51.9

00:29:24 51.8

00:44:24 51.7

00:59:25 51.6

01:14:24 51.6

01:29:25 51.5

01:44:25 51.5

01:59:24 51.4

02:14:24 51.3

02:29:24 51.3

02:44:24 51.2

02:59:25 51.2

03:14:24 51.1

03:29:25 51

03:44:24 51

03:59:25 51

04:14:25 50.8

04:29:25 50.8

04:44:25 50.7

04:59:25 50.7

05:14:24 50.6

05:29:25 50.6

05:44:25 50.5

05:59:24 50.5

06:14:24 50.4

06:29:24 50.3

06:44:25 50.2

06:59:24 50.2

07:14:24 50.1

07:29:25 50.1

07:44:24 52.1

07:59:25 53

08:14:24 53

08:29:24 53

08:44:24 53

08:59:24 52.9

09:14:24 52.8

09:29:25 52.8

09:44:24 52.6

09:59:25 52.6

10:14:24 52.6

10:29:25 52.5

10:44:24 52.4

10:59:24 52.4

11:14:24 52.3

11:29:24 52.3

11:44:24 52.2

11:59:24 52.1

12:14:25 52.1

12:29:24 52.1

12:44:24 52

12:59:24 52

13:14:24 51.9

13:29:25 51.8

13:44:24 51.8

13:48:24 51.8

Which is a nice steady downward curve - until the boiler came on at 7.30am.  The reported data flipped at about 3am.
So the sign is "showing" the 11th bit since I have data above 51.2 which seems to make sense?
It also looks like my hot water tank thermostat may be set too low!
Now I have to work out a way to change what is reported to cosm/pachube - which may be an easier task methinks.
Thanks for all your efforts programming and to Derek for his excellent parts delivery.
Regards
Kim 

 

brett
Offline
Providence, United States
Joined: 9 Jan 2010
Here is a solution for you

Here is a solution for you that might work.

Copy the roomNode.lua applet into /etc/plugboard and rename it something like boilerNode.lua

Modify this line in the file and remove the sign bit for the 10 bits of data coming from the Node.

Find This -> local li, mo, hu, te, lo = jeenode.bitslicer(data,8,1,7,-10, 1)

Modify like this -> local li, mo, hu, te, lo = jeenode.bitslicer(data,8,1,7,10, 1)

Modify your jeeNodeApplet.lua and use this newly modifyed node type.

BoilerNode = require("boilerNode").RoomNode

Then you should be able to use it like the standard room node except now the temperature will be in the range 0..102.4C as long as you're boiler is below that limit you should be good.

Brett

kim
Offline
Throwleigh, United Kingdom
Joined: 1 Dec 2010
Brilliant

... thank you very much for that.  I was just working myself up to attempting a lua applet - which of course would not have been as elegant as this method.  I am away for a few days - but will test out upon my return and report back.  Keeping the tank below boiling point should not be a problem!

Regards

 

Kim 

kim
Offline
Throwleigh, United Kingdom
Joined: 1 Dec 2010
Failed :(

 

Well I had a really good go at getting it to work.

So you understand my lack of expertise I shall detail my initial screw ups!

1) Couldn't find a roomNode.lua - decided it must be roomnode.lua - could only find that in code.google on the web

2) Copied it into a file edited with vi - and got loads of html!  Overcame that and then needed the very useful dos2unix program.

3) Eventually remembered the ftp route and got it in that way

4) Read and read your documentation and eventually found the file was in /usr/share/lua/5.1/xap !

5) Followed all the instructions and it didn't work - so decided just to copy the roomnode.lua file into plugboard directory and 

then just change the jeenodeApplet.lua (couldn't find jeeNodeApplet.lua) so the Roomnode line read

Roomnode = require("roomnode").RoomNode - i.e only changing xap.roomnode to just roomnode

6) Get an error as follows - which I can't understand despite much searching

 

lua: /etc/plugboard/jeenodeApplet.lua:9: attempt to index a boolean value

stack traceback:

           /etc/plugboard/jeenodeApplet.lua:9: in main chunk

           [C]: in function 'require'

           /etc_ro_fs/plugboard/plugboard.lua:23: in function 'fun'

           /usr/share/lua/5.1/pl/tablex.lua:365: in function 'foreach'

           /etc_ro_fs/plugboard/plugboard.lua:75: in main chunk

           [C]: ?

7) Above error is typed out - hopefully without errors - don't know how to copy text when using cmd and telnet.

8) either way jeenodeApplet.lua doesn't start - yet all works perfectly when reverting to the "xap.roomnode" text

9) I have checked there is only one plugboard running, killing as appropriate.  Also roomnode.lua is in the same plugboard directory as jeenodeApplet.lua - and I have tried every different name I can think off.

 

So - help! - any ideas most welcome.

 

 

Regards

Kim 

brett
Offline
Providence, United States
Joined: 9 Jan 2010
Kim,You are making a bit of a

Kim,

You are making a bit of a dogs breakfast of my instructions.

They where brief and assumed some knowledge about how things work.  It would seem you are missing this knowledge and perhaps I should have been a little more verbose in my explanation.

At least you had fun trying - now when I give you the solution as files I know you've given it your best effort !

Given I'm not now trying to tell you how to do it as I'm supplying code I've made other changes beyond my instructions to make it more clear.   The jeenodeApplet.lua is for example purposes to show you how the boilernode could be used - don't use it.

If you compare the boilernode.lua with roomnode.lua you'll see there are very minimal changes involved.

  • rename the class from RoomNode to BoilerNode
  • change the module location path as its hosted locally in /etc/plugboard
  • change the 10bits so that the sign bit isn't interpreted

Enjoy, Brett

AttachmentSize
boilernode.lua 1.53 KB
jeenodeApplet.lua 1008 bytes
kim
Offline
Throwleigh, United Kingdom
Joined: 1 Dec 2010
Success ! :)

Got that one straight away - at least when I had once again got over the fact that what you see when you save a file is not always what you get.

The problem with ignorance is that you don't know what you don't know (!?).... and that, unfortunately, included changing the class and the path.

I also didn't know enough to actually put 

BoilerNode = require("boilernode").BoilerNode

instead of

BoilerNode = require("boilernode").RoomNode

in the jeenodeApplet.lua

Now it is all working at https://cosm.com/feeds/13194?pachube_redirect=true , although I am 

going to ask them why the timezone on the feed seems to keep changing.

Thank you very much for your time - off to play now with my two liveboxes - working out what can be moved between them for a distributed system!

Regards

Kim

Hardware Info