Monday 23 April 2012

My DB-Con Poster

Figure 33: DB-Con Poster

This is my last post present the poster that I'm going to present for my fyp demo (24/04/2012) ^_^ Thank you...

Saturday 7 April 2012

Results

1) Activate the system
Figure 25: Prototype System

Figure 26: LCD display upon activating the system

Figure 27: LCD display upon GSM Modem is ready to operate
Figure 25-27 shows the system prototype and LCD display when the system is activated and ready to operate. The prototype is activated when the 9Vdc power is applied to the control board and 6Vdc power is applied to the GSM Modem.
2) 1st RCCB Trip
Figure 28: LCD display upon Earth Fault occur

Figure 29: SMS receive upon the trip condition

Figure 28 and 29 shows the LCD display when an earth fault has occurred and trip the 1st RCCB. The system sends a SMS to the user to report the tripping and reply command to switch on the Backup RCCB.
3) Backup RCCB Triggered
Figure 30: User SMS Reply Command

Figure 31: LCD display upon switching on the Backup RCCB

Figure 32: SMS receive upon the Backup RCCB successfully energize
Figure 30-32 shows the SMS reply from the user to switching on the Backup RCCB. When the Backup RCCB successfully triggered, LCD will display “B.RCCB TRIGGERED” while at the same time GSM Modem will sends SMS to the user to inform the status of Backup RCCB.

Sunday 1 April 2012

My Project

Figure 24: DB-Con


This picture shown after finish the hardware and software development and now, DB-Con in the stage of testing to ensure all fuctioning.

Sunday 18 March 2012

Saturday 17 March 2012

Distribution Board Panel Wiring Design

Figure 21: DB Wiring Design


In the above figure, it shown the wiring design for DB-Con distribution board.

Thursday 15 March 2012

Control Board Circuit

Overall from the previous posts, they together create a complete control circuit to monitor the 1st RCCB situation and turn on the Backup RCCB when the 1st RCCB trip.

Figure 20: Control Board Circuit

Wednesday 7 March 2012

ICSP: In-Circuit Serial Programming

In-System Programming (ISP) is a technique where a programmable device is programmed after the device is placed in a circuit board. In-Circuit Serial Programming (ICSP) is an enhanced ISP technique. ICSP (In-Circuit Serial Programming) mode is special programming protocols that allow read and write to PIC Microcontroller and is the most direct method used to program the device. The ICSP capability is microchip’s proprietary process for microcontroller programming in the target application. The ICSP interface uses two pins as its core. The programming data pin (PGD) functions as both an input and an output, allowing programming data to be read in and device information to be read out on command. The programming clock pin (PGC) clocks in data and controls the overall process.

Serial programming allows customers to manufacture boards with unprogrammed devices and then to program the digital signal controller just before shipping the product. Serial programming also allows the most recent firmware or a custom firmware to be programmed.
Figure 19: ICSP Connector

PGD - Data: usual port and connection RB7
PGC - Clock: usual port and connection RB6
RESET: for the reset input

These are the signals that do the work. Data (PGD) and clock (PGC) transmit data to the pic micro. First data is sent either high or low voltage (0/1). After a suitable time the clock is strobe low to high - rising edge clocking the data into the microcontroller. PGD is also the line driven by the pic micro during verify i.e. it is bi-directional.

Monday 5 March 2012

AT Command

AT Command is a set of instructions used to control a modem. It is the abbreviation of ATtention. Each and every command of the set starts with “AT”. That's why modem commands are called AT commands. Many of the commands that are used to control wired dial-up modems, such as ATD (Dial), ATA (Answer), ATH (Hook control) and ATO (Return to online data state), are also supported by GSM/GPRS modems and mobile phones. Besides this common AT command set, GSM/GPRS modems and mobile phones support an AT command set that is specific to the GSM technology, which includes SMS related commands like AT+CMGS (Send SMS message), AT+CMSS (Send SMS message from storage), AT+CMGL (List SMS messages) and AT+CMGR (Read SMS messages).

Table 1: Common AT Command

Figure 18

Click here for more AT Command Classification information

Sunday 4 March 2012

