Designing a Computer Controlled Switch: Components and Steps

  • Thread starter Thread starter Bassalisk
  • Start date Start date
  • Tags Tags
    Computer Switch
AI Thread Summary
To design a computer-controlled switch for AC 220V lighting, a microcontroller like Arduino is recommended for interfacing with the computer. Essential components include a relay or solid-state relay for safety and electrical isolation from the mains. Understanding the hazards of working with high voltage is crucial, and using wireless or infrared outputs can simplify the control process. The project involves programming, which can be done in C or C-like languages, and requires careful planning of the circuit to ensure safety. This project serves as a practical application of electrical engineering concepts while providing valuable hands-on experience.
Bassalisk
Messages
946
Reaction score
2
Hello,

I am interested in making a computer controlled switch. Can anyone give me a simple overview what components will I need and how should that work.

I am aiming for making/designing my own circuit. I just need schematics and steps.

Thanks
 
Engineering news on Phys.org
What computer, and what are you switching?

(one of) The most "common" switches is the "common emitter transistor". Here's a buncha (actually too much) info on transistors and how they work:
http://www.williamson-labs.com/480_xtor.htm
 
I am planning on using it as switch for AC 220V light. I've seen something like that on ebay, a serial port that connects computer to some thingy but its 40$ and that's no fun (: I want to build it myself
 
Oh. K. Controlling AC is a bit harder, both technically and from a safety stand-point...

To get the part that connects your _PC_ computer to a switchy thing, I would find a hobby-micro-controller board like the Arduino -- you don't need anything so fancy, but that's a pretty common and "easy" to use example. That board would have a USB connection to your PC and a bunch of inputs and outputs you can connect to things.
I always recommend sparkfun.com as a source because they have a lot of choices in this area, but there are plenty others out there -- and being 220v you are probably not in the USofA so there could be more local sources for you.

For the 220v part, the easiest is a "relay" -- or "solid-state relay" -- which will maintain separation of your computer from the power mains. You can often run such a device directly from the output pin of the micro-controller.

I'd say you're looking at at least $40 in parts and a lot of learning curve. But it's actually a pretty good project to start with, as long as you are cautious with the real power. You can start out with the micro-controller and get it to light up an LED or something, just to see if you have what it takes...
 
schip666! said:
Oh. K. Controlling AC is a bit harder, both technically and from a safety stand-point...

To get the part that connects your _PC_ computer to a switchy thing, I would find a hobby-micro-controller board like the Arduino -- you don't need anything so fancy, but that's a pretty common and "easy" to use example. That board would have a USB connection to your PC and a bunch of inputs and outputs you can connect to things.
I always recommend sparkfun.com as a source because they have a lot of choices in this area, but there are plenty others out there -- and being 220v you are probably not in the USofA so there could be more local sources for you.

For the 220v part, the easiest is a "relay" -- or "solid-state relay" -- which will maintain separation of your computer from the power mains. You can often run such a device directly from the output pin of the micro-controller.

I'd say you're looking at at least $40 in parts and a lot of learning curve. But it's actually a pretty good project to start with, as long as you are cautious with the real power. You can start out with the micro-controller and get it to light up an LED or something, just to see if you have what it takes...

Im a first year EE and we just finished diode part of the course and we are currently learning transistors. We finished bipolar and we are doing MOSFETs now. I must say that we don't apply our knowledge yet.
So that learning curve won't be a problem for me. I am eager to learn.

Thank you for your help (:
 
You need to create electrical isolation between the ouput of your computer and the mains both for safety and common sense reasons.
Even if a fault does not hurt someone mains could easily damage the computer - expensive.

If you computer has wireless or infra red output this is easy and better than the RS232 serial port. (The infra red is also serial.)

If you do not have these outputs then your interface needs to incorporate the isolation device.
This could be a transformer, optoisolator, relay etc.
 
Studiot said:
You need to create electrical isolation between the ouput of your computer and the mains both for safety and common sense reasons.
Even if a fault does not hurt someone mains could easily damage the computer - expensive.

If you computer has wireless or infra red output this is easy and better than the RS232 serial port. (The infra red is also serial.)

If you do not have these outputs then your interface needs to incorporate the isolation device.
This could be a transformer, optoisolator, relay etc.

So what you are saying is that I use a device like a Bluetooth or infrared or wireless to control external device that controls the switch?
 
I am suggesting you lok at the output 'channels' available on you pc. Some of them already provide isolation.

I suggested the IR port, because it is the easiest to program, but yes you could use bluetooth or wireless LAN if you have them.

You do understand what I mean by electrical isolation and why?
 
  • #10
Studiot said:
I am suggesting you lok at the output 'channels' available on you pc. Some of them already provide isolation.

I suggested the IR port, because it is the easiest to program, but yes you could use bluetooth or wireless LAN if you have them.

You do understand what I mean by electrical isolation and why?

Like if there was a short circuit so that it wouldn't damage my computer?
 
  • #11
There is a component called a SSR, a Solid State Relay, that can be turned on or off by a watch cell battery. It is a form of optically switched TRIAC, so your computer could control one with something like the Parallel Port (the old style printer port), assuming your's has one.

Bowden's Hobby Circuits has some really good schematics for this kind of setup...

http://www.bowdenshobbycircuits.info/page6.htm#PPRIC
 
  • #12
Bassalisk,

Make sure you understand the hazards of high voltage AC - 220V is enough to kill you or others. Good luck.
 
  • #13
RocketSci5KN said:
Bassalisk,

Make sure you understand the hazards of high voltage AC - 220V is enough to kill you or others. Good luck.

I am well aware of that thank you.
 
  • #14
Bassalisk said:
Im a first year EE and we just finished diode part of the course and we are currently learning transistors. We finished bipolar and we are doing MOSFETs now. I must say that we don't apply our knowledge yet.
So that learning curve won't be a problem for me. I am eager to learn.

In that case this might be too simple...just wiring a couple of black boxes together and learning a little programming. I'd guestimate that 50% of EE these days is doing exactly that, so maybe it's ok to get your feet wet...

I second the hazards of putzing with the AC mains. Be very careful.

Also I'd think sparkfun would have a solid-state-relay that could be driven directly from the controller I/O pin, but the intervening transistor would be a useful learning device too.
 
  • #15
I just read what relay does from that link above. Shouldn't I be able to control the relay switch and still be in safe zone? Says here that relay has 2 distinctive parts and can control very high currents and voltages without getting in touch in DC part.

Now if I got it right: You control relay with a low voltage battery (5-9V). If you put the relay on 5V(lets say) Switch turns on. If you put it off again, switch turns off, right?

Now if this is right, it gave me a fairly simple idea. I could control the flow of current through 5V part, with a transistor. Transistor would let the current pass if it gets the signal(from my computer).

Now the hard part is, how can I effectively send that signal...
 
Last edited:
  • #16
What you are proposing is exactly what schip meant.

but the intervening transistor would be a useful learning device too.
 
  • #17
Studiot said:
What you are proposing is exactly what schip meant.

Ok so I will need to find out my computers specifications, usb and such right? And I would have to build a relay or a buy one with circuit board.

Really looking forward to this.
 
  • #18
Good luck. I would suggest going with the cheapest usb-compatible microcontroller you can find.
 
  • #19
The sparkfun tutorial ref'd by Jiggy-Ninja shows just such a transistor switching circuit as you propose. Given you are an EE student looking for real-world projects -- can it be that engineering courses don't actually have you build things these days? -- that circuit with a garden-variety electromagnetic relay is probably a great feet-wetting (as long as you stay away from the power-mains while your feet are wet) project.

I see QuietMan has also ref'd a SSR which would moot the transistor, and thus be less of a learning experience. I can't find mention of an SSR on the proffered link, but the other circuits look like they would be good learners too. The use of a parallel port -- if you can find a computer that still has one -- shown at the beginning of that page would be a quicker and dirtier project which wouldn't require any micro-controller programming. However I think the code shown there might only work under DOS, since Widows doesn't usually allow you to directly access I/O port addresses on the PC these days.
 
  • #20
schip666! said:
The sparkfun tutorial ref'd by Jiggy-Ninja shows just such a transistor switching circuit as you propose. Given you are an EE student looking for real-world projects -- can it be that engineering courses don't actually have you build things these days? -- that circuit with a garden-variety electromagnetic relay is probably a great feet-wetting (as long as you stay away from the power-mains while your feet are wet) project.

I see QuietMan has also ref'd a SSR which would moot the transistor, and thus be less of a learning experience. I can't find mention of an SSR on the proffered link, but the other circuits look like they would be good learners too. The use of a parallel port -- if you can find a computer that still has one -- shown at the beginning of that page would be a quicker and dirtier project which wouldn't require any micro-controller programming. However I think the code shown there might only work under DOS, since Widows doesn't usually allow you to directly access I/O port addresses on the PC these days.

Well yes unfortunately we don't go right away and test these things we learn. I find it difficult to capture all that just from a textbook, but what ya' going to do...
Top experiment was last week we did and that was 3 phase systems overview and what happens when you disconnect one phase etc.

I am probably only one on first year that actually wants to put in use what I learn.

I just ordered from ebay loads of different transistors, diodes, resistors and I think I can find a good relay in local EE shop.

I see that this programming of microchips is in either C or C++ or Basic which, apart from BASIC, I know very well. (I learned BASIC 6 years ago, but haven't used it since). I might even build my own relay ! In fact from the looks of it, its not that complex. And its most fresh to me, given the fact that I aced the exam with diodes and rectifiers. Just need that coil.

I will reopen this thread when I get all the parts.

Thank you all
 
Last edited:
  • #21
I recommend _against_ BASIC. Probably just an old-skool prejudice...

C will be useful for any subsequent programming, and you can get free resources from, e.g., microchip.com for their PIC chips. The Arduino has it's own language, based on C-ish precepts and may/not be a quicker start-up.

I find it hard to believe that you don't have labs for your classes as that is the only way I learn anything. Maybe future EE's will only need to simulate things on their computers, of which they know nothing about the inner workings thereof, and it will be left to grunts like me to make things actually work -- if they need to be built at all...
 
  • #22
Well I am first year, my field of specialization is telecommunication. I will learn deep electronics on my second year I think. Til' then will have to settle with home school and application of what I learn based on my good will and curiosity.
 
  • #23
UPDATE:

I've just finished reading and preparing material for my computer controlled switch.
But, there is always a but.

I've just read that I can seriously damage my computer motherboard if I mishandle my parallel port, which is very likely. Murphy says so.
I've also learned that I could avoid this problem if I buy a cheap ISA parallel port I/O card. But there is always a but. I don't have an ISA bus on my motherboard. It says that I COULD use PCI but I will have problems with accessing address of the port.

Now, final summation and question: Any other suggestions on how can I send signals out from my PC excluding parallel port? OR if someone has knowledge and experience with PCI card who can give me advice on those addresses or confirm that it has no difference between that one and on motherboard one whatsoever.

Thanks
 
  • #24
Computer interfacing is really quite easy and can provide many good graded projects for Electronic Engineering students.

The parallel port is also quite easy and safe to use - just don't start off with mains interfacing.

Look here for some pdfs and come back for help if you need it.

http://www.beyondlogic.org/

If you can afford one there are several good ready made interfacing cards on the market at reasonable cost perhaps £10 -£50.
These have the advantage of plug in and go (ie do the experiments)

eg
http://www.maplin.co.uk/usb-experiment-interface-board-42857

go well
 
Last edited:
  • #25
Thanks I'll give it a shot.
 
Back
Top