1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

3x3x3 LED Cube - can i use16f628 instead 16f690

Discussion in 'Microcontrollers' started by robotsmani, Jan 20, 2009.

  1. welflash

    welflash New Member

    Joined:
    Mar 8, 2009
    Messages:
    22
    Likes:
    0
    I have no idea bout part number
    what should i do to drive them at 12 volts
    so i could keep the blue
    but first i guess i'll change them to yellow
    if it's really the blue LEDs are the problem
     
  2. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    4,794
    Likes:
    134
    Location:
    morristown,tn
    Welfash take a look at this it should help you. Just add the part from
    the blue led circuit where I put the resistors. I left them out sorry.
     

    Attached Files:

    Last edited: Mar 26, 2009
  3. 3v0

    3v0 Coop Build Coordinator Forum Supporter

    Joined:
    Jul 14, 2006
    Messages:
    9,404
    Likes:
    227
    Location:
    OKLAHOMA USA
    If the circuits are constructed correctly all the LEDs will light at the same intensity regardless of color.

    I would not change anything unless I knew what was wrong.

    Write test code that slowly cycles through each layer one LED at a time. The watch it run to see each LED lights in the correct order and intensity. The check to see if you have them wrong in the maxtrix.

    I have not worked with hight power LEDs but the last time I checked about the highest Vf for an led was about 2.2V. A few show 5 or more but they have internal resistors or other current limiting. Why are we talking about 12V ?
     
    Last edited: Mar 21, 2009
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    4,794
    Likes:
    134
    Location:
    morristown,tn

    I say he hooked something up wrong. But any way this will light them for sure.
    And I bet he didn't put no resistors on the led port pins. What I posted works real
    good. I made 10 of them for some kids. I ran out of 16f690 that's why I changed to
    16f628a.
     
    Last edited: Mar 21, 2009
  6. 3v0

    3v0 Coop Build Coordinator Forum Supporter

    Joined:
    Jul 14, 2006
    Messages:
    9,404
    Likes:
    227
    Location:
    OKLAHOMA USA
    I agree that there may be a problem with the wiring. But the 12V thing is not a fix.
     
  7. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    4,794
    Likes:
    134
    Location:
    morristown,tn
    Your right it should have no problem lighting blue leds. One at a time. I did the math. LOL
    But can it sink 9 at one time the code blinks a whole roll in one part of it.
    And one more thing I don't see how it could be the code. I posted the cube working on youtube it was a 16f628a and I even posted the hex on here
     
    Last edited: Mar 21, 2009
  8. 3v0

    3v0 Coop Build Coordinator Forum Supporter

    Joined:
    Jul 14, 2006
    Messages:
    9,404
    Likes:
    227
    Location:
    OKLAHOMA USA
    Each bit on PORTA and RB4 each source exactly 1 led. Each layer of the cube has a common ground via a NPN transistor which can handle about 700 mA if I do not have it messed up (in head). This setup is good for driving the LEDS with up to 25ma. The limiting factor is how much current the PIC can drive.

    If you want to go higher then that you need transistors on PORTA and RB4, and maybe higher current transistors to sink the layers.
     
    Last edited: Mar 21, 2009
  9. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    4,794
    Likes:
    134
    Location:
    morristown,tn
    Well what i posted can give him about 77mA a led if he adds the transistors the way I have it. All he has to do is to replace the R 1. Like I posted in the Blue led.png
     
  10. 3v0

    3v0 Coop Build Coordinator Forum Supporter

    Joined:
    Jul 14, 2006
    Messages:
    9,404
    Likes:
    227
    Location:
    OKLAHOMA USA
    Ah I did not notice the 2nd schematic was for PORTA. My bad.

    Even if he has leds that can handle that sort of current I would expect to have them light to some degree with 25ma. And that is easily tested. I do not work with that sort of LED so I do not know for sure.

    Figure out what is wrong then fix it.
     
  11. welflash

    welflash New Member

    Joined:
    Mar 8, 2009
    Messages:
    22
    Likes:
    0
    Thank you for the schematic, be80be
    i'll try that and post the result.
     
  12. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    4,794
    Likes:
    134
    Location:
    morristown,tn
    welflash take 1 of them blue led and hook it to 3volts with an 100ohm resistor
    and tell me if lights.
     
    Last edited: Mar 21, 2009
  13. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    4,794
    Likes:
    134
    Location:
    morristown,tn
    welflash try this on your cube
    Code (text):
     
    LIST    p=16F628a       ;tell assembler what chip we are using
        include "P16F628a.inc"      ;include the defaults for the chip
        __config 0x3D18         ;sets the configuration settings
                        ;(oscillator type etc.)
        cblock  0x20            ;start of general purpose registers
            count1          ;used in delay routine
            counta          ;used in delay routine
            countb          ;used in delay routine
        endc


        org 0x0000          ;org sets the origin, 0x0000 for the 16F628,
                        ;this is where the program starts running  
        movlw   0x07
        movwf   CMCON           ;turn comparators off (make it like a 16F84)
        bsf     STATUS,     RP0 ;select bank 1
        movlw   b'00000000'     ;set PortB all outputs
        movwf   TRISB
        movwf   TRISA           ;set PortA all outputs
        bcf STATUS,     RP0 ;select bank 0

    main:
        banksel PORTA
        bsf     PORTA,5  ;change this for each roll 6 and then 7
        goto blinkleds
    blinkleds:
        banksel PORTB
        bsf     PORTB,0
        call    delay
        bcf     PORTB,0
        call    delay
        bsf     PORTB,1
        call    delay
        bcf     PORTB,1
        call    delay
        bsf     PORTB,2
        call    delay
        bcf     PORTB,2
        call    delay
        bsf     PORTB,3
        call    delay
        bcf     PORTB,3
        call    delay
        bsf     PORTB,4
        call    delay
        bcf     PORTB,4
        call    delay
        bsf     PORTB,5
        call    delay
        bcf     PORTB,5
        call    delay
        bsf     PORTB,6
        call    delay
        bcf     PORTB,6
        call    delay
        bsf     PORTB,7
        call    delay
        bcf     PORTB,7
        call    delay
        banksel PORTA
        bsf     PORTA,4
        call    delay
        bcf     PORTA,4
        call    delay
        goto    blinkleds
    delay  
        movlw   d'250'          ;delay 250 ms (4 MHz clock)
        movwf   count1
    d1  movlw   0xC7
        movwf   counta
        movlw   0x01
        movwf   countb
    Delay_0
        decfsz  counta, f
        goto    $+2
        decfsz  countb, f
        goto    Delay_0

        decfsz  count1  ,f
        goto    d1
        retlw   0x00

        end      
     
     
    Last edited: Mar 22, 2009
  14. robotsmani

    robotsmani Member

    Joined:
    Oct 15, 2008
    Messages:
    86
    Likes:
    1
    Location:
    Bangalore, India
    I tried the same with blue LED in a breaboard. Nothing works. :-( When i touch the 1k resistor the last two LED is glowing continuously.

    How can i check my PIC is programmed correctly. Can i check the voltages at every pin of my PIC. what are the voltages of every pins.

    Actual 16f690 3x3x3 is very bright...how they have done that?

    Thanks,
    Robots
     
    Last edited: Mar 25, 2009
  15. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    4,794
    Likes:
    134
    Location:
    morristown,tn
    Last edited: Mar 26, 2009
  16. Mike - K8LH

    Mike - K8LH Well-Known Member

    Joined:
    Jan 22, 2005
    Messages:
    3,637
    Likes:
    109
    Location:
    Michigan, USA
    Whoa! Drawing on steroids (grin)..
     
    Last edited: Mar 25, 2009
  17. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    4,794
    Likes:
    134
    Location:
    morristown,tn
    I wanted to make sure they seen it :D
     
  18. welflash

    welflash New Member

    Joined:
    Mar 8, 2009
    Messages:
    22
    Likes:
    0
    I tried that n use the last LED.HEX but nothing happen :confused:
    too bad i didn't have pickit2 or icd2 programmer so i could try the asm file
    i only got jdm programmer with winpic800 that only work with HEX.
     
    Last edited: Mar 25, 2009
  19. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    4,794
    Likes:
    134
    Location:
    morristown,tn
    They all use Hex files you build the .asm in to a hex with mplab can you take a good pic of what you made and post it try this 1 I no it works I make 10 cubes with it.
     

    Attached Files:

    Last edited: Mar 25, 2009
  20. welflash

    welflash New Member

    Joined:
    Mar 8, 2009
    Messages:
    22
    Likes:
    0
    i don't understand...
    that hex...i can't write it...
    winpic says ERROR -> Verifying address 0x002007
    Verified : 0x2118 Read : 0x21FF

    I'll take a picture later after i got some sleep
    it's 5 am here n i'm very tired
    thank you :)
     
  21. welflash

    welflash New Member

    Joined:
    Mar 8, 2009
    Messages:
    22
    Likes:
    0
    What the...!!!
    it works !!!

    i tried once more before i go to bed
    but this time i write it with icprog
    Walla! it's working man
    except for RA4 column, there's something wrong
    i'll deal with it soon as i woke up

    Thanks man...you're the best...
     

Share This Page