Microcontroller › AVR › how to control room lights via pc and microcontroller
- This topic has 13 replies, 3 voices, and was last updated 12 years ago by
romel emperado.
-
AuthorPosts
-
May 7, 2011 at 9:36 am #908
Aina
ParticipantHi,
I am computer science student and i want to control the room lights via sms sent from remote mobile through gsm modem AT commands sent to pc and is further forwarded to microcontroller. I want to use ATMEGA8 microcontroller that will switch lights on and off using one relay, but i have no idea how to interface relay and pc with microcontroller via serial port. Can any one send me the circuit diagram. Any kind of help will be appreciated.
Thanks for help in advance.
Regards,
AinaMay 8, 2011 at 3:36 am #6112dagakshay
Participantlink for serial interfacing in AVR
Atmega8 interfacing with relay ckt
when you send logic low at PC0 the LED will be OFF and when you send logic high at PC the relay switch and the LED will glow. In your case instead of LED you can connect bulb/ tube light/ fan , etc.
nice project all the best
May 8, 2011 at 6:09 am #6113Aina
ParticipantThanks for the help. The circuit diagram you sent for relay interfacing is clear but serial interfacing circuit is bit confusing to me. Can you send me the schematic diagram of that?
Regards,
Aina
May 9, 2011 at 5:13 am #6114dagakshay
Participanti have pasted one link above… That link has given a nice explanation, code, video and ckt diagram too… which part has confused you in ckt diagram…..
May 9, 2011 at 12:35 pm #6119Aina
Participantyes its fine but i have never worked with circuits sort of things before this. So, i want to follow simplest approach for getting my work fulfilled. I have come to know that lights can be controlled via pc by just using the circuit based on relays without microcontroller. Is it possible to interface this kind of circuit serially to control light??
May 10, 2011 at 5:05 am #6124Aina
Participantok thanks. Can you send me some source codes??
May 10, 2011 at 5:56 am #6127dagakshay
Participanthello Aina,
you can do that via a simple C programe too…. you just need to send the value on the parallel port address using a outport function… do a bit of googling you will get it
May 10, 2011 at 6:04 am #6128dagakshay
Participantinclude
#include<dos.h>
in your hedder file…
function to send value on parallel port
outportb(0x378, <value>);
<value> = is that value what you need to send on parallel port address… is should not be grater than a Byte
ex:
outportb(0x378, 0x80);
0x378 is the prallel port address and 0x80m is the hex value i need to send on parallel port
May 10, 2011 at 1:13 pm #6134Aina
Participantok.thanks dagakshay can i use the following circuit diagram regarding my project?
Here is the link:
May 10, 2011 at 1:41 pm #6137dagakshay
Participantyes, you can. here i am pasting a ckt (edited on the link you send)….
here i had eliminated the need of diode, resistance and the NPN tansistor … instead of thatconncet a direct wire as i had did by using a green colour one… and above one a switch, instead of that use ULN 2003/ ULN 2008 IC… it a buffer IC as you cannt interface the peripherials directly to PC’s parallel port.. just for protection porpose…. and connect the diode in reverse fasion… make The ULN and prallel port ground common….don’t use the Vcc pin from prallel port.. apply VCC = relay voltage… the lengh of wire fron Parallel should not be greater then 1.4 meter… for safty keep it as 1.2m only…
let me know till where you have completed
May 11, 2011 at 7:08 am #6148Aina
ParticipantOk thanks a lot, it proved to be very helpful for me. I will try this but i have to ask one more thing that is it possible to attach sensor by modifying the given circuit for future work?? For example smoke sensor sensing whether there is smoke in surrounding environment or not??
May 11, 2011 at 2:16 pm #6152romel emperado
Participantactually you can by pass the use of PC if you have gsm modem and microcontroller… that two components will do your desired application
May 12, 2011 at 7:13 am #6167dagakshay
Participant@ Aina,
yes you can. use status pins of parallel port
May 13, 2011 at 12:23 am #6174romel emperado
Participantparalled port is much easy that serial interfacing… go for it
-
AuthorPosts
- You must be logged in to reply to this topic.