loading

One of the reasons the OneWire Maxim DS1820/DS18S20//DS18B20 Thermometers are so popular is that multiple thermometers can be connected and even powered by only 2 wires. I already posted Instructables on how to connect one Thermometer, and how to get the Address of a Thermometer. In this Instructable, I will show you how you can connect multiple Thermometers to a single Arduino pin, and read their temperature, with the help of Visuino.

Step 1: Components

  1. One Arduino compatible board (I use Arduino Nano, because I have one, but any other will be just fine )
  2. Multiple DS18S20 Thermometers (I used 3 for this Instructable)
  3. One 4.7 K Resistor
  4. One Breadboard
  5. 3 Male-Female jumper wires

Step 2: Install the Thermometers on the Breadoard, and Add Pull-Up Resistor

  1. Place the Thermometers on the Breadboard as shown on Pictures 1, 2, and 3
  2. Connect the 4.7 K Resistor between the middle pin of the Thermometers and the Power bus of the Breadboard (Picture 4)
  3. Picture 5 shows the pins on the DS18S20 Thermometer. The VDD pin is optional, and in our case we will not connect it.

Step 3: Connect Power and Data Wires for the Thermometers

  1. Connect a jumper wire(Black wire) for Ground to the first (Ground) pin of the Thermometers (Pictures 1, 2 and 3)
  2. Connect jumper wire(Red wire) for Power to the Power bus of the Breadboard (Pictures 1, 2 and 3)
  3. Connect jumper wire(Yellow wire) for Data to the middle pin of the Thermometer where the Resistor was connected in the previous step(Picture 4)

Step 4: Connect the Thermometers to Arduino

  1. Connect the other end of the Ground wire(Black wire) to Ground pin of the Arduino board(Picture 1)
  2. Connect the other end of the Power wire(Red wire) to the 5V power pin of the Arduino board(Picture 1)
  3. Connect the other end of the Data wire(Yellow wire) to Digital pin 2 of the Arduino board(Picture 2)
  4. Picture 3 shows where are the Ground, 5V Power, and Digital 2 pins of the Arduino Nano

Step 5: Start Visuino, and Select the Arduino Board Type

To start programming the Arduino, you will need to have the Arduino IDE installed from here: http://www.arduino.cc/ .

Please be aware that there are some critical bugs in Arduino IDE 1.6.6.

Make sure that you install 1.6.7 or higher, otherwise this Instructable will not work!

The Visuino: https://www.visuino.com also needs to be installed.

  1. Start Visuinoas shown in the first picture
  2. Click on the "Tools" button on the Arduino component (Picture 1) in Visuino
  3. When the dialog appears, select Arduino Nano as shown in Picture 2

Step 6: In Visuino: Add OneWire Thermometer Components, and Connect Them

  1. Type "ther" in the Filter box of the Component Toolbox then select the "Maxim 1-Wire Thermometer" component (Picture 1), and drop 3 of them in the design area (If you use different number of Thermometers than 3 add one component for each)
  2. Connect the "OneWire" output pin of the Thermometer1 component to the "Digital" input pin of the Digital[ 2 ] channel of the Arduino component(Picture 2)
  3. Connect the "OneWire" output pin of the Thermometer2 component to the "OneWire" input pin of the Thermometer1(Picture 3)
  4. Connect the "OneWire" output pin of the Thermometer3 component to the "OneWire" input pin of the Thermometer2(Picture 4)
  5. If you have more components continue to connect the "OneWire" outputs to the "OneWire" inputs

Step 7: In Visuino: Add Formatted Text Component and Elements in It

To display the Temperatures in the Serial Terminal, we will use Formatted Text component. This component allows you to generate customized formatted text from multiple data values.

  1. Type "form" in the Filter box of the Component Toolbox then select the "Formatted Text" component (Picture 1), and drop it in the design area
  2. Click on the "Tools" button of the FormattedText1 component (Picture 2)
  3. In the Elements editor, select the "Analog Element" from the list, and click 3 times(once for each Thermometer) on the "+" button(Picture 3) to add 3 elements (Picture 4)
  4. Close the Elements editor

Step 8: In Visuino: Connect the Formatted Text Component, and Specify Formatted Text

  1. Connect the "Out" pin of the Thermometer1 component to the In pin of the AnalogElement1 of the FormattedText1 component (Picture 1)
  2. Connect the "Out" pin of the Thermometer2 component to the In pin of the AnalogElement2 of the FormattedText1 component (Picture 2)
  3. Connect the "Out" pin of the Thermometer3 component to the In pin of the AnalogElement3 of the FormattedText1 component (Picture 3)
  4. Connect the "Out" output pin of the FormattedText1 component to the "In" input pin of the Serial[ 0 ] channel of the Arduino component(Picture 4)
  5. In the Object Inspector set the value of the Text property of the FormattedText1 component to "Temperatures: %0 %1 %2" (Picture 5). The %0 will be replaced with the value from AnalogElement1, %1 will be replaced with the value from AnalogElement2, and %2 will be replaced with the value from AnalogElement3

Step 9: In Visuino: Optionally Set the Thermometer Address

When working with multiple thermometers, the code will automatically discover the connected Thermometers, and will work with them. The Thermometers however will be discovered in random order. It is usually necessary to specify the address of the Thermometer for each component. In one of the previous Instructables, I already showed how you can get the Address of the Thermometer, and you can find the instructions here.

In this step you can use the already discovered Address:

  1. Select the Thermometer component for which you want to set the Address
  2. Set the value of the AutoDiscover property to False (Picture 1)
  3. Set the value of the Address property as shown on the (Picture 2)

Step 10: Generate, Compile, and Upload the Arduino Code

  1. In Visuino, Press F9 or click on the button shown on Picture 1 to generate the Arduino code, and open the Arduino IDE
  2. In the Arduino IDE, click on the Upload button, to compile and upload the code (Picture 2)

If you get compiler error in the Arduino IDE, this means that you are missing at least one of the following libraries:

https://github.com/adafruit/MAX31850_OneWire

https://github.com/adafruit/MAX31850_DallasTemp

Look at the Next Step to see how to install them!

Step 11: If Not Installed: Install the OneWire Thermometer Arduino Libraries From Adafruit

If you don't have the OneWire libraries already installed, follow these steps:

  1. In the Arduino IDE menu, select |Sketch|Include Library|Manage Libraries...| (Picture 1)
  2. Type "onewir" in the filter box (Picture 2)
  3. Select the MAX31850 OneWire by Adafruit library, and click the Install button (Picture 2)
  4. Select the MAX31850 DallasTemp by Adafruit library, and click the Install button (Picture 3)
  5. Click on the Close button (Picture 3)
  6. In the Arduino IDE, click on the Upload button, to compile and upload the code

Step 12: And Play...

You can see the connected and running Thermometers on Picture 1.

If you open Serial Terminal in the Arduino IDE or Visuino, you will see the Temperatures measured by the Thermometers (Picture 2).

On Picture 3 you can see the complete Visuino diagram.

Also attached is the Visuino project, that I created for this Instructable.

You can download and open it in Visuino: https://www.visuino.com

About This Instructable

4,214views

24favorites

License:

More by BoianM:Assemble Kuman Wi-Fi Robot With Camera and Manipulator Arduino and Visuino: Long Distance Remote Light Sensor With RFM95W/RFM98W Makerfabs LoRa Shields  Arduino Nano and Visuino: Animate the Colors of RGB LED 
Add instructable to: