TANN THONA: Electronics

Department of Telecommunication and Electronic Engineering

Hot

Post Top Ad

Showing posts with label Electronics. Show all posts
Showing posts with label Electronics. Show all posts

Friday, August 23, 2019

Stereo Audio Amplifier Using KA2209 (IC)

7:37 PM 0

Royal University of Phnom Penh

Faculty of Engineering

Dep. of Telecommunication and Electronic Engineering


Project Title: Stereo Audio Amplifier


Group member:

Ly Seyha, Tann Thona, Chhoy Noreath, Nop Da, Simpich Dany

Advisor: Dr. Thap Tharoeun

First Generation, Year 3rd Semester II
2017



I. Introduction

This is a stereo audio amplifier module using the KA2209 IC, which is equivalent to the TDA2822. It will operate well from 3 – 12v DC and will work from a battery since the quiescent current drain is low. It requires no heat sink for normal use. The input and output are both ground referenced. Maximum output will be obtained with a 12v power supply and 8-ohm speaker, however it is particularly suitable for driving headphones from a supply as low as 3V.


II. Specifications of KA2209

  • D.C. input: 5 – 12 V at 200 – 500 mA max.
  • Power output: - > 1-Watt max. 4-8 ohms, 12V DC
  • > 500 mW, 32-ohm, 12V
  • > 500 mW, 4-ohm, 6V
  • Freq. Resp.: ~ 40 Hz to 200 kHz, 8-ohm, G=10
  • < 20 Hz to > 50 kHz, 32 ohms
  • THD: < 1 % @ 750 mW, 4-8Ω, 12V
  • < 0.2 % @ 250 mW, 4-8Ω, 12V
  • Sensitivity: < 300 mV, G = 20 dB
Figure 1. KA2209 IC



III. Assembly Instructions

  • The electrolytic capacitors are polarized, they have a + or - marked on them and they must be inserted correctly into the PCB.
  • The IC and socket have a notch at one end, which is marked on the PC board overlay. If there is no notch on the IC, there will be a dot next to pin 1, which is the same end.
  • Solder the socket in place first before installing the IC itself, then resistors, capacitors, and PCB pins. Leave the potentiometer until last. We have also provided input attenuation via the potentiometer which can be used as a volume control. This will keep the signal to noise ratio as high as possible. Extra gain provided by the amplifier will reduce the S/N ratio by a similar amount, since the input noise figure is constant.

IV. Testing

Check the voltage and polarity before connecting the battery or power supply. If it does not work, recheck all component positions and polarity. Check all solder joints, and all external wiring. The IC itself is quite robust, and there is very little else to go wrong. Remember when testing, it will not produce full output for more than a short duration because of limited heat dissipation. We found it easily exceeded the manufacturers specifications however.

IV. Circuit Description

There are only a few external components, 

  • R1, R2 and R3, R4 are the feedback resistors. 
  • C1 provides power supply decoupling.
  • C2, C3 are the output coupling capacitors.
  • C4, R1 and C5, R2 block DC in the feedback circuit from the inverting inputs.
  • C6, R3 and C7, R4 act as Zobel networks providing a high frequency load to maintain stability at frequencies where loud speaker inductive reactance may become excessive.
  • C8 and C9 are the input coupling capacitors, which block any DC that might be present on the inputs.
  • The pot provides adjustable input level attenuation.

Figure 2. Stereo Audio Circuit with KA2209 IC