UART Circuit

Figure 16: UART circuit contain of MAX232 circuit and the DB9 pin socket

For this post, there will be discussing on the UART circuit which enable for the GSM Modem connection to the PIC16F877A.

Figure 17: DB9 Serial Port Female Connector and MAX232 IC

A serial port is used to connect devices or computers, and therefore it should be connected to another serial port. An external device or modem that is connected to the serial port has an identical built-in serial port. It is possible two connection types between serial ports: straight (pins2 on both sides are connected) or null-modem (pin2 is connected to pin3 on another side). First connection type is used between DTE (Data Terminal Equipment) and DCE (Data Communications Equipment) devices (for example, a computer and modem), and the second connection type is used between two DTE devices (for example, two computers or a computer and an external device).

All signals of the RS232 port is are unidirectional. For example, if pin 2 outputs data, then it is unable to receive any signal using this pin. Therefore, two devices that can send data out (DTE-DTE connection) can’t connect using a straight cable. If not, then they would both send out signals on the same wire but neither would be able to receive any signal. Initially, RS232 ports were used for connecting a dumb terminal (DTE) to a modem (DCE). Nowadays computers used as DTE instead of a terminal. The meaning of the pins is the same on both Data Terminal Equipment and Data Communications Equipment. The names: "receive" and "transmit" should be interpreted from the "point of view" of the computer (DTE).

For this project, the microcontroller works on TTL logic; Logic 1= 5V and Logic 0 = 0V. The MAX232 IC is used to convert the TTL/CMOS logic levels to RS232 logic levels during serial communication of PIC16F877A with GSM Modem. It is a dual driver/receiver that includes a capacitive voltage generator to supply RS232 voltage levels from a single 5V supply. Each receiver converts RS232 inputs to 5V TTL/CMOS levels. These receivers (R1 & R2) can accept ±30V inputs. The drivers (T1 & T2), also called transmitters, convert the TTL/CMOS input level into RS232 level. The transmitters take input from controller’s serial transmission pin and send the output to RS232’s receiver. The receivers, on the other hand, take input from transmission pin of RS232 serial port and give serial output to microcontroller’s receiver pin. MAX232 needs four external capacitors whose value ranges from 1µF to 22µF.

Friday 2 March 2012

GSM / GPRS Modem

Figure 15: GSM Modem

A GSM modem is a wireless modem that works with GSM networks. A wireless modem behaves like a Hayes compatible dial-up modem. The main difference between a standard Hayes modem and a GSM modem is that a Hayes modem sends and receives data through a fixed telephone line while a GSM modem sends and receives data through radio waves. A GSM modem can be an external unit or a PCMCIA card (also called PC Card). An external GSM modem is connected to a PC through a serial cable, a USB cable, Bluetooth or Infrared. Like a GSM mobile phone, a GSM modem requires a SIM card from a wireless carrier in order to operate.

GSM/GPRS Modules are similar to modems, but there's one difference: A GSM/GPRS Modem is external equipment, whereas the GSM/GPRS Module is a module that can be integrated within equipment. It is an embedded piece of hardware.

PC's use AT commands to control a modem. GSM modems and normal Hayes modems support a common set of AT commands. A GSM modem can be used just like a Hayes compatible modem. GSM modems support an extended set of AT commands. These extended AT commands are defined in the GSM standards. With the extended AT commands, the things that can be done are like:
  1. Read, write and delete SMS messages.
  2. Send SMS messages.
  3. Monitor the signal strength.
  4. Monitor the charging status and charge level of the battery.
  5. Read, write and searched phone book entries.
The number of SMS messages that can be processed by a GSM modem is pretty low, approx. six messages per minute.
A GPRS modem is a GSM modem with additional support for GPRS technology for data transmission. GPRS means: 'General Packet Radio Service'. It is based on a packet-switched technology, as an extension to GSM (note that GSM is a circuit-switched). An advantage of GPRS over GSM is that GPRS has a much higher data transmission speed. GPRS can be used as the bearer of SMS. If SMS over GPRS is used, an SMS transmission speed of about 30 SMS messages per minute may be achieved. This is much faster than SMS over GSM. A GPRS modem is required to send and receive SMS via GPRS. Some wireless carriers do not support the sending and receiving of SMS via GPRS. A GPRS modem is typically required for MMS.

Friday 24 February 2012

TDMA technology

Figure 14: The GSM system uses TDMA to split a frequency into time slots.

Time division multiple access (TDMA) is the access method GSM uses for shared networks. GSM uses TDMA to raise the efficiency of the network. GSM uses TDMA to raise the efficiency of the network.Using TDMA, a narrow band that is 30 kHz wide and 6.7 milliseconds long is split time-wise into three time slots. Narrow band means channels in the traditional sense. Each conversation gets the radio for one-third of the time. This is possible because voice data that has been converted to digital information is compressed so that it takes up significantly less transmission space. Therefore, TDMA has three times the capacity of an analog system using the same number of channels.

Thursday 23 February 2012

What is GSM?

GSM stand for Global System for Mobile communications. Originally, the acronym GSM stood for Groupe Spécial Mobile, a group formed by the Conference of European Posts and Telegraphs (CEPT) in 1982 to research the merits of a European standard for mobile telecommunications. In Europe and many other parts of the world, GSM is the only type of cellular service available. Commercial service using the GSM system did not actually start until 1991. The technology behind the GSM uses Gaussian Minimum Shift Keying (GMSK) modulation a variant of Phase Shift Keying (PSK) with Time Division Multiple Access (TDMA) signalling over Frequency Division Duplex (FDD) carriers. (How GSM works?)

GSM systems provide a number of useful features:
  • Uses encryption to make phone calls more secure 
  • Data networking 
  • Group III facsimile services 
  • Short Message Service (SMS) for text messages and paging 
  • Call forwarding 
  • Caller ID 
  • Call waiting 
  • Multi-party conferencing

    Thursday 16 February 2012

    Input & Output Circuit

    In the previous post, the basic circuit is complete but still can't see any result yet. This is because there is no input and output attached to the I/O pins to show any result. Below is the basic input and output circuit for this project:


    Input Circuit
     Figure 7: Input Circuit

    The push button input is a very simple and direct input. It has being put in the circuit replacing the input from J6 connector (signal status from the 1st RCCB) for simulating in the Proteus Software for output generating. As in the circuit above, push button is being pulled up by R4 (10KOhm Resistor) to Vcc. So, when the push button is being released, the voltage will be Vcc (5V, since it is being pulled up to Vcc), and when push button is being pressed, the voltage will be 0V. This type of input is called active low input, where the output voltage is 0V or Logic 0 when it is active (button pressed). Sometime, there is a circuit that will put a resistor before the digital input port. The function of the resistor is to protect the digital input port at the microcontroller, just in case that the digital input port is being configured as an output, and the resistor will limit the current from the port.


    Output Circuit

    There are 3 output circuit for this project:

    1) LED
    Figure 8: Basic Output Circuit

    When OUTPUT 2 receive logic condition from the microcontroller, R10 (330kohm) will limit the current to the D3 LED. The D3 LED will on.


    2) LCD
    Figure 9: LCD Pins Diagram
    
    The most commonly used LCDs found in the market today are 1 Line, 2 Line or 4 Line LCDs which have only 1 controller and support at most of 80 characters. Most LCDs with 1 controller has 14 pins. Pin description is shown in the table below:

    Figure 10: Character LCD Pins with 1 Controller

    Display data RAM (DDRAM) stores display data represented in 8-bit character codes. Its extended capacity is 80 X 8 bits, or 80 characters. The area in display data RAM (DDRAM) that is not used for display can be used as general data RAM. So whatever user sends on the DDRAM is actually displayed on the LCD. For LCDs like 1x16, only 16 characters are visible, so whatever user write after 16 chars is written in DDRAM but is not visible to the user.
    Figure 11: DDRAM Address for 2 Line LCD

    2.1) LCD Circuit
    Figure 12: LCD Circuit Connection
    

    Above is the connection diagram of LCD in 4-bit mode, only 7 pins needed to interface with an LCD. D4 - D7 are the data pins connection and Enable and Register select are for LCD control pins. The Read/Write (RW) pin of the LCD will not be using, as the data only writing on the LCD. So, it has to be grounded permanently. If user wants to use it, then they may connect it on controller but that will only increase another pin and does not make any big difference. The unwanted data pins of LCD i.e. Vss, VEE and D0-D3 are connected to ground.
    There are many reasons why use LCD in 4-bit mode instead of 8-bit. One basic reason is lesser number of pins are needed to interface LCD.

    More about LCD

    3) Relay Switching
    Figure 13: Relay Switching Circuit
    

    For the above circuit, when the base of the transistor receive any supply from the microcontroller, it will allow the 5V to the ground without active the relay. Otherwise, the relay will active and create a back e.m.f that will turn the switching from the normally open to normally close (which is turn on the Backup RCCB).

    Thursday 9 February 2012

    Basic Circuit for PIC16F877A

    There's no point in knowing the PIC16F877A without know how to start up it. There are 7 pin should be connect correctly. 

    Power Supply Pin

    Table 1: Power Supply Pin


    In every single electronic component, the supply pin is the most important thing. Same goes to PIC16F877A. The ideal voltage for this microcontroller is 5V (DC). The current that supply to this microcontroller should not be higher that 5.5V and below then 2V. This is because, the higher current will burn the microcontroller and the microcontroller will not operate if the current is below than it required current. Usually, the supply come from either battery or dc adapter and it's hard to fine normal battery or dc adapter in 5V. This problem can be solve by using LM7805 (Datasheet) voltage regulator which will step down the larger input voltage to 5V. Below is the voltage regulating circuit to regulate a voltage from 7V-20V to a stable 5V by using LM7805:

    Figure 3: Basic connection to step down to 5V

    The circuit begins with J2 which is a 2 pins connector to connect to battery or ac adapter. Pin 1 is negative and pin 2 is positive. The first capacitor C1, cleans up the signal if any (ac) noise is present on this. It shorts this noise to ground and allows the pure DC signal into the regulator. The regulator regulates this voltage down to 5 volts. After it comes out of the regulator, the other capacitor C2, cleans up any high-frequency or ac noise that may come out, again to produce a clean DC signal. Now this DC voltage, clean and crisp, is ready to power the load. D1 is a 5V LED as power on/off indicator and R1 is a resistor to limit the current through the LED.

    Reset Pin

    As being mention before, there are 7 pins to connect in order to operate the microcontroller. 4 pins already connected, so there are 3 more pins left. The other important pin is the reset pin (MCLR-Master Clear Reset at Pin 1). If the PIC read 0V at the MCLR pin, it will reset the program and if the MCLR pin read 5V, the PIC will execute the program. The MCLR can be directly connect with 5V (series with resistor like picture below) but it will unable to reset if something goes wrong with the system.

    Figure 4: 5V direct current connection to MCLR pin

    To solve this problem, a switch and a pull up resistor can be added in between 5V and the reset pin so it can create logic condition which is 1 and 0 to reset the pin.

    Figure 5: Reset connection with switch and pull up resistor

    Table 2: Logic Condition for MCLR pin

    When the switch is not pushed, current will flow trough 10K resistor and MCLR Pin. As a result, MCLR Pin receive 5V and PIC read it as logic 1. But when switch is push, current will flow through 10K resistor, switch and directly to ground. There is no voltage will receive at MCLR Pin. This give 0 logic at MCLR Pin.

    Oscillator

    Five from seven of important pins already covered, now there are only 2 pin left which is pin number 13 and 14. Those pin was named as OSC1 and OSC2. It can been connect  to the crystal osillator from various frequency. Pulse generated from the oscillator will some time have the noise. To reduce the noise, two capacitors in piko farad value is needed. The value of capacitor is depend on the speed of oscillator that you use. Below is the way how to connect the the cristal oscillator and capacitor value table.

    Figure 6: Oscillator connection

    Table 3: Capacitor value refer to the oscillator type

    Thursday 2 February 2012

    PIC16F877A Microcontroller


    Figure 1: PIC16F877A 

    PIC16F778A is widely uses now and it is also famous among the beginner until all the professionals because of the FLASH Memory technology which can be write/erase within a tousand times of programming. Speed and code compression are the superiority of this risc microcontroller compared to other 8-bit microcontroller. PIC16F877A have 40 pin by 33 path of I/O. EEPROM memory makes it easier to apply microcontrollers to devices where permanent storage of various parameters is needed (codes for transmitters, motor speed, receiver frequencies, etc.). Low cost, low consumption, easy handling and flexibility make PIC16F877A applicable even in areas where microcontrollers had not previously been considered (example: timer functions, interface replacement in larger systems, coprocessor applications, etc.).In System Programmability of this chip (along with using only two pins in data transfer) makes possible the flexibility of a product, after assembling and testing have been completed. This capability can be used to create assembly-line production, to store calibration data available only after final testing, or it can be used to improve programs on finished products.


    Figure 2: PIC16F877A Bubble Diagram


    Special Microcontroller Features:

    • 100,000 erase/write cycle Enhanced Flash program memory typical
    • 1,000,000 erase/write cycle Data EEPROM memory typical
    • Data EEPROM Retention > 40 years
    • Self-reprogrammable under software control
    • In-Circuit Serial Programming™ (ICSP™) via two pins
    • Single-supply 5V In-Circuit Serial Programming
    • Watchdog Timer (WDT) with its own on-chip RC oscillator for reliable operation
    • Programmable code protection
    • Power saving Sleep mode
    • Selectable oscillator options
    • In-Circuit Debug (ICD) via two pins

    Peripheral Features:

    • Timer0: 8-bit timer/counter with 8-bit prescaler
    • Timer1: 16-bit timer/counter with prescaler, can be incremented during Sleep via external crystal/clock
    • Timer2: 8-bit timer/counter with 8-bit period register, prescaler and postscaler
    • Two Capture, Compare, PWM modules
    • Synchronous Serial Port (SSP) with SPI™ (Master mode) and I2C™ (Master/Slave)
    • Universal Synchronous Asynchronous Receiver
    • Transmitter (USART/SCI) with 9-bit address detection
    • Parallel Slave Port (PSP) – 8 bits wide with external RD, WR and CS controls (40/44-pin only)
    • Brown-out detection circuitry for Brown-out Reset (BOR)

    High-Performance RISC CPU:

    • Only 35 single-word instructions to learn
    • All single-cycle instructions except for program branches, which are two-cycle
    • Operating speed: DC – 20 MHz clock input DC – 200 ns instruction cycle
    • Up to 8K x 14 words of Flash Program Memory, Up to 368 x 8 bytes of Data Memory (RAM), Up to 256 x 8 bytes of EEPROM Data Memory
    • Pinout compatible to other 28-pin or 40/44-pin PIC16CXXX and PIC16FXXX microcontrollers

    Analog Features:

    • 10-bit, up to 8-channel Analog-to-Digital Converter (A/D)
    • Brown-out Reset (BOR)
    • Analog Comparator module (Two analog comparators, Programmable on-chip voltage reference (VREF) module, Programmable input multiplexing from device inputs and internal voltage reference, Comparator outputs are externally accessible)

    CMOS Technology:

    • Low-power, high-speed Flash/EEPROM technology
    • Fully static design
    • Wide operating voltage range (2.0V to 5.5V)
    • Commercial and Industrial temperature ranges
    • Low-power consumption

    Friday 27 January 2012

    Review on other project: GSM Control Project



    This GSM Control project is about controlling the home appliances such as bulb, fan, motor and etc. The concept and technology used is similar but different device controlled. 

    Thursday 26 January 2012

    2nd FYP Briefing



    1. Prof. Zul had explain on fyp systematic management by slides.
    2. Discussion by phone with advisor about changing the title of fyp from "Fault Power Home Device Using GSM" into "Home Distribution Backup Power via GSM".
    3. The new title has been approved.  


      Thursday 19 January 2012

      1st FYP Briefing

      In the first fyp briefing, all student are required to have a blog for a new way of presenting weekly progress and Sir Ismail Adam had presented the way of doing fyp in a systematic way.