/*
Multi Temp Sensor
Arduino | hardware-help
Wiring up multiple sensors (4 DHT22's etc) to 1 data pin using a register.
vito — 7/16/24 at 3:30 AM
I am attempting to use 74hc595 register to extend the number of
available pins on the UNO board. The logic was to only have 1 sensor
active at once and read them off all the same digital pin.
After building it, it doesn't work and from an oscilloscope, I can
see that the voltage drops to 5V to about 1V after connecting 2 DHTs
to the register pins.
I can confirm that there is only one register output on at once
however I guess the digital pins interact with each other when connect in parallel.
The images show the 2 signals at the digital pin when only 1 is connected vs 2.
The circuit is basically Q0 and Q1 connected to the +Vcc on the DHT22 and the other wire grounded.
DS18B20 example from https://lastminuteengineers.com/multiple-ds18b20-arduino-tutorial/
*/
#include <OneWire.h>
#include <DallasTemperature.h>
// Data wire is plugged into digital pin 2 on the Arduino
#define ONE_WIRE_BUS 2
// Setup a oneWire instance to communicate with any OneWire device
OneWire oneWire(ONE_WIRE_BUS);
// Pass oneWire reference to DallasTemperature library
DallasTemperature sensors(&oneWire);
int deviceCount = 0;
float tempC;
void setup(void)
{
sensors.begin(); // Start up the library
Serial.begin(9600);
// locate devices on the bus
Serial.print("Locating devices...");
Serial.print("Found ");
deviceCount = sensors.getDeviceCount();
Serial.print(deviceCount, DEC);
Serial.println(" devices.");
Serial.println("");
}
void loop(void)
{
// Send command to all the sensors for temperature conversion
sensors.requestTemperatures();
// Display temperature from each sensor
for (int i = 0; i < deviceCount; i++)
{
Serial.print("Sensor ");
Serial.print(i+1);
Serial.print(" : ");
tempC = sensors.getTempCByIndex(i);
Serial.print(tempC);
Serial.print((char)176);//shows degrees character
Serial.print("C | ");
Serial.print(DallasTemperature::toFahrenheit(tempC));
Serial.print((char)176);//shows degrees character
Serial.println("F");
}
Serial.println("");
delay(1000);
}
Loading
ds18b20
ds18b20
Loading
ds18b20
ds18b20
Loading
ds18b20
ds18b20
Loading
ds18b20
ds18b20