Tuesday 23 July 2013

Serial LCD

This example shows how to send serial input from a host computer to the LCD connected to microcontroller. I am using 4 bit mode to drive my LCD.


Video




Original Photo




Pin Connection

  • LCD RS pin to digital pin 12
  • LCD Enable pin to digital pin 11
  • LCD D4 pin to digital pin 5
  • LCD D5 pin to digital pin 4
  • LCD D6 pin to digital pin 3
  • LCD D7 pin to digital pin 2

Schematic




Code

#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup(){
    // set up the LCD's number of columns and rows: 
  lcd.begin(16, 2);
  // initialize the serial communications:
  Serial.begin(9600);
}

void loop()
{
  // when characters arrive over the serial port...
  if (Serial.available()) {
    // wait a bit for the entire message to arrive
    delay(100);
    // clear the screen
    lcd.clear();
    // read all the available characters
    while (Serial.available() > 0) {
      // display each character to the LCD
      lcd.write(Serial.read());
    }
  }
}



Open the serial monitor, type anything and press send.
The data from your PC will be displayed on your LCD.

Thursday 11 July 2013

Mood Lamp

Mood Lamp basically is a RGB led lamp made with 10 RGB led connected in parallel. This lamp is controlled by microcontroller which changes its colour through PWM pins.




RGB led 
                                   


PARTS USED

  • RGB LEDs
  • PCB
  • Power supply (9v)
  • Arduino microcontroller
  • Transistor TIP122
  • Solder iron

Schematic 

RGB led lamp Circuit

Code

int redPin = 6;
int greenPin = 15;
int bluePin = 3;
void setup()
{
  pinMode(redPin, OUTPUT);
  pinMode(greenPin, OUTPUT);
  pinMode(bluePin, OUTPUT);  
}
void loop()
{
  setColor(255, 0, 0);  // red
  delay(1000);
  setColor(0, 255, 0);  // green
  delay(1000);
  setColor(0, 0, 255);  // blue
  delay(1000);
  setColor(255, 255, 0);  // yellow
  delay(1000);  
  setColor(80, 0, 80);  // purple
  delay(1000);
  setColor(0, 255, 255);  // aqua
  delay(1000);
}
void setColor(int red, int green, int blue)
{
  analogWrite(redPin, red);
  analogWrite(greenPin, green);
  analogWrite(bluePin, blue);  
}


Change the code as per your project.

Wednesday 3 July 2013

Embedded system

An Embedded System is a computer system designed for specific control functions within a larger system. It is embedded as part of a complete device often including hardware and mechanical parts.

Embedded systems control many devices in common use today, namely Mobile Phones, Automobiles, Aircrafts, Computers, etc.

In simple words: An Embedded System is a combination of hardware and software whose purpose is to control a device, a process or a larger system.