Coilgun Power
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Coilgun Power

Microcontroller/Coilgun Ideas and Support
 
Main HomeMain Home  HomeHome  Latest imagesLatest images  SearchSearch  RegisterRegister  Log in  

 

 Single color 4x4x4 led cube

Go down 
2 posters
Go to page : 1, 2  Next
AuthorMessage
DaveyPocket




Posts : 74
Join date : 2008-04-01

Single color 4x4x4 led cube Empty
PostSubject: Single color 4x4x4 led cube   Single color 4x4x4 led cube Icon_minitimeTue Apr 01, 2008 7:29 pm

So I'm making a single color led cube, this cube I'm going to control with the BASIC stamp microcontroller. There are 16 anodes, and 4 cathodes, the BASIC stamp as 16 I/O pins(4 they didn't connect to PIC scratch ). Now here's the question, should I invert a 4017 bargraph driver and make the 5th pin reset to control the cathodes, or should I just wait until I can find a PIC with more I/O pins? I believe that if I use the 4017, the 4017 might get off time when multiplexing with the BASIC stamp and the cube effects will look screwed up. Also, should I use a optical D-flip flop to make the LED's bright enough? I made a 3x3x3 cube earlier(single color), but I'm seeing if I could get a 4x4x4 to work. If you have any idea or thoughts, please tell me. Thank you.
Back to top Go down
Admin
Admin
Admin


Posts : 115
Join date : 2008-03-26
Location : USA, California

Single color 4x4x4 led cube Empty
PostSubject: Re: Single color 4x4x4 led cube   Single color 4x4x4 led cube Icon_minitimeWed Apr 02, 2008 3:20 am

For a 4x4x4 single color cube you only need 16 IO pins. You connect the anode of each column and the cathode of each row, as in my 4x4x4. Then connect pairs of anodes of different rows, and cathodes of alternating rows. (see the multiplexing section under "how parts work" for a picture). That way you will have 8 cathodes and 8 anodes. You may be able to not use flip flops but they definitely help, however if you are using the BS2 then you won't have any pins left.

I would recommend that you learn to use PIC by them selves (or better yet AVR) and not with the BASIC stamp. The basic stamp is in interpreter. If you noticed the PIC on it is not flash. It can only be programmed once. Your program is stored in EEPROM. That causes the PIC to halve to read the EEPROM then decide what to do. A normal PIC running at 20MHz gets 5 million instructions per second, while the BS2 gets 4 thousand per second.

Justin
Back to top Go down
http://coilgunpower.com
DaveyPocket




Posts : 74
Join date : 2008-04-01

Single color 4x4x4 led cube Empty
PostSubject: Really?   Single color 4x4x4 led cube Icon_minitimeWed Apr 02, 2008 8:06 pm

Wow, I didn't know that. I kept thinking that the BASIC stamp editor translated the code into assembly and then programmed the PIC. lol
Yea, I'm trying to learn assembly. I programmed a 16 pin PIC to make some LED's flash in a sequence(brain hurt 5 min. later). I'm trying out this MikroBasic, seems to be a little more suitable.
Back to top Go down
Admin
Admin
Admin


Posts : 115
Join date : 2008-03-26
Location : USA, California

Single color 4x4x4 led cube Empty
PostSubject: C   Single color 4x4x4 led cube Icon_minitimeWed Apr 02, 2008 8:14 pm

I would learn C. C can be used for much more then assembly. If you want to switch from a PIC to an AVR with C just change the registers and recompile. With assembly you have to learn a whole new instruction set. It is good to know assembly, but I would learn C first. C is nice because you can use in-line assembly. Try MikroC, or better yet, use C18 (only for 18F series though), Microchips free student C compiler. MikroC is kinda weird because it does not make you include the libraries that are built in. I started on MikroC and it took me a wile to learn how to properly include libraries and files.

To learn C I would recommend this course. You can find free tutorials also but, that is the course I learned with and I still use it for reference sometimes.

Justin
Back to top Go down
http://coilgunpower.com
DaveyPocket




Posts : 74
Join date : 2008-04-01

Single color 4x4x4 led cube Empty
PostSubject: I'll give it a try   Single color 4x4x4 led cube Icon_minitimeWed Apr 02, 2008 9:55 pm

I'll give it a try. I'm trying out MikroB because I started out using BASIC, and I'm still using BASIC(Visual Basic, Dark Basic, REALBasic, I use all that stuff). I'm also trying to learn C++. I know some basic stuff, but so far I found it confusing since all I have been doing was looking at sample programs and the source code to some old early 90's games, haven't been going to the books yet. study.
Back to top Go down
Admin
Admin
Admin


Posts : 115
Join date : 2008-03-26
Location : USA, California

Single color 4x4x4 led cube Empty
PostSubject: Re: Single color 4x4x4 led cube   Single color 4x4x4 led cube Icon_minitimeWed Apr 02, 2008 10:46 pm

I am not a huge fan of BASIC, and only started to learn C++. C++ is more for computers and is usually not as fast as C. I like C because I can use it on computers and microcontrollers.

Good luck,
Justin
Back to top Go down
http://coilgunpower.com
DaveyPocket




Posts : 74
Join date : 2008-04-01

Single color 4x4x4 led cube Empty
PostSubject: PIC16f627   Single color 4x4x4 led cube Icon_minitimeSun Apr 06, 2008 1:44 am

I have a question that has been bothering me for a while, on the PIC 16F627, the two pins Ra6 and RA7 are the same as the clock in and clock out pins. If the clock is occupying these two pins, will I still be able to use RA6 and RA7?
Back to top Go down
Admin
Admin
Admin


Posts : 115
Join date : 2008-03-26
Location : USA, California

Single color 4x4x4 led cube Empty
PostSubject: Re: Single color 4x4x4 led cube   Single color 4x4x4 led cube Icon_minitimeSun Apr 06, 2008 3:01 am

No, RA6 and RA7 is only available when the internal clock is used and the I/O pins are enabled. This is set in the fuses.
Back to top Go down
http://coilgunpower.com
DaveyPocket




Posts : 74
Join date : 2008-04-01

Single color 4x4x4 led cube Empty
PostSubject: Can I enable internal clock?   Single color 4x4x4 led cube Icon_minitimeSun Apr 06, 2008 3:50 pm

So, does this mean that the 16F627 has an internal clock that I can enable?
Back to top Go down
Admin
Admin
Admin


Posts : 115
Join date : 2008-03-26
Location : USA, California

Single color 4x4x4 led cube Empty
PostSubject: Re: Single color 4x4x4 led cube   Single color 4x4x4 led cube Icon_minitimeSun Apr 06, 2008 4:44 pm

Yes. See page 94 of the data sheet. The internal clock is not as accurate as a crystal nor as fast,it is usually 4 or 8 MHz when you could get 20MHz.
Justin
Back to top Go down
http://coilgunpower.com
DaveyPocket




Posts : 74
Join date : 2008-04-01

Single color 4x4x4 led cube Empty
PostSubject: Awesome.   Single color 4x4x4 led cube Icon_minitimeSun Apr 06, 2008 7:06 pm

Awesome! I got it working. Had to change the bit config. Very Happy
Back to top Go down
Admin
Admin
Admin


Posts : 115
Join date : 2008-03-26
Location : USA, California

Single color 4x4x4 led cube Empty
PostSubject: Re: Single color 4x4x4 led cube   Single color 4x4x4 led cube Icon_minitimeSun Apr 06, 2008 7:17 pm

Glad to hear that. Very Happy
Justin
Back to top Go down
http://coilgunpower.com
DaveyPocket




Posts : 74
Join date : 2008-04-01

Single color 4x4x4 led cube Empty
PostSubject: Well, heres what happened.   Single color 4x4x4 led cube Icon_minitimeMon Apr 07, 2008 1:27 pm

So I program some simple stuff to start out(just a column of LED's flashing on the cube), I take it out of the programmer, I insert it into the LED cube board I'm making, then it starts randomly flickering two columns. The PIC isn't fried or defective, I think that I didn't set something right in the config or that I just didn't connect one of the pins to something. I'm using basically every pin on the 16F627, I'm not sure if I have to connect the MCLR pin to Vss or Vdd(I'm using that as RA5 so I'm not sure). Right now I'm kind of stumped.
Back to top Go down
Admin
Admin
Admin


Posts : 115
Join date : 2008-03-26
Location : USA, California

Single color 4x4x4 led cube Empty
PostSubject: Re: Single color 4x4x4 led cube   Single color 4x4x4 led cube Icon_minitimeMon Apr 07, 2008 6:29 pm

You may want to check if you disabled the analog comparator. I believe it is normally on. Usually I just disable the MCLR pin. Try
Code:
CMCON=0x07; //disable comparator
Justin
Back to top Go down
http://coilgunpower.com
DaveyPocket




Posts : 74
Join date : 2008-04-01

Single color 4x4x4 led cube Empty
PostSubject: The comparator has been disabled.   Single color 4x4x4 led cube Icon_minitimeMon Apr 07, 2008 6:39 pm

It's already disabled in the code
Code:
MOVLW   B'00000111'   ;Disable Comparator module's
MOVWF   CMCON
I'm not sure what's wrong.
Back to top Go down
Admin
Admin
Admin


Posts : 115
Join date : 2008-03-26
Location : USA, California

Single color 4x4x4 led cube Empty
PostSubject: Re: Single color 4x4x4 led cube   Single color 4x4x4 led cube Icon_minitimeMon Apr 07, 2008 10:29 pm

Try and test each port with a simple on off code
Code:
PORTA=0xFF;
PORTB=0xFF;
delay_ms (1000);
PORTA=0;
PORTB=0;
then connect a LED to each pin and see what you get. For pins that don't work check the data sheet and see what is attached to them. Disable anything you can think of and try again.
Justin
Back to top Go down
http://coilgunpower.com
DaveyPocket




Posts : 74
Join date : 2008-04-01

Single color 4x4x4 led cube Empty
PostSubject: This is the code.   Single color 4x4x4 led cube Icon_minitimeTue Apr 08, 2008 3:02 pm

I tested it on the experiment board, it works. The code you displayed above is what I'm already doing. When I insert the PIC, all it does is flicker the LED's randomly and starts to light up other columns randomly. I have the cathodes connected to PORTA and the anodes connected to PORTB. Works just fine on experiment board, but not on cube.
Back to top Go down
Admin
Admin
Admin


Posts : 115
Join date : 2008-03-26
Location : USA, California

Single color 4x4x4 led cube Empty
PostSubject: Re: Single color 4x4x4 led cube   Single color 4x4x4 led cube Icon_minitimeTue Apr 08, 2008 10:30 pm

Check to make sure that the LED don't short (I am sure you probably did that already). Are you using a crystal or the internal RC clock? You may need to add some capacitors to your supply lines. Get them as close to the PIC as possible. 1uf or .1uf is usually good. It is good practice to have one capacitor of >10uf and one <1uf. That way you can catch high and lower frequency noise. Have you tried adding a LED to a pin on the PIC while in the cube? Try connecting the MCLR pin to VDD. Other then that I don't know what to tell you if it works fine in another board. You should also check to see if the voltage of VDD is high enough when it is on. How are you powering the PIC?

Justin
Back to top Go down
http://coilgunpower.com
DaveyPocket




Posts : 74
Join date : 2008-04-01

Single color 4x4x4 led cube Empty
PostSubject: So here it is,   Single color 4x4x4 led cube Icon_minitimeThu Apr 10, 2008 12:52 am

Every pin on the PIC is connected to cube, RB0-RB7 are connected to anodes, RA0-RA7 are connected to cathodes. Pin 5 Vss, pin 14 Vdd. the power source is from a 12v DC PSU regulated down to 5v, there are two capacitors connected to the 7805 regulator(one from 5v to ground, the other 12v to ground). I don't know what they are, I believe one of them is .1uf on 12v or something. But all I know was that I just took the idea from an old regulator diagram using the same capacitors. I found the diagram 5 years ago from some site, I don't remember what it exactly said and I never wrote it down. I will provide a schematic if you it will help. I will try your advice and see if I can get it to work. I believe you're right.

scratch
Back to top Go down
Admin
Admin
Admin


Posts : 115
Join date : 2008-03-26
Location : USA, California

Single color 4x4x4 led cube Empty
PostSubject: Re: Single color 4x4x4 led cube   Single color 4x4x4 led cube Icon_minitimeThu Apr 10, 2008 3:17 am

You can't use every pin. Some are input only RA5 is input only.
"RA5 is a Schmitt Trigger input only and has no output drivers"
Looks like you will need a larger PIC. Very Happy
Justin
Back to top Go down
http://coilgunpower.com
DaveyPocket




Posts : 74
Join date : 2008-04-01

Single color 4x4x4 led cube Empty
PostSubject: aaaaawwwwww   Single color 4x4x4 led cube Icon_minitimeThu Apr 10, 2008 8:21 pm

Any suggestions on which one I should get? My goal for this project was to use a PIC with the minimum amount of pins to run it. Well, I wasn't aware that not all pins worked the same. Like it said in the data sheet, "16 controllable I/O pins", that means all of them. xD
Yea, I'm kind of stumped at this part, I can't fit a 28 pin PIC on the board(the board is smaller than my hand) and I don't have any other PIC's except this one and some other one a friend gave to me(found it lying around his house).
Back to top Go down
DaveyPocket




Posts : 74
Join date : 2008-04-01

Single color 4x4x4 led cube Empty
PostSubject: I got it to be more responsive.   Single color 4x4x4 led cube Icon_minitimeThu Apr 10, 2008 8:25 pm

I got it to stop flickering, Very Happy x2
The solution, added a polarized capacitor to the power pins of the PIC, it is now under control, but I'm not sure about all the I/O pins.
Back to top Go down
Admin
Admin
Admin


Posts : 115
Join date : 2008-03-26
Location : USA, California

Single color 4x4x4 led cube Empty
PostSubject: Re: Single color 4x4x4 led cube   Single color 4x4x4 led cube Icon_minitimeThu Apr 10, 2008 10:38 pm

If you are just starting you may want to switch to AVR now. AVR (in my opinion) are better then PIC and better through put (with a 16MHz clock you can get 16MIPs, with PIC you get 4MIPs). They usually have all the port pins together, witch is rare with PIC. I used the 16f777 or 16f767 (different pin count) a lot. Always look at the pin diagrams (page 4), you will notice that the arrow on RA5 only points in.
Page 32 of data sheet for 16f627
Quote :
PORTA and TRISA Registers
PORTA is an 8-bit wide latch. RA4 is a Schmitt Trigger
input and an open drain output. Port RA4 is multiplexed
with the T0CKI clock input. RA5 is a Schmitt Trigger
input only and has no output drivers. All other RA port
pins have Schmitt Trigger input levels and full CMOS
output drivers. All pins have data direction bits (TRIS
registers) which can configure these pins as input or
output.
Justin
Back to top Go down
http://coilgunpower.com
DaveyPocket




Posts : 74
Join date : 2008-04-01

Single color 4x4x4 led cube Empty
PostSubject: Hmm.   Single color 4x4x4 led cube Icon_minitimeThu Apr 10, 2008 10:48 pm

So, your saying that AVR micro controllers are faster and more reliable when doing experiments like this. Now my question, will I be able to use EVERY pin on the AVR as an I/O pin, and do they ave internal clocks? And I'm not sure which AVR is right for this project.
Back to top Go down
Admin
Admin
Admin


Posts : 115
Join date : 2008-03-26
Location : USA, California

Single color 4x4x4 led cube Empty
PostSubject: Re: Single color 4x4x4 led cube   Single color 4x4x4 led cube Icon_minitimeFri Apr 11, 2008 12:15 am

I would not say more reliable. I have never had a PIC or AVR fail (without abuse). Some have internal clocks and some don't.

The ATtiny861 looks good for what you want. I believe you can use every IO pin. You should always double check the data sheet. See the I/O Ports section on page 53. It has an internal clock. Slightly larger then a PIC though, but can get 20MIPs (16f627 gets 5MIPs).

Justin
Back to top Go down
http://coilgunpower.com
Sponsored content





Single color 4x4x4 led cube Empty
PostSubject: Re: Single color 4x4x4 led cube   Single color 4x4x4 led cube Icon_minitime

Back to top Go down
 
Single color 4x4x4 led cube
Back to top 
Page 1 of 2Go to page : 1, 2  Next
 Similar topics
-
» questions on a cube
» 4x4x4 RGB Plans
» 4x4x4 or 5x5x5 RGB LED problem.
» Led cube 5x5x5 programming problem
» 3x3x3 RGB LED Cube Patterns

Permissions in this forum:You cannot reply to topics in this forum
Coilgun Power :: PIC Microcontrollers :: LED Cubes-
Jump to: