LCD Icon Display Project With 12V+ Pin Activation

Good Morning,

I need help with or would like someone to build this project for me. I am new to this and have no idea how to continue..

This is going inside my gauge cluster in my car and I need it to be clean/simple...

I need a LCD of many color or not that displays 5 icons when 12V is applied to pins.. each pin or combination of pins will display different icons on the screen.

Icon 1 when 12V is applied to pin 1 - Traction Control On
Icon 2 when 12V is applied to pin 2 - Low Gas
Icon 3 when 12V is applied to pin 3 - NOS Active
Icon 4 when 12V is applied to pin 4 - Meth Active
Icon 5 when 12V is applied to pin 5 - NOS and Meth Active

Priory..
If pin 1 has power and any other pin has power always display icon 1
If pin 2 has power and pin 1 is off display icon 2
If pin 3 has power and pin 1 is off , pin 4 is off, pin 5 is off display icon 3
If pin 4 has power and pin 1 is off , pin 3 is off, pin 5 is off display icon 4
If pin 5 has power and pin 1 is off , pin 3 is on, pin 4 is on display icon 5
If all pins are off then turn off display.

The display screen can be 2x2 inch, I can make the icons if given the resolution of the screen icon limits. I can even make animated Gifs if needed.

Thanks,
Eazy

12V signals can be sensed on the Arduino with digitalRead() and resistor voltage dividers: Voltage Dividers - SparkFun Learn

Here is one example of a color display (there are others): Overview | 2.2" TFT Display | Adafruit Learning System

So can i accomplish this with the following?

1x OLED Breakout Board - 16-bit Color 1.5" w/microSD holder

1x Arduino Uno R3 (Atmega328 - assembled)

5x Voltage Dividers wired to the Arduino somehow for different voltages on one input, using different voltages as activation points for the different activations? if so that creates a problem because if i i use one voltage such as 12 for icon 1 it works fine. but activating other icons could be a problem.

one issue i see is that on the Arduino is that the voltage range is 7-12V in a car you can see 7-15v will the +3V fry this unit?
Another issue is that can i load 5 images to the SD card on the screen and switch to them depending on voltage references?

Thanks,
Eazy

eazy2001x:
5x Voltage Dividers wired to the Arduino somehow for different voltages on one input, using different voltages as activation points for the different activations?

This could be done in theory but is not recommended. Just use 5 different input pins. The Arduino has plenty of pins.

one issue i see is that on the Arduino is that the voltage range is 7-12V in a car you can see 7-15v will the +3V fry this unit?

Yes, if you set your dividers to divide 12V to 5V, then a 15V input will divide down to 6.25V and that will indeed fry the Arduino. Whatever your highest expected voltage will be, divide that down to 5V. If the input is sometimes lower, that's okay. Your Arduino will still successfully read a 4V input.

If the Arduino had 5 pins free to use why do i even need the Voltage Dividers? also i'm referring to the operating voltage on the Arduino i will need to power it from the car which will most likely see 14.7 - 15.2 V under normal operation.

eazy2001x:
why do i even need the Voltage Dividers?

Applying more then 5.5VDC to a pin will fry the Arduino. Can't use 12V directly.

also i'm referring to the operating voltage on the Arduino i will need to power it from the car which will most likely see 14.7 - 15.2 V under normal operation.

I think 15.2V is iffy on the built-in regulator. You may want to use a USB power adapter designed for automotive use as your 5V source.

So as far as powering the unit.. which operates at 7-12V and 15.2V being the max voltage ill ever see on the cars alternator..

Looking at figure 4 in this link: https://dlnmh9ip6v2uc.cloudfront.net/r/600-600/assets/4/0/3/a/e/511948ffce395f7f47000000.png

and the chart on this page: Voltage Dividers - SparkFun Learn

I can have an input voltage of 15.2 with R1 @ 1700 and R2 @ 3300 and my output voltage will be 10.03 V which falls within the operating voltage of the unit. cranking voltage is aprox 10V and it will drop to 6.6V which i dont care to have this unit work at anyway and it will most likely shut off or not start up. I'm fine with that. So that takes care of that issue for powering the unit.

