Multiple ds18b20 on Emontx3.4

I spend my saturday afternoon to try to set up one Emontx3.4 firmware with 4 ds18b20 temperature sensor, but with no result....:-(((

 

Some suggestions ??

 

Thanks

Robert Wall's picture

Re: Multiple ds18b20 on Emontx3.4

Look at https://github.com/openenergymonitor/emonTxFirmware/blob/master/emonTxV3..., but be certain you change the I/O ports to the correct ones for your emonTx V3.4, because that sketch is for an emonTx V3.2.

Without knowing what you have done, I can't help any more.

truzzman's picture

Re: Multiple ds18b20 on Emontx3.4

Thank for the link, I understood all and now my four sensor are working.

First mod the payloadTX (line 80)

typedef struct { int power1, power2, power3, power4, Vrms, temp1, temp2, temp3, temp4; } PayloadTX;

Then I create four float to store temp value from array of sensors (deleted line 364 that call only sensor array position [0])

float temp1=(sensors.getTempC(allAddress[0]));
float temp2=(sensors.getTempC(allAddress[1]));
float temp3=(sensors.getTempC(allAddress[2]));
float temp4=(sensors.getTempC(allAddress[3]));

 

Control of value range and sending value to payload as in the original line 366 but changing the name of variable (the same also for temp2, temp 3 and temp4)

if ((temp1<125.0) && (temp1>-40.0)) emontx.temp1=(temp1*10);

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.