Help adjusting the code for ThruMatrix FSR Array 10x16 to a ShuntMatrix FSR Array 16 x16

HELP!

I want to use a Shunt Matrix Array FSR that I have bought and built using the instructions on this website thats for a Thru Matrix Array Tutorials: FSR MatrixArray

It says it can be adjusted but I can't work it out and I am going round in circles! Can anyone help?

The supplied code is included and the schematic is on the page which I have built my model according to, with the extra rows included on the spare 74HC4051 pins


/**********************************************************************************************************
* Project: MatrixArray.ino
* By: Chris Wittmier @ Sensitronics LLC
* LastRev: 09/09/2015
* Description: FSR MatrixArray Demonstration of Sensitronics' 16x10 element resistive ThruMode. Scanning
* electronics consist of 2 HCT595 shift registers, and 2 4051 multiplexers connected to Arduino Uno.
**********************************************************************************************************/


/**********************************************************************************************************
* MACROS / PIN DEFS
**********************************************************************************************************/
#define BAUD_RATE                 115200
#define ROW_COUNT                 10
#define COLUMN_COUNT              16

#define PIN_ADC_INPUT             A0
#define PIN_SHIFT_REGISTER_DATA   2
#define PIN_SHIFT_REGISTER_CLOCK  3
#define PIN_MUX_CHANNEL_0         4  //channel pins 0, 1, 2, etc must be wired to consecutive Arduino pins
#define PIN_MUX_CHANNEL_1         5
#define PIN_MUX_CHANNEL_2         6
#define PIN_MUX_INHIBIT_0         7  //inhibit = active low enable. All mux IC enables must be wired to consecutive Arduino pins
#define PIN_MUX_INHIBIT_1         8

#define ROWS_PER_MUX              8
#define MUX_COUNT                 2
#define CHANNEL_PINS_PER_MUX      3


/**********************************************************************************************************
* GLOBALS
**********************************************************************************************************/
int current_enabled_mux = MUX_COUNT - 1;  //init to number of last mux so enabled mux increments to first mux on first scan.


/**********************************************************************************************************
* setup()
**********************************************************************************************************/
void setup()
{
  Serial.begin(BAUD_RATE);
  pinMode(PIN_ADC_INPUT, INPUT);
  pinMode(PIN_SHIFT_REGISTER_DATA, OUTPUT);
  pinMode(PIN_SHIFT_REGISTER_CLOCK, OUTPUT);
  pinMode(PIN_MUX_CHANNEL_0, OUTPUT);
  pinMode(PIN_MUX_CHANNEL_1, OUTPUT);
  pinMode(PIN_MUX_CHANNEL_2, OUTPUT);
  pinMode(PIN_MUX_INHIBIT_0, OUTPUT);
  pinMode(PIN_MUX_INHIBIT_1, OUTPUT);
}


/**********************************************************************************************************
* loop()
**********************************************************************************************************/
void loop()
{
  for(int i = 0; i < ROW_COUNT; i ++)
  {
    setRow(i);
    shiftColumn(true);
    shiftColumn(false);                         //with SR clks tied, latched outputs are one clock behind
    for(int j = 0; j < COLUMN_COUNT; j ++)
    {
      int raw_reading = analogRead(PIN_ADC_INPUT);
      byte send_reading = (byte) (lowByte(raw_reading >> 2));
      shiftColumn(false);
      printFixed(send_reading);
      Serial.print(" ");
    }
    Serial.println();
  }
  Serial.println();
  delay(200);
}


/**********************************************************************************************************
* setRow() - Enable single mux IC and channel to read specified matrix row.
**********************************************************************************************************/
void setRow(int row_number)
{
  if((row_number % ROWS_PER_MUX) == 0)  //We've reached channel 0 of a mux IC, so disable the previous mux IC, and enable the next mux IC
  {
    digitalWrite(PIN_MUX_INHIBIT_0 + current_enabled_mux, HIGH);  //Muxes are enabled using offset from MUX_INHIBIT_0. This is why mux inhibits MUST be wired to consecutive Arduino pins!
    current_enabled_mux ++;
    if(current_enabled_mux >= MUX_COUNT)
    {
      current_enabled_mux = 0;
    }
    digitalWrite(PIN_MUX_INHIBIT_0 + current_enabled_mux, LOW);  //enable the next mux, active low
  }
  for(int i = 0; i < CHANNEL_PINS_PER_MUX; i ++)
  {
    if(bitRead(row_number, i))
    {
      digitalWrite(PIN_MUX_CHANNEL_0 + i, HIGH);
    }
    else
    {
      digitalWrite(PIN_MUX_CHANNEL_0 + i, LOW);
    }
  }
}


/**********************************************************************************************************
* shiftColumn() - Shift out a high bit to drive first column, or increment column by shifting out a low
* bit to roll high bit through cascaded shift register outputs.
**********************************************************************************************************/
void shiftColumn(boolean is_first)
{
  if(is_first)
  {
    digitalWrite(PIN_SHIFT_REGISTER_DATA, HIGH);
  }
  digitalWrite(PIN_SHIFT_REGISTER_CLOCK, HIGH);
  digitalWrite(PIN_SHIFT_REGISTER_CLOCK, LOW);
  if(is_first)
  {
    digitalWrite(PIN_SHIFT_REGISTER_DATA, LOW);
  }
}


/**********************************************************************************************************
* printFixed() - print a value padded with leading spaces such that the value always occupies a fixed
* number of characters / space in the output terminal.
**********************************************************************************************************/
void printFixed(byte value)
{
  if(value < 10)
  {
    Serial.print("  ");
  }
  else if(value < 100)
  {
    Serial.print(" ");
  }
  Serial.print(value);
}

Can we presume that you have changed these values ?

#define ROW_COUNT                 10
#define COLUMN_COUNT              16

Yes I have

So where are you stuck ?

I note that you have marked the topic as solved, but is it ?

This is my output

Don’t know how I have done that but it’s not solved!

Why is the baud rate of eeh Serial monitor set to 2,000,000 baud ?

That was automatic what do you recommend it should be? Sorry I am clearly useless

I am not sure what you mean by automatic because you have to set it manually and it cannot be done by the sketch

In the sketch you have

#define BAUD_RATE                 115200
Serial.begin(BAUD_RATE);

Change the Serial monitor baud rate to match the setting in the sketch

Ok I will try that thank you

I have done this and my readout is still a collection of zeros which is better than it was. I have rechecked my build and I am sure I have grounded it all correctly. Any help appreciated

I have gone through the build with someone a bit more savvy then me and we are sure its correct with everything connected properly but still getting readouts of 000000s is there a way of testing whether a matrix array is actually working?

Yes, there is.

tl:dr; show your devices and their specifications, show your wiring, show your code. Found some reference material.

connect a meter to the leads and hit it with a big hammer. A much better way would be to post an annotated schematic showing exactly how it is wired, be sure to show all connections, power and ground along with power sources. All you need to do is connect the sensor, not the rest of the project. Post links to technical information on the parts, this will also let us know what you are using. At this point it is one of the thingies on that table.

Use a multimeter to measure the resistances at individual points in the matrix, and check whether the sensors at those points respond to pressure.

Also, do yourself a favor by reading and following the directions in the "How to get the best out of this forum" post.

Not correct. Show the new sketch.

If you posted a schematic we could tell if the array was shorting out or not. It seems to me that the array has no diodes in it, and / or you are not scanning it correctly.

MatrixArrayExampleSchematic.pdf (1.1 MB)

Corrected this to 16 x 16 and Baum rate is correct

Apologises everyone. Piss poor post





MatrixArrayExampleSchematic.pdf (1.1 MB)