I want to messure temp from 5 diffrent sensor.
I can get one sensor temp.
I can also connect 5sensor and i se that the serial monitor see that 5 i connected.
But i can not get them printet to emoncms or in serial monitor with any temperatur. I just get temø from one sensor.
Anyone that can give me a hint og an example sketch for sensing and sending more than one ds18b20 sensor?
Re: multiple ds18b20 emontx v3
A quick look at the default sketch for the emonTx V3 tells me that it will send only one temperature. You must change the sketch so that it sends all 5 temperatures.
What to change:
In
add the extra temperatures ... Vrms, temp0, temp1, temp2, temp3, temp4; }
In the conditional if (DS18B20_STATUS==1) { .... } where it reads the temperature sensor, you must do this 5 times:
then convert the temperatures 5 times and put them into the struct
This is not the best way to do it but the simplest to explain, and it should work - I don't have 5 sensors to test with!
Re: multiple ds18b20 emontx v3
tnx robert.
I tested your guide and it works ok with 4 sensor. but with 5sensor connected the debug serial output that its find 5 ds18b20 but only give me messurements on 4 sensor. the last one is 0in temp.
Is there anyting that wrong in this sketch that does not give me the last reading on the sensor.
the sketch i attached.
Re: multiple ds18b20 emontx v3
Ah! I missed this bit - sorry:
That appears to be an artificial limit, the library indicates it is good to 64 devices on the same bus. I suggest you increase the array to 5 x 8.
But it may be a good idea to check the free memory - for that you need the "MemoryFree" library.
Re: multiple ds18b20 emontx v3
tnx again for the help Robert.
I had allready change that array, but the fault was that the serial console did not come with any signal on that sensor. but the emoncms gets it :).
As you maybe know im not good in this but learning. tnx again for a good tips and guides.
im now searching info about that memoryfree and how to get that work.
Re: multiple ds18b20 emontx v3
I cannot see a good reason why the serial monitor did not show the last temperature, unless it was low on memory. You could save some memory by doing this:
if (debug==1)
{
Serial.print("temperature1: "); Serial.println(emontx.temp*0.1);
Serial.print("temperature2: "); Serial.println(emontx.temp1*0.1);
Serial.print("temperature3: "); Serial.println(emontx.temp2*0.1);
Serial.print("temperature4: "); Serial.println(emontx.temp3*0.1);
Serial.print("temperature5: "); Serial.println(emontx.temp4*0.1);
delay(100);
}
You might also save some memory by using an array instead of 5 separate variables for the temperature, and then process them in loops:
...