Author Topic: Custom LCD tag powerd by Arduino  (Read 2877 times)

0 Members and 1 Guest are viewing this topic.

Offline GrandTheftAuto4lifeTopic starter

  • Contributor
  • Posts: 35
  • Country: se
  • Random Dude Doing Random Stuff
Custom LCD tag powerd by Arduino
« on: July 19, 2013, 07:25:06 pm »
Hmm, I got a bunch of lcd's I haven't come up with a use for...


I like these led/lcd tags you can buy, but I'd like to make my own one, using mainly parts that I already have...

Here is the list of parts I intend to use:

NHD-0216K1Z-NS(RGB) (LCD 2x16 chars, HD47780 compatible)
Arduino Mini
3v coin cells or tripple-A battery solution
Arduino sound sensor module


This should allow for a pretty slim design even though the lcd module is kinda fat (13 mm).

The reason why I have choosen this particular display is that it's the transmissive and has got rgb backlight.
(They were intended for another project which I never got around doing anything with)

Datasheet: http://www.mouser.com/ds/2/291/NHD-0216K1Z-NS_RGB_FBW-REV1-47051.pdf





Application Note: Antenna would be replaced by a sound sensor


Now the questions comes;

What do you think about the font?
Which battery solution should I go for?
Any ideas on how to do nice effects to the music played?
Any ideas on how to keep the depth of the final product below 2.5 cm?

I would appreciate help regarding the above...


If anyone is interested in the code used in the video;
Code: [Select]
#include <LiquidCrystal.h>

const int lcd_red = 9;
const int lcd_green = 10;
const int lcd_blue = 11;

const int AudioPin = A7;
int AudioValue;

int count=0;
int textflow=-1;

const int RS_pin = 13; // LCD R/S pin connected to Arduino Nano D2
const int RW_pin = -1; // LCD R/W pin connected to GND (We won't read data from the display)
const int Enable_pin = 12; // LCD R/S pin connected to Arduino Nano D3
const int Data_4 = 4; // Upper 4bit data bus line #1 (DB4)
const int Data_5 = 5; // Upper 4bit data bus line #2 (DB5)
const int Data_6 = 6; // Upper 4bit data bus line #3 (DB6)
const int Data_7 = 7; // Upper 4bit data bus line #4 (DB7)

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(RS_pin, Enable_pin, Data_4, Data_5, Data_6, Data_7);

// Letter E - Pixels group ONE (First)
byte Letter_E_1[8] = {
  B11111,
  B11111,
  B11000,
  B11000,
  B11000,
  B11000,
  B11111,
  B11111,
};

// Letter E - Pixels group TWO (Second)
byte Letter_E_2[8] = {
  B11110,
  B11111,
  B00000,
  B00000,
  B00000,
  B00000,
  B11000,
  B11100,
};
// Letter E - Pixels group THREE (Third) [Use Letter_E_1 to save LCD RAM]
// Letter E - Pixels group FOUR (Fourth) [Use Letter_E_2 to save LCD RAM]

// Letter X - Pixels group ONE (First) [Diagonal Line: DownRight]
byte Letter_X_1[8] = {
  B11000,
  B11000,
  B11100,
  B01100,
  B01110,
  B00110,
  B00111,
  B00011,
};
// Letter X - Pixels group TWO (Second) [Diagonal Line: TopLeft]
byte Letter_X_2[8] = {
  B00011,
  B00011,
  B00111,
  B00110,
  B01110,
  B01100,
  B11100,
  B11000,
};
// Letter X - Pixels group THREE (Third) [Use Letter_X_1 to save LCD RAM]
// Letter X - Pixels group FOUR (Fourth) [Use Letter_X_2 to save LCD RAM]

// Letter I - Pixels group (Only) [Use twice to create the character 'I']
byte Letter_I[8] = {
  B01011,
  B01011,
  B01011,
  B01011,
  B01011,
  B01011,
  B01011,
  B01011,
};

// Letter L - Pixels group ONE (First) [Use Letter_I to save LCD RAM]
// Letter L - Pixels group TWO (Second)
byte Letter_L[8] = {
  B01011,
  B01011,
  B01011,
  B01011,
  B01011,
  B01011,
  B01000,
  B01111,
};
// Letter L - Pixels group THREE (Third) (Uses no pixels)
// Letter L - Pixels group FOUR (Fourth)
byte Letter_dot[8] = {
  B00000,
  B00000,
  B00000,
  B00000,
  B11110,
  B11110,
  B00110,
  B11110,
};

