So..after 1 year of slow progress with the RGB Cube, I decided at the beginning of half term that I would aim to have the cube working by the time the week was over. It took me roughly 5 hours to come up with the double sided motherboard and single sided cube support board in Eagle CAD and after checking it over several times I proceeded to produce the PCB's. At this point it was Friday night, and if I were to hit the deadline I was going to have to get it done. After roughly 2 hours I had 2 circuit boards which on initial inspection appeared great. However then I realised that in my hast I had neglected to think about the double sided board as carefully as I should have done. I had produce a PCB with the sides the wrong way around. I must say this is something which I will not be doing again as it lead to all sorts of complications with me having to surface mount through hole chips.
This was very frustrating. However it did work out okay in the end, lesson learnt. Now I moved onto the MOSFETs for controlling each of the layers of the cube. I initially planned on using the original BUZ171 p channel ones I had ordered, however after spending an hour trying to work out why the things were not working I concluded they were faulty. This set me back by 4 days whilst I waited for some replacements to arrive. When they did I quickly soldered them in place and they worked perfectly.
Now, the next job was to remove the actual cube from the proto-board I initially tried to use, this involved using the wire cutters to cut each of the 48 legs from the base of the cube. Then after painstakingly aligning each of the legs with the corresponding whole on the PCB I soldered the cube in place and stuck the boards together. Finally it was done.
Now I moved onto the code, something which I had not quite worked out in my breadboard version. However from the FFT spectrum analysis project I had made a discovery as to why my code had not been working - I had the interrupt which ran the cube running to quickly. After working out how long the arduino took to send out the data to the TLC5940s I was able to make an informed decision about the interrupt frequency (I decided upon around 300Hz). My far greater electronics knowledge now compared to a year ago meant I was bale to produce the code for the cube in around an hour - it really isn't that complicated now I understand it thoroughly.
I was able to get red green and blue LEDs illuminated in the same column with no problem, however I made a quick piece of code which randomly set the value of each of the red, green and blue elements in every LED. This produced a rather disappointing, watered out cube of colours which blinked. I couldn't wok out why this was happening. The next morning however it suddenly came to me; because the LED was not set bright enough, it was not making enough of a mark on the retina meaning the persistence of vision was not working as well. This was because the LEDs were not bright enough. The watered out appearance came because the colour were all random and therefore could all have been on, making them whit effectively. The fix was simple, by making a piece of code which turned a number, between 0 and 1530 into a true colour on the spectrum allowed me to solve this problem. Below is an image of the pattern:
Although the diagram is a little rough it demonstrates the point, each black line is 255 bits apart (1 byte), 6 bytes consist of 1530 bits. At each of these bits along the number line one of the colour elements is fully on ensuring that the LED will not flicker. Then there is part of another colour as well which allows any colour on the spectrum to be produced by the cube. This allows for much more attractive colours to be made and is something I have used before for other RGB LED projects.
So below is the final product, my 4x4x4 RGB LED Cube:
It isn't really done justice by the pictures, in real life it looks awesome! After the difficulty I faced producing this 4x4x4 cube, I had practically given up on the final goal an 8x8x8 RGB LED Cube. However the cube has restored my passion as well as all of the compliments I have had about the cube. So I have started planning the 8x8x8 cube...