1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

Fast Switching Circut On/Off

Discussion in 'Electronic Projects Design/Ideas/Reviews' started by epicfatigue, Jan 26, 2013.

  1. epicfatigue

    epicfatigue New Member

    Joined:
    Jan 26, 2013
    Messages:
    49
    Likes:
    0
    sorry about the poor recording, here are the drivers in action i had to make because microsoft doesnt support windows XP64 anymore.... or like ever

    [video=youtube_share;fHTtLsdJbgQ]http://youtu.be/fHTtLsdJbgQ[/video]
     
  2. ()blivion

    ()blivion Active Member

    Joined:
    Nov 24, 2010
    Messages:
    857
    Likes:
    210
    Location:
    Level 5
    Hi, sorry I haven't been in touch in a day or so. My internet went down. Something about paying the bill? ... IDK ... Anyway...

    Thanks. Working with the PS/2 protocol is actually sort of amusing so far. And I could probably recycle the routines for some other things too. So I do get some small reward out of doing this. I also didn't really know that it was a bi-directional protocol. That is useful information, I could use that as an alternative to some RS232 serial projects probably, though I don't really need to.

    OK, Yeah, I may as well have you build the circuit right now anyway, as it will most likely be the same no matter what the software does, so there is no real reason not to. Originally, I was thinking of making you a layout first, then doing the code. That way you could build it at the same time I was making the software, maximize usable time. But it takes me a little while to get you a working layout using my layout creation process, even though the circuit is so simple.

    *OFF TOPIC*
    I was actually considering asking you if you wanted to maybe do some programming for an idea I had, to sort of "pay off" this help I am giving you. No obligation, I'm mostly doing this for myself anyway, and I don't even know what kind of programming you can do. This would be mostly windows GUI programming I suspect. My idea is making a "circuit layout creation tool", based on dot matrix prototyping board and an electronics graphic library I am putting together. So it's mostly manipulating *.PNG graphics elements, on a grid, with transparency. It could easily get much more fancy honestly, but that's all it needs to be. I'll PM you the details later.
    *OFF TOPIC*

    Anyway, below is the layout for the circuit you need to build, I used my manual method for making it up. As you can see, the results are quite graphical and quite easy to follow. The down side is the large investment of time it takes to make the layout by hand. It will probably take you less time to make the circuit than it took me to draw this up.

    (Note that your exact parts may appear slightly different than what is shown here)
    KVM switch layout.png

    For making it, you will need...

    One(1) PIC12X508. (It would be best if it was FLASH, but it looks like you only have the "12C508's", which are PROM... You may need TONS)
    One(1) 8-pin DIP socket.
    One(1) Small section of solderable protoboard, at least 7x9 holes.
    One(1) Short PS/2 cable, with at least wires/pins 1-3-4-5. For data, ground, Vcc, and clock wires.
    One(1) 0.1-1μF decoupling cap. Film/ceramic, doesn't really matter.
    One(1) Small signaling LED, 5~10mA. (good for diagnostics, we could use more too)
    One(1) 1/4 or 1/8 watt resistor, at 470 Ohms, (for the LED.)
    Two(2) 1/4 or 1/8 watt resistors, in the range of 4.7K to 10K ohms. Matching, but otherwise not too critical.

    Some wire, solder, flux, soldering iron, digital multimeter, clean work space, and assorted general use tools for clean up and construction.

    Let me know when your done building that, or if you need help. I will be doing some hardware tests on my end until I'm convinced a test has a decent probability of success.

    Also, use your programmer to rip the blank memory from one of your PICs and post it please. I still need the calibration value, and for some reason what you have sent me so far doesn't have it. You may want to research into how to get that directly from your programmers software. That would be less error prone than looking at the ripped hex honestly.

    That looks great. Yeah, I remember not having wireless xbox 360 drivers that worked for PC in general being a problem for quite a while. Always had to use the wired ones and the support there was bad too, couldn't do much with the controller. I ended up making an adapter for the original Xbox controllers and using a hacked driver instead. Worked better than anything else I had ever used up to that point.

    Actually (LOL) once upon a time, long before the above, I took apart a PlayStation controller and wired the buttons of that to a regular old PS/2 keyboard. I of course had to wire some of the buttons to things like CTL-SHIFT-Shift et cetera and so forth, so I could hit more than one button at a time. But believe it or not it actually worked fantastically, blew my mind.
     
  3. ()blivion

    ()blivion Active Member

    Joined:
    Nov 24, 2010
    Messages:
    857
    Likes:
    210
    Location:
    Level 5
    OK, here is a hex file you can try and burn to the PIC. The likelihood of it working right off the bat is fairly low, very low actually... honestly, you will probably basically just be throwing away a PIC12C508 :( Tried to make it so it wouldn't write over the calibration data, don't know if I succeeded or not. Chip programmer dependent thing.

    I tested my prototype in my spare/work PC, it promptly locked up the PS/2 controller until after reboot (^__^). PC wants to know what the PS/2 device is so it can install drivers. My code doesn't play like that though... Should be a different story for the KVM.

    You *MAY* have to have the PS/2 side of the KVM plugged into the computer for it to work. But that is highly unlikely. I don't really know if the KVM emulates a host on one end and a device on the other, or if it's just wires that passes through the signal.
     

    Attached Files:

  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. epicfatigue

    epicfatigue New Member

    Joined:
    Jan 26, 2013
    Messages:
    49
    Likes:
    0

    Thanks mate shall try it today!, in terms of the pic getting the voltage does that come from the PS2 port from the kvm? or it it receiving it from the switch wires?

    PS. your going to hate me but i figured out away how to make it work perfectly the other night before i went to bed after i posted my video was sick so was unable to let you know.

    On the programming side for the application not really my kettle of fish but we should rig up a skype call and i will see what i can do not fully understanding what it is you are looking to do.
     
  6. ()blivion

    ()blivion Active Member

    Joined:
    Nov 24, 2010
    Messages:
    857
    Likes:
    210
    Location:
    Level 5
    The power for the circuit comes from the PS/2 socket, which should be plugged into the KVM. The PS/2 Cable that feeds the circuit is also the power. It could be done any number of ways.

    Not a problem. The idea crossed my mind that it could be done any number of ways. I can still use PS/2 protocol routines for my own projects. So, as long as we get this done, I am satisfied. If you have it figured out, we can skip it and move on to any other problems you are having?

    If it's not specifically your thing that's fine, I was just wondering if it was. We can still talk it out some time though if you want. I need to get a shipping emergency I am having sorted out right now first, then I'll give you the details over the PM system.
     
  7. epicfatigue

    epicfatigue New Member

    Joined:
    Jan 26, 2013
    Messages:
    49
    Likes:
    0
    Sure pm me your skype name.

    The one issue i have is i need to make a small delay on this relay when it switches, so it interrupts the 5v supply.

    iv drawn a small diagram to show you what i mean.
     

    Attached Files:

  8. ()blivion

    ()blivion Active Member

    Joined:
    Nov 24, 2010
    Messages:
    857
    Likes:
    210
    Location:
    Level 5
    PM sent...
     
  9. epicfatigue

    epicfatigue New Member

    Joined:
    Jan 26, 2013
    Messages:
    49
    Likes:
    0
    so i believe i have created a time delay circuit.
    I will build it tomorrow when i get a chance but does this look right everyone???

    [​IMG]
     
  10. ()blivion

    ()blivion Active Member

    Joined:
    Nov 24, 2010
    Messages:
    857
    Likes:
    210
    Location:
    Level 5
    Close, but it simulates the opposite of what you want I think. The relay is on as soon as power is on, then shuts off after the delay is over. Is this really what you want? If so, leave it, works wonderfully. Otherwise, take out the transistor, reduce the resistor to like... 100-500 ohms... hook that to the relay coil, and the other end of the relay to ground.

    Also, no matter what you do, don't forget to add a reverse polarity diode to the coil terminals of the relay, this stops HV inductive kickback from destroying your transistor/555 timer. You will be sorry if you don't add this.



    P.S. Looks like I have stuff to do this week, so I won't be able to help as much as I did last week. But I will be able to pop in every now and then still. I may actually have to work all this next month if things go well(bad) for me, so plan to be helping yourself as much as you can.


    Edit:
    Actually, the trimpot and the capacitor in the top left don't really do anything. You can just remove them, then make the 1M resistor a 500K trimpot, or use a 250K trimpot and a 250K resistor in series for about the same effect. Also, the 10K resistor on the transistor is too high, use 1K instead. If you don't use enough current to turn on the transistor, it will only be partly on and will overheat.
     
    Last edited: Feb 26, 2013
  11. epicfatigue

    epicfatigue New Member

    Joined:
    Jan 26, 2013
    Messages:
    49
    Likes:
    0
    hahah yes you are 100% right, well i got it majority of the way there thanks for poiting out the pot being in the wrong place *facepalm*

    Yes the circut is now 100% the opposite of what i want, what components do i need to move to make it the other way, i tried removing the npn and all that does is allows a positive charge (like what i want) but only for x number of seconds.
     
  12. epicfatigue

    epicfatigue New Member

    Joined:
    Jan 26, 2013
    Messages:
    49
    Likes:
    0
    Ah i think i know what i need to do replace the npn with a pnp and it will reverse!!!! it will be off !! i will test tomorrow!
     
  13. ()blivion

    ()blivion Active Member

    Joined:
    Nov 24, 2010
    Messages:
    857
    Likes:
    210
    Location:
    Level 5
    Ho, looks like I messed up yet again.

    Don't actually hook it to ground, hook the other end of the relay to the positive, this will make it off until the delay is over. The other way around will bring you back to where you started again.

    Explanation.
    Pin 3 of the NE555 timer IC can both sink(short to ground) and source(short to +) up too ~200mA of current. This is quite a lot for such a little chip and should be more than enough to drive the average relay coil. So you really shouldn't need any buffer transistors, though there are some relays out there that could easily exceed 200mA, but I don't think yours does.

    More importantly, the sinking and sourcing on pin 3 allows you to easily invert it's output, by letting it drive to either positive or drive to ground. This can be done by just hooking the other end of the load to the opposite power rail. In your case, you want one terminal connected to the positive, and the other to pin 3. If you hook one end to pin 3, and the other to ground, it will be on for the delay, then shut off.

    Moving on, the timer part of the circuit works by slowly charging the 10μF capacitor through the 1M resistor. Threshold (pin 6) is constantly watching the voltage between the cap and resistor, and will change it's (Edit: The 555's) output whenever the voltage matches the voltage on pin 5, which is about 2/3rds (~66%) of Vin. The lower the resistance of the 1M resistor, the faster the 10μF cap charges up to 2/3rds Vin, and thus the faster the timer will run out. The lower the voltage on pin 5, the sooner it will trip also.

    In this configuration, the NE555 is really only working as a Schmidt trigger/comparator buffer for the RC delay circuit. This effect could be achieved many many other ways, but since you already have it started, you should probably just keep going with it. The circuit will work nonetheless.

    Click *HERE* for a simulation of the circuit. The pin numbers are right next to the 555. The trimpots resistance can be changer with the slider on the right. Resetting the simulation with the button at the top right will let you see how long it takes for the timer to run out and the circuit to trip. The time taken is at the bottom of the schematic.
     
    Last edited: Feb 27, 2013
  14. epicfatigue

    epicfatigue New Member

    Joined:
    Jan 26, 2013
    Messages:
    49
    Likes:
    0
    Ah nice! i really like this 555 timer chip it has so many application, thanks for helping me understand what the threshold does, i was looking into it for ages and i i was not sure if that could be done or not, i like how it has a flipflop in it, i ran down and brought a 555 Timer and its Applications book but its all in AC lol however i can convert it now
     
  15. epicfatigue

    epicfatigue New Member

    Joined:
    Jan 26, 2013
    Messages:
    49
    Likes:
    0
    here is the end result!

    [​IMG]
     
  16. ()blivion

    ()blivion Active Member

    Joined:
    Nov 24, 2010
    Messages:
    857
    Likes:
    210
    Location:
    Level 5
    Sorry, your circuit is still not quite right I'm afraid... :(

    First off, you really need to remove the 0.1μF cap and resistor in the top left. Those parts, in that configuration, have the effect of holding pin 2 at Vin voltage level. Well... pin 2 is the "trigger" input, and without going into too much detail, holding it up like that forces the output pin (pin 3) to ground. In other words, as soon as power is applied to the circuit, the relay will activate, regardless of where you have the trimmer pot. This is clearly not what you are wanting. If you plan to do anything with pin 2, you should just use the 10K to tie it down to ground, not to Vin.

    Second, D1 will block pin 3 from being able to turn on the relay, so it needs to be removed. If you have a compelling reason why you added it, I would love to hear it? It won't stop high voltages from entering the 555 if that's what you were after. Most "normal diodes" break down at 50~200 Volts, and a HV inductive kick from the coil can easily get into the thousands of volts range. D2 is enough to stop the coil kick back voltages from getting large enough to destroy the chip. For more sensitive chips though it wouldn't be enough, and you would need to use an "ultrafast", Schottky diode for D2, or proper RC snubber along with it. But the 555 is anything but sensitive, so such things are unneeded.

    Thirdly, pin 7 is the "discharge" pin, and is only used in astable modes. It has the effect of resetting the timer by discharging the timing capacitor. Pin 7 isn't going to work without the trigger hooked up, but if it did work like it is supposed to, what would end up happening is it would shut your relay back off after a second time delay. This is also not what you want. You CAN leave it hooked up, since it's not going to do what it is intended for. But this could lead to glitches later on down the road. It won't hurt anything to just let it float though, the pin is not used for your configuration.

    Lastly, it looks like you are trying to make it so every pin on the chip is being used? Normally this would be a good thing, many IC's can be damaged if you don't do something with specific pin types. But the 555 is a very odd duck, and doesn't really have this requirement. It won't break anything, but you don't need to be doing it either. This is mainly only needed with digital IC's, but the 555 is an analog part. If you absolutely have to do something with every single pin, tie both pin 2 and pin 7 to ground with a 10K resistor. That's the best thing you could do to keep all the pins used up. Again, you don't need to do anything, you can leave them floating.


    Everything else is correct, and changing the values of the timing cap and trimmer resistor is also OK. One thing, if you want a specific minimum time, you will need to add a fixed resistor in series with the 10K trimmer. The trimmer can go all the way down to 0 ohms, this in theory will make the timing cap charge instantly and the output pin turn on instantly. So if you want to make it so that you can't set the time to less than ~0.5 seconds, like you have ion your drawing, then you will want to add a 1K fixed resistor in there also. It doesn't matter if it's on the top or bottom of the trimmer, it will have the same effect.
     
  17. epicfatigue

    epicfatigue New Member

    Joined:
    Jan 26, 2013
    Messages:
    49
    Likes:
    0
    hrm the circuit will not work with those changes.

    However the only change i can seem to make is pin 7 i can remove that and it works like a treat.

    ill remove D1 no idea why i put that there
     
  18. dougy83

    dougy83 Well-Known Member

    Joined:
    May 18, 2008
    Messages:
    2,677
    Likes:
    215
    Location:
    Brisbane, Australia
    What's the point of the time delay circuit? Is it to send a trigger to the KVM switching PIC? If so, then why don't you just implement the delay in the PIC itself?

    Also, I saw mention of a circuit for controlling the PC PSU switch from a toggle switch - that function could also be put into the PIC code very simply...
     
  19. epicfatigue

    epicfatigue New Member

    Joined:
    Jan 26, 2013
    Messages:
    49
    Likes:
    0
    this was in place of the pic chip.
     
  20. dougy83

    dougy83 Well-Known Member

    Joined:
    May 18, 2008
    Messages:
    2,677
    Likes:
    215
    Location:
    Brisbane, Australia
    In place of the pic chip? You can't replace a PIC with a 555.. though I'm sure that's not what you meant; I don't know what you meant.
     
  21. ()blivion

    ()blivion Active Member

    Joined:
    Nov 24, 2010
    Messages:
    857
    Likes:
    210
    Location:
    Level 5
    The OP found a different way to trigger the KVM.

    It's sad that all of the leg work I did on the PIC is going to be abandon, but It can't be helped. If he found a reliable way to make the KVM work with just a 5V signal, then that will have to do and the PIC circuit becomes unnecessary. As I said, some day, sooner or later, having PS/2 code will probably come in quite handy for me. So It doesn't bother me that we are changing directions. As long as the OP gets his work finished.

    Odd... maybe it's the simulation? Or could be my understanding, has been a while since I used a 555. Well, if you tested it, and it worked with your mods, then go ahead and do it your way. Though I may want to investigate why the system is not acting the way I figure it should. You are using a proper NE555 or compatible IC right? There are actually probably thousands of variations on the original design, you could have a different one. I do believe one of the pins is an inverted input, maybe that's where I went wrong...

    IDK, if it works your way then go ahead.
     

Share This Page