DS18B20 simulator

Hi everyone, I would need some arduino program that will behave like the DS18B20 because I am testing a device that uses the DS18B20 sensor. I don't know his code and I need to be able to simulate different temperatures

Why not use a real DS18B20? The one wire interface, I believe, will not be easy to simulate.

I need to change the temperature exactly

I have no idea what you are trying to do or how you propose to do it so I can't be of much help.
I do not know what "behave like the DS18B20" means. Describe in detail what you want to do.

Do you have code? Post the code and describe, in detail, what it actually does and how that differs from what you want. Read the forum guidelines to see how to properly post code.
Use the IDE autoformat tool (ctrl-t or Tools, Auto format) before posting code in code tags.

Did you do any searching at all? I immediately hit this:

I will try to better explain my problem. The device I am testing asks ds18b20 for the temperature and I need a device that is able to answer it with my set value


Have you got a DS18B20?
How accurate do you want it to be, DS18B20 is =/- 0.5DegC.

You can use a pot and an analog input to give you an instantly variable value, then convert that to the range of temperature you need using possibly map() function.
Then pass the temperature variable onto the bit of code that needs the temperature reading that would normally come from the DS18B20.

Are you trying to make a temperature controller?

Can you please tell us your electronics, programming, arduino, hardware experience?

Thanks.. Tom... :grinning: :+1: :coffee: :australia:

the device has an accuracy of +/- 0.1 so probably 11 or 12 bits accuracy. Rather basic experience. I need the device to be able to receive data from the device and send a temperature response with the appropriate accuracy. temperatures will be two and will be specified in the code

No, the device has resolution of 9 to 12 bits, but the accuracy is +/- 0.5DecC.
DS18B20.pdf (383.0 KB)

Tom... :grinning: :+1: :coffee: :australia:
PS. If you want higher accuracy you will need to make a calibration sheet to show actual calibrated temperature against the temperature output from the sensor, for EACH sensor.

I simply need a device that will simulate a temperature of 15 and 25 ° C and behaved like a real DS18B20

Did you see reply #6 - there's a library that can do all this. Its even got an example for the DS18B20 emulation.


I think we have a problem with terms.

  1. You have a DS18B20
  2. You have a controller that you want to read the value of temperature form the DS18B20
  3. You want the controller to compare that temperature and a setpoint temperature.
  4. You want the controller to then output the Difference between the two readings.

How do you want the output to be presented. Display, data such as RS232?
Do you just want a HIGH or LOW digital signal to show if the temperature you are measuring is HIGHER or LOWER than the setpoint temperature?

Thanks.. Tom.. :grinning: :+1: :coffee: :australia:

I don't think he needs any of that, and you are just adding to the confusion. OP just wants to test a device that (usually) reads a DS18B20, and wants to do that by using an Arduino to send it dummy signals. What he says actually reads quite clearly.

I have deleted my posts because I was adding to the confusion too, but the essence of the first may be correct, and all he needs to do is check the data sheets to see and understand to form of the datastream from a DS18B20, and duplicate it from an Arduino, inserting whatever value is required.

I suspect the data sheets will be the only source of information on this - information that nobody else has felt the need to read.