Ok.. Now for the triggers.. I found these on e-bay.. They will take any input from 8-23v and drop it down to 5V/3A I can order 5 for each input trigger: http://www.ebay.com/itm/161436954663

sound good so far for power and trigger issues?

Whoops I think we got off track.

The USB (or that eBay unit you linked to) power supply is to provide power to the Arduino. You only need one. It's input is connected directly to the vehicle 12V bus and it's output is connected directly to the +5VDC / VCC pin on the Arduino. No resistors here.

The resistor voltage dividers are for the input puts. One divider per each of the five input pins.

Tie the USB output ground and Arduino ground and vehicle ground together.

Actually.. Looking at the R3 Specs again.. It will work from 6-20 and not fry to power the unit.

Input Voltage (recommended) 7-12V
Input Voltage (limits) 6-20V

the link to the adapters.. They can be used to wire directly to the R3 to trigger each one of the 5 pins with 5 volts. the triggers on the car are all 12V. so i will wire one side to the car for 12in on the step down adapter and wire the other side to the R3 which is the 5v out. that should work fine cause at that point the 12V trigger from the car will be seen on the R3 as 5V. those adapters are also low cost..

I haven't tried an Arduino above 12V, I just go by what others here have recommended, so I'll just say "I don't know" about feeding 15.2V into an Arduino. The regulator might get kind of hot.

As for the adapters... they are big and over $1. Resistors are tiny and about $0.02 each. :slight_smile:

I'm sure it was tested at 20V for them to list 6-20 so i'm not too caught up on the voltage to power the unit anymore..

Also looking at this.. Are the input pins below?

The link here: http://arduino.cc/en/Main/ArduinoBoardUno says that it has Analog Input Pins.

(AD C5) PC5 - 6
(AD C4) PC4 - 5
(AD C3) PC3 - 4
(AD C2) PC2 - 3
(AD C1) PC1 - 2
(AD C0) PC0 - 1

You can use analog input pins if you wish, but your application just wants to look for voltage or no-voltage, so any input pin, analog or digital, will work.

"Digital" in this case doesn't mean "binary communication", it means "on or off".

Ok.. that takes care of power concerns.. Now back to this unit.. and i may use the resistors to reduce the voltage at a later date after testing..

so how would I go about accessing the following on the SD card?

Icon1.bmp
Icon2.bmp
Icon3.bmp
Icon4.bmp
Icon5.bmp

and setting the triggers?

Please study the Lady Ada tutorial I linked to earlier. I believe it will tell you everything you need to know about loading images from an SD card and displaying them.

For your triggers, see:

Ok, looking at the display it only shows me how to load an image when the unit restarts.

example:

Step 1. Copy the file "lily128.bmp" from the Adafruit_SSD1351_OLED\examples\bmp folder to the root directory of your micro-SD card.

Step 2. Insert the micro SD card into the slot on the back of the SSD1351 breakout board.

Step 3. Select "Examples->Adafruit_SSD1351_OLED->bmp" and upload it to your Arduino.

Result: When the Arduino restarts, you should see the flower as below!

It dosent tell me how to make a pin activate a image from the R3

In the Example for the pins.. I assume the following..

int ledPin = 13; // LED connected to digital pin 13
int inPi = 1; // LCD connected for Traction Control On
int inPi = 2; // LCD connected for Low Gas
int inPi = 3; // LCD connected for NOS Active
int inPi = 4; // LCD connected for Meth Active
int inPi = 5; // LCD connected for NOS and Meth Active
int inPi = 6; // LCD connected for Other