// Letter F - Pixels group ONE (First) [Use Letter_I to save LCD RAM]
// Letter F - Pixels group TWO (Second) [Use Letter_E_2 to save LCD RAM]
// Letter F - Pixels group THREE (Third) [Use Letter_I to save LCD RAM]
// Letter F - Pixels group FOUR (Fourth)
byte Letter_bit[8] = {
  B11100,
  B11000,
  B00000,
  B00000,
  B00000,
  B00000,
  B00000,
  B00000,
};

void setup() {
  // Set up the audio input
  analogReference(DEFAULT); // 5v
  Serial.begin(9600); // Data rate between computer and project board
 
  // initialize the digital pin as an output.
  pinMode(lcd_red, OUTPUT);
  pinMode(lcd_green, OUTPUT);
  pinMode(lcd_blue, OUTPUT);
  // set up the LCD's number of columns and rows:
  lcd.begin(16, 2);
 
  // Print a message to the LCD.
  lcd.print("ExileFox");
  // Lit the LCD backlight
  analogWrite(lcd_red, 247);
 
  // Store a custom char on the LCD's memory
  lcd.createChar(0, Letter_E_1);
  // Store a custom char on the LCD's memory
  lcd.createChar(1, Letter_E_2);
 
  // Store a custom char on the LCD's memory
  lcd.createChar(2, Letter_X_1);
  // Store a custom char on the LCD's memory
  lcd.createChar(3, Letter_X_2);
 
  // Store a custom char on the LCD's memory
  lcd.createChar(4, Letter_I);
  // Store a custom char on the LCD's memory
  lcd.createChar(5, Letter_L);
 
  // Store a custom char on the LCD's memory
  lcd.createChar(6, Letter_dot);
  // Store a custom char on the LCD's memory
  lcd.createChar(7, Letter_bit);
 
}

// the loop routine runs over and over again forever:
void loop() {
    // Increase counter
    count++;
    // Adjust RGB LED
    if(count == 33 ||  count == 66 || count == 100)
    {
      AudioValue = analogRead(AudioPin); // Store the read value
      analogWrite(lcd_green, AudioValue);
      if(count == 66)
      {
        AudioValue = analogRead(AudioPin); // Store the read value
        analogWrite(lcd_red, AudioValue);
      }
      else if(count == 100)
      {
        AudioValue = analogRead(AudioPin); // Store the read value
        analogWrite(lcd_blue, AudioValue);
      }
    }else AudioValue = analogRead(AudioPin); // Store the read value
    // Send data to computer (serial monitor)
    Serial.println(AudioValue);
   
    if(textflow == -1) lcd.clear();
   
    // Write custom message
    if(count > 100)
    {
      count=0;     
      textflow++;
     
      if(textflow > 32) // Reset LCD
      {
        textflow=0; // Reset status of the message
        lcd.clear();
      }
      if(textflow >= 1) // E
      {
        lcd.setCursor(0, 0); // Move cursor up to the top line/row
        lcd.write(byte(0));
        lcd.write(byte(1));
        lcd.setCursor(0, 1); // Move cursor down to the bottom line/row
        lcd.write(byte(0));
        lcd.write(byte(1));
      }
      if(textflow >= 2) // EX
      {
        lcd.setCursor(2, 0);
        lcd.write(byte(2));
        lcd.write(byte(3));
        lcd.setCursor(2, 1);
        lcd.write(byte(3));
        lcd.write(byte(2));
      }
      if(textflow >= 3) // EX I
      {
        lcd.setCursor(4, 0);
        lcd.write(byte(4));
        lcd.setCursor(4, 1);
        lcd.write(byte(4));
      }
      if(textflow >= 4) // EXI L
      {
        lcd.setCursor(5, 0);
        lcd.write(byte(4));
        lcd.setCursor(5, 1);
        lcd.write(byte(5));
        lcd.write(byte(6));
      }
      if(textflow >= 5) // EXIL E
      {
        lcd.setCursor(7, 0);
        lcd.write(byte(0));
        lcd.write(byte(1));
        lcd.setCursor(7, 1);
        lcd.write(byte(0));
        lcd.write(byte(1));
      }
      if(textflow >= 6) // EXILE F
      {
        lcd.setCursor(9, 0);
        lcd.write(byte(4));
        lcd.write(byte(1));
        lcd.setCursor(9, 1);
        lcd.write(byte(4));
        lcd.write(byte(7));
      }
      if(textflow >= 7) // EXILEF O
      {
        lcd.setCursor(11, 0);
        lcd.write(byte(3));
        lcd.write(byte(2));
        lcd.setCursor(11, 1);
        lcd.write(byte(2));
        lcd.write(byte(3));
      }
      if(textflow >= 8) // EXILEFO X
      {
        lcd.setCursor(13, 0);
        lcd.write(byte(2));
        lcd.write(byte(3));
        lcd.setCursor(13, 1);
        lcd.write(byte(3));
        lcd.write(byte(2));
      }
      // EXILEFOX
    }
}

