LCD 2004 - VA Negative_ Ceas cu DS3231



Diferenta dintre un display clasic si unul cu VA negativ.


La display-urile cu VA negativ, controlul contrastului este realizat printr-un potentiometru de 10K care este conectat la VEE - VO - VDD. 
Intre VEE si GND este masurata o tensiune negativa -7Vcc fara a fi conectat potentiometrul. Sursa negativa este realizata cu circuitul 7660.
Dupa cum se observa eu am inlocuit condensatorul C2 deoarece am conectat VDD la VEE asa cum se conecteaza la LCD-eurile clasice unde pinul 15 este A-nodul.



Test display doar alimentare si reglaj contrast:






Documentatie display: VA Negative

Ceas cu Arduino si DS3231 + scrol text:










Arduino - Code:
My Example
#include "Wire.h"  //WireLibrary comes with arduino
//Arduino UNO SDA = A4, SCL = A5
#include "LiquidCrystal.h"
#include "RTClib.h"

RTC_DS3231 rtc;
char daysOfTheWeek[7][12] = {"Duminica", "Luni    ", "Marti   ", "Miercuri", "joi     ", "Vineri  ", "Sambata "};

// initialize the library with the numbers of the interface pins
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
int count = 0;

String txtsc1, txtsc2, txtnosc;

void setup() {
  Wire.begin(); //initialise the TWI
  if (! rtc.begin()) {
    Serial.println("Couldn't find RTC");
    while (1);
  }

  //rtc.adjust(DateTime(__DATE__, __TIME__));
  rtc.adjust(DateTime(2021, 05, 02, 23, 59, 40));

  lcd.begin(20, 4);  //20 x 4 LCD (Change if required)

  //txtnosc = "Text No Scroll";
  txtsc1 = "Text Scrolling1     ";


  lcd.begin(20, 4);
  lcd.clear();
  delay(4000);
  lcd.setCursor(2, 0);
  lcd.print("text scrolling");
  lcd.setCursor(8, 1);
  lcd.print("si");
  lcd.setCursor(2, 2);
  lcd.print("Ceas cu DS3231");
  delay(4000);
  lcd.clear();

}

void loop() {
  DateTime now = rtc.now();

  lcd.setCursor(0, 0);
  txtsc1 = ScrollTxt(txtsc1);
  lcd.print(txtsc1);
  delay(200);

  lcd.setCursor(7, 1);
  lcd.print(":");

  lcd.setCursor(10, 1);
  lcd.print(":");

  lcd.setCursor(6, 2);
  lcd.print("/");

  lcd.setCursor(9, 2);
  lcd.print("/");

  //  pozitionare secunde
  if (now.second() < 10) {
    lcd.setCursor(11, 1);
    lcd.print(" ");
    lcd.setCursor(12, 1);
    lcd.print(now.second(), DEC);
  }
  if (now.second() >= 10) {
    lcd.setCursor(11, 1);
    lcd.print(now.second(), DEC);
  }

  //  pozitionare minute
  if (now.minute() < 10) {
    lcd.setCursor(8, 1);
    lcd.print(" ");
    lcd.setCursor(9, 1);
    lcd.print(now.minute(), DEC);
  }
  if (now.minute() >= 10) {
    lcd.setCursor(8, 1);
    lcd.print(now.minute(), DEC);
  }

  //  pozitionare ore
  if (now.hour() < 10) {
    lcd.setCursor(5, 1);
    lcd.print(" ");
    lcd.setCursor(6, 1);
    lcd.print(now.hour(), DEC);
  }
  if (now.hour() >= 10) {
    lcd.setCursor(5, 1);
    lcd.print(now.hour(), DEC);
  }

  //  pozitionare zi
  if (now.day() < 10) {
    lcd.setCursor(4, 2);
    lcd.print(" ");
    lcd.setCursor(5, 2);
    lcd.print(now.day(), DEC);
  }
  if (now.day() >= 10) {
    lcd.setCursor(4, 2);
    lcd.print(now.day(), DEC);
  }

  //  pozitionare luna
  if (now.month() < 10) {
    lcd.setCursor(7, 2);
    lcd.print(" ");
    lcd.setCursor(8, 2);
    lcd.print(now.month(), DEC);
  }
  if (now.month() >= 10) {
    lcd.setCursor(7, 2);
    lcd.print(now.month(), DEC);
  }

  lcd.setCursor(10, 2);
  lcd.print(now.year(), DEC);

  lcd.setCursor(1, 3);
  lcd.print("Azi este");
  lcd.setCursor(10, 3);
  lcd.print(daysOfTheWeek[now.dayOfTheWeek()]);

}

String ScrollTxt(String txt) {
  return txt.substring(1, txt.length()) + txt.substring(0, 1);

}


Niciun comentariu:

Trimiteți un comentariu