V. Components Requirement

  • KA2209 IC   (x1)
  • Printed Circuit Board   (x1)
  • Capacitors
    • C1: 10 uF / 16 or 25V elec_cap   (x1)
    • C2, C3, C4, C5: 100 uF / 16 or 25V elec_cap   (x4)
    • C6, C7: 104 / 16V cera_cap   (x2)
    • C8, C9: 103 / cera_cap   (x2)
  • Resistor 4.7KOhm
    • R1, R2:  4.7 KOhm   (x2)
    • R3, R4:  3.3 KOhm   (x2)
  • Potentiometer: 10KOhm   (x1)

    VI. Reference

    Quasar Electronics Limited
    PO Box 6935
    Bishops Stortford
    CM23 4WP
    UNITED KINGDOM 
    Website:    http://www.quasarelectronics.com/3087.htm


    Photos


    Date: 26 October 2017
    Location: Royal University of Phnom Penh





    Read More

    Wednesday, January 16, 2019

    7 Segment One Digit Display Counting Up Number

    4:52 PM 0

    7 Segment One Digit Display

    1. Objective

    The objective of this project is talk about, how to use 7 segment 1 digits and display it around 0 to 9.

    2. Requirement

    • Arduino
    • USB Cable
    • 7 Segment 1 Digit (Cathode Type)
    • Resistor 220 or 330 Ohm
    • Electronic Wire

    3. Building

    The first build circuit like below on Figure 1.

    Figure 1: 7 Segment 1 Digit Connection

    4. Coding

     

      // 22 October 2017
     
    int PIN_A = 1;
    int PIN_B = 2;
    int PIN_C = 3;
    int PIN_D = 4;
    int PIN_E = 5;
    int PIN_F = 6;
    int PIN_G = 7;
    int i = 0;
    int j = 0;

    int Arduino_Pins[7] = {PIN_A, PIN_B, PIN_C, PIN_D, PIN_E, PIN_F, PIN_G}; // an array of pin numbers to which LEDs
    int Segment_Pins[10][7] = {{0,1,1,1,1,1,1}, // 0
    {0,0,0,0,1,1,0}, // 1
    {1,0,1,1,0,1,1}, // 2
    {1,0,0,1,1,1,1}, // 3
    {1,1,0,0,1,1,0}, // 4
    {1,1,0,1,1,0,1}, // 5
    {1,1,1,1,1,0,1}, // 6
    {0,0,0,0,1,1,1}, // 7
    {1,1,1,1,1,1,1}, // 8
    {1,1,0,1,1,1,1}, // 9
    };

    void setup() {
    // Configure Digital I/O
    pinMode(PIN_A, OUTPUT);
    pinMode(PIN_B, OUTPUT);
    pinMode(PIN_C, OUTPUT);
    pinMode(PIN_D, OUTPUT);
    pinMode(PIN_E, OUTPUT);
    pinMode(PIN_F, OUTPUT);
    pinMode(PIN_G, OUTPUT);
    }

    void loop() {

    for(i=0;i<10;i++)
    {
    for(j=0;j<7;j++)
    {
    digitalWrite(Arduino_Pins[j],Segment_Pins[i][j]);
    }
    delay(500);

    if(i==9)
    {
    i = 0;
    }
    }
    }



    5. Result

    Now we get a result, 7 Segment can display number from 0 to 9 with counting up.







    Royal University of Phnom Penh
    Faculty of Engineering
    Dep. Telecommunication and Electronic Engineering

    Group Member:
    1. Tann Thona
    2. Thach Soveasna
    3. Chhoy Noreath
    4. Neth Channa
    5. Mok Vira

    Instructor: Prof. Chann Tola
    Date: 22 October 2017
    Read More

    Transmition Encrypt and Decrypt Code in Arduino

    1:00 AM 0

    Send Message Encrypt and Decrypt in Arduino

    1. Objective

    The objective of this project is talk about,  use serial communication to send message with unreadable by use encrypt method that make someones who try hack our message. Receiver can decrypt message for readable because transmitter and receiver have the same reference.

    2. Requirement

    • Arduino UNO (x2)
    • USB Cable
    • Button
    • Electronic Wire

    3. Building

    The first build circuit like below on Figure 1.

    Figure 1: Serial Communication Encrypt and Decrypt



    4. Coding

    Transmitter Code:

          
    char Ref[94] = {'0','1','2','3','4','5','6','7','8','9',
    'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',
    'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',
    '`','~','!','@','#','$','%','^','&','*','(',')','-','_','+','=','[',']','{','}','|',';',':','"','<','>',
    '/','?','.',',','\'','\\'};

    int Encrypt[94] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,
    36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,
    69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93};

    int button = 13;
    String msg = "RUPP_MY002_L1_ON";
    String a = "3";

    void setup() {
    Serial.begin(9600);
    pinMode(button,INPUT_PULLUP);
    }

    void encryption(String str) {

    int msgLength = 0;
    int RefLength = 0;
    String dataEncrypt[20];

    //Serial.println(str);
    RefLength = sizeof(Ref);
    msgLength = str.length();

    // Encrypt
    for(int i=0;i<msgLength;i++) {
    for(int j=0;j<RefLength;j++) {
    if(msg[i]==Ref[j]) {
    dataEncrypt[i] = String(Encrypt[j]);
    }
    }
    Serial.print(dataEncrypt[i]);
    delay(30);
    }
    }

    void loop() {
    if(digitalRead(button)==0) {
    encryption(msg);
    }
    }



    Receiver Code:

    #define Ref '_'
    char Index[94] = {'0','1','2','3','4','5','6','7','8','9',
    'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',
    'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',
    '`','~','!','@','#','$','%','^','&','*','(',')','-','_','+','=','[',']','{','}','|',';',':','"','<','>',
    '/','?','.',',','\'','\\'};

    int Encrypt[94] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,
    36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,
    69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93};

    String msg[20];
    String data[20];
    String dataDecrypt;

    int button = 13;
    int i = 0;

    void setup() {
    pinMode(button,INPUT_PULLUP);
    Serial.begin(9600);
    Serial.setTimeout(3);
    }

    void AnalyseMsg(String msg) {

    int msgLength = 0; // Total of Message length
    int cnt = 0; // Count Reference number
    int refLocate[10] = {0}; // Location of the Reference in the message
    int x = 0; // Variable for helping arrange the msg
    int y = 0; // Variable for helping arrange the msg
    msgLength = msg.length() - 1;

    for(int i=0;i<msgLength+1;i++) {
    if(Ref == msg[i]) {
    cnt++;
    refLocate[cnt] = i;
    }
    }
    //Serial.println(cnt);
    refLocate[cnt+1] = msgLength;
    for(int j=0;j<cnt+1;j++) {
    if(refLocate[j+1] == msgLength) {
    y = 1;
    }
    for(int i=refLocate[j]+x;i<refLocate[j+1]+y;i++) {
    data[j] += msg[i];
    }
    Serial.println(data[j]);
    x = 1;
    }
    // Clear data
    for(int i=0;i<cnt+2;i++) {
    data[i] = "";
    }
    }

    void decryption() {
    for(int j=0;j<i;j++) {
    dataDecrypt += Index[msg[j].toInt()];
    }
    //Serial.println(dataDecrypt);
    AnalyseMsg(dataDecrypt);
    dataDecrypt = "";
    i = 0;
    }

    void Readmsg() {
    if(Serial.available()) {
    msg[i] = Serial.readString();
    //Serial.println(msg[i]);
    i++;
    }
    }

    void loop() {
    Readmsg();
    if(digitalRead(button) == 0) {
    decryption();
    delay(200);
    }
    }



    5. Result

    In the result when we push transmitter's button, the transmitter send message that we set in code to receiver with encrypt message. if we want receive message from transmitter in decrypt with readable just push receiver's button. In this case If we push receiver's button before push transmitter's button transmit "that mean transmitter don't send message to receiver", the text receive will errors.

    Figure 2: Result Sending Message with Encrypt and Decrypt in Proteus Simulation.









    Royal University of Phnom Penh
    Faculty of Engineering
    Dep. Telecommunication and Electronic Engineering

    Group Member:
    1. Tann Thona
    2. Thach Soveasna
    3. Chhoy Noreath
    4. Neth Channa
    5. Mok Vira

    Instructor: Prof. Chann Tola
    Date: 12 May 2017
    Read More

    Send Message Between Two Arduinos Use Serial Communication

    12:14 AM 0

    Send Message with Arduino Serial Communication

    1. Objective

    The objective of project is talk about, Using serial communication for send message between two Arduino. Transmitter send message with the text without spaces unreadable to receiver. Receiver automatic separate that text to different world which can read.

    2. Component Requirement

    • Arduino Uno (x2)
    • USB Cable
    • Button
    • Electronic Wire

    3.  Building

    The first build circuit like below show on Figure 1.

    Figure 1: Arduino Serial Communication Connected

    4. Coding

    Transmitter Code:

    // Code by Tann Thona, 20 November 2017
     
    int button = 13;
    String msg="RUPP_MY002_L1_ON";

    void setup() {
    // put your setup code here, to run once:
    pinMode(button,INPUT_PULLUP);
    Serial.begin(9600);
    }

    void loop() {
    // put your main code here, to run repeatedly:
    if(digitalRead(button)==0)
    {
    Serial.print(msg);
    delay(100);
    }
    else
    {
    Serial.write('0');
    delay(100);
    }
    }


    Receiver Code:

    // Code by Tann Thona, 20 November 2017

    #define Ref '_'
    String rmsg;
    int msglength=0;
    int cnt=0;
    int Reflocated[10]={0};
    String data [20];
    int x,y=0;
    void setup() {
    // put your setup code here, to run once:
    Serial.setTimeout(30);
    Serial.begin(9600);
    }
    void loop()
    {
    msglength=0;
    cnt=0;
    Reflocated[10]={0};
    data [20];
    x = 0;
    y = 0;
    // put your main code here, to run repeatedly:
    if(Serial.available())
    {
    rmsg = Serial.readString();
    msglength=rmsg.length()-1;
    for(int i=0;i<msglength+1;i++)
    {
    if(Ref ==rmsg[i]){
    cnt++;
    Reflocated[cnt]=i;
    }
    }
    Reflocated[cnt+1]=msglength;
    for(int j=0;j<cnt+1;j++){
    if(Reflocated[j+1]==msglength){
    y=1;
    }
    for(int i=Reflocated[j]+x;i<Reflocated[j+1]+y;i++){
    data[j]+= rmsg[i];
    }
    Serial.println(data[j]);
    Serial.println("---------------------------");
    data[j] = ' ';
    x=1;
    }
    }
    }



    5. Resulte

    In the result of this project show like Figure 2.

    Figure 2: Result Send Message in Arduino Use VIRTUAL TERMINAL in Proteus.

    •  If we don't push button transmitter send message "0" and receiver also receive message "0" too.
    • when we push button, transmitter send message “RUPP_MY002_L1_ON" to receiver then receiver separate in world readable RUPP MY002 L1 ON.



    -----------------------------------------------------
    Royal University of Phnom Penh
    Faculty of Engineering
    Dep. Telecommunication and Electronic Engineering

    Group Member:
    1. Tann Thona
    2. Thach Soveasna
    3. Chhoy Noreath
    4. Neth Channa
    5. Mok Vira

    Instructor: Prof. Chann Tola
    Date: 20 November 2017

    Read More

    Tuesday, December 11, 2018

    Arduino Serial Communication, One Transmiter with Three Receivers

    10:37 PM 0

    Transmit Data from One Arduino to Three Arduino

    1. Objective

    The objective of this project is talk about arduino serial communication. one arduino is a transmitter and three arduino are receiver. Transmitter have three buttons to control LED light at receiver.

    2. Requirement

    • Arduino Uno (x4)
    • USB Cable
    • Resistor (220ohm or 330ohm)
    • Button
    • LED
    • Electronic Wire

    3. Circuit Connection

    Build circuit like figure 1.


    Figure 1. Circuit connection arduino serial communication

     4. Coding

    Transmitter Code:

    // Code by Tann Thona 24 April 2017
    int button1 = 13;
    int button2 = 12;
    int button3 = 11;
    char inByte1 = '1';
    char inByte2 = '2';
    char inByte3 = '3';

    void setup() {
    // put your setup code here, to run once:
    pinMode(button1,INPUT_PULLUP);
    pinMode(button2,INPUT_PULLUP);
    pinMode(button3,INPUT_PULLUP);
    Serial.begin(9600);
    }

    void loop() {
    // put your main code here, to run repeatedly:
    if(digitalRead(button1)==0)
    {
    Serial.write(inByte1);
    delay(100);
    }
    else if(digitalRead(button2)==0)
    {
    Serial.write(inByte2);
    delay(100);
    }
    if(digitalRead(button3)==0)
    {
    Serial.write(inByte3);
    delay(100);
    }
    else
    {
    Serial.write('0');
    delay(100);
    }

    }

    Receiver 1 Code:
    // Code by Tann Thona 24 April 2017
    int led1 = 13;
    char inByte1 = '1';

    void setup() {
    // put your setup code here, to run once:
    pinMode(led1,OUTPUT);
    Serial.begin(9600);
    }

    void loop() {
    // put your main code here, to run repeatedly:
    if(Serial.available())
    {
    inByte1 = Serial.read();
    if(inByte1 == '1')
    {
    digitalWrite(led1,1);
    }
    else
    {
    digitalWrite(led1,0);
    }
    }

    }

    Receiver 2 Code:
    // Code by Tann Thona 24 April 2017
    int led2 = 13;
    char inByte2 = '2';

    void setup() {
    // put your setup code here, to run once:
    pinMode(led2,OUTPUT);
    Serial.begin(9600);
    }

    void loop() {
    // put your main code here, to run repeatedly:
    if(Serial.available())
    {
    inByte2 = Serial.read();
    if(inByte2 == '2')
    {
    digitalWrite(led2,1);
    }
    else
    {
    digitalWrite(led2,0);
    }
    }

    }


    Receiver 3 Code:
    // Code by Tann Thona 24 April 2017
    int led3 = 13;
    char inByte3 = '3';

    void setup() {
    // put your setup code here, to run once:
    pinMode(led3,OUTPUT);
    Serial.begin(9600);
    }

    void loop() {
    // put your main code here, to run repeatedly:
    if(Serial.available())
    {
    inByte3 = Serial.read();
    if(inByte3 == '3')
    {
    digitalWrite(led3,1);
    }
    else
    {
    digitalWrite(led3,0);
    }
    }

    }

    5. Result

    Now we get result:
    • Push button1 arduino transmitter tansmit number 1, LED's receiver 1 bright.
    • Push button 2 arduino transmitter tansmit number 2, LED's receiver 2 bright.
    • Push button 3 arduino transmitter tansmit number 3, LED's receiver 3 bright.








    Royal University of Phnom Penh
    Faculty of Engineering
    Dep. Telecommunication and Electronic Engineering

    Group Member:
    1. Tann Thona
    2. Thach Soveasna
    3. Chhoy Noreath
    4. Neth Channa
    5. Mok Vira

    Instructor: Prof. Chann Tola
    Date: 24 April 2017



    Read More

    Thursday, December 6, 2018

    Serial Communication Transmit Data Between Two Arduino

    5:39 PM 0

    Serial Communication Between Two Arduino

    1. Objective

    The objective is talk about, serial communication between two Arduino that use serial port Tx and Rx. A Arduino is transmitter and another one is receiver. Transmitter push button send data 1 or 0 to receiver to control LED light.

    2. Requirement

    • Arduino Uno x2
    • USB Cable x2
    • Breadboard
    • LED
    • Resistor (220Ohm or 330Ohm)
    • Button
    • Electronic Wire

    3. Build Circuit Serial Communication

    Build circuit like Fig1.1.

    Fig1.1. Serial communication between two Arduino

    Transmitter Code:
     
    // Code by Tann Thona (24/04/2017)
    // Transmitter Coder
    int button = 13;
    char inByte = '1';

    void setup() {
    // put your setup code here, to run once:
    pinMode(button,INPUT_PULLUP);
    Serial.begin(9600);
    }

    void loop() {
    // put your main code here, to run repeatedly:
    if(digitalRead(button)==0)
    {
    Serial.write(inByte);
    delay(100);
    }
    else
    {
    Serial.write('0');
    delay(100);
    }
    }


    Receiver Code:

    // Code by Tann Thona (24/04/2017)
    // Reciever Coder
    int led = 13;
    char inByte = '1';

    void setup() {
    // put your setup code here, to run once:
    pinMode(led,OUTPUT);
    Serial.begin(9600);
    }

    void loop() {
    // put your main code here, to run repeatedly:
    if(Serial.available())
    {
    inByte = Serial.read();
    if(inByte == '1')
    {
    digitalWrite(led,1);
    }
    else
    {
    digitalWrite(led,0);
    }
    }

    }


    4. Result

    According to code above, if we push button transmitter send number 1 to receiver and LED is bright. Then if we release button transmitter send number 0 to receiver and LED is dark.








    Royal University of Phnom Penh
    Faculty of Engineering
    Dep. Telecommunication and Electronic Engineering

    Group Member:
    1. Tann Thona
    2. Thach Soveasna
    3. Chhoy Noreath
    4. Neth Channa
    5. Mok Vira

    Instructor: Prof. Chann Tola
    Date: 24 April 2017
    Read More

    Wednesday, December 5, 2018

    Analog Read to Control LED Light

    11:33 PM 0

    Analog Read Control LED Light

    1. Objective

    The objective of this project is talk about, how to use analog read to control LED light colors. We use voltage divider input to analog pin and read value to control LED with digital pin.

    2. Electronic Requirement

    • Arduino Uno
    • USB Cable
    • Breadboard
    • LED (or RGB)
    • POT-HG (Variable Resistor)
    • Resistor 330Ohm or 220Ohm (Digital pin --> Resistor --> LED)
    • Electronic Wire

     3. Build Circuit

    The first build circuit like Fig1.1.


    Fig1.1 Analog read to control LED lights.

     Arduino Code:
    // Coding by Tann Thona (26/03/2017), Adviser: Chann Tola  
    float x=0;
    float y=0;
    int t =300;
    void setup()
    {
    pinMode(13,OUTPUT);
    pinMode(1,OUTPUT);
    pinMode(2,OUTPUT);
    pinMode(3,OUTPUT);
    //pinMode(10,OUTPUT);
    }
    void loop()
    {
    y = analogRead(A0);
    x=(5*y)/1023;
    if(x>3)
    {
    digitalWrite(13,HIGH);
    }
    else
    {
    digitalWrite(13,LOW);
    }

    // LED Three color (RGB)

    digitalWrite(1,HIGH);
    digitalWrite(2,LOW);
    digitalWrite(3,LOW);
    delay(t);
    //-------------------------
    digitalWrite(1,LOW);
    digitalWrite(2,HIGH);
    digitalWrite(3,LOW);
    delay(t);
    //-------------------------
    digitalWrite(1,LOW);
    digitalWrite(2,LOW);
    digitalWrite(3,HIGH);
    delay(t);
    //-------------------------
    }


    4. Result

    When we run this code in Arduino software and output to circuit, LED has light or dark is depend on value of POT-HG that we change. While we change POT-HG value power supply in put voltage to Pin Analog (A0) of Arduino and Pin Digital (13) red from A0 and output to LED. Whereas RGB is change color one by one of the three color with delay time in code.



    Royal University of Phnom Penh
    Faculty of Engineering
    Dep. Telecommunication and Electronic Engineering

    Group Member:
    1. Tann Thona

    2. Thach Soveasna
    3. Chhoy Noreath
    4. Neth Channa
    5. Mok Vira

    Instructor: Prof. Chann Tola
    Date: 26 March 2017
    Read More

    LCD 16x2 Automatic Scroll Letter Left to Right

    5:06 PM 0

    LCD 16x2 Display Automatic Scroll Letter

    1. Objective

    The objective of project is talk about, how to use LCD Screen 16x2 and display text on screen. On the first row of screen show text “RUPP ^_^ “and second row show “ TELECOM 2017” . In second row of screen display text that move text from left to right one by one. If which letters move to line fines limit screen that letter show back on the first column of left screen.

    2. Electronic Requirement

    • Arduino Uno
    • USB Cable
    • Breadboard
    • LMO16L (LCD 16x2)
    • Potentiometer (POT-HG Variable Resistor)
    • Resistor (220Ohm)
    • Electronic Write

    3. How to Build it?

    The first build circuit like below on Fig1.1.

    Fig1.1. LCD 16x2 display connection diagram

    Arduino Code:

    // Write code by Tann Thona (15/03/2017), Adviser: Chann Tola    


    // include the library code:
    #include <LiquidCrystal.h>

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

    char Telecom[16] = {' ',' ','T','E','L','E','C','O','M',' ',' ','2','0','1','7',' '};

    void setup()
    {
    // set up the LCD's number of columns and rows:
    lcd.begin(16, 2);
    lcd.setCursor(4, 0);
    lcd.print("RUPP ^_^");

    }// void setup

    void loop()
    {
    lcd.setCursor(0, 1);
    for(int j=0;j<=15;j++)
    {
    lcd.print(Telecom[j]);
    }
    lcd.setCursor(0, 1);
    delay(100);
    int swap = Telecom[15];
    for(int i=15;i>0;i--)
    {
    Telecom[i] = Telecom[i-1];
    }
    Telecom[0] = swap;

    }


    4. Result

    When we run this code in Arduino software and output to circuit, the text is automatic display on the LCD screen. The text “RUPP ^_^” is static show on the first row of LCD screen. Second row of LCE screen we see the text “TELECOM 2017” is automatic move step by step depend on delay in code on Arduino software like Fig1.2.


    Fig1.2. Result LCD 16x2 display automatic scroll letter left to right








    Royal University of Phnom Penh
    Faculty of Engineering
    Dep. Telecommunication and Electronic Engineering

    Group Member:
    1. Tann Thona

    2. Thach Soveasna
    3. Chhoy Noreath
    4. Neth Channa
    5. Mok Vira

    Instructor: Prof. Chann Tola
    Date: 15 March 2017


    Read More

    Tuesday, December 4, 2018

    7 Segment 4 Digits Display Count Up Number

    7:12 PM 0

    7 Segment 4 Digits Display

    1. Objective

    The objective of this project is talk about, how to use 7 segment 4 digits and display count up from 0 to 9999.

    2. Electronic Requirement

    • Arduino UNO
    • USP Cable
    • 7 Segment 4 digits (Cathode Type) 
    • Breadboard
    • Electronic Wire
    • Resistor x4 (330Ohm or 220Ohm)
      • Arduino pin 5 --> R1 --> 7 Segment D1
      • Arduino pin 4 --> R2 --> 7 Segment D2
      • Arduino pin 3 --> R3 --> 7 Segment D3
      • Arduino pin 2 --> R4 --> 7 Segment D4

      3. How to Build it?

       The first build circuit like below on Fig 1.1 automatic count up number.

      Fig 1. 7 segment 4 digits display automatic count up number 0 to 9999
      // Write code by Tann Thona (25/02/2017), Adviser: Chann Tola
      int PIN_A = 12;
      int PIN_B = 11;
      int PIN_C = 10;
      int PIN_D = 9;
      int PIN_E = 8;
      int PIN_F = 7;
      int PIN_G = 6;
      int DL4 = 5;
      int DL3 = 4;
      int DL2 = 3;
      int DL1 = 2;
      int i = 0;
      int j = 0;
      int n = 0;
      int k = 0;
      int h = 0;
      int Arduino_Pins[7] = {PIN_A, PIN_B, PIN_C, PIN_D, PIN_E, PIN_F, PIN_G}; // an array of pin numbers to which LEDs
      int Segment_Pins[10][7] = {{1,1,1,1,1,1,0}, // 0
      {0,1,1,0,0,0,0}, // 1
      {1,1,0,1,1,0,1}, // 2
      {1,1,1,1,0,0,1}, // 3
      {0,1,1,0,0,1,1}, // 4
      {1,0,1,1,0,1,1}, // 5
      {1,0,1,1,1,1,1}, // 6
      {1,1,1,0,0,0,0}, // 7
      {1,1,1,1,1,1,1}, // 8
      {1,1,1,1,0,1,1}, // 9
      };
      int DELAY = 1;
      int TIME = 0;
      void digit4()
      {
      digitalWrite(DL1,0);
      digitalWrite(DL2,1);
      digitalWrite(DL3,1);
      digitalWrite(DL4,1);
      for(j=0;j<7;j++) {
      digitalWrite(Arduino_Pins[j],Segment_Pins[i][j]);
      }
      delay(DELAY);
      }
      //=============================
      void digit3()
      {
      digitalWrite(DL1,1); // change 1 to 0 and 0 to 1 (for 7segment anoth type)
      digitalWrite(DL2,0);
      digitalWrite(DL3,1);
      digitalWrite(DL4,1);
      for(j=0;j<7;j++)
      {
      digitalWrite(Arduino_Pins[j],Segment_Pins[n][j]);
      } // end loop j
      delay(DELAY);
      }
      //==============================
      void digit2()
      {
      digitalWrite(DL1,1);
      digitalWrite(DL2,1);
      digitalWrite(DL3,0);
      digitalWrite(DL4,1);
      for(j=0;j<7;j++)
      {
      digitalWrite(Arduino_Pins[j],Segment_Pins[k][j]);
      } // end loop k
      delay(DELAY);
      }
      //==============================
      void digit1()
      {
      digitalWrite(DL1,1);
      digitalWrite(DL2,1);
      digitalWrite(DL3,1);
      digitalWrite(DL4,0);
      for(j=0;j<7;j++)
      {
      digitalWrite(Arduino_Pins[j],Segment_Pins[h][j]);
      } // end loop j
      delay(DELAY);
      }
      void setup()
      {
      // put your setup code here, to run once:
      pinMode(PIN_A, OUTPUT);
      pinMode(PIN_B, OUTPUT);
      pinMode(PIN_C, OUTPUT);
      pinMode(PIN_D, OUTPUT);
      pinMode(PIN_E, OUTPUT);
      pinMode(PIN_F, OUTPUT);
      pinMode(PIN_G, OUTPUT);
      pinMode(DL1, OUTPUT);
      pinMode(DL2, OUTPUT);
      pinMode(DL3, OUTPUT);
      pinMode(DL4, OUTPUT);

      }
      void loop()
      {

      for(i=0;i<10;i++)
      {
      for(TIME=0;TIME<=250;TIME++)// Simulation (TIME=0;TIME<=250;TIME++)
      {
      digit4();
      digit3();
      digit2();
      digit1();
      //delay(1);
      }
      // Condition Count Up

      if(i==9)
      {
      n++;
      //----------------
      if(n>9)
      {
      k++;
      //----------------
      if(k>9)
      {
      h++;
      //----------------
      if(h>9)
      {
      h = 0;
      } // end if(h>9)
      } // end if(k==9)
      //----------------
      if(k>9)
      {
      k = 0;
      }
      } // end if(n==9)
      //----------------
      if(n>9)
      {
      n = 0;
      } // end if (n>9)
      } // end if (i==9)

      } // end time

      } // End Void Loop


      4. Result

      Now we get a result that 7 segment 4 digits  display are started from 0 to 9999 with count up one by one per second in automatically like video below.








      Royal University of Phnom Penh
      Faculty of Engineering
      Dep. Telecommunication and Electronic Engineering

      Group Member:
      1. Tann Thona

      2. Thach Soveasna
      3. Chhoy Noreath
      4. Neth Channa
      5. Mok Vira 


      Instructor: Prof. Chann Tola
      Date: 25 February 2017
      Read More

      Monday, August 6, 2018

      Arduino Project Set Real Time Control Light 7 Segment

      11:54 PM 1

      Set Real Time Control Light Using 7 Segment


      1. Abstract

      Traditionally electrical light control by Time that regulate the electricity to these device. Time control light works by making everything in your house that turn on or turn of automatic controlled using technology control and do job that we would normally do manually. Light automatic take care of a lot of different activities in the house.

      2. Introduction

      In this project we want to do how to turn ON/OFF LED by press button as a switch to control Light of LED. We have three button for set time to turn on and turn of LED light. we used Real Time Clock (DS3231 module) to keep tract of the time even if the microcontroller is disconnect the main power because RTC run on its own batter like our clock. Using two of 7 segments cathode to display time by get real time from DS3231 module.
       

      3. Objective

      The main objective of this project is: that we are control light at our home using simple circuit.
      • Display Real Time on 7 segment
      • Set Time Automatic Turn ON LED Light
      • Set Time Automatic Turn OFF LED Light

      4. Electronic Requirement

      Electronic requirement use in this project:
      • Arduino Meg 2560
      • RTC DS3231 Module
      • 7 Segment Two Digit Cathode Type (x2)
      • Button (x3)
      • Resistance 330 Ohm (x6)
      • LED Red(x2) Wite(x1)
      • Breadboard (x1)
      • USB Connected from Arduino to Computer
      • Jumper Wire

      5. Methodology

      To create this project we use Arduino Meg 2560 as a main controller and 7segment show time clock, button set time such as minute and hour and LED turn on/off light. RTC DS3231 module to keep the time alive, and Arduino as a software for transfer the data from device to laptop or computer.
      • Controller
      The Arduino Mega is a microcontroller board based on the ATmega2560. It has 54 digital input/output pins, 16 analog inputs, 4 UARTs (hardware serial ports), a 16MHz crystal oscillator, a USB connection, a power jack and a reset button.

      Figure 1: Arduino MEGA 2560)

      • RTC DS3231 Module
      We need to use Real-time Clock (RTC DS3231) to keep tract of the time even if we program the microcontroller or disconnect the main power because RTC run on it own batter like our clock.
      The DS3231 is low-cost, highly accurate real-time which can maintain hours, minute, and seconds. This module work on both 3.3v and 5v that make it suitable for using with microcontroller (Arduino).

      Figure 2: DS3231 Real-time Clock Module

      • 7 Segment Cathode Two Digit
      7 Segment (cathode type) has 10 pins. 2 pins are GND (one for one’s digit) and others 8 pins are get power source for display number.


      Figure 3: 7Segment Cathode Two Digit

      • Button
      Button is similar switch too. If we press button it like switch open, but if we release it like switch close. We use button in this project to set time for torn on the light and turn off the light.

      Figure 4: Button

      • LED
      We use LED to show light depend on time that we set turn on or turn off.


      Figure 5: LED

      5.2 Circuit Diagram

      Connect Arduino pins to RTC and 7 Segment like diagram bellowed:
      • RTC DS3231 Module
      Table Connection RTC to Arduno

      Figure 6: The circuit of connection from Arduino MEGA to RTC

      • 7 Segment Cathode Two Digit
      Table Connection 7 Segment to Arduino


      Figure 7: The circuit of connection from Arduino MEGA to 7 Segment

      5.3 Algorithim of Project

      For this project we have 3 buttons to set time turn on and turn off LED light. The first button is use for save time and change digit edit time value. Second button use for go to set time turn on LED light and decrease time value. The last button use for go to set time turn off LED light and increase time value. DS312 module is keeping track of the time and 7 Segment display clock number.

      Figure 8: Full Diagram of Project

      Flow Chart Process

      5.4 Coding

      First open arduino software plus Arduino Mega USB Cable to computer and the select port:



      After connect pin RTC DS3231 module like above then upload code set real time to RTC like below:

      //#include <SPI.h>
      #include <DS3231.h> //Library for RTC module (Download from Link in article)
      DS3231 rtc(SDA, SCL);
      void setup()
      {
      Serial.begin(9600);
      //SPI.begin(); /* Enable the SPI interface */
      rtc.begin(); // Initialize the rtc object
      rtc.setTime(13, 52, 00); // Set the time to 12:00:00 (24hr format)
      rtc.setDate(13, 3, 2018); // Set the time to 12:00:00 (24hr format)
      }
      Void loop()
      {
      }

      *Note: You have to add library DS3231 in to this software.

      Then download code and upload to your arduino: Download Code



      6. Result

      After upload code to Arduino already we get result like below:

      • 7 Segment display real time clock by get time from DS3231.
      • Button 2 (Middle): press a second 7 Segment will go to set time turn on LED mode. In mode set time if click less than a second on Button it will increase number on 7 Segment.
      • Button 3 (Right): press a second 7 Segment will go to set time turn off LED mode. In mode set time if click less than a second on Button it will decrease number on 7 Segment.
      • Button 1 (Left): press a second in set time mode it will save time value. But if we click less than a second it will change digit for edit number of time.
      • LED will turn on/off when time we set the same real time.





      Royal University of Phnom Penh
      Faculty of Engineering
      Dep. Telecommunication and Electronic Engineering

      Group Member:
      1. Tann Thona
      2. Sim Pichdany
      3. Ven Seyha
      Instructor: Prof. Kuong Samnang
      Date: 16 March 2018
      Read More

      Post Top Ad