Use of demux with Arduino to take multiple sensor data to single analog pin in arduino
Use of demux with Arduino to take multiple sensor data to single analog pin in arduino
Components Required:
Arduino Uno, 4052 demux and few sensors.
Circuit diagram:
In the following you can put the any output analog sensor instead of potentiometer output in 4052 IC.
74155 IC demux is used here.
Arduino code
float data;
void setup()
{
Serial.begin(9600);
pinMode(8,OUTPUT);
pinMode(9,OUTPUT);
pinMode(A0,INPUT);
}
void loop()
{
digitalWrite(8,LOW);
digitalWrite(9,LOW);
data= analogRead(A0);
Serial.print("Sensor1 value= "); //send sensor 1 value .
Serial.println(data);
delay(2000);
digitalWrite(8,LOW);
digitalWrite(9,HIGH);
data= analogRead(A0);
Serial.print("Sensor2 value= "); //send sensor 2 value .
Serial.println(data);
delay(2000);
digitalWrite(8,HIGH);
digitalWrite(9,LOW);
data= analogRead(A0);
Serial.print("Sensor3 value= "); //send sensor 3 value .
Serial.println(data);
delay(2000);
digitalWrite(8,HIGH);
digitalWrite(9,HIGH);
data= analogRead(A0);
Serial.print("Sensor4 value= "); //send sensor 4 value .
Serial.println(data);
delay(2000);
}
Comments
Post a Comment