Hall Sensor Matrix: Debugging

Hey Guys,

I created a hall sensor matrix. Everytime a sensor is triggered an LED in a corresponding matrix is triggered.

The sensor matrix is coupled to a demux for the voltage supply and a mux for the input signal, to see which sensor row is triggered. Using the mux and demux information the position in the matrix is determined. The ground of each sensor is constantly connected.

It works fine... for 7 of the 8 rows. When a sensor is triggered in this 7 rows, the LED on the same coordinates is activated. For the other row a strange behavior occurs: When triggering a sensor in the fourth row, the proper LED gets activated plus the LED in the same col but 0th row.

By printing the input from the sensors to the row, I can say it is NOT a problem with the LED wiring: The input shows that for both sensor (the one from the fourth row, and the 0th-row) HIGH is set. I checked the contacts of the mux, everything is wired properly and no contact is "bridged". I also tried to change the mux, with no effect. When triggering a sensor in the 0th row everything works fine, only the right LED is set, but no in the fourth row. So this can't be reversed.

This is such a strange behaviour. I lead every logical implication that came into my mind ad absurdum.

Idea, anyone?

Here is an idea: post your circuit diagram and code (in code tags)!

What I actually did can be seen on the right side of this diagramm, beside the fact, that the miltplexers trigger transistors with 5V on it for a proper hall sensor supply. Like describe all hall sensor grounds are connected to a common ground.

Code:

//Include the library LedControl
#include "LedControl.h"

LedControl lc=LedControl(10,8,9,1);

int MUX_ONE  = 11;
int MUX_TWO  = 12;
int MUX_THREE= 13;

int DMUX_ONE  = 5;
int DMUX_TWO  = 6;
int DMUX_THREE= 7;

int HALLIN=4;

void setup() {
  pinMode(MUX_ONE   , OUTPUT);  
  pinMode(MUX_TWO   , OUTPUT);  
  pinMode(MUX_THREE , OUTPUT);  
  pinMode(DMUX_ONE  , OUTPUT);  
  pinMode(DMUX_TWO  , OUTPUT);  
  pinMode(DMUX_THREE, OUTPUT); 
     Serial.begin(9600);      // open the serial port at 9600 bps:    
  
  pinMode(HALLIN, INPUT_PULLUP); 
            lc.setLed(0, 0, 0, true);

  
  /* Wakey Wakey */
  lc.shutdown(0,false);
  /* Set the brightness to a max values */
  lc.setIntensity(0,15);
  /* and clear the display */
  lc.clearDisplay(0);
}



void read(){
  for(int i = 0; i < 8; i++){
    for(int j = 0; j < 8; j++){
  
      
      digitalWrite(MUX_ONE  , (i & 1)   );
      digitalWrite(MUX_TWO  , (i & 3)>>1);
      digitalWrite(MUX_THREE, (i & 7)>>2);
      
      digitalWrite(DMUX_ONE  ,(j & 1)   );
      digitalWrite(DMUX_TWO  ,(j & 3)>>1);
      digitalWrite(DMUX_THREE,(j & 7)>>2);
      

      
      if(!digitalRead(HALLIN)){
        
           lc.setLed(0, j, i, true);
           Serial.print(i, DEC); 
           Serial.print(" "); 
           Serial.print(j, DEC); 
           Serial.print("\n");
      } else {
          lc.setLed(0, j, i, false);
      }

      
      delay(5);
        
      }
  }
}

void loop() {
 read();
}

As you can see the sensor are read using the internal pull up resistor.