PDA

View Full Version : OneWire plugin



khun
February 9th, 2013, 01:01 PM
Hi!

I think I'm almost there! I can call:

table.print(OneWire.DeviceList())

and see all my DS1822 temperature sensors listed. But when I then call:

print("Temperature" .. OneWire.GetTemperature("9600000030323822"))

I get the error: attempt to concatenate a nil value.

I have checked the id over and over and it is copied directly from the output of devices, so I'm sure it is correct. What else can be wrong?

khun
February 10th, 2013, 05:40 AM
Since no one answered, I dug into the source code of the plugin, which Marcel provided along with the plugin. I found out that although the DS1822 is supported in the listing of devices, it is not supported for temperature reading.

I was able to fix this in the code and can now read the temperatures. Quite important for me, since I already have 4 tenants waiting for a heat control system to come in place and have placed DS1822's in all the smoke alarms in the house. An operation I'm not very eager to have to redo. Of course, I should have checked if the sensors worked with Girder before I installed so many! But I was confident that it was _possible_ and luckily it was :-)

But now the question arises: how do I distribute this upgrade of the plugin, so the Girder community also can take advantage of it? And hopefully without stepping on any toes of the people who did the real work here, finding out the basic principles in the first place...

Best regards,

Knut

gravy
February 16th, 2013, 11:00 AM
Great work, Knut! I would start by attaching it to this thread, and maybe PM Ron to see where it can be posted.

I have a bunch of 1Wire stuff that I would love to integrate into Girder.

khun
February 17th, 2013, 04:23 AM
Hm, seems I can't upload dll's? I get an error about invalid file...

I'll check into the possibility of creating a Sourceforge project of this. I got a go from Marcel on using his code however I like. Thanks to him for that!

Best regards,

Knut

khun
February 17th, 2013, 06:37 AM
Ok, I have created a Sourceforge project now (my first!). If you go to http://sourceforge.net/projects/girderonewirepl/files/Plugin/ you can download the latest dll.

I will tidy up the sourcecode a little before I upload it, be patient :-)

gravy
February 18th, 2013, 10:10 AM
Ok, I have created a Sourceforge project now (my first!). If you go to http://sourceforge.net/projects/girderonewirepl/files/Plugin/ you can download the latest dll.

I will tidy up the sourcecode a little before I upload it, be patient :-)

Plugin works just as advertised - thanks! For anyone else, I just had to download the Windows 7 64 Bit 1-Wire drivers, run "SETPRT" from the install directory to configure the right comport for my USB 1-Wire device, then install and enable the 1-Wire Plugin in girder.

To get the temperatures of the 2 probes, i created a script event:


table.print(OneWire.DeviceList())
print("Temperature Probe #1" .. OneWire.GetTemperature("870000035300C628"))
print("Temperature Probe #2" .. OneWire.GetTemperature("F300000353000328"))


which results in:



{ -- #0
[1] = { -- #1
["name"] = "DS18B20",
["address"] = "870000035300C628",
["description"] = "Digital thermometer measures temperatures from -55C to 125C in 0.75 seconds (max). +/- 0.5C accuracy between -10C and 85C. Thermometer resolution is programmable at 9, 10, 11, and 12 bits. ",
["alternatenames"] = "Programmable Resolution Digital Thermometer,DS1820B,DS18B20X",
} -- #1,
[2] = { -- #2
["name"] = "DS18B20",
["address"] = "F300000353000328",
["description"] = "Digital thermometer measures temperatures from -55C to 125C in 0.75 seconds (max). +/- 0.5C accuracy between -10C and 85C. Thermometer resolution is programmable at 9, 10, 11, and 12 bits. ",
["alternatenames"] = "Programmable Resolution Digital Thermometer,DS1820B,DS18B20X",
} -- #2,
} -- #0
Temperature32.0625
Temperature28.8125


Thanks Marcel and khun!