SD activity indicator for Wii

[DeadlyFoez] wanted to know when the SD card in his Nintendo Wii was in use. He built and indicator LED using a PICAXE 08M and added it next to the SD slot. He uses one pin of the microcontroller to monitor the voltage on one pin of the SD card slot. That pin has a specific value when the card is idle, which rises when it’s in use. He didn’t share the details of which pin he’s sampling, or what the magic number from his source code actually represents. But the concept should be enough of a start if you want to do this one yourself. Watch it go blink-ity-blink in the clip after the break.

Comments

  1. alankilian says:

    There are five digital signals that have pullup
    resistors connected. CMD and the four data lines.

    Since he’s saying tha card is idle if the analog
    voltage is greater than a magic value, I’m
    guessing he’s monitoring one of these five lines,
    and when it starts toggling that he sometimes
    detects a “low” on a line and lights up the LED.

    It seems like just hooking the CMD line up to a
    digital input on the PIC and turning on the LED
    for 1 second or so every time it goes low would
    also do it, but you’d need to make sure the
    voltage at CMD went high enough to show as a “1”
    on the PIC.

    Without a schematic it’s pretty much guessing for
    me, so I expect to be wrong about some of this.
    (I didn’t create a login on that website to be
    able to look at the photos, so there might be
    some useful information in those also.)

  2. fartface says:

    If you dont release details about your “hack” then you are faking it.

    Until he ponys up details it’s a fake.

  3. rocketman1001 says:

    At first I thought it was overkill to use a microcontroller for this when a single transistor or monostable timer would do.

    But then at £1.50 for a PICAXE 08, why not?

    Good job anyhow.

  4. Bill says:

    Sounds like a 74123 one shot would do the same thing.

  5. None says:

    What do the images show that are linked in the post?

  6. Leif-KC8RWR says:

    Does it take a picaxe to do this? Wouldn’t blinking a LED based on the state of only 1 input just require a single transistor at most? Or am I missing something?

  7. DeadlyFoez says:

    Sorry about that. I was not aware that you had to be a member of wiihacks.com to view anything on the site.

    So I uploaded my pics to my FB page. Here are some of the pics.

    http://bit.ly/ecm1dB

    http://bit.ly/ihom7t

    http://bit.ly/hTEQ4k

    http://bit.ly/e64E4Z

    And here is the initial code that I used, although I have changed it up a bit to be able to detect slight voltage changes, but I lost the file that had the newer code in it, so here is the first bit of code that I did.

    start:
    setfreq m4          
    low 1                
    
    
    main:
    readadc 4,b1       
    if b1 > 210 then   
            low 1         
    end if
    if b1 < 210 then   
            high 1        
    pause 50
    end if
    goto main
    

    Basically what I have going on here is that pin 4 of the 08M reads the voltage of the SD cards pin 7. Pin 1 of the 08M controls the LED. I was able to find a constant 5v output on the wii’s motherboard and used that to power the 08M.

    If people still insist on a schematic then I can do one up, but I’m sure it will look cheesy.

  8. smoker_dave says:

    You don’t need a uC to monitor a voltage level!

  9. DeadlyFoez says:

    I tried using a transistor at first, but what would happen if that the LED was always on when the SD card was idle, and the LED would just go dim where there was data activity. Plus at times the transistor was taking up too much voltage from the SD card’s pin 7 and would cause there to be no data written to the SD card and it would fail. I used the 08M to get around these issues so I could slow down the blink rate and so too much voltage wasn’t being taken away from the SD card’s pin 7.

  10. Philip says:

    Could this not be done with a resister and LED connected to pin 7(parallel to DO) of the SD card to ground?

  11. DeadlyFoez says:

    I know I don’t NEED a micro-controller to monitor voltage, but this was part of the fun of having an afternoon project. I did the hack for fun, not for efficiency.

  12. DeadlyFoez says:

    @philip. No it can’t. I tried it and the LED used up too much power and caused there to be no data written to the sd card. I was getting data read and data write errors like crazy when I tried it that way or with a transistor. Many of the times the SD card would not even be detected.

  13. dext0rb says:

    did you try a different type of transistor (NPN vs. PNP).

  14. Gdogg says:

    that would just change when it’s on or not.

    You he have used a darlington array or used a 555 timer to keep the pulse ‘on’ longer, but personally I would have done it the same as him (except with a normal pic. I hate picaxes)

  15. seer says:

    @DeadlyFoez.
    Then an Op-amp, a comparator even a 555 will do. They have much high input impedance.
    And if the voltage is compatible to a logic level, most logic device can handle it.

  16. Leif-KC8RWR says:

    Ah… just asking, didn’t mean to sound critical or anything. Great job!

  17. dext0rb says:

    gdogg, i know. he said it was always on when the SD was not being accessed.

    “the LED was always on when the SD card was idle,”

  18. st2000 says:

    Does this really work?

    1) I would say it is better than nothing.

    2) I would also say it is not full proof.

    Anyone who has tried to use SDCards on a large base of products knows the problem. When can you safely power the darn thing down (or pull it out)!

    The answer? Well, I don’t think a manufacturer is going to say. I’ve tried. Truth is these things manage their own memory and you don’t have a clue what they are up to. For instance when they may go off and do memory-load-averaging.

    My guess is they do house keeping when they power up then when necessary. My guess is it is safer to pull them out after you ask them if they are ready to do something. Which is something only the host can pull off easily. Even then it is all guess work.

    If anyone knows different – I for one would love to hear about it! Really – would make my life easier.

    -good luck

  19. Scuzz says:

    @st2000
    SD cards use the SPI clock as the primary clock. If you don’t have the SPI clock running, the SD card will be frozen in time, unaware that anything is going on, and won’t be doing anything on their own.

    I know that in pretty much all of my applications I simply clock when I input a command, and the spec demands that I send an empty clock period in order to give the SD card enough “time” to process, because it can’t run unless there are clock pulses.

    This is (from what I recall) pretty well laid out in the spec. So in most uC cases, you can be certain that if you’re not running a command, the SD card is safe to yank.

  20. Scuzz says:

    Ack, and sorry for the double post, but in a non-SPI environment (aka a built-in peripheral or fancy-schmancy fpga thing) I assume that the card still uses the clock pin for the same purpose, and thus you can assume if the clock is not running the card is safe to pull.

  21. DeadlyFoez says:

    @seer, I thought about using a 555 timer since I have one kicking around. I don’t have any op-amps nor have I ever played with one to know how to correctly use it.

    But with a 555 I would have to add in more components like capacitors and resistors and I did not want to have to add in more than needed. I really wanted to keep it simple and I succeeded in that.

  22. zigzagjoe says:

    I did this for the first generation zipit (little embedded linux machine). I was already using a 74HC04 inverter, so hooked that up to the SPI pin and presto, activity light.

  23. DeadlyFoez says:

    I remember my updated code that works better.

    start:
    setfreq m4
    low 1
    readadc 4,b1
    
    main:
    readadc 4,b2
    
    if b1 > b2 then
    	let b3 = b1 - b2
    else
    	let b3 = b2 - b1
    end if
    
    
    if b3 > 7 then 
    	toggle 1
    else
    	low 1
    end if
    
    let b1 = b2
    pause 50
    goto main
    

    Basically what is happening is that the micro controller and checking the voltage of pin 1 (variable b1), then it goes and and checks it again (variable b2). It then compares those 2 variables. If the value is greater than 7 then it knows that the SD card is not idle and it will proceed to toggle the output of pin 4 (for the LED).

    I had to do it this way because many times the wii will read or write data to the SD card via serial connection with data only being transfered via pin 7 of the SD card. But I have noticed that many time of trying to write data to the sd card that is all bits of 1, the 08M would see that as the card being idle because it was on high for a longer period to the point that the 08M would get a reading that was higher than 210.

    In the end, this worked out pretty sweet for someone who doesn’t have a whole boat load of electrical skills.

  24. EE says:

    Next time try and Emitter-Follower driving an LED, you can have a 100% reduction in required MIPS.

    just sayin…

  25. DeadlyFoez says:

    @EE, if I knew what those were then I probably would have thought of it as an idea. Quite honestly, I don’t have really any skills in this field at all. I’m great with soldering and thats about it. I was lucky enough to pull together a few things that I had kicking around and knowing just enough about it to be able to make it happen.

    The only thing I really had going for me is that I used program in QBasic a lot as a kid.

  26. Reikaze says:

    If I would have a uC laying around, for the sake of simplicity I would have done the same thing.
    With a OPamp you’ll need resistors, then a 555 (and all the peripherals) to slow down the blink, and maybe a few more things to make it work looking fine.
    Simple, easy, quite inexpensive, and it works. Exactly what an engineer’s boss would want I rather thought (and my teachers would say that too)
    But more important, that Wii got pimped up. (just a little though)

  27. DeadlyFoez says:

    So I decided to try and see if I could add in a NAND activity LED to my wii. For this I used my PICAXE 08M micro controller to to read the CE pin of the NAND flash chip to determine if there is activity. When there is any NAND activity, the CE pin become low (0 volts), but when idle the CE pin floats at around 3.5 volts.

    The SD card activity is determined by pin 7 of the SD card that the PICAXE reads. When idle, pin 7 floats at a voltage range, but when there is activity then the voltage will bounce all around.

    I changed the way that I have it now it before. Now the blue SD card activity LED is placed above the SD card slot and the red NAND activity LED is to the left of the SD card slot.

    I also added in a headphone jack to the right of the SD card slot. This headphone jack is used to reprogram the micro controller.

    [img]http://sphotos.ak.fbcdn.net/hphotos-ak-ash1/hs736.ash1/162958_172245846148049_100000879040713_328375_5028548_n.jpg[/img]

    [img]http://sphotos.ak.fbcdn.net/hphotos-ak-snc4/hs1384.snc4/163674_172245869481380_100000879040713_328376_3443203_n.jpg[/img]

    The video below demos the activity of the NAND and SD card activity LED’s.

    start:
    setfreq m8                        ;Make sure the frequency is set to 8 Mhz
    low 0 , 1                         ;Make sure pins 0 and 1 are low
    main:
    readadc10 4,w0                    ;Read pin 7 of the SD card.
    if w0 < 604 or w0 > 620 then      ;values between 604 and 620 are when the SD card is idle.
        toggle 0                      ;If there is activity then toggle pin 0 (the blue LED)
    else
        low 0                         ;If there was no activity then make sure pin 0 is low
    end if
    readadc 2, b2                     ;read the CE pin of the NAND flash
    if b2 = 0 then                    ;A value of 0 means there is NAND activity
        toggle 1                      ;If there is activity then toggle pin 1 (the red LED)
    else
        low 1                         ;If there was no activity then make sure pin 1 is low
    endif 
    goto main                         ;Go to the main: label to loop the code.
    

    [b][size="3"]Future additions:[/size][/b]
    Wifi activity indicator
    CPU temp monitoring
    Fan speed controller
    Backlit LCD displaying various things.
    NAND reprogramming via PICAXE and SD card (No infectus needed)
    Wiimotes that will explode if my wife has been playing games and not doing dishes :D

  28. Conner says:

    You could just use a comparator. That way you could just skip the code. (:

  29. squirrelarmies says:

    @DeadlyFoez or anyone else good with soldering with the wii.

    I’ve gotten into soldering recently and I like what you’ve done with the activity light.

    I’ve been having a little trouble though, I tried desoldering the SD card port and soldering on another because it stopped seeing any SD cards I put in. I’ve drive two different SD card slots but they both ended up telling my that the card was locked when it wasn’t I’m hoping you’ll be able to tell me what I’m doing wrong. I’ll see if I can PM you if you don’t get this message.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 94,052 other followers