Arduino nano with MAX485 and DS18B20

Hi, i have three postions where i want to measure temperature with arduino nano with MAX485 and DS18B20 but i need some help with the software pls help!

Which part of the software?

Reading the DS18B20?
Transferring the data?
Where must the measured data go to? Other Arduino? PC? ...?

  1. " https://www.instructables.com/Arduino-Nano-and-Two-DS18B20-Temperature-Sensors-W/

  2. https://www.instructables.com/RS485-Serial-Communication-Between-Arduino-Mega-an/

The web is full of examples. Just look for it.

reading data from ds18b20 and sendin to a pc

You may get familiar with the following facts of DS18B20 Digital Temp Sensor and then create your sketch:

1. More than one sensors can be connected with an input pin of the Arduino UNO; hence, it is a "One Wire Device".

2. The following lines are included in the sketch to tell that the sensor is connected with DPin-7. The Library named OneWire.h contains C++ codes for the methods that are applied on the object ds.

#include<OneWire.h>
OneWire ds(7);

3. Every sensor has its own 64-bit (8-byte) identification codes called ROM Code which is engraved in the ROM memory of the sensor at manufacturing time. The following lines/codes acquire the ROM Code and is saved in an array.

byte romCode[8];   
ds.reset();
ds.search(romCode);

4. The sensor can register a change of 0.06250C of temperature.

5. The temperature sensing element of the sensor produces DC voltage proportional to the surrounding temperature. Execution of the following codes begins the analog-to-digital conversion proocess. The conversion takes about 750 ms time (maximum). After conversion, the 12-bit temperature value is stored within the upper two byte locations of the following 9-byte wide buffer known as Scratch Pad Memory (Fig-1).

ds.reset();
ds.select(romCode);
ds.write(0x44);
delay(750);


Figure-1:

6. The positional weights for the bits of the "Temp Signal" locations are given below (Fig-2). The Fig-2 has also explained the mechanism of computing temperature signal from the bits distributed over two 8-bit wide locations.


Figure-2:

7. Execution of the following codes brings/acquires the content of the buffer from the sensor and save it in an array.

byte myData[9];
ds.reset();
ds.select(romCode);
ds.write(0xBE);
ds.read_bytes(myData);

8. Connect the data/signal pin of your sensor with DPin-7 of UNO and connect a 4.7k pull-up resistor between DPin-7 and 5V/VCC. Do not forget to connect the VCC-pin and GND-pin of the sensor with 5V-pin and GND-pin of Arduino UNO.

9. Open IDE with the following two blank functions and insert the codes mentioned above at the appropriate places. Study/follow Fig-2 to compute the float type temperature value and show it on the Serial Monitor (at 1-sec interval) that comes on the desktop of the PC.

void setup()
{

}

void loop()
{

}

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.