Connecting DS18B20 temperature sensor to emonTx shield

I’m using an emonTx shield with an Arduino Uno v3. I can’t find any documentation about which of the three wires (red, black, white) on the sensor go into which holes. I also don’t see any examples about reading the temp while I read the power values. Any advice?

There is an article in Resources > Building Blocks that details the connections.

I had not noticed, but there is indeed no sketch for the emonTx Shield that measures temperature. You’ll need to look at one of the emonTx (non-shield) sketches and graft into your sketch the temperature parts from that. I don’t have a Shield nor an Arduino, so although it wouldn’t be too hard to graft the appropriate parts into a Shield sketch, I wouldn’t be able to test it.

(You’ll probably need the circuit diagrams from the Wikis to check the I/O pins etc.)

I’ve found the connection information. Does the emonTx shield already have the 4.7K resistor installed?

Yes, it does. It’s R24. See schematic.

I have just connected up a temp probe to my TX Shield but i think i need to change to a new Sketch with the temp sensor code in it. Which sketch should i use as the current volts one i am using does not at the moment include the temp code?
Will any of the EmonTX V2 or V3 sketches work with the TX shield?

Unfortunately, there isn’t a sketch for the Shield that incorporates temperature sensing. So a little work is needed.

I suggest you start with the sketch that you have, and incorporate the temperature sensing code from one of the emonTx V3 sketches. That will probably be easier, quicker and safer than stripping the unnecessary parts (DIP switches etc) out of the emonTx sketch to convert it.
I think everything you need either has “temp”, “sensors” or “DS18B20” in the name or in a nearby comment - but you don’t need (unless you implement it yourself via an output) the power switching for the sensors.

Ask again if you run into problems.

ThanksRobert for the information, i will investigate further over the weekend to see if i can build a new sketch by adding in the extra sections of code.

I’m afraid that if I do it, I can’t test because I have neither Arduino nor Shield.

I know this is an old topic but I wanted to do this recently. With some help from a friend in work we cropped out the code from the emontx discreate monitoring sketch and implemented it into the emonsheild sketch and works.

If anyone needs the code I would be happy to share it. :slight_smile:

cheers

Gareth

The RFM Native version of the emonTx Shield sketch already includes temperature measurement.

Hi,

Thanks for your reply.

Not sure where you are looking.?

None of these firmware examples include temperature measurment.

Could you share a link please?

Thanks

Gareth

As it stands, the emonTx Shield sketch listed there is not compatible with the emonPi running with JeeLib, but it would probably have been easier to start with this and swap the RFM Native library (rfm69nTxLib) for the ‘old standard’ library (rfmTxLib) which is compatible with the older emonPi/emonBase.

Thanks.

So just to confirm. I could have used my emontx- shield with firmware EmonTxShieldCM_rfm69n.ino if im using a emon base as a Rpi3? And the temp measurment would have worked?

The problem is, and as explained in my post, until the emonPiCM software was launched, the emonPi could not do continuous monitoring because the demands of JeeLib to handle incoming messages meant it couldn’t keep up. The emonPiCM uses a different radio message format, so it’s incompatible with everything OEM has done from the start. And that is why there’s a whole raft of new sketches, each with “rfm69n” in the name.

If your (discrete sample) Shield sketch works for you, that’s fine. If you wanted the latest CM version for the Shield and temperature monitoring but didn’t want to change your emonPi (or emonBase) software, then swapping libraries would have been the easiest route.