Any write-ups on the power button for the G4 Cube?

Discussion in 'PowerPC Macs' started by JamesAvery22, Jan 7, 2007.

  1. JamesAvery22 macrumors newbie

    Mar 3, 2004
  2. JamesAvery22 thread starter macrumors newbie

    Mar 3, 2004
    Eh never found the answer to my question. Found a project more suited to me though:

    Googling the part number of the Cube power button found me this thread:

    Poster wanted to do the same thing and never got an answer. They told him to try forums which I searched for a few hours and never found any actual pin-out definitions. Just photos of the connectors that showed what wires went where on the connector. Seemed common that people would rip the wires out. Naturally all the wires are black though...
  3. California macrumors 68040


    Aug 21, 2004
    The fix on my cube with a bad power button was to get an iMac G3 keyboard with the power button on it. Yes, it turned on the Cube without the smoking powerbutton problem! BUT my cube had bad usb ports so I could not use the rest of the keyboard.

    Cheap solution: get an iMac keyboard with the powerbutton.
  4. JamesAvery22 thread starter macrumors newbie

    Mar 3, 2004
    Thanks. Im not trying to replace or fix a cube though. I was trying to use the powerbutton part from a cube in a PC I'm building.
  5. linuxguru macrumors newbie

    Sep 20, 2008
    some answers

    I found this post when i was asking the same question, but there appear to be no answers out I figured it out and here is the answer.

    I put a writeup here:

    but, just in case that goes away, I'll put it in text too.

    Looking at the small 5 pin connector, the pinout is as follows:
    (looking from the top)
    | 5____ +5 volts
    | 4____ (not connected)
    | 3____ Control Line from Cube
    | 2____ LED Power (3.3v from the cube)
    | 1____ GND (0 volts)

    Also, the frame that the button is mounted on must be connected to GND. Normally this is done with the frame of the Cube, however when testing it I had to use a wire clipped between them.

    Now if you just connect 5v between +5 and GND, and stick your finger over the button you will find nothing happens. That is because pin 2 is the power input for the LED. I didn't want to deal with another power line going to it, so I just connected a 1k Ohm resistor between +5 and pin 2. This did the job just fine. You can go smaller than that, I ran it up to the full +5 volts without seeing any problems, however I would say it is a safer bet to stick the resistor in there.

    If you look just off the the side of the connector, there is a "large" rectangular chip which is a Phillips microcontroller (uC). Pin 3 on the connector goes to pin 18 on the uC. Pin 2 on the connector goes to pin 10 on the uC. Pin 11 on the uC is the output to the LED, and goes up to about 1.25 volts when the LED is on.

    As it is somewhat difficult to solder to the pin on the connector, I soldered the 1k resistor between pin 15 (+5v) on the uC to pin 10. The pins on that are a lot bigger, so it was more strait forward (see pictures on the web page above).

    If you have done this, or connected 3.3v to the LED power in connector pin (2), then you can stick your finger over the button and it will light up. If you hold your finger over the button for 4 seconds or so, the light will shut off. I have it setup such that the button only lights up when I am "pressing" it.

    ATX (and similar) systems turn on/off when the power switch pins are shorted. To simulate this, I used a transistor connected to pin 11 (the LED output on the uC). The one I used is a 2n3904 NPN transistor, like you can get at Radio Shack. Really any "run of the mill" NPN transistor you can get your hands on will work.

    If you want to use a MOSFET transistor, you might find you don't have enough voltage to turn it on. I originally tried a 2n7000, but you need 2.1 volts to turn that on. The NPN transistor only needs about 0.7v or so, and it works just fine.

    So how to connect it. You will need a 10k Ohm resistor. Solder a wire to pin 11 on the uC, and go to the 10k resistor. That should go into the Base of the transistor (probably the middle pin, but look up the data sheet for whichever one you have). On the transistor, the Collector pin should go the the positive (+) switch pin on the motherboard, and the Emitter should go to the negative (-) pin.

    Here is some crude ASCII art of the transistor connections (the "..." are just so things line up right, white space gets removed...which is "bad" for ascii art)

    .MB PWR+ pin----------- ..........._ -------------MB PWR- Pin
    ................................. C \ ......... /| E
    ...................................... \____/
    ...........................................B -------/\/\/\/-----Pin 11 on uC

    If you do this, when the light is on the two pins will be "shorted" because the transistor is acting like a switch that closes when the light is on. To hold things in place, I just hot glued the transistor to the metal plate that the board screws onto next to the board.

    This also means you need +5v to work with before the computer is on. If you lookup the ATX power connector pinout online, you will find that one of the pins is a +5v Standby (usually called +5vSTBY or something). This is the power the motherboard uses to run the power on/off stuff, wake-on-LAN, etc. You can connect to that power line (splice in, solder on, whatever) and use that to power the power switch board. The peak current pulled by the board is about 110mA when the LED is on, and less than 5mA when it is off (my Power supply only shows that low, in any case it is all far less than the +5v standby line can supply).

    For those who want to keep the light on, the way you do that is as follows. The microcontroller monitors pin 18 (pin 3 on the connector) to see if it changes while the button is being "pressed." If you want the light to stay on, you have to pull connector pin 3 low while the light is on. If you do this, the light will stay on after you remove your finger. You can turn it off again by holding your finger over it for 4 seconds. I didn't do it this way, so I didn't have to deal with how to flip the switch on and off while the light stays on. You could do it with a one-shot type circuit (look it up on the web, they are common) that fires on the rising edge of the LED coming on. Like I said, I didn't do that.
  6. linuxguru macrumors newbie

    Sep 20, 2008
    One additional thing

    I forgot to put this in my last reply, but here it is for completeness.

    I think the Cube is determining that the button is being pressed by sensing that the LED is on via the current being drawn on pin 2 of the connector. That seems like the only line of "information" that goes back to the cube, and it would be pretty easy to sense it on that end.
  7. AshmanE macrumors newbie

    Jan 25, 2009
    linuxguru: This is great. I'd also come to the same conclusions about the pinout by reverse-engineering the connection to the Philips chip.

    However, I'm wondering how well the setup works for putting a machine into sleep mode.

    I guess if I set it up the way you describe and then hold my finger on the switch, the light will light up for 4 seconds. It seems that this should do the trick.

    However, if you set it up using the one-shot to keep the light on while the machine is powered on, it seems like this would take away the ability to hold your finger on the switch and put your machine into sleep mode.

    Any thoughts?
  8. linuxguru macrumors newbie

    Sep 20, 2008
    Sleep Mode thoughts

    I'm not sure how well it would work for going to sleep. It depends a lot on how you have you hardware configured to know that it should go to sleep.

    Putting your finger over the button for 4 seconds will turn the machine off completely. It sends a shutdown signal to the power supply that is running it. This is part of the PC98 standard (I think). Basically, it is just a hardware override to let you kill the power, since the button doesn't actually break the circuit like it did on the old AT style machines.

    You could probably just tell your computer that you want it to go to sleep when the power button is pressed, and then you can just touch it and have it go to sleep. In Ubuntu (what I am running on mine), I have it configured to ask if I want to shutdown/switch user/restart/etc. It's the same as poking the button on a regular case.

    If you want to do this, you might want to consider doing something for debouncing the button. If found that if I touch the button while it is on, it effectively gives 2 to 6 button press events. I didn't put anything on there to debounce it, so that is really my fault. You could probably just use an RC filter on the base of the transistor to cut down on the glitches. If you make the time constant (1/RC) something "long", maybe 0.1 seconds or something.

    If you want to use the one-shot approach to keep the light on, then you could build in the functionality to give a pulse to put it to sleep. Just something that would pass though a button press event without turning off the light if the power was already on (monitor a hard drive power connector or something to tell when it is on).

    Personally, I don't like having lights on, so I would leave it off and just put some debouncing on it.
  9. choodalls macrumors newbie

    May 14, 2008
    No need for all the resistor and transistor stuff to get it to work. The whole purpose of the board is to perform the proximity switching function, so adding an extra switching transistor is NOT required as it over complicates an essentially quite simple device.
    The 3.3v referred to by Linuxguru is simply intended to be the positive side of the PC "On" button and the GND connection should instead be referred to as the negative side of the PC "On" button. To say it differently, these are the outputs from the MOBO on/off power connection.
    The rest of the write up by Linuxguru is fine, +5v connection is correct and the important point about grounding the plate on which the switch sits is also critical to how everything works.
    To try and clearly set out how this switch can be used, I made a write-up of this recently.
    Waking, sleeping and on/off functions all work fine. Hope this helps.
  10. Clive At Five macrumors 65816

    Clive At Five

    May 26, 2004
    St. Paul, MN
    Wow, great write-up, choodalls and others. Question, though on the voltage amounts for +ve. Must it be 3.3v? I'm attaching this power switch to the D945GCLF2 (Atom Dual-Core) board from Intel, which I'm pretty sure throws out 5v from the + header. Sure I can use Linux Guru's resistor trick, but wouldn't that result in an always-on state?

    Edit: Nevermind, it's -ve that changes... duh.


  11. Clive At Five macrumors 65816

    Clive At Five

    May 26, 2004
    St. Paul, MN
    I now have some legitimate issues with the walkthroughs. I tested the voltages and +ve is indeed 3.3V from the intel D945GCLF2 board. I tied pin 1 to stby +5V, pin 4 to +ve and pin 5 to -ve. When plugged in, the circuit returns an "always on" state, which results in a 5-second power-up/reset cycle. Sure, I can start it by simply short-circuiting the header pins but I really want to get this touch switch to work.

    Any suggestions? I suppose I could try the transistor business, but my recollection of my circuits class is a little hazy, and I'd at least like to have some sort of idea as to what is going on...

  12. choodalls macrumors newbie

    May 14, 2008
    Only comment I can make is that my set-up definitely works with switching a Mac Mini on, off and into and out of sleep, and I am pretty much 100% certain the momentary switching requirements of the Mini are exactly the same as for the on/off switching of MOBOs in general use.
    Important to realise that on the picture I put together, although I list five connections top to bottom, there are only three of interest. These are the +5v standby voltage you can get from your ATX, and the two wires that would normally be shorted by your push to make power switch. The ground wire of those two is the "bottom" wire, the other (next one up from bottom of my picture if I recall correctly) is the positive side of the switch - which when not shorted to ground by a proximity condition sits at around 3.3v.
    With this arrangement, you must also make sure the actual shield area of the touch switch is properly earthed too, otherwise, some really bizarre things happen with it trying to turn on/off repeatedly. The plate part of the switch that attaches with a pair of short screws is crucial in this too, as if it becomes loose or detached the switch doesn't work and displays the same bizarre behaviours.
    I would put money on the problem you are experiencing being either one of the two above switch panel earthing type issues, or you having something in the area of the switch that is perpetually sending it into an on state - or you have a faulty switch board!
    Remember that when hooked up, the LED only pulses when the switch is actually activated by approaching finger, at all other times it will be off.
    The dodge I use to make it look as if it is a proper "power on" LED is achieved by using a normal power on LED that shines through the base of the proximity switch LED and I am sorry I never got around to actually including a picture of that....I hope you get what I mean though.
    I really wouldn't bother with farting about with transistors and stuff as it is over-complicating what I believe to be a supremely simple arrangement.
    Good luck!
  13. Clive At Five macrumors 65816

    Clive At Five

    May 26, 2004
    St. Paul, MN
    This was indeed what the problem was... unfortunately, I discovered this after I had wired up all the crazy transistors & resistors. I knew that I was supposed to make sure the unit had proper grounding, but I didn't realize that it specifically referenced the screw hole! After playing around with my multimeter, I discovered that the one to the right of the circular switch (oriented with the connector in the top-right corner) is connected to the circuitry of the board. Since my controller board doesn't have room to mount in the original position, I simply attached it, via wire, to pin 5, which I connected to ground per "linuxguru's" instructions.

    I presume that your method would work as well, but now that I have everything all soldered up and working, I don't have the will to mess with it. Maybe I'll try it with my next Cube ;)

    I'll upload pictures and maybe a movie of everything in operation sometime soon.

    Thanks for the guidance. I truly appreciate it!

  14. choodalls macrumors newbie

    May 14, 2008
    Well, the main thing is you have it working! :)
    I had that screw fall out at one point and saw the board go through the spiral of on/off rapid re-boots, so knew it was critical. Maybe i should adjust my write up on the web page to just underline that issue.........
  15. choodalls macrumors newbie

    May 14, 2008
    Updated switch write up

    Just thought I'd post here that I have updated my write up of the switch function, see here.
    The update is just to make a couple of things clearer and also to share another workaround to make the switch LED function better.
    I am using these switches now both in my modded Mac Mini installation and in a Mini-ITX project.
    Hope someone finds the write up useful.
  16. Toshibo macrumors newbie

    May 27, 2012
    i need help!

    thanks for all hard work u guy thid! please upload pics hot to connect all cable on mini-itx mod! thanks

  17. choodalls macrumors newbie

    May 14, 2008

Share This Page