Reverse Engineer the PowerKey by Sophisticated Circuits?

Byte Knight

Well-known member
Slightly off topic, but would there be any way to get the PowerKey to work with the IIgs? Does anyone know what the control panel does besides get rid of the "It's now safe to shutdown your Mac" window?
 

Tashtari

PIC Whisperer
Slightly off topic, but would there be any way to get the PowerKey to work with the IIgs? Does anyone know what the control panel does besides get rid of the "It's now safe to shutdown your Mac" window?
That's at least most of what it does. I think someone experienced in such things could write a driver for it for the IIgs without too much trouble (does the IIgs have a Shut Down command like the Mac does?). The PowerKey will close the relay when the power key is pressed, and an ADB Listen command will open the relay when software wants to power down - that's all that's really necessary, though if one were so inclined, timed powerup is fairly simple too.
 

NJRoadfan

Well-known member
GS/OS does have a shutdown command. One would likely need to patch the routine. GS/OS does notify INITs and CDEVs of the shutdown command (Marinetti throws a warning if there is an active TCP/IP connection), but the actual shutdown routine is likely handled by the OS.
 

Tashtari

PIC Whisperer
I wrote some PIC firmware! (Who's surprised?)

The firmware emulates the PowerKey Classic (PK-1), controlling a single relay with a clock signal extracted from the mains AC waveform, and includes a PS/2 keyboard protocol converter so not only can you make your non-soft-power Mac soft-power, you can power it up from a non-ADB keyboard.

Sadly, it's PS/2 keyboard only, no mouse, there's just no room for it. I've really packed this PIC12F1501 firmware to the gills - out of 1024 words of program memory, I'm currently using 1018.

Firmware is all it is at the moment because I'm wary of dealing with mains current. But in case I find someone to work with who's interested in making it into a full PowerKey clone, the firmware is ready.
 

Tashtari

PIC Whisperer
Code posted on Github (firmware is now using 1023 words out of 1024, hah.)


For anyone like me who's not up to dealing with mains current, it's also possible to use this in an ATX conversion, just connect +5VSB to the PIC (and the PS/2 keyboard if you're using one) and connect the relay control line to PS_ON.

For situations where you're dealing with two separate +5V rails, one generated by the PowerKey-like device, one generated by the Mac when it's powered, I think this should be safe, though I would accept correction from anyone who knows better. There should be no situation where the two +5V supplies are connected together, and as long as the Mac's +5V rail isn't too much higher than the PowerKey's, the pullup on the ADB line shouldn't damage the PIC (its GPIO lines are rated for a maximum of 0.3V above supply). In any case, it'd be the PIC that would be damaged rather than the Mac. I did consider optoisolating the ADB line entirely, but besides requiring two optoisolators, that'd require an extra pin on the PIC and there aren't any to spare.
 

Tashtari

PIC Whisperer
For anyone like me who's not up to dealing with mains current, it's also possible to use this in an ATX conversion, just connect +5VSB to the PIC (and the PS/2 keyboard if you're using one) and connect the relay control line to PS_ON.
Though... in that case you'd also have to feed the "line clock" line 50 or 60 Hz from somewhere.
 

njr

New member
I've got an original PowerKey (used with my SE/30 back in the day) and a new-to-me IIgs I was hoping to use with it. If I can get the hardware working I might make it a small Apple IIgs software project…

I don't think I have the original cable but I'm not quite sure; I did find one ADB "Y" cable but can't recall if it is related.

However I don't see a 5th pin on the PowerKey end. Is this just a PowerKey Pro thing?

I also have a PowerKey Remote, which would let me turn on my Mac via the phone. Don't think that's too useful in 2024 but if there's anything I can do with it, happy to help.
 

Tashtari

PIC Whisperer
I don't see a 5th pin on the PowerKey end. Is this just a PowerKey Pro thing?
The 5-pin DIN is only seen on the PowerKey Pro 200, as far as I know. I believe the PowerKey Classic's Y cable just tees the 4-pin DIN straight.

I also have a PowerKey Remote, which would let me turn on my Mac via the phone. Don't think that's too useful in 2024 but if there's anything I can do with it, happy to help.
Yeah, I got my hands on one of these recently, only to find it's not actually a device on the ADB bus, it just pulls the ADB power-on line low when it detects a ring on the connected phone line, pretty simple. Cool concept in its time, though.
 

Fizzbinn

Well-known member
I'm coming back to looking at recreating a new "cable" so I can use my PowerKey Pro 200, current plan:

1722141587235.png

I have some Mini DIN-5 male connectors I got from eBay (#3) and some small project electronic project boxes from Amazon. I'm thinking of buying this S-Video splitter cable from Amazon to cannibalize the connectors for #1 an #2. Which leaves me with needing a wire for the cable to the PowerKey and some rubber grommets to secure the cables to the project box.

Anyone see an issue with this 5 conductor wire? Should I be concerned its not shielded?


To secure the cables to the box I'm looking at these:

 

Tashtari

PIC Whisperer
I have some of those miniDIN-5s, and not only do they look like a pain to solder, I don't think they fit in the recessed connector on the PK Pro 200.

You could make a reasonable cable, I think, by taking a good S-video cable (one with four separate wires in it) and yanking out the key on one end and just plugging that into the PK Pro 200, then plugging the other end into an S-video splitter. It's not entirely true to the original Y cable, but the fifth pin looks like it's only used when using the PK Pro 200 with a soft power Mac, and where's the sense in doing that anyway.
 

Fizzbinn

Well-known member
I have some of those miniDIN-5s, and not only do they look like a pain to solder, I don't think they fit in the recessed connector on the PK Pro 200.

You could make a reasonable cable, I think, by taking a good S-video cable (one with four separate wires in it) and yanking out the key on one end and just plugging that into the PK Pro 200, then plugging the other end into an S-video splitter. It's not entirely true to the original Y cable, but the fifth pin looks like it's only used when using the PK Pro 200 with a soft power Mac, and where's the sense in doing that anyway.
These Mini DIN 5 connectors do fit the in the PK Pro 200 quite nicely! Soldering seems no worse than the tiny stuff we do on logic boards, no? I guess I’ll let you know!

I would like to have a fully capable cable. I guess the benefit for using it with a machine that already supports soft power is the ability to power on and off multiple other accessories along with the system via the keyboard power button.

…does anything like that even exist today? I guess low power modes these days are much better but we still seem to have too many wall warts always sucking power.
 

opualuan

Well-known member
These are worth preserving, I set up a powerkey pro this weekend. Combined with the BMOW wombat usb-adb converter, I was able to enable soft-power type capability to LC475.

Shut down, powerkey powers off the computer. Hit F13, wombat wakes up the powerkey to boot the computer. Simple but useful integration.
 

GorfTheChosen

Well-known member
I have this really nifty and cool surge protector by Sophisticated Circuits called a PowerKey. It has 4 power plugs and an ADB port. When used in conjunction with the software, you can program the power plugs on it (such as turn completely on/off.)

This is extremely useful on machines that don't have an auto-power circuit like the LC or SE. But it's also just as useful in general as it can turn off any peripherals, too, eliminating any annoying LEDs or turning off LCDs that like to stay on when there's no signal detected (I'm looking at you, HP.)

My PowerKey had one of the plugs die on it (other three still work,) and it appears to have some internal clips that will need to be broken for me to get inside it to even attempt a repair.

Not sure if anyone has mentioned this or not, but there are two Phillips screws - placed diagonally - under the label. One in the top right corner under the PowerKey name and the other in the lower left corner near the reset button.

Carefully peeling back the label will give you access. Unscrew those two and the back comes off fairly easily:

IMG_3550 copy.jpg

As far dead outlets go, the individual outlets apparently use some type of clip - probably with a slot - to knife into the wire's insulation and make a connection ... possibly similar to those connectors (aka "power tap") used on 12v systems to tap into a hot wire and take power off it.

On the back of the PowerKey outlets there are three slots ... probably so some tool (a straight blade screwdriver ?) can be stuck in to press the wires into the knife to make wires connect to the outlets connectors:

IMG_3551 copy.jpg

I just "fixed" the one "dead" outlet in my original PowerKey by doing exactly that.

FWIW, I'll posting it for sale in the Trading Post once I can get some photos taken of it for the ad.

Will be sad to see it go ... :cry:
 

jmacz

Well-known member
Not having looked at this before, the power on part of it seems understandable. But how exactly does power off work lets say if you hooked an SE to this? Will it auto power off the SE after shutdown (which is what I'm not quite picturing) or for shutdown, you still have to manually toggle the PowerKey to turn the power off after you get the shutdown dialog?
 

Tashtari

PIC Whisperer
Not having looked at this before, the power on part of it seems understandable. But how exactly does power off work lets say if you hooked an SE to this? Will it auto power off the SE after shutdown (which is what I'm not quite picturing) or for shutdown, you still have to manually toggle the PowerKey to turn the power off after you get the shutdown dialog?
There's a cdev that hooks shutdown and sends a signal to the PowerKey to power off immediately, it's all automatic.
 

jmacz

Well-known member
These PowerKeys are pretty awesome. Just having the ability to have my SE/30 turn on via the keyboard and turn off when you choose Shutdown is just really neat. I got one that wasn't working from eBay for a great price. Three of the outlets had the problem @GorfTheChosen mentioned. There was also something going on with the relay. I desoldered it, tested it outside the unit, and then put it back in, and it started working. Most likely a bad solder joint. But it's working great now.
 
Top