Updated code
Code: [Select]
#include <LiquidCrystal.h>

const int lcd_red = 9;
const int lcd_green = 10;
const int lcd_blue = 11;

const int AudioPin = A7;
int AudioValue;

int count=0;
int textflow=-1;

const int RS_pin = 13; // LCD R/S pin connected to Arduino Nano D2
const int RW_pin = -1; // LCD R/W pin connected to GND (We won't read data from the display)
const int Enable_pin = 12; // LCD R/S pin connected to Arduino Nano D3
const int Data_4 = 4; // Upper 4bit data bus line #1 (DB4)
const int Data_5 = 5; // Upper 4bit data bus line #2 (DB5)
const int Data_6 = 6; // Upper 4bit data bus line #3 (DB6)
const int Data_7 = 7; // Upper 4bit data bus line #4 (DB7)

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(RS_pin, Enable_pin, Data_4, Data_5, Data_6, Data_7);

// Letter E - Pixels group ONE (First)
byte Letter_E_1[8] = {
  B11111,
  B11111,
  B11000,
  B11000,
  B11000,
  B11000,
  B11111,
  B11111,
};

// Letter E - Pixels group TWO (Second)
byte Letter_E_2[8] = {
  B11110,
  B11111,
  B00000,
  B00000,
  B00000,
  B00000,
  B11000,
  B11100,
};
// Letter E - Pixels group THREE (Third) [Use Letter_E_1 to save LCD RAM]
// Letter E - Pixels group FOUR (Fourth) [Use Letter_E_2 to save LCD RAM]

// Letter X - Pixels group ONE (First) [Diagonal Line: DownRight]
byte Letter_X_1[8] = {
  B11000,
  B11000,
  B11100,
  B01100,
  B01110,
  B00110,
  B00111,
  B00011,
};
// Letter X - Pixels group TWO (Second) [Diagonal Line: TopLeft]
byte Letter_X_2[8] = {
  B00011,
  B00011,
  B00111,
  B00110,
  B01110,
  B01100,
  B11100,
  B11000,
};
// Letter X - Pixels group THREE (Third) [Use Letter_X_1 to save LCD RAM]
// Letter X - Pixels group FOUR (Fourth) [Use Letter_X_2 to save LCD RAM]

// Letter I - Pixels group (Only) [Use twice to create the character 'I']
byte Letter_I[8] = {
  B01011,
  B01011,
  B01011,
  B01011,
  B01011,
  B01011,
  B01011,
  B01011,
};

// Letter L - Pixels group ONE (First) [Use Letter_I to save LCD RAM]
// Letter L - Pixels group TWO (Second)
byte Letter_L[8] = {
  B01011,
  B01011,
  B01011,
  B01011,
  B01011,
  B01011,
  B01000,
  B01111,
};
// Letter L - Pixels group THREE (Third) (Uses no pixels)
// Letter L - Pixels group FOUR (Fourth)
byte Letter_dot[8] = {
  B00000,
  B00000,
  B00000,
  B00000,
  B11110,
  B11110,
  B00110,
  B11110,
};

// Letter F - Pixels group ONE (First) [Use Letter_I to save LCD RAM]
// Letter F - Pixels group TWO (Second) [Use Letter_E_2 to save LCD RAM]
// Letter F - Pixels group THREE (Third) [Use Letter_I to save LCD RAM]
// Letter F - Pixels group FOUR (Fourth)
byte Letter_bit[8] = {
  B11100,
  B11000,
  B00000,
  B00000,
  B00000,
  B00000,
  B00000,
  B00000,
};

