Is anyone interested in this? (Interface computer and relay)

Selfbondage software and other kinky developments

Moderators: Riddle, Shannon SteelSlave

User avatar
Imaginary_Girl
**
Posts: 86
Joined: 21 Mar 2016, 20:58
Location: South Central United States

Is anyone interested in this? (Interface computer and relay)

Post by Imaginary_Girl »

So I have a program that I wrote a long time ago and I wonder if anyone is interested. I know today a lot of people use arduinos or whatever for this purpose, but that wasn't as much of a thing back when I developed this software.

Basically for the software to be of any use you must build a small device. You need an old keyboard and very beginner level electronics knowlege to do so. Basically you replace the lock key indicator LEDs with a transistor, and the transistor in turn controls a relay. Then by using software to control the indicator lights, you can control whatever is attached to the relay(in my case an extension cord which I usually plug my magic wand into but I've done other things like my TENs unit for instance).

I actually have three programs regarding this device. The first is the original one I wrote which can do things like delayed on/off, random on/off, incremental on/off, and all sorts of fun things. Actually I forget half of what it can do because I basically wrote it over the course of all these years and each time I needed something new I added it. The other two are a client/server program set. You give the client and your IP and a password to whoever, and you run the server on your PC and then they can control said device over the net.

At least in my opinion it's a pretty nice alternative to Arduino's or whatnot, but it does require some basic electronic knowledge to build the device itself. So I was wondering if anyone was interested in them. If so I will clean the code up a bit and provide it for download.
gemt
***
Posts: 313
Joined: 01 Nov 2012, 17:04
Location: East Anglia

Re: Is anyone interested in this?

Post by gemt »

I guess this could even work with wireless keyboards, and it should be possible to hack the keyboard down and just use the electronics, leaving the bulky physical keyboard behind?
Or you could start with a smaller numeric keyboard if they still have 3 internal light connectors, though they usually only have a num lock light visible.
johns1234
*
Posts: 45
Joined: 22 Dec 2015, 01:32

Re: Is anyone interested in this?

Post by johns1234 »

It could be useful.

As an alternative for remote control power:
http://www.amazon.com/Edimax-Wi-Fi-Ener ... B00N4OBJAO
But this maybe just me as I know that I would probably destroy 3 good keyboards before I would have one working as planned ;)
sadisticflipside
*
Posts: 17
Joined: 10 Jan 2012, 07:42

Re: Is anyone interested in this?

Post by sadisticflipside »

This sounds totally amazing and I welcome diagrams, images and whatever you can produce. :)
davisev5225
****
Posts: 579
Joined: 28 Aug 2007, 09:03

Re: Is anyone interested in this?

Post by davisev5225 »

gemt wrote:I guess this could even work with wireless keyboards, and it should be possible to hack the keyboard down and just use the electronics, leaving the bulky physical keyboard behind?
Actually, yes. Most of the "guts" of a typical bargain keyboard are actually just the membrane layer to detect key strokes. The actual circuit board is usually a fraction of the size of the keyboard itself. Often times, you can literally tear out the membrane and just have a ruler-like circuit board to work with.

Source: I'm a computer repair guy.
sadisticflipside
*
Posts: 17
Joined: 10 Jan 2012, 07:42

Re: Is anyone interested in this?

Post by sadisticflipside »

I am curious, for those of us who kinda don't want to destroy a keyboard, would something like this work?

http://www.gearbest.com/development-boa ... Anxp8P8HAQ
User avatar
Imaginary_Girl
**
Posts: 86
Joined: 21 Mar 2016, 20:58
Location: South Central United States

Re: Is anyone interested in this?

Post by Imaginary_Girl »

davisev5225 wrote:
gemt wrote:I guess this could even work with wireless keyboards, and it should be possible to hack the keyboard down and just use the electronics, leaving the bulky physical keyboard behind?
Actually, yes. Most of the "guts" of a typical bargain keyboard are actually just the membrane layer to detect key strokes. The actual circuit board is usually a fraction of the size of the keyboard itself. Often times, you can literally tear out the membrane and just have a ruler-like circuit board to work with.

Source: I'm a computer repair guy.
Yes, exactly this. For instance in the one I built, the circuit board I was left with was something like 5 cm by 3 cm. Quite small. As for wireless keyboards - the problem is that they generally require a power source. This makes the size of the device bigger, in exchange for more portability. But assuming the LEDs are on the keyboard itself(and not the receiver) it should work.

Basically with cheap membrane keyboards(which is what you want to use for this), what you will find inside is a small circuit board like that. Connected to that circuitboard with a pressure thingy will be a few floppy plastic sheets stacked on one another, and then the membrane itself.

Here is an image I found. This one is a bit different than mine but it shows it well enough:
Image

Literally everything but that small green circuitboard you can see will get disconnected and thrown away. That board is where the indicator lights are and that's what you need, and it will work fine without the other stuff attached. In my case I mounted the circuitboard, relay and associated wires inside a small necklace box I had.

@sadisticflipside - I'm not sure exactly what that thing is or what it's purpose is, but at least with my program it won't work. The programs I wrote function by changing the state of the lock key indicator LEDs(e.g. like the small green light that lights up when you turn on Caps lock for instance). Since the device is built by replacing those LED with a transistor, the program instead controls the transistor(which controls the relay).

As for destroying keyboards, it didn't bother me. The local thrift store has many crappy old keyboards for less than a single dollar. I just went there and got a few for this purpose. If you can, get a USB keyboard. Some modern PCs(like mine) no longer have the PS/2 style connectors. I was able to use a converter with my device though, but of course it's better and cheaper if you don't need it.

As for building the device, I actually found this instructable(I did not use this when building mine, but I found it later): http://www.instructables.com/id/Control ... -computer/ However, the device that guy builds there is a bit more complicated. It does the same thing but he's making it super nice and he's also doing it in such a way that he can still use the keyboard in question.

For anyone that understands how transistors work it should be fairly obvious how to build this actually. But if you don't, let me explain a bit. Basically a transistor controls a larger current of electricity with a smaller one. So say you have two sources of electricity and one is 2 volts and the other is 12 volts. A transistor lets you control the state of the 12 volt circuit based on the state of the 2 volt circuit. However, 12 volts is not enough to run household things on(unless they have internal transformer and you mod them). Here in the U.S., household power is 120V AC. And you can't really control AC with a transistor. That's where the relay comes in. A relay does literally the same thing as a transistor - control a large current/voltage with a smaller one. But it works mechanically and can take way more power.

So what we are doing here is this: we take the ~3.3-5volt electricity from the keyboard LED and use it to control a 12v power supply(from a wall wart transformer). We then use that 12v power to control 120v power with a relay. So when the program tells the keyboard logic chip to turn on the caps lock LED, it sends power to where that LED normally would be. But instead, a transistor is there. So this functionally turns on the 12v power source. Which functionally turns on the 120v source.

I can draw up a schematic in a bit and post it. You still will need to be able to identify the base, collector, and emitter of the transistor in order to build the circuit. If you have a multimeter, that is not hard.

Believe it or not, this whole thing actually came about because I was trying to learn about transistors many years ago. This is literally the device I built to understand them(well I fried that one because I wasn't using a relay and I was putting too much power through it, but yeah). Little did I know when setting out to learn about that I would make such a cool thing.

Slightly off topic: A similar sort of device I made once is this: I basically used a MOSFET(which is a type of transistor, one that can take more power than usual ones) and connected it to the speaker output of my stereo. For the output I connected a relay and then a lamp. And then I played some music. Basically when the voltage/current from the speaker hit a high enough point, the lamp would turn on. The most power that comes out of a stereo is when the bass hits. So basically, when the beat hit the lamp lit. Was neat. Transistors are awesome.
User avatar
Sir Cumference
Moderator
Posts: 1606
Joined: 29 Jan 2012, 22:00
Location: Scandinavia

Re: Is anyone interested in this?

Post by Sir Cumference »

sadisticflipside wrote:I am curious, for those of us who kinda don't want to destroy a keyboard, would something like this work?

http://www.gearbest.com/development-boa ... Anxp8P8HAQ
Probably, but it is a Chinese copy of something, and as usual with those, there is little or nothing in the way of manuals and documentation.

It could be plug-and-play and it could be a nightmare. I personally prefer not having to download anything from a Chinese website.




With regards to keyboards, they are dirt cheap, and typically scrapped when the buttons start being flaky (or just too greasy and disgusting). There is literally no wear on the electronics inside.
~ Leatherworking, blacksmithing , woodworking and programming are the most pervertable skills you can learn! ~
gemt
***
Posts: 313
Joined: 01 Nov 2012, 17:04
Location: East Anglia

Re: Is anyone interested in this? (Interface computer and re

Post by gemt »

Yes the bat pack for wireless will add a bit more bulk, and presumably whatever you are controlling is also going to need power.
My thought with the number pad is you could hack it down to the top row and have a couple of keys to use for feedback, but it isn't that difficult to set up a few simple end-to-end switches across the removed keyboard matrix diagonals.
User avatar
Imaginary_Girl
**
Posts: 86
Joined: 21 Mar 2016, 20:58
Location: South Central United States

Re: Is anyone interested in this? (Interface computer and re

Post by Imaginary_Girl »

Yes, whatever you are controlling will need a power source. At least with the one I built, it actually has three cables that come out of it. One is the PS/2 cable to connect to the PC(in my case it goes through a PS/2 -> USB converter as I said). The second goes to a 12v wallwart transformer, this provides the power for the relay. The last is an extension cord which of course is what ultimately gets controlled(well, whatever is plugged in to it). This works well for me because all of my stuff is either native 120v or modded to be on 120v. E.G. like with my TENs unit, it nominally takes a 9V battery but instead I connected a 12v wall wart to the battery terminals. This lets me run it off mains power, and also gives it a bit more kick(I am really really "good" with electricity. As in I can take a LOT and not be bothered. Likely because I play with it a lot).

One simplification that you might could do is as follows. Basically there are many different types of relays. Mine will not operate with <9v power(well the pickup point is at 9v, drop off is at 5) which is why I set things up the way I did. But if you got a more sensitive one, then you might could draw the power for the relay from USB(though I'm not sure a PC would like a near dead short on it's USB power) and get rid of one cable. You would need a relay with a pickup point around 5v, a little less would be better. And yeah I'm not sure how the PC would like that, USB is pretty heavily current limited and using it to power a relay might upset the USB controller.
User avatar
Imaginary_Girl
**
Posts: 86
Joined: 21 Mar 2016, 20:58
Location: South Central United States

Re: Is anyone interested in this? (Interface computer and re

Post by Imaginary_Girl »

I drew up this crappy drawing to show how it's built. I didn't wanna make a proper schematic(not that I could, but there are tools online for that) because I doubt many of us can read them and it's really too simple to require that level of knowledge. BTW in this diagram RED = POSITIVE and BLACK=NEGATIVE for those that aren't familiar with this stuff.

Image

As I said before, you still need to identify the base, collector and emitter of the transistor(labeled B, C, E) somehow. It also matters whether your transistor is PNP or NPN. This diagram is assuming NPN btw. If you have a PNP the connections to BCE will be different. If you scavenged a transistor then it may have markings on it that indicate it's model which you can look up to figure this out. Otherwise you need a multimeter to identify BCE(well, you can do it without one but it's harder). Here is some information about that: http://www.zen22142.zen.co.uk/ronj/cpt.html

Don't be fooled by the technical terms and having to identify the transistor - this really is a very simple project. As I said the first time I built it I was actually teaching myself about transistors - I had literally 0 knowledge before I built this project the first time many years ago.

If anything is unclear then just ask!

In my case this is where I got everything:

Keyboard: Thrift store, $1
Transistor: MOSFET scavenged from a computer power supply(MOSFETs use Source/Gate/Drain instead of BCE). If you don't want to worry about identifying BCE then you can purchase a transistor online or at hobby stores for cheap, and they should come with the information you need.
Relay: Radio Shack, $5
Extension cord: Had one, but of course they are cheap
Wires: Had these too, can be scavenged but choose sane colors
12v power supply: Mine is just a wall wart transformer I got at the thrift store for $1

Also one final word of caution: Make very sure that you connect everything exactly right! You wouldn't want to send 12v or even 120v back into your PC. Bad things will happen! Very bad! Also make sure the connection points for 120v on the relay are insulated very well(in my case I covered them with lots of hot glue) so you don't get zapped!
MKu
**
Posts: 127
Joined: 23 Apr 2009, 21:47
Location: Germany

Re: Is anyone interested in this? (Interface computer and re

Post by MKu »

Instead of using transistors i recommend using optocouplers as a mean of galvanic isolation.
Indeed over time people got knowledge but no wisdom.

Accidents do not happen, they are caused.
User avatar
Imaginary_Girl
**
Posts: 86
Joined: 21 Mar 2016, 20:58
Location: South Central United States

Re: Is anyone interested in this? (Interface computer and re

Post by Imaginary_Girl »

MKu wrote:Instead of using transistors i recommend using optocouplers as a mean of galvanic isolation.
While that would certainly make things more safe, I've had 0 problems using this setup with multiple PCs over the course of 10 years. As long as you hook up things right, it should be fine.

I suppose if you had a leaky transistor things could get suspicious though.
sadisticflipside
*
Posts: 17
Joined: 10 Jan 2012, 07:42

Re: Is anyone interested in this? (Interface computer and re

Post by sadisticflipside »

Imaginary_Girl wrote:I drew up this crappy drawing to show how it's built. I didn't wanna make a proper schematic(not that I could, but there are tools online for that) because I doubt many of us can read them and it's really too simple to require that level of knowledge. BTW in this diagram RED = POSITIVE and BLACK=NEGATIVE for those that aren't familiar with this stuff.
This is exactly what I needed to visualize the connections. Thank you so much! This is quickly turning into a mad scientist tool to use on my fiancee. :D
User avatar
Imaginary_Girl
**
Posts: 86
Joined: 21 Mar 2016, 20:58
Location: South Central United States

Re: Is anyone interested in this? (Interface computer and re

Post by Imaginary_Girl »

sadisticflipside wrote:
Imaginary_Girl wrote:I drew up this crappy drawing to show how it's built. I didn't wanna make a proper schematic(not that I could, but there are tools online for that) because I doubt many of us can read them and it's really too simple to require that level of knowledge. BTW in this diagram RED = POSITIVE and BLACK=NEGATIVE for those that aren't familiar with this stuff.
This is exactly what I needed to visualize the connections. Thank you so much! This is quickly turning into a mad scientist tool to use on my fiancee. :D
I suppose then you'll be wanting the program that controls it? Without the program, you can control it with the physical num caps and scroll keys on your keyboard, but yeah. The program can do all kinds of automated fun stuff.

I cleaned up the code of the client/server set today and commented it nicely and such so that's done. But the main app is much larger, around 1000 lines, so I'll work on that tomorrow. It's actually pretty well written, I was doing a LOT of coding when I wrote the base part of it so I was very familiar with what I was doing. Today I don't code as much so it's not quite as nice XD
Post Reply