Emulate DS18b20 Temperature Sensor using Arduino

I currently doing a project which Arduino Pro Mini read temperature from DS18b20 and send it to Arduino UNO and Aduino UNO will transmit the temperature to one wire master device which is Teltonika.

The Arduino Pro Mini working well in reading temperature and sending to Arduino UNO.

But on the Arduino UNO side, I try to use a DS18b20 Temperature Sensor emulator to communicate with the one wire master device. The temperature that I set is able to show on the server.

But the only problem is the code only can emulate int number instead of float number. Since I want the temperature to be more accurate, this is not allow to me.

The emulator code and library files are attached below.

So, I hope some one can help me on implement float temperature using one wire protocol.

Thank you.

Regards,
Nick

DS18B20Emulator.ino (2.16 KB)

LowLevel.h (4.2 KB)

OneWireSlave.h (4.05 KB)

Why can't you send just the information received from the sensor? Should the information be sent in binary or text form?

Which emulator library are you using? There is the prjc one and a couple of others on github.

DrDiettrich: Why can't you send just the information received from the sensor? Should the information be sent in binary or text form?

Because one wire protocol has it own reading method, it is quite difficult for me to send what I read from sensor to one wire master device. So that's why I try to look for some emulator and embed the temperature that sensor sense into the emulator.

rw950431: Which emulator library are you using? There is the prjc one and a couple of others on github.

I don't know which library I am using, I found the emulator and library from this forum. I have attached the code and library in my post. Or do you have any recommendation of library that works better in emulating DS18b20? Hope you can help me. Thank you.

You have to write into SCRATCHPAD[] exactly that information, which the other device (master) expects. Actually the master expects 2 bytes, containing the low and high part of the temperature. Sending other (float...) values will confuse that master.

You seem not to read the temperature from your sensor, right now. Implement that part, too, then copy the information from the receiver SCRATCHPAD to the sender SCRATCHPAD.

You have to write into SCRATCHPAD exactly that information, which the other device (master) expects. Actually the master expects 2 bytes, containing the low and high part of the temperature. Sending other (float…) values will confuse that master.

You seem not to read the temperature from your sensor, right now. Implement that part, too, then copy the information from the receiver SCRATCHPAD to the sender SCRATCHPAD.

Sorry for replying late and thanks for your reply. Actually my project is to read temperature from sensor and send the temperature wirelessly to another Arduino and this Arduino will push the temperature to the one wire master device. This is to skip the wiring part from sensor to master device.

So does it means I just need to focus on the scratchpad?

Also, I have a new type of master device that provide 1 wire power. I’m struggling with the connection between Arduino and the master device, since 1 wire power is included. Please help me on this as well.

Thank you.

Regards,
Nick

The previous master device did not include 1 wire power, and when I straight away connect the Arduino 1 wire pin to 1 wire data of master device, it was working well. But now the 1 wire power included the connection seems like not functioning.

I tried to connect the DS18B20 sensor to the new 1 wire master device using parasite with an external resistor, master device is able to read the temperature.

So that’s why I struggling with the connection between Arduino and new 1 wire master device.

Regards,
Nick

My YouTube video #28 deals with the DS18B20 and the one wire system in some detail. Have a look to see if it helps you. URL in the signature of this post.

Hi,

I went through all your comments, right now I'm working on the same wireless transmission and got stuck at how to use arduino to send the data to teltonika. Hope you can help me with this issue as you already have some experience in it.

Regards, ShanmukhaGanesh.

Somebody has learned to emulate DS18b20 Temperature Sensor using Arduino for Teltonika or other device ?