void setup() {
  // Set up the audio input
  analogReference(DEFAULT); // 5v
 
  // initialize the digital pin as an output.
  pinMode(lcd_red, OUTPUT);
  pinMode(lcd_green, OUTPUT);
  pinMode(lcd_blue, OUTPUT);
  // set up the LCD's number of columns and rows:
  lcd.begin(16, 2);
 
  // Print a message to the LCD.
  lcd.print("ExileFox");
  // Lit the LCD backlight
  analogWrite(lcd_red, 247);
 
  // Store a custom char on the LCD's memory
  lcd.createChar(0, Letter_E_1);
  // Store a custom char on the LCD's memory
  lcd.createChar(1, Letter_E_2);
 
  // Store a custom char on the LCD's memory
  lcd.createChar(2, Letter_X_1);
  // Store a custom char on the LCD's memory
  lcd.createChar(3, Letter_X_2);
 
  // Store a custom char on the LCD's memory
  lcd.createChar(4, Letter_I);
  // Store a custom char on the LCD's memory
  lcd.createChar(5, Letter_L);
 
  // Store a custom char on the LCD's memory
  lcd.createChar(6, Letter_dot);
  // Store a custom char on the LCD's memory
  lcd.createChar(7, Letter_bit);
 
  // Reset the LCD backlight
  analogWrite(lcd_red, 0);
}

// the loop routine runs over and over again forever:
void loop() {
    // Increase counter
    count++;
    // Adjust RGB LED
    if(count == 10 || count == 20 || count == 30 || count == 40 || count == 50 || count == 60 || count == 70 || count == 80 || count == 90)
    {
        AudioValue = analogRead(AudioPin); // Store the read value
        analogWrite(lcd_green, AudioValue);
        if(count == 10 || count == 30 || count == 50 || count == 80)
        {
          AudioValue = analogRead(AudioPin); // Store the read value
          analogWrite(lcd_red, AudioValue);
        }
        else if(count == 20 || count == 40 || count == 60 || count == 70 || count == 80 || count == 90)
        {
          AudioValue = analogRead(AudioPin); // Store the read value
          analogWrite(lcd_blue, AudioValue);
        }
        delay(100);
    }
   
    if(textflow == -1) lcd.clear();
   
    // Write custom message
    if(count > 100)
    {
      delay(100);
     
      count=0;     
      textflow++;
     
      if(textflow > 32) // Reset LCD
      {
        textflow=0; // Reset status of the message
        lcd.clear();
      }
      if(textflow >= 1) // E
      {
        lcd.setCursor(0, 0); // Move cursor up to the top line/row
        lcd.write(byte(0));
        lcd.write(byte(1));
        lcd.setCursor(0, 1); // Move cursor down to the bottom line/row
        lcd.write(byte(0));
        lcd.write(byte(1));
      }
      if(textflow >= 2) // EX
      {
        lcd.setCursor(2, 0);
        lcd.write(byte(2));
        lcd.write(byte(3));
        lcd.setCursor(2, 1);
        lcd.write(byte(3));
        lcd.write(byte(2));
      }
      if(textflow >= 3) // EX I
      {
        lcd.setCursor(4, 0);
        lcd.write(byte(4));
        lcd.setCursor(4, 1);
        lcd.write(byte(4));
      }
      if(textflow >= 4) // EXI L
      {
        lcd.setCursor(5, 0);
        lcd.write(byte(4));
        lcd.setCursor(5, 1);
        lcd.write(byte(5));
        lcd.write(byte(6));
      }
      if(textflow >= 5) // EXIL E
      {
        lcd.setCursor(7, 0);
        lcd.write(byte(0));
        lcd.write(byte(1));
        lcd.setCursor(7, 1);
        lcd.write(byte(0));
        lcd.write(byte(1));
      }
      if(textflow >= 6) // EXILE F
      {
        lcd.setCursor(9, 0);
        lcd.write(byte(4));
        lcd.write(byte(1));
        lcd.setCursor(9, 1);
        lcd.write(byte(4));
        lcd.write(byte(7));
      }
      if(textflow >= 7) // EXILEF O
      {
        lcd.setCursor(11, 0);
        lcd.write(byte(3));
        lcd.write(byte(2));
        lcd.setCursor(11, 1);
        lcd.write(byte(2));
        lcd.write(byte(3));
      }
      if(textflow >= 8) // EXILEFO X
      {
        lcd.setCursor(13, 0);
        lcd.write(byte(2));
        lcd.write(byte(3));
        lcd.setCursor(13, 1);
        lcd.write(byte(3));
        lcd.write(byte(2));
      }
      // EXILEFOX
    }
}
« Last Edit: July 20, 2013, 03:18:59 pm by GrandTheftAuto4life »
I may not be perfect, but parts of me are excellent
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf