Saturday, April 24, 2010

Preparing for the final draft and hardcover report

Preparing the final draft that include all 5 chapter from the beginning. After get the approval from the supervisor, the hardcover will be made. The hardcover must do 2 copies. One for the FYP committee and the other one is for my self. For my supervisor, he only want a softcopy. So I need to burn it to the cd using pdf format.

Monday, April 19, 2010

viva..

Demo day that been held on 12th April 2010 at Multipurpose Hall with all degree final semester student. Each student get 2 accessors to access them.. Below is some of the situation in the hall and my prototype..









Picture below is my prototype that I do by using the A4 box and for the decoration I using the recycle paper and calendar.


















Monday, April 5, 2010

Finalize the Circuit and Prototype

The circuit is almost done, so need to finalize it and do the prototype.. My prototype is most likely a living room part that have light and bulb. The prototype is done by using the A4 box and some colour paper and recycle calendar.

Wednesday, March 31, 2010

Do the PCB fabrication and Drilling process

Even though I already make the circuit using the strip board, the circuit cannot be function as usual.. The light cannot be dim.. It can only on and off.. So, I decided to try to do the circuit using PCB and test whether the circuit can work as planned or not..

And this is a few step in etching and drilling the board..


This is the PCB UV board when we open the cover of the board


The circuit is printed by using laser jet printer on the transparency paper. The circuit is tab on the UV board an seal it with the tape but make sure the tape doesn't cover the circuit..


Put the UV board that already tab with the transparency into the UV box to print the circuit by using the UV technology on the board.


This box is to remove the green layer of the board and only left the layer of the circuit.. To make this box function, need to put the circuit inside the net given and push both green button on the left of this box..


After about 3 minutes, take it out from the box and the result you can see as in the picture above..


Then wash the circuit using a water to make sure that the chemical from the box is totally removed..


Place the board to the etching net carefully and make sure that it not cover the circuit that printed on the board..


Place the board inside the etching box and close the cover of the etching machine..


Set the etching machine to 5 minutes and press the yellow button for start the machine.. Then wait for 5 minutes.. But please make sure that ON the etching machine by switch ON the power supply and push both green button on the machine..


After wait about 5 minutes, the machine will stop and place it out from the etching net and wash it again..


That's the result when the copper are gone..


This me with my circuit.. But there still have one more step.. You need to dip the board into the tinner to remove the green layer.. If not, you cannot solder the component on your board...


Then, the next state, we all go for drilling the PCB to make the hole so that it can place the component on this board.. And for your information, this is my first time in drilling things so I need to read a manual and ask for help in using this drilling device.. hehehe... Its quite fun you know..


This is my picture in drilling the board.. My hand is shaking badly because of the drilling device so I need my friend to hold the PCB..

Monday, March 29, 2010

Program for Receiver

#include <16f877a.h>
#use delay(clock=20000000)
#fuses hs,nowdt,protect
#use rs232(baud=9600,xmit=PIN_C6,rcv=PIN_C7,PARITY=N)

//initialize port
#byte PORTA=5
#byte PORTB=6
#byte PORTC=7
#byte PORTD=8

int receive1=0;
int receive2=0;
int receive3=0;

//receive data
#int_rda
void serial_isr()
{
receive1=getch();
receive2=getch();
receive3=getch();
}

void main()
{
//set io for pic
set_tris_a(0b11111111);
set_tris_b(0b00000000);
set_tris_c(0b10000000);
set_tris_d(0b00000000);
setup_port_a(NO_ANALOGS);
setup_adc(ADC_CLOCK_INTERNAL);

//set interrupt
enable_interrupts(int_rda);
enable_interrupts(GLOBAL);

//set pwm
setup_ccp1(CCP_PWM);
setup_ccp2(CCP_PWM);
setup_timer_2(T2_DIV_BY_1, 255, 1);

//test output
output_high(pin_d1);
output_high(pin_c4);
set_pwm1_duty(255);
set_pwm2_duty(255);
delay_ms(2000);
output_low(pin_d1);
output_low(pin_c4);
set_pwm1_duty(0);
set_pwm2_duty(0);

do
{
//blink led
output_high(pin_c4);
delay_ms(250);
output_low(pin_c4);
delay_ms(250);

if(receive1=='a') //on relay
{
output_high(pin_d1);
}
else if(receive1=='b') //off relay
{
output_low(pin_d1);
}

set_pwm1_duty(receive2);
set_pwm2_duty(receive3);

}while(1);


}
******************************************
Program above is about to make the fan, light and radio work.. The relay is about to on and off the radio.. while for pwm is to set the signal that will get from the transmitter is going to 255 (higher) and 0 (lower). This is the final program and will be test to the circuit by detect the LED first as an output.

Thursday, March 25, 2010

Suddenly SKXBee cannot be function..

My both SKXbee cannot function at all.. They don't want to communicate to each other.. I need to troubleshoot it? but how? So leave it to keep in view (KIV) for a moment.. So, I will continue in designing the transmitter circuit and program..

Thursday, March 18, 2010

Program for Transmitter

#include <16f877A.h> //use pic16f877A
#device adc=8 //use 8 bit adc function to read temperature
#use delay(clock = 20000000) //clock=20mhz
#fuses hs, noprotect, nowdt //default setting
#use rs232(baud=9600,xmit=PIN_C6,rcv=PIN_C7,PARITY=N)

#byte PORTA=5 //define PORT A address
#byte PORTB=6 //define PORT B address
#byte PORTC=7 //define PORT C address
#byte PORTD=8 //define PORT d address

void main()
{
int press1, press2;
int txdata1=0;
int txdata2=0;
int txdata3=0;
int myvr1, myvr2;

//set i/o for each pin
set_tris_a(0b11111111);
set_tris_b(0b00000000);
set_tris_c(0b10110000);
set_tris_d(0b00000000);
setup_port_a(ALL_ANALOG);
setup_adc(ADC_CLOCK_INTERNAL);

//test output
output_high(pin_d2);
delay_ms(1000);
output_low(pin_d2);
delay_ms(1000);

do
{
//if forward button pressed
if(input(pin_c4)==0 && press1==1)
{
txdata1='a';
press1=0;
}
else if(input(pin_c4)==1)
{
press1=1;
}

//if reverse button pressed
if(input(pin_c5)==0 && press2==1)
{
txdata1='b';
press2=0;
}
else if(input(pin_c5)==1)
{
press2=1;
}

set_adc_channel(0);
delay_ms(10);
myvr1=read_adc();
txdata2=myvr1;

set_adc_channel(1);
delay_ms(10);
myvr2=read_adc();
txdata3=myvr2;

if(input(pin_c4)==0 ||input(pin_c5)==0)
{
output_high(pin_d2);
}
else
{
output_low(pin_d2);
}

putc(txdata1);
putc(txdata2);
putc(txdata3);

delay_ms(250);

}while(1);
}
**********************************************
Program above is to another PIC in remote circuit that will transmit the data by using variable resister and push button as an input and LED as an output.. The variable resister is connected to the analog pin at the PIC. So, in the program, it need to setup all Pin A as an analog.. And the PIC will sent data 'a' to make the relay on, and data 'b' to make the relay off.. As for the variable resister, it need a ADC to read the signal and transmit it to another circuit.. And if it success in transmitting the data, each LED will light on as for the testing purpose..

Circuit for Transmitter



Figure above is receiver circuit. The power supply is connected to the 5v regulator to jot down the voltage from 9v to 5v because the PIC can only receive 5v of supply if not, the microcontroller will be damage. The supply also connect to the 3.3v regulator to jot down the 9v supply to 3.3v supply and connect it to the XBee chip. The XBee can only accept 3.3v of supply and if it not, the Xbee chip will be burn or damage. But, if you using the XBee module, you no need to connect it to the 3.3v regulator, you can just directly connect the supply 5v at the PIC because the module it self already have the built-in circuit to jot down the supply.

As for the crystal, I'm using the 20MHz because it is the maximum speed that PIC can reach to read the program in one clock pulse. This crystal has no polarity and it always connect to the 13 and 14 pin of PIC because that pin have clock peripheral. And the two capacitor at each side of the crystal is to filter the noise.

The two variable resistor is to control the dimmer of the light and the speed of the fan and it is connected to the analog I/O port because analog data can receive the voltage between 0v to 5v range. So, the variable resistor is suitable to connect to the analog I/O port because to dim and bright the light and slow and fast the fan. If the voltage is lesser then 5v, the light will be more dim and it depends on the voltage that been receive from variable resistor to the PIC and the PIC will transmit the data to the receiver circuit. Same goes to the variable resistor that control the speed of the fan.

As for the push button, it is simply connect to the digital I/O port because it just function to ON and OFF the radio. The digital I/O port can only receive the 5v and 0v so it is suitable for the push button. And it can connect to which ever pin but make sure that the pin is digital I/O port.

The XBee module need to be connect to the receiver and transmitter port. Because the PIC will transmit and receive the data from that port. It is easy to use XBee because you can directly connect it to the PIC as simple as the circuit above. But, to connect the XBee module to PIC, the pin of receiver at the PIC must be connected to the transmitter of the XBee module and vise versa.

And finally, the all the LED inside this circuit is as the indicator when I construct this circuit. It is because to make sure that the circuit can be function and receive the data.

Friday, March 12, 2010

troubleshoot the circuit





The circuit that I construct have a problem. The signal that are sent to the receiver are not stable. For temporary, I replace the receiver board with the computer. And I need to troubleshoot it.

Friday, March 5, 2010

construct the circuit






this are the process of construct the circuit. I construct the transceiver circuit first. the, when the circuit can work properly, I design the PCB for this circuit.

Wednesday, March 3, 2010

Doing the poster..

Working in completing the poster for the demo day which is at 13th April 2010.. still need to edit a little bit more because my project not really finalize.. and the poster must get approval from my supervisor.. In the poster, you need to have a bit explanation about your project.. It must contains abstract, intoduction, methodology, result, and conclusion.. at the result, atleast there are some picture attached..

Monday, February 22, 2010

Home Automation (Receiver module)




This system is using battery 9Vdc and it will step down to 5V using LM7805 voltage regulator.

The voltage regulator module is used to protect PIC and other connected sensors or actuators from over voltage. This is because PIC and all other connected sensors, actuators all support 5V DC only. Over voltage will cause any of the module burn. LM7805 is used to regulate voltage in the system and output 5V DC (max current: 1000mA). It supports input voltage from 7V DC to 18V DC.

The output of each PIC pin is 5V with max output current of 20mA or 0V with 0mA output. The voltage is not enough to run high power device e.g. motor, solenoid. Thus we need a relay to control these high power items. A simple switching circuit (using NPN transistor, C9013) will be used to energize / de-energize the input coil of the relay.

Thursday, February 18, 2010

Remote (Transceiver module)



PIC16F877A microcontroller is used to control the whole system. It is designed using flash technology. So the PIC can read/write program for more than 100,000 times. The PIC can store up to 8Kbytes program. A program is downloaded into PIC through PIC programmer. This program will be used to operate the system.The PIC can operate using 4.5V to 6.0V DC voltage. In the project is operating at 5.0V (by using 7805). It is DIP layout (dual in line package) and suitable for student project. It has 40 pins but only 33 I/O pins can be set as digital input or digital output. The digital output of the PIC is 5V (for signal 1) and 0V (for signal 0) these signals will be directly connected to actuators for control purpose. When the PIC pin is set as digital input. It will detect input voltage 5V as signal 1 and 0V as signal 0. Any voltage less than 0V or more than 5V will damage PIC.

A normal LED use 5V and 5mA to operate. And through LED the current status of the system can be known. A 1KR resistor is connected series with the LED to limit the current pass through LED is 5mA. This is calculated using V=IR. Where V=5VDC, R=1KR. The LED will light on when the power is go through the circuit to alert user.

The variable resistor is to control the dimmer of the light and the speed of the fan. And as for the push button, it is for turn on or off the relay at the receiver module. When the remote is complete, only the push button will display on top of the remote.

Friday, February 12, 2010

Component that will use



PIC16F877A microcontroller is used to control the whole system. It is designed using flash technology. So the PIC can read/write program for more than 100,000 times. The PIC can store up to 8Kbytes program. A program is downloaded into PIC through PIC programmer. This program will be used to operate the system. The PIC can operate using 4.5V to 6V DC voltage. In the project is operating at 5V (by using 7805).



ZigBee is a standard for wireless data transmission just like Wi-Fi and Bluetooth. The entire device (wireless device) is function to move the desired data to the next carrier in the communications path until the data is delivered to the target end-point. MaxStream is a well-known manufacturer of components for wireless communication. ZigBee is one of the MaxStream products. There are two versions of ZigBee that are available from MaxStream which are XBee and XBee PRO. Both versions are functionally identical and pin compatible. The only difference is the transmit power, which is 1mW maximum for XBee and 63mW maximum for XBee PRO. ZigBee’s mission is to cut the traditional wires between sensors, wired slaves devices, and the microcontrollers and microprocessors they serve.



Battery is work as the supply power to the circuit so that the circuit can work at anywhere and anytime. The battery that is used in this project is 9v battery.



The voltage regulator module is used to protect PIC and other connected sensors or actuators from over voltage. This is because PIC and all other connected sensors, actuators all support 5V DC only. Over voltage will cause any of the module burn. LM7805 is used to regulate voltage in the system and output 5V DC (max current: 1000mA). It supports input voltage from 7V DC to 18V DC.



This regulator is to step down the voltage to 3.3v. XBee cannot accept the voltage larger then the 3.3v. If not, the XBee chip will be damage or burn. As for this project circuit, the PIC and other component such as LED can only accept 5v of voltage. So, the voltage need to be filter with this regulator to step down the voltage second time. First, step down the voltage to 5v using LM7805 regulator, then step down again the voltage to 3.3v using LM1086 regulator for the second time.



The variable resistor is to control the dimmer of the light and the speed of the fan. Variable resistors are often called potentiometers in books and catalogues. They are specified by their maximum resistance, linear or logarithmic track, and their physical size. The standard spindle diameter is 6mm.The resistance and type of track is marked on the body 4K7 LIN means 4.7 k linear track and 1M LOG means 1 M logarithmic track. Some variable resistors are designed to be mounted directly on the circuit board, but most are for mounting through a hole drilled in the case containing the circuit with stranded wire connecting their terminals to the circuit board.



A reverse diode 1N4007 is connected with input of relay to avoid reverse spike or over current flow back from the load. It also protects the circuit from over current load.



This selected bulb is easy to use and easy to put in the prototype.



This fan is selected because it is small and it suitable for the prototype.

Saturday, February 6, 2010

relay vs optocoupler


Connect the PIC to the relay or optocoupler to communicate from the remote to the home automation circuit. The problem is that I don't know whether to use the relay or optocoupler to connect from the PIC to light and fan. If I use the relay, the output just the LED but if I use the optocoupler, the output can be the the light(bulb) and fan(PC fan). This is because that the relay is a electronics switch. It's function as on and off to the LED.


A relay is an electrically operated switch. Many relays use an electromagnetic to operate a switching mechanism, but other operating principles are also used. Relays find applications where it is necessary to control a circuit by a low-power signal, or where several circuits must be controlled by one signal. A simple electromagnetic relay, such as the one taken from a car in the first picture, is an adaptation of an electromagnetic. It consists of a coil of wire surrounding a soft iron core, an iron yoke, which provides a low reluctance path for magnetic flux, a movable iron armature, and a set, or sets, of contacts; two in the relay pictured.


Optocoupler is a device that uses a short opticaltransmission path to transfer an electronic signal between elements of a circuit, typically a transmitter and a receiver, while keeping them electrically isolated since the electrical signal is converted to a light beam, transferred, then converted back to an electrical signal, there is no need for electrical connection between the source and destination circuits.The opto-isolator is simply a package that contains both an infrared light-emitting diode (LED) and a photodetector such as a photosensitive silicon diode, transistor Darlington pair, or silicon controlled rectifier (SCR). The wave-length responses of the two devices are tailored to be as identical as possible to permit the highest measure of coupling possible.


Sunday, January 31, 2010

Lamp, fan, home ventilation and radio..

For home automation, I've choose to make lamp, fan, ventilation system at home and radio become automatic.

The lamp is adjustable to control the dimmer of the light. As for the lamp, I've choose the DC lamp because this DC lamp is more practical then the AC. AC lamp such as the LED just can be use for the prototype and for the small used. But for the DC lamp such as bulb, it can be used direct to the house. But to connect the bulb to the PIC, I need to do the experiment on the voltage so that I can adjust the dimmer of the lamp.

For the fan, I make it automatic by control the speed of the fan from the remote control. The fan that I used for this project is just the laptop's cooler pad fan.

The home ventilation is just for the prototype. It just add another fan and make it move to the apposite direction so that the air will be absorb out from the prototype home.

And as for the radio, I still in the process to make it real. I mean that I still learning to make the radio can automatic on from the remote control.

Monday, January 25, 2010

Design circuit..


This is the basic circuit of my project. The function of this circuit is just to run the PIC16F877.

As you all know that the PIC16F877 can only receive maximum 5v of supply. If the supply is more then 5v, the IC will burn or damage. But in the real world, we can get the supply power from battery or adapter. Your adapter can be 9v to 15v and you cannot direct connect the power supply to the PIC, otherwise, your PIC will burn or damage. To overcome this problem, the regulator is used in this circuit because this regulator is function to reduce the power from high voltage to 5v. And I take 1000nF for the capacitor near the regulator because 1000nF is faster then 100nF to reduce the noise.

The LED near the regulator is function to alert me that there is power or not in the circuit by LED will on when there is a power and LED will off if there is no power in the circuit.

To set the reset button in this circuit, the switch button is connected to the MCLR pin of PIC16F877.

20 MHz crystal is used in this circuit because PIC16F877 peripheral said that this PIC can accept until 20MHz of pulse. If more then 20MHz, the PIC cannot run the program that burned inside them. Crystal is one of the important component that need to have in every circuit that used PIC or microcontroller. It is because this crystal is like a heart beat of the PIC. It control the pulse of the program inside the PIC. And I choose 20MHz because it is the fastest pulse that PIC16F877 can support and the program inside the PIC can be run faster then 8MHz or else.