Intro: Mac Envy
You got to hand it to Apple, they don't skimp on design or the little things. These little nuances set them apart from the mass produced clones, but now you can have a level playing field ...sort of. This project will supply you with the fading standby LED that the mac boast when resting. A few dollars of components and you will be fading in and out like any mac in the land.
Step 1: Shopping List
For this project you will need -
1. Picaxe 08m and prototype board Kiwi's go here,Americans go here. Brits go here
2. 10kohm and 100ohm resistors (+ one more discussed later)
3. Some hook-up wire
4. Some bus connectors
NOTE: You will need a picaxe 08m this is not the same as a Picaxe 08. If you have not used this type of PIC before you will have to get the programming cable as well.
Step 2: Computer Stuff
Now I am making some assumptions here. I assume you have a spare floppy disc drive power lead and I also assume you have a spare usb connector on you mother board and that you mother board keeps this live in standby.
If these assumptions are correct lets move on!
This circuit works off the theory that when the power to your drive is removed the computer is going into standby. When this happens the micro controller starts a PWM routine (raising and lower the voltage) on the status light of the PC giving you the mac effect.
First thing you need to find is a spare USB port and the floppy disk drive connector. Most modern PC's have these as spare so don't panic.
Step 3: Getting the Board Together
Assemble the components on the proto board as shown in the picture. The third resistor is for the LED on the front of your PC. The value for the resistor can vary depending on make size etc etc. I measured the voltage drop across the LED and the current drawn to figure out the correct size resistor. You can go to this site LED calc to calculate the LED resistor once you have the values. If you do not have a multimeter then about 20mA and 2.3v is a good figure to roll with, probably a resistor around 150ohms to 180ohms will do.
Step 4: Connecting to the Mother Board
Word of caution - computers take a bit of stick but if you kooz your PC I can't help ya.
Connect the power leads of the proto board to the USB plug as shown. Note the connector has one row of 5 pins and one row of 4 pins the pin to the left of the extra pin is the -ve or ground pin. The pins furthermost away from the extra pin are the +ve of 5v pins. Still confused? Look here.
Step 5: Connecting to Motherboard Cont'd
Now connect the floppy disk drive power plug as shown. This is VERY important to get this the right way, if you plug it in back to front you should prepare yourself for some magic smoke!
The front panel LED can be connected also, depending on your case this may or may not be labeled on the leads. If it is the -ve lead goes to the board edge side of the connector. If it isn't don't stress it just won't work, then just swap them over.
Step 6: Programming the PIC
Once your all connected fire up you PC and see what happens. With a bit of luck nothing will happen. The PIC is blank and needs to be programmed to do anything. I hear you groaning 'so now I have to buy some programmer and fudge around with assembly to make it work'.
No you don't in fact all you need is the free software and a download cable (USB or serial are available make sure you buy one when you order the proto kit or make your own). Open the software and type in the following as a new program.
pause 2000 'wait to seconds
if pin3 = 1 then pwron ' if the power is on goto pwron sub routine
if pin3 = 0 then standby 'if off goto standby
pwmout 2,255,1000 'set pwm so light stays on
pause 2000 ' wait 2 seconds
goto start ' got back to start and check status again
for w0 = 0 to 500 step 1 'start a loop to ramp up pwm
pwmout 2,255,w0 ' ramping up pwm using w0
pause 5 'slowing things down bit
next w0 'loop back to w0
for w1 = 500 to 0 step -1
goto start ' check status again.
This is a very simple method of achieving what we need. You can fudge around with pauses and loop (stuff in bold) amounts to perfect your fading but for the most part this should get you going. Make sure you practice on the LED you are actually using as they will all react a bit different.
Anyone who has done any programming will recognise this as BASIC.
Press the f5 key in the programmer and it should download right to the PIC and it should start working!
Step 7: Conclusion
You should put the circuit board in a plastic case so you don't have to worry about shorting things out and also it'll be easier to swap between computers.
Now some puritans will be saying that they could do the same with a 555 timer chip or a pair of transistors and some capacitors, but why would you? These little PIC's are cheap as chips (drum fill) and can be easily modified with a few lines of code. If you get adventurous you will be able to measure the temperature of your pc add some more LEDS control more fans the options are limitless.
So if you have been successful you have...
1.Found a use for the spare plugs in your PC.
2.Worked out how to calculate resistors for LED's
3.Made your first step into the world of microcontrollers
4.Ticked one more box against the MAC.
p.s sorry about the crap video.