The LED's in this project are SunLED's, which are bi-directional LED's. There are three types of LED's used, blue-red, green-red, and green amber. I got them from digikey, and they're about $0.20 each in quantity. You could in theory use nothing but one type of LED, but I used 3 different types. This gives it overall a bit more variety. When I assembled the entire thing, I lined up three rows of LED's, and just started populated each one in order, to attempt keeping general uniformity around the entire xmas tree.
The LED's are each controlled by a single IO pin on the MCU, and the other side of the LED's go to a common power bus that can be either low or high due to a complementary pair of SOT23 mosfets. I re-used my 2n7002 schematic symbol for the PFET, so the schematic might look a little funny, but eh, it was a quick last minute hack. Basically, the way it works is if you want all LED's to be on (Both colors), you write logic 0 to all IO pins, and then logic 0 (inverted to '1') to LED48 which controls the power bus to +3.3V. As a result, all the LED's on one side will turn on. Then do this really fast back and forth every 10 or 100 microseconds. Write 1's to all the IO pins, and bring the common bus low, and now the other side of the LED's are on.
Do this back and forth really fast and all LED's are lit up. There are 4 variables used (32 bits each) that basically get written directly to the IO registers, to basically say which LED's you want on. So every 10us, the variables for 1a/1b get written to the IO registers, and the main bus is set to +3.3V. After 10us, the variables for 2a/2b get written to the same IO registers, but the main bus is now set to 0V to control which of the other side LED's are desired to be on. This is repeated automatically every 10us back and forth.
The program I have written can be programmed to do any specific color or other sequence one might like, but the default program just once every 10 milliseconds performs a random bit flip. Because the registers are 64 bits long, and because some of the IO don't exist (As there are only 48 IO pins on this device used), not every bit actually changes an LED, which adds a bit more natural randomness.
In the end, I really liked the twinkling effect, and left it at that. That and it was 2 days before Christmas, and I wanted to gift one as a present.
For power supplies, I used some 3.3V wallwarts I had already. You could easily modify the power jack connector and/or add in a voltage regulator, but I didn't bother with a regulator on this design, because I didn't need to.
Because I had 3 of them, I gave one to my better half, one to a neighbour, and one to a co-worker.