TANN THONA

TANN THONA

Department of Telecommunication and Electronic Engineering

Hot

Post Top Ad

Post Top Ad

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

    Thursday, February 7, 2019

    Smart Detecting Train Auto Control Gate

    2:01 AM 0

    Royal University of Phnom Penh

    Faculty of Engineering

    Dep. of Telecommunication and Electronic Engineering



    Course: Electronic System Design

    Project Title:

    Smart Detecting Train Auto Control Gate


    Group member:

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

    Advisor: Chan Tola


    1st Generation, Year 4th Semester I

    2017-2018

    Project Smart Detecting Train Auto Control Gate


    Smart Detecting Train Auto Control Gate


    I. Abstract

    In this article, we aim to build an electronic project is a Smart Detecting Train Auto Control Gate to control traffic of the quadrilateral road of the train and cars road. In this project, we will use 3 main controllers; microcontroller, sensor, and servo motor. we have developed it by invented a new board as Arduino board by using an ATmega328P microcontroller instead of Uno Arduino to control the project process, IR sensor type of TCRT5000 to cooperate with our new board to detect the train coming and then feedback the signal to the microcontroller for control the traffic light, buzzer and servo motor for on/off gate to prevent accident of cars and the train. The invention of the new board is too many steps to do, we will show the board invention of each step in the detail of article below. We have made a new board in order to control the process instead of the Arduino board, so this is a powerful project that we can make a PCB by our own.

    II. Introduction

    In Cambodia, nowadays there is not so strong in using electronic system to control the system along the railroad, usually we see just the manual system in this case, so we will have an idea to make a system which it works automatically by electronic components in it. This is called Smart Detecting Train Auto Control Gate, it is an Arduino project which we built it with the process commonly as the reality in training process. It is working by automatically in detecting the coming train in a specific distance and then command to traffic light and on-off the gate. It is a powerful project that we have developed by using a main board of a new making PCB with a ATmega328 instead of using the Arduino board in controlling the whole process of our project. In this project, we have used two more important components: servo motors and sensors. we used IR sensor type TCRT5000 to detect train and feedback to a microcontroller while the train is coming for control the traffic light, buzzer and on/off gate to stop cars by servo motors for prevention accident at the quadrilateral road between cars road and railroad. There are 6 pairs of IR sensor along the two part of railroad which there are 3 pairs of sensors to control a direction and 3 more pairs to control another, we have arranged it because we have imagined that we need more safety and smoothly to process on it. Two servo motors are used in controlling in on/off gate when the train coming and across and the traffic light is just used LEDs to output.

    We made it up in order to:
    • To learn about electronic components.
    • To show the powerful of electronic components in automatically working.
    • To understand the process in developing project and in reality
    • To compare process in project and reality working.
    • To know the designing of PCB by using software.
    • To know about making a new PCB as Arduino.
    • To show that we can making a controller PBC by our own selves.

    III. Electronic Requirement

    Base on this whole project, some requirement electronic components is list below:
    • Mini Servo x2
    • ATmega328P x1
    • Crystal 16MHz x1 and Capacitor Ceramic 22pF x2
    • IR sensor (TCRT5000) x6
    • LDR Sensor x1
    • LED (Red x3, Greenx2, Yellow x2 and White x8)
    • Resistor (10Kohm x7, 330ohm x 6 and 100ohm x2)
    • Capacitor Ceramic (100nF x2)
    • Capacitor Electrolyte 10uF x2
    • Adapter DC 9 or 12V (1 - 1.2A)
    • 12vDC Connector x1
    • Switch 12v x1
    • Terminal Block 2pins x1
    • Button x1
    • Regulator (L7805) x1
    • PCB (77mm x 72mm)
    • Jumper wire

    1. TCRT5000 IR Sensor


    There are two IR LEDs in a TCRT500 that blue LED is transmitter and black LED is a receiver. IR receiver is a potentiometer that is resistor has value depend on IR light.

    It works by transmitter LEDs transmit the IR light while the receiver receives the IR light by reflecting signal from object to making change the resistance value. The resistance value of transmitter should be the same of LED’s resistance value and receiver should more than 1Kohm. See Figure 1 below for IR Sensor characteristic and Its working.




    Figure 1: IR Sensor characteristic and Its working.


    2. Servo Motor

    In this project, we use servo motor to control to on-off gate when the train goes through that way.
    • It operates voltage from 4.8 – 6v
    • Stall torque: 1.8 kg.cm (4.8V), 2.2 kg.cm (6 V)
    • Operating speed: 0.1 s/60 degree (4.8 V), 0.08 s/60 degree (6 V).

    Figure 2: Servo motor specification.


    3. ATmega328P

    We used ATmega328P instead of Arduino board process of controlling, it is operating well with 1.8-5.5V of input voltage. It needed a crystal clock with two ceramic capacitors and a 10KOmh resistor and a button for reset to working our microcontroller.
    • Pin 1 is a reset pin to connect with a button.
    • Pins 2&3 are the Rx and Tx pins.
    • Pins 4 to 6 and 11 to 19 are the output digital pins.
    • For pins 7&8 are the power pins of VCC and GND.
    • For pins 9&10 are the connection pins of crystal with 2 capacitors.
    • For pins 23-28 are the output analog pins.

    Figure 3: Pins connection diagram for ATmega328P.


    IV. Methodology

    1. Making Print Circuit Board(PCB)

    1.1 PCB Software Design

    Base on this project, we have used 2 kind of software programs of Proteus to make new a PCB:


    Figure 4: Interface of Proteus ISIS design circuit schematic with v7.10.

    Figure 5: Interface of Proteus ARES design layout diagram with v7.10.

    • Proteus ISIS software v7.10: is used to draw the circuit diagram by connecting from any components which we necessary need for our project. It is also corporates to an ARES software program. See Figure 4 below for ISIS design.
    • Proteus ARES software v7.10: used to draw a layout of PCB diagram which connect form ISIS schematic design. See Figure 5 below for ARES design layout diagram.
    *Note: in these combining program, some package may not have in this software, so you need to draw it by manually.
    Go to this link to download software of the Proteus.v7.10 for the designing circuit schematic and diagram: Download Proteus.v7.10 Software

    1.2 PCB Hardware

    After we already design the diagram in Proteus software, then we need to follow these below steps:


    Figure 6: Making PCB hardware with step by step.


    These above figures show the steps of how to make a new PCB:
    • For Fig6.1, show the printing out of the circuit drawing on a slipper paper by the Laserjet printer.
    • Fig6.2, Iron that printed paper on the PCB board with a specific size.
    • Fig6.3, Put the PCB which already ironed into acid and making vibrate it carefully.
    • After we finish these 3 steps above then we need to apply all components to PCB board of each its position and then soldering it one by one. See Fig6.4&6.5.

    V. Experiment

    1. Program on ATMEGA328P Microcontroller


    This is the explains how to migrate from an Arduino board to a standalone the ATmega328P microcontroller on a breadboard for burning the bootloader and uploading program to it.

    Unless you choose to use the minimal configuration described at the end of this tutorial, we'll need four main components (besides the Arduino, ATmega328, and breadboard):
    • a 16 MHz crystal,
    • a 10k resistor, and
    • two 18 or 22 picofarad (ceramic) capacitors.

    1.1 Burning the Bootloader

    We need to burn the bootloader onto a new ATmega328P microcontroller by using an Arduino board as an in-system program (ISP).


    Figure 7: Wire connection to burn the bootloader onto an ATmega328P with Uno Arduino.


    We’re choosing an Uno Arduino board for this section, so to burn the bootloader, we need to follow these below steps:
    • Firstly, need to upload the ArduinoISP sketch onto an original Arduino board by select the board and serial port from the Tools menu that correspond to our board.
    • Wire up the Arduino board and microcontroller as shown in the diagram of Figure7.
    • Select "Arduino Duemilanove" from the Tools -> Board menu and then select to ATmega328.
    • Select "Arduino as ISP" from Tools -> Programmer
    • Run Tools -> Burn Bootloader
    You should only need to burn the bootloader once. After you've done so, you can remove the jumper wires connected to pins 10, 11, 12, and 13 of the Arduino board.

    1.2 Uploading Using an Arduino Board

    After ATmega328P has the Arduino bootloader on it, then we can upload programs to it by using the USB-to-serial convertor (FTDI chip) on an Arduino board.

    • To upload our code onto it, need to remove the microcontroller from the Uno Arduino board so the FTDI chip can talk to the microcontroller on the breadboard instead.
    • Connect the RX and TX lines from the Arduino board to our ATmega328 on the breadboard as shown in Figure 8.
    • To program the microcontroller, select "Arduino Duemilanove " from the the Tools > Board menu and select ATmega328, then upload as usual.

    Figure 8: Wire connection to uploading sketches code to an ATmega328P on a breadboard.


    1.3 Algorithm of Project

    In this section, we will introduce you to know about our project processing in the diagram, see Figure 9 below to understand well.

    To make a process in this project, we need to do the coding. For coding, you can download in link:


    Figure 9: Processing of Smart Detecting Train Auto Control Gate.



    Figure 10: Flow Char


    VI. Result

    After we spent 10 weeks to develop it, finally we have completed it with 90% of fully project.
    According to this project, there are two main parts, the smart detecting train system and auto night light system on this project. Let see the result of our full project’s demo is in the link below.


    Figure 11: Result of Smart Detecting Train Auto Control Gate.



    VI. Conclusion

    In sum, we have developed an electronic project which work automatically to traffic light and gate control by detecting the coming train at quadrilateral road. We have made a new PCB board which include a new chip ATmega328P and all-important components on it to cover to a whole project’s process that can be replacement to an Uno Arduino board. Finally, it is working 90% of fully project and we need to update it with any remaining part and something lost in order to finish our project completely.

    After we have finished this project, we knew many things about this project:
    • Knew some electronic components characteristic and its specification.
    • Understood the process in developing project and in reality.
    • Know the comparing of process in project and reality working.
    • Understood well about the designing of PCB by using Proteus software.
    • Knew about how making a new PCB and boot-loading the ATmega328P as Arduino.


    Reference


    [1]. https://www.arduino.cc/en/Tutorial/ArduinoToBreadboard

    [2]. https://nomada-e.com/store/sensores/9-sensor-optico-reflectivo-tcrt5000.html

    [3]. http://full-parts.com/mg90s-metal-gear-servo-for-arduino-micro-tower-pro-180-degrees.html

    [4]. https://voidyourwarranty.wordpress.com/2014/08/17/using-arduino-as-an-isp-to-program-a-standalone-atmega-328p-including-fuses/


    Photos

    Date: 20 December 2017
    Location: Royal University of Phnom Penh, Cambodia














    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

    Post Top Ad