0
\$\begingroup\$

My schematic as below. I have connected 8 hall sensor as shown in picture. Problem i am facing here is SO, s1, s2 The Led light are not glowing .Even the forard voltage across is 3.9v. i have tested with multimeter LED working fine. Please let me know why might be reason to not glow when upload below code.

SO,S1,S2 are selective pins for MUX IC. Here i am scaling up to 24 after that. I found The digital Io across are getting properly as per truth table or array mentioned.

#include <avr/wdt.h>
int SO_enable=7;
int S1_enable=6;
int S2_enable=5;
int Enablepin=4;
int Sensor_Value0=0;
int Sensor_Value1=0;
int Sensor_Value2=0;
float  voltage0;
float voltage1;

float Current_Mux1[9];
float Current_Mux2[9];
float Current_Mux3[9];
float ARDUINO_ANALOG_SCALING=0.004799608993157;
int row,column;
int DigitalHigh=8;
int DigitalHigh1=9;
static float  Mux1_array[9]={
  0.0};
static float  Mux2_array[9]={
  0.0};
  static float  Mux3_array[9]={
  0.0};

 float Current_Value1[9]={0.0};
 float Current_Value2[9]={0.0};
int array[9][4]={
  {    0,0,0,0  }
  ,
  {    0,0,0,1  }
  ,
  {    0,0,1,0  }
  ,  
  {    0,0,1,1  }
  ,
  {    0,1,0,0  }
  ,
  {    0,1,0,1  }
  ,
  {    0,1,1,0  }
  ,
  {    0,1,1,1  }
  ,
  {    1,0,0,0  }

};

void setup()
{
  wdt_enable(WDTO_8S);
  pinMode(SO_enable, OUTPUT) ;// pin can enable/disable using digital IO 7 of arduino
  pinMode(S1_enable, OUTPUT) ;// pin can enable/disable using digital IO 6 of arduino
  pinMode(S2_enable, OUTPUT) ;// pin can enable/disable using digital IO 5 of arduino
  pinMode(Enablepin, OUTPUT) ;// pin can enable/disable using digital IO 4 of arduino
  pinMode(A0, INPUT) ;
  pinMode(A5, INPUT) ;
  pinMode(DigitalHigh,OUTPUT);
  pinMode(DigitalHigh1,OUTPUT);
  Serial.begin(9600);
  Serial.print("Channel\t");
 Serial.print("MUX1_V \t"); Serial.print("MUX1_C \t");
   Serial.print("MUX2_V \t"); Serial.print("MUX2_C \t");
   Serial.print("MUX3_V \t"); Serial.println("MUX3_C \t");
}

void loop()
{
  wdt_reset();
  digitalWrite(DigitalHigh,HIGH);
  digitalWrite(DigitalHigh1,HIGH);
  for(row=0;row<9;row++)
  {
    int k=(8*array[row][0]+4*array[row][1]+2*array[row][2]+1*array[row][3]);

   // Serial.print("k:");
    Serial.print(k);
    Serial.print("\t");
    digitalWrite(Enablepin,array[row][0]);
    digitalWrite(SO_enable,array[row][1]);
    digitalWrite(S1_enable,array[row][2]);
    digitalWrite(S2_enable,array[row][3]); 
   delay(100); 
    Sensor_Value0=analogRead(A0);
    Sensor_Value1=analogRead(A5);
    Sensor_Value2=analogRead(A3);

   Mux1_array[row]=(Sensor_Value0 * ARDUINO_ANALOG_SCALING);
   Mux2_array[row]=(Sensor_Value1 * ARDUINO_ANALOG_SCALING);
   Mux3_array[row]=(Sensor_Value2 * ARDUINO_ANALOG_SCALING);
    Current_Mux1[row] = (Mux1_array[row]*35.1428571429)-87.6571428571;
    Current_Mux2[row]=(Mux2_array[row]*35.1428571429)-87.6571428571;
    Current_Mux3[row]=(Mux3_array[row]*35.1428571429)-87.6571428571;

  Serial.print( Mux1_array[row]);Serial.print("\t");Serial.print( Current_Mux1[row]);Serial.print("\t");
Serial.print( Mux2_array[row]);Serial.print("\t");Serial.print( Current_Mux2[row]);Serial.print("\t");
Serial.print( Mux3_array[row]);Serial.print("\t");Serial.println( Current_Mux3[row]);


  }
 Serial.println("...................................................................");
 Serial.print("Channel\t");
 Serial.print("MUX1_V \t"); Serial.print("MUX1_C \t");
   Serial.print("MUX2_V \t"); Serial.print("MUX2_C \t");
   Serial.print("MUX3_V \t"); Serial.println("MUX3_C \t");
 delay(500);
}

schematic

simulate this circuit – Schematic created using CircuitLab

\$\endgroup\$
2
\$\begingroup\$

From the CD74HCT4051 datasheet:

IIL (Control input leakage current): ±0.1μA

Err... that's not going to light up the LED. Unless you have superhuman vision. Put the LED in parallel with the MUX instead.

schematic

simulate this circuit – Schematic created using CircuitLab

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.