void setup()
{
pinMode(ledPin, OUTPUT); // sets the digital pin 13 as output
pinMode(inPin, INPUT); // sets the digital pins 1-6 as input

void loop()
{
val = digitalRead(inPin); // read the input pin
icon 1 = icon1.bmp
icon 2 = icon2.bmp
icon 3 = icon3.bmp
icon 4 = icon4.bmp
icon 5 = icon5.bmp
icon 6 = icon6.bmp

If inPin 1 = high then digitalWrite(ledPin, icon1.bmp)
If inPin 1 = high and inPin 2 = low and inPin 3 = low and inPin 4 = low and inPin 5 = low and Inpin 6 = low then drawBitmap(icon1.bmp)
If inPin 1 = high and inPin 2 = high and inPin 3 = low and inPin 4 = low and inPin 5 = low and Inpin 6 = low then drawBitmap(icon1.bmp)
If inPin 1 = high and inPin 2 = high and inPin 3 = high and inPin 4 = low and inPin 5 = low and Inpin 6 = low then drawBitmap(icon1.bmp)
If inPin 1 = high and inPin 2 = high and inPin 3 = high and inPin 4 = high and inPin 5 = low and Inpin 6 = low then drawBitmap(icon1.bmp)
If inPin 1 = high and inPin 2 = high and inPin 3 = high and inPin 4 = high and inPin 5 = high and Inpin 6 = low then drawBitmap(icon1.bmp)
If inPin 1 = high and inPin 2 = high and inPin 3 = high and inPin 4 = high and inPin 5 = high and Inpin 6 = high then drawBitmap(icon1.bmp)

If inPin 2 = high then digitalWrite(ledPin, icon2.bmp)
If inPin 2 = high and inPin 1 = low and inPin 3 = low and inPin 4 = low and inPin 5 = low and Inpin 6 = low then drawBitmap(icon2.bmp)
If inPin 2 = high and inPin 1 = high and inPin 3 = low and inPin 4 = low and inPin 5 = low and Inpin 6 = low then drawBitmap(icon2.bmp)
If inPin 2 = high and inPin 1 = high and inPin 3 = high and inPin 4 = low and inPin 5 = low and Inpin 6 = low then drawBitmap(icon2.bmp)
If inPin 2 = high and inPin 1 = high and inPin 3 = high and inPin 4 = high and inPin 5 = low and Inpin 6 = low then drawBitmap(icon2.bmp)
If inPin 2 = high and inPin 1 = high and inPin 3 = high and inPin 4 = high and inPin 5 = high and Inpin 6 = low then drawBitmap(icon2.bmp)
If inPin 2 = high and inPin 1 = high and inPin 3 = high and inPin 4 = high and inPin 5 = high and Inpin 6 = high then drawBitmap(icon2.bmp)

//Meth-NOS//
If inPin 3 = high then drawBitmap(icon3.bmp)
If inPin 4 = high then drawBitmap(icon4.bmp)
If inPin 3 = high and inPin 4 = high then drawBitmap(icon5.bmp)
///not used///
If inPin 5 = high then drawBitmap(blank.bmp)
If inPin 6 = high then drawBitmap(blank.bmp)

}

I need help with the code..

eazy2001x:
It dosent tell me how to make a pin activate a image from the R3

I need help with the code..

I don't want to sound like a jerk, but... throw out all that code you posted. Start with the Lady Ada tutorial. Get it working with your hardware. Once your hardware is successfully displaying Lady Ada's images, then read through this

http://arduino.cc/en/Tutorial/HomePage

specifically

http://arduino.cc/en/Reference/VariableDeclaration
http://arduino.cc/en/Tutorial/DigitalPins

and you will begin to see how you can alter Lady Ada's existing code to include checks for your triggers and take appropriate actions. If you get stuck modifying Lady Ada's code to do what you want, post the modified code here in code tags (the '#' button in the reply editor) and we can help.

Can I just PayPal someone 20 bucks to write me the code and ill worry about the images.. Lol.. I know some vb and basic.. I really don't care much for new languages these days with all the time I'm putting into the rest of this project..

Post here: Jobs and Paid Consultancy - Arduino Forum

I'm reading thru all the examples and even see how to activate a LED with the use of a push button.. I dont want to just give up on this and spent the day creating all the icons i need in BMP with 128x128 to fit the screen. But i really cant see how to do the same with a bmp from the SD card. Ive been looking at this example: http://arduino.cc/en/Tutorial/TFTBitmapLogo

/*

 Arduino TFT Bitmap Logo example
 
 This example reads an image file from a micro-SD card
 and draws it on the screen, at random locations.
 
 In this sketch, the Arduino logo is read from a micro-SD card.
 There is a .bmp file included with this sketch.
 - open the sketch folder (Ctrl-K or Cmd-K)
 - copy the "arduino.bmp" file to a micro-SD
 - put the SD into the SD slot of the Arduino TFT module.
 
 This example code is in the public domain.
 
 Created 19 April 2013 by Enrico Gueli
 
 http://arduino.cc/en/Tutorial/TFTBitmapLogo
 
 */
 
// include the necessary libraries
#include <SPI.h>
#include <SD.h>
#include <TFT.h>  // Arduino LCD library

// pin definition for the Uno
#define sd_cs  4
#define lcd_cs 10
#define dc     9
#define rst    8  

// pin definition for the Leonardo
//#define sd_cs  8
//#define lcd_cs 7
//#define dc     0
//#define rst    1  

TFT TFTscreen = TFT(lcd_cs, dc, rst);

// this variable represents the image to be drawn on screen
PImage logo;


void setup() {
  // initialize the GLCD and show a message
  // asking the user to open the serial line
  TFTscreen.begin();
  TFTscreen.background(255, 255, 255);

  TFTscreen.stroke(0, 0, 255);
  TFTscreen.println();
  TFTscreen.println("Arduino TFT Bitmap Example");
  TFTscreen.stroke(0, 0, 0);
  TFTscreen.println("Open serial monitor");
  TFTscreen.println("to run the sketch");

  // initialize the serial port: it will be used to
  // print some diagnostic info  
  Serial.begin(9600);
  while (!Serial) {
    // wait for serial line to be ready
  }

  // clear the GLCD screen before starting
  TFTscreen.background(255, 255, 255);
 
  // try to access the SD card. If that fails (e.g.
  // no card present), the setup process will stop.
  Serial.print("Initializing SD card...");
  if (!SD.begin(sd_cs)) {
    Serial.println("failed!");
    return;
  }
  Serial.println("OK!");
 
  // initialize and clear the GLCD screen
  TFTscreen.begin();
  TFTscreen.background(255, 255, 255);

  // now that the SD card can be access, try to load the
  // image file.
  logo = TFTscreen.loadImage("arduino.bmp");
  if (!logo.isValid()) {
    Serial.println("error while loading arduino.bmp");
  }
}

void loop() {
  // don't do anything if the image wasn't loaded correctly.
  if (logo.isValid() == false) {
    return;
  }
 
  Serial.println("drawing image");

  // get a random location where to draw the image.
  // To avoid the image to be draw outside the screen,
  // take into account the image size.
  int x = random(TFTscreen.width() - logo.width());
  int y = random(TFTscreen.height() - logo.height());

  // draw the image to the screen
  TFTscreen.image(logo, x, y);

  // wait a little bit before drawing again
  delay(1500);
}

Now the Pin to activate LED code is here:

int ledPin = 13;                 // LED connected to digital pin 13

void setup()
{
  pinMode(ledPin, OUTPUT);      // sets the digital pin as output
}

void loop()
{
  digitalWrite(ledPin, HIGH);   // sets the LED on
  delay(1000);                  // waits for a second
  digitalWrite(ledPin, LOW);    // sets the LED off
  delay(1000);                  // waits for a second
}

but this is not helpful at all in my case. I'm just missing information..

#define ACTIVATED LOW

byte buttonPin = 12;
byte ledPin = 13;

pinMode(buttonPin, INPUT_PULLUP); // wire button to connect the Arduino pin to ground
pinMode(ledPin, OUTPUT);

if (digitalRead(buttonPin) == ACTIVATED)
  {
  digitalWrite(ledPin, HIGH);
  }
else
  {
  digitalWrite(ledPin, LOW);
  }