By now, let us talk about the temperature sensor that we are going to use with our aquarium. Considering that the role of this sensor is to measure water temperature, we had to buy a waterproof sensor. We opted for the DS18B20 from Dallas manufacturer which has a measuring range appropriate for our application (-55°C to 125°C).
One of the particularities of this component is that it’s a digital sensor so we don’t have to use the analog pin of the arduino as an analog to digital converter. By this way, we can plug the data wire in any pins of the Arduino. Moreover, this sensor uses the one wire technology which allows to connect several sensors on the same pin. Even if we are not going to use this functionality, we need to include the “OneWire” librabry. Furthermore, the DS18B20 datasheet specifies that we also need a 4.7K pullup resistor to integrate into the circuit.
Finally, we also used the Dallas Temperature library which allowed us to get the temperature directly in °C. At the beginning, when we received this sensor, we didn’t know all these little subtleties and that’s the reason why we lost some time in this part of the project.