Click here to Skip to main content
15,887,596 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I would like to control my modem using relay and c# code. The c# code should be able to turn on and off modem at pre set time(the relay should act as a switch that turns on at required time).I am not sure how to start?
I am using 12v relay(sugar cube).can i use serial port to control the relay? if so how do i do it?
Please help.
Posted

1 solution

Look at this CodeProject article:
Control Physical World Through Computer (Step by Step)[^].

You can develop it all by yourself. First, learn the specifications and the standards of RS-232 which is used for COM ports: http://en.wikipedia.org/wiki/RS-232[^], see also: http://en.wikipedia.org/wiki/Serial_port[^].

To work with the port programmatically, use the class System.IO.Ports.SerialPort, see:
http://msdn.microsoft.com/en-us/library/system.io.ports.serialport.aspx[^].

Optionally, you can consider using parallel port:
Control Electrical Appliances using PC[^],
I/O Ports Uncensored - 1 - Controlling LEDs (Light Emiting Diodes) with Parallel Port[^],
Computer Controlled Watering System with C# or VB.NET[^].

—SA
 
Share this answer
 
Comments
Espen Harlinn 9-Feb-12 8:46am    
Lots of good links, my 5 :)
Sergey Alexandrovich Kryukov 9-Feb-12 11:48am    
Thank you, Espen.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900