Lookup table selected on LCD

Hello,

I am trying to use multiple sensors. I have come to the conclusion that I need to add a look up table because I do not see another way to decipher between the sensors currently being scanned by my arduino.

I place one sensor on a dip that is hooked into my arduino. I have a regulator of my own regulating the power to 5V. Which is going to be another hassle because I want to be able to switch between 5V and 3.3V sensors. I am trying to make this portable. I have sensors whose address is the same, I have tried the Device ID but the sensors currently used do not have the ID stored in them. I would then like to create a look up table that I can scroll through on my LCD to find and select the device I currently have attached. I am not sure how to proceed.

How should I implement this lookup table into the scroll keys on the LCD?

Lcd being used: https://www.adafruit.com/products/714 Arduino Uno Proto shield that carries my regulator and wired to their spec.

Thanks for any advice.

I have looked at http://forum.arduino.cc/index.php?topic=94701.0 and http://forum.arduino.cc/index.php?topic=44144.0, I am not sure if this would work with the LCD keys on the board.

PS: I am using I2C.

More details needed. What are the sensors? If you have a mix of 3.3V and 5V sensors, then 5V to 3.3V adapters can be used. If devices have the same address, a little control logic can be added, sometimes just a simple logic gate to determine which chip gets the clock line for example. That works well for I2C, a 2-input OR gate can be used input is the SCL line, the other a gating signal from the Arduino - a low gate allows the output to follow the SCL input. Etc. You should not have to manually select which sensor is being used.

I have an 8 pin dip socket that is scanning the dip. I plug in one sensor and I want the information to display on the screen, I then want to unplug it, scroll with the LCD keys to another sensor with information on it and then have that scan for its information and display on the LCD.

I have 2 sensors so far: http://www.meas-spec.com/downloads/MS4525DO.pdf
http://www.mouser.com/ds/2/187/honeywell-sensing-trustability-hsc-series-high-acc-708740.pdf

I am using 4 pins, power, GND, SDA, and SCL, to go to my dip socket. I have my LCD on top of this, and my regulator in between. I have the LCD displaying when I push buttons, left, right, up, down, select. I would like to be able to select the desired part once it is displayed on the screen of the LCD with the select button.

I am new to Arduino and just trying to figure this out. From what I can comprehend what is missing is being able to store when I press what button into a variable that can then be used with the select button.

// include the library code:
#include <Wire.h>
#include <Adafruit_RGBLCDShield.h>
#include <utility/Adafruit_MCP23017.h>

Adafruit_RGBLCDShield lcd = Adafruit_RGBLCDShield();

// These #defines make it easy to set the backlight color
#define RED 0x1
#define YELLOW 0x3
#define GREEN 0x2
#define TEAL 0x6
#define BLUE 0x4
#define VIOLET 0x5
#define WHITE 0x7

#define adr 0x28 // Address of part

char const* ADDR;
char const* MPN;
char const* MPN2;
char const* MPN3;
char const* VSS={“SS5AI100GP”,“PSI A”, “PSI G”};
uint8_t i=0;

//Declare my Variables

void setup() {
// Debugging output
Serial.begin(9600);
// set up the LCD’s number of columns and rows:
lcd.begin(16, 2);

lcd.setCursor(3,0);
lcd.print(“Select the”);
lcd.setCursor(5,1);
lcd.print(“Sensor”);
//time = millis() - time;
//Serial.print(“Took “); Serial.print(time); Serial.println(” ms”);
lcd.setBacklight(WHITE);

for (int i = 0; i < 3 ;i++)
MPN = VSS[i-2];
MPN2 = VSS[i-1];
MPN3 = VSS*;*

}
void loop() {

  • MPN = VSS[0];*

  • MPN2 = VSS[1];*

  • MPN3 = VSS[2];*

  • //MPN4 = VSS[3];*

  • int j = 0;*

  • uint8_t buttons = lcd.readButtons();*

  • if (buttons) {*

  • lcd.clear();*

  • lcd.setCursor(0,0);*

  • if (buttons & BUTTON_UP)*

  • { *

  • lcd.setCursor(3,0); *

  • lcd.print(MPN);*

  • lcd.setBacklight(RED);*

  • lcd.setCursor(5,1);*

  • lcd.print(MPN3);*

  • delay(50);*

  • j=1;*

  • }*

  • if (buttons & BUTTON_DOWN) {*

  • lcd.print(MPN2);*

  • lcd.setBacklight(YELLOW);*

  • j = 1;*

  • }*

  • if (buttons & BUTTON_LEFT) {*

  • lcd.print("LEFT ");*

  • lcd.setBacklight(GREEN);*

  • j = 2;*

  • }*

  • if (buttons & BUTTON_RIGHT) {*

  • lcd.print("RIGHT ");*

  • lcd.setBacklight(TEAL);*

  • j = 3;*

  • }*

  • if (buttons & BUTTON_SELECT) {*

  • if (j == 4)*

  • { *

  • lcd.print(“You pushed up”);*

  • lcd.setBacklight(VIOLET);*

  • }*

  • else{*

  • lcd.setBacklight(RED);*

  • lcd.print(“False”);*

  • }*

  • }*

  • }*

  • }[/td]*
    [/tr]
    [/table]

There are applications existing that can scan all I2C addresses quickly and report what is connected. Scroll down to Nick Gammon's "I2C Scanner" here: http://www.gammon.com.au/i2c I would think you'd need a switch to select the appropriate VCC level, that could also control the pullup voltage for the I2C signals. I'd have the user set that before plugging any devices onto the socket. It could also be automated - have the code scan at 3.3V, if no responses raise the voltage and scan at 5V. Couple of transistors to control whether 3.3V or 5V gets used.