How to make a star on a Christmas tree from LEDs. You can please your loved ones with such an LED star at any occasion. Glowing Christmas decoration for Christmas tree

- Hmmm ... So the New Year has already passed?- you say.
Well, yes, it did. Well, who's stopping you from preparing for the next New Year? And the star itself is not necessarily just a New Year's attribute. After all, soon, for example, May 9. Well, or now - February 23, which has just come.

Manufacturing history

In general, I will briefly describe the history of creation. For this we need a ceiling (ceiling tiles are light square pieces of foam with a thickness of 3.5 mm). Still need a simple AVR microcontroller Attiny13, five LEDs of any color (I used blue - the only bright LEDs available to me at that time), a couple of pieces of wire. As well as a soldering iron, a heat-shrinkable tube for insulation, a model knife for cutting ceilings, a programming connector (it will also be used to connect power to the star). Well, and, of course, you need at least the most simple programmer(not shown in the photo)

We mark on the ceiling sheet two contours of the star and stripes for the end surfaces.

We cut out all the details and start gluing. We glue with polymer glue such as "Titanium" or "Dragon", in a word, any that is suitable for gluing ceiling tiles. How to glue ceiling tiles:

  • we smear the surfaces to be glued with a thin layer of glue.
  • We are waiting for a minute (or less) for the glue to dry a little.
  • We press the parts together (strongly, but not so as to break the parts) for a few seconds.

If everything is done correctly, then the details are grasped literally in a minute. Of course, they will not stand the full load right away, but you can continue to glue on. Complete drying in half an hour or an hour. If you do not wait for the glue layer to dry before gluing, then you will have to wait much longer.

Having glued all the end surfaces to the lower contour of the star, we proceed to making the filling. The circuit is very simple.

Limiting resistors are not shown on it (I don't remember how much I took - it seems 470 ohms), power (4 legs of the MK - ground, 8 legs - +5 volts).
Not really bothering with the board (after all, it was soldered a couple of hours before the New Year!) I decided to make a voluminous installation. After all, the scheme is simple. Although ... I felt like a barbarian, soldering wires directly to the legs of the microcontroller in an SMD package. Here's the result:

The photo shows a ribbon cable with power connectors and microcontroller programming... Hmm, I think I got so insolent that I didn't even use heat shrink tubing to insulate the LED leads. Well, in principle, it is quite possible to get by. After all, the LEDs will stick and should not move, i.e. there should be no closures. But it is better not to do this and isolate at least one conclusion. We look at the diagram, and, guided by it, we place the LEDs along the rays of the star.

In order for the light from the LEDs to dissipate at least a little, we close them with cotton circles (I begged the circles from my wife, it seems they are intended for removing cosmetics). You can also not bother and use ordinary cotton wool. Well, or even leave it that way.

We flash the microcontroller ( microcontroller connection to the programmer in this circuit is very dreary, because of the non-standard connector, but if you understand, I think it will not be difficult. If you still have questions - ask - I will answer.) Leave the factory fuses. Make sure the LEDs are blinking nicely and positioned correctly (I didn't do that ... I ended up with a slightly incorrect star animation orientation). And glue the star.
Here's what happened.

And here is a video with a demonstration of work (the star has not yet been closed).

The firmware, the scheme and the idea are not mine, but taken from Radiocat, and there, in turn, it was said that it was taken somewhere else.

Many thanks both to the developer of the circuit and firmware, and to the one who wrote an article based on this on Radiocote, where I saw it.

(firmware, schematic in Proteus)

Epilogue

By the way, this is the only device on a microcontroller, which was soldered by hinged installation, and which at the same time immediately started working.

I remembered, by the way - the very first scheme made by me, somewhere in the class ... uh .... sixth? don't remember ... was symmetrical multivibrator circuit,. I did it by hanging installation, but at the same time I did not use a soldering iron. I just twisted everything with wires. When I connected the batteries and saw the light blinking, I was very happy. Twisted by wires and immediately worked!

The LED star, especially when it twinkles, creates a romantic atmosphere and is a worthy festive decoration for any occasion. LED stars are exceptionally good for the New Year and for Christmas: they help create a magical, fabulous environment. Knowing how to solder a little, you can make quite decent LED stars with your own hands.

Required materials (for one star):

- LEDs 5 mm (one can be blinking) 5 pieces;
- 9-volt battery;
- resistors 60 Ohm 2 pieces;
- battery connector (more precisely, connectors from it).

Required tools:

- plywood sheet for a template, approximately 0.5x0.5 m;
- marker;
- protractor;
- insulating tape;
- soldering iron and solder;
- multimeter (only desirable);
- pliers or tongs.

LED Star Making

The wiring diagram of the star is very simple. Five LEDs are connected one after the other in one chain. Note that the switch shown in the diagram will not be a star detail: the star will light up when the battery is inserted into the battery connector. It is important to connect the LEDs correctly: the anode legs (they are longer) are connected to the cathode legs.

For the convenience of assembling a star on a piece of plywood, we make a template: we draw a circle with a marker and mark five points on it at equal distances from each other - for example, using a protractor - dividing the whole circle into five sectors of 72 degrees each.

We place the LEDs on the template at the marked points, unbend their legs to such an angle that the legs of the adjacent LEDs intersect with each other (remember that the anode legs intersect with the cathode ones). We fix the legs on the template with electrical tape. We solder the intersecting legs in four places. We get a star with a broken chain.

We test the electrical circuit. We connect the ends of the star to both contacts of the battery, observing the polarity. If the circuit is made up correctly, then the star will light up. If it does not light up, check if the polarity is correct. If the polarity is correct, and the star still does not light up, then this means that some LED is damaged. In this case, we check the LEDs one by one using a multimeter or a 3-volt power supply.

After making sure that the device is working, we adapt the connector to it for connecting a 9 V battery. The connector will be connected to the star through two resistors. The resistors will limit the current through the LEDs, which will extend the life of the LEDs and the battery.

We take the connector for the 9-volt battery and cut off its soft plastic case with a sharp knife.

We unsolder the wires from the connectors.

Solder resistors to both connectors.

The free ends of the resistors are soldered to the "plus" and "minus" of the star, observing the polarity.

Carefully install the star connector onto the battery. This concludes our work successfully: the LED star is completely ready.

So, we begin our New Year's streamer. I think that the topic is very relevant - to make the top for the tree with your own hands!

The article presents 2 design options - on SMD and conventional LEDs. The design "LED garland on MK Attiny13" is taken as a basis.

Asterisks - I used Chinese transparent tops. Added transistors to increase the number of LEDs. There are three printing options in the files.
According to the scheme: instead of LEDs through a 1kOhm resistor to the base of the NPN BC547 transistor, then the LEDs are simply in parallel. Current limiting resistance - 47 Ohm. The fill is used as a plus and not a minus as we are usually used to (I don’t know why it happened, well, how it happened). In the archive of materials there is a third design option, double-sided, for two-color LEDs. We just made the transition to the other side and added four more LEDs for each beam. This gives a total of 8 LEDs per transistor. When I made a board in DIP packages, I sawed grooves under the LEDs and they illuminate both sides of the star. And then the idea arose not to cut the grooves, but to make two sides of different colors. If you put it on a rotating Christmas tree, or just hang it on wires, it will turn to the viewer in different colors. The hardware has not yet been tested.

details:

The administrator of the portal ordered SMD LEDs several times already here, the seller ships literally on the same day.

Hello to all readers and admirers of the Radiocircuit website! Today I will tell you about a small modernization of the Christmas tree decoration - an asterisk. Taking out Christmas decorations from the box as usual to decorate a Christmas tree for the children for the New Year, I found an asterisk there, bought last year on the market. And I immediately remembered about its drawback - it shines too brightly and works in the "turn signal" mode. Which is pretty annoying, especially if the lights are off in the room.

It was decided to change its internal structure. So, having disassembled it, at first I could not understand for a long time why it was blinking, but then, listening, I found clicks. Which, as it turned out later, published a bimetallic plate in one of the lamps - she was the hero of the occasion.

I decided to improve this business: I designed and manufactured a board for the future "brain" of the asterisk according to Soldered all the components, I had to tinker a little with the LEDs, bending their legs in a certain way (as in the photo). I used LEDs, which were (bright narrow-beam ones), but wide-angle ones would be better suited here. The power supply was summed up by five volts - from the cell phone power supply, which replaced the former plug of the plug.


List of used parts

  • MK Atmega8 - 1pc.
  • Transistors KT503 - 3 pcs.
  • SMD resistors:
  • 1206 1 kOhm - 3 pcs.
  • 0805 220 Ohm - 15 pcs.
  • Bright LEDs (red / yellow) - 15 pcs.

When repeating the device, take into account that there are several jumpers on the reverse side of the board. They are not shown in the diagram of the printed circuit board, for easier visual perception. But the contact numbers are signed, the contacts of the same name must be closed with jumpers. Transistors can be used with any low-power n-p-n structures with a collector current of 150 mA and above. KT503 is installed in the LED star. Resistors are used in frame sizes 1206 and 0805.

For programming the Atmega8 MK, there are signed pins on the board, to which you need to solder the wires from the programmer. With correct assembly, the device starts working immediately and does not need adjustment. When uploading the firmware to the MK, the fuses must be set to work from an internal generator with a frequency of 8 MHz. Although, I think it will work at the factory settings, only slower.

Video

Now the updated LED star is fixed in its rightful place and pleases the eyes of everyone looking at it, creating a truly New Year's mood! For all questions and wishes, you can contact the forum or in a personal. Archive with all files (circuit, firmware, etc.). The program is written in the language Si using the CodeVisionAVR development environment. Tyomich (Artyom Bogatyr) was with you, see you again on the Radio Scheme website in the New Year!

Discuss the article LED STAR ON MICROCONTROLLER

Christmas tree LED star powered by two AA batteries





In the distant past, this Christmas star was made on the basis of a control logic decoder, transistors and LEDs. Now, many years later, this project has been re-implemented using modern technologies including a microcontroller, a DC / DC voltage converter and a constant current LED driver.

For its power supply, the project uses two AA batteries, therefore it is necessary to use a DC / DC voltage converter, since the blue LEDs have a forward voltage drop of just over 3V, and the LED driver chip is about 0.6V. Two new AA batteries produce a voltage of just over 3V, and rechargeable batteries, even when fully charged, cannot provide sufficient potential. To eliminate this problem, a voltage converter is used, which converts the nominal 3V from the batteries into the 3.71V required for operation.

The microcontroller can be powered by a DC / DC converter voltage or directly from batteries. Also, the microcontroller can turn off the DC / DC converter during sleep mode to save battery power, in this mode the converter consumes about 1 μA. The PIC16LF1703 microcontroller itself works reliably up to 1.8V and is very economical in power consumption, especially in sleep mode.

The LED driver receives SPI commands from the microcontroller and, based on them, turns on certain LEDs. The microcontroller software uses a standard machine architecture to render animations.

This little Christmas project contains 16 LEDs in two different colors, mounted on a PCB in the form of a star. The LEDs are individually controlled by a microcontroller, which is programmed for several modes of operation to create good visual effects. Since the power consumption is not high, the star can operate continuously for at least one day.

The choice of using conventional LEDs is due to their small size compared to SMD LEDs. The LED driver provides a constant current of 5mA LEDs.

The microcontroller performs 3 main functions:

  1. Sends SPI commands to the driver to turn the LEDs on and off.
  2. It monitors the voltage of batteries or accumulators, if the voltage drops below the allowable value, then it puts the DC / DC converter into sleep mode.
  3. Processes signals from an external button.

Using an external button connected to the microcontroller, you can change the operating modes of the LEDs, change the display speed, and also put the star into sleep mode.

The figure below shows the complete wiring diagram of the star:

The figure below shows the architectural diagram of the software, and the diagram of its dynamic behavior:


System design and LED driving principle











The LED driver is driven by 16-bit SPI packets, in one such packet, each bit corresponds to one LED. When a certain bit is one, then the corresponding LED turns on, when it is zero, then the LED turns off.

To create a sequence, packets of bits are sent to the LED driver at a specified frequency. The base period is 62ms. It can vary from 81ms to 81 * 255ms.

For example, a program that has circular LEDs toggles over time looks like this:

When creating the project, the following electronic components were used:

  • TLC5925IDWR LED Driver
  • Microcontroller PIC16LF1703-I / SL
  • DC / DC converter MCP1640T-I / CHY
  • Battery compartment
  • Capacitor 22 uF
  • 27pF capacitor
  • 4.7uF capacitor
  • PCB Mount Button
  • Diode assembly MBR0530T1G
  • Resistor 300 kOhm
  • 620 kΩ resistor
  • 4.3k ohm resistor
  • 8mm LEDs, blue and red
  • 10mm LEDs, yellow and red

DIY glowing Christmas ball on a Christmas tree in the form of the Death Star from the movie "Star Wars"

To make a Death Star night light from the Star Wars movie you will need:

  • Plastic ball with a diameter of 100 mm
  • Drill
  • Fine-grained sandpaper
  • Rubbing alcohol
  • Epoxy putty
  • Pieces of clay or plasticine
  • Masking tape
  • Stationery knife
  • Spray paint
  • LEDs
  • Thin black wire
  • Soldering iron
  • Waste electronic circuit, old flashlight and LED candle

Step 1





To cut the disc, secure the ball with a piece of clay or plasticine. Hold the sphere firmly while drilling. Drill a small hole as a guide, then use a plastic bit to cut the disc around the circumference. Remove it and sand the edges with sandpaper, with it, under running water, process both halves of the sphere and the disc.

Step 2





Secure the hemisphere and place the disc in the hole so that the outside surface is flat. Knead the epoxy filler and roll it into a cylinder. Press it along the edges of the disc, holding it with your finger. Place a small amount of putty in the hole so that a small protrusion appears on the back side. Use a utility knife to cut the loop for hanging the sphere and smooth out the roughness. Sand the sphere under running water.

Step 3

Glue a thin strip of tape along the equator of the sphere. Dampen the cloth with rubbing alcohol and wipe the entire surface. Using a gentle primer, paint everything a basic light gray. Now attach strips of duct tape to all parts, the spheres, which should remain light. Now apply some dark gray paint and remove the tape.



Step 4




Cut a small square with a side of 1.5 cm from a PCB or regular plastic (you need to drill two holes for the LED). Take two wires 20 cm long, pass them through the holes in the square, install the LED. Now you can solder the wires. Thread the wires through the hole at the top of the sphere. Now we need a small battery compartment (suitable for an LED candle). It remains to solder the ends of the wires to the body of the candle, observing the polarity.

Step 5

Scrape off some of the paint in some areas to allow light to enter. If too much light passes through the equator of the sphere, you can glue a dark strip with holes on the back side. To slightly mask the body of the candle, you can paint it black.



Glowing Christmas decoration for Christmas tree


This tutorial is intended to walk you through the steps of creating an LED Christmas tree star that glows very brightly and can change colors. The project used a sheet of plywood, WS2812b addressable LED strips and an Arduino microcontroller.

Step 1: Tools and Materials

  • Plywood sheet approx.30 x 30 x 0.6 cm.
  • LED strip WS2812b with a density of 60 LEDs per meter. You will need a piece of 67 cm long, which contains 40 LEDs.
  • Small-sized Arduino microcontroller based on an ATmega328 or Attiny45 chip (for example, Arduino Pro Mini 3.3 / 5V or Adafruit Gemma will do)
  • Medium grit sandpaper
  • Acrylic adhesive
  • 3.3 / 5V power supply or 3.7V LiPo battery or any other suitable power supply
  • Thin electrical wire

Step 2: drawing the star



The first step is to create a star. The LED strip will be glued to the body of the plywood star, so appropriate dimensions must be selected. For this project (40 LEDs), you can use the template in the attached file below. Note that some ends are cut a little to fit on A4 sheet. Thus, you need to print a stencil, take a sheet of plywood and carbon paper. Then lay the stencil with copy paper on a sheet of plywood, and using a ruler and pencil, transfer it to the plywood. Before starting the transfer, it is advisable to secure the stencil on the plywood sheet using the pushpins so that it does not accidentally shift. After finishing the transfer, remove the stencil and carefully check all the edges.

Step 3: carving the star


After the image of the star is transferred to a sheet of plywood, it must be cut out. To do this, you can use a jigsaw or a suitable hand saw. In this project, the star was cut only along the contour, but if you wish, you can also cut out the middle. Once the cut is complete, the edges of the sprocket need to be sanded to make them smooth.

Step 4: Prepare the LEDs




At this step, you need to take a piece of LED strip containing 40 LEDs and cut it into the minimum allowable lengths of 4 LEDs. As a result, you should get 10 segments of 4 LEDs.
In this project, the waterproof sheath of the tape was removed, but this may not be done, but then, before soldering, it is necessary to carefully remove the protection from the contacts by cutting with a knife.

Next, we glue the LED segments onto the edges of the wooden star using acrylic glue. Apply a few drops of glue to the back of the LED strip and stick it onto the star. It is advisable to align the stripes so that the pixels are fairly even.

Caution: Before sticking the strip, make sure it is oriented correctly, as this type of LED strip has a one-way communication direction (i.e. the Dout pin of the previous strip must be connected to the Din pin of the next one)

Step 5: Connecting the LEDs

Now the LED strips need to be connected together. To do this, we cut many small pieces of thin wire, about 3-4 cm long. Using a soldering iron, we need to solder these pieces of wire between the contacts of the LED strips in the following form: DO - DI, V - V, GND - GND. The soldering and connection check will be performed in the next step, and at the moment only a visual inspection is performed, for short circuits and other physical errors.

Attention: Do not loop back the chain! The output of the last strip is not connected to anything, and wires are soldered to the first strip, which will later be connected to the microcontroller.

Step 6: Connecting the microcontroller

The first step is to connect the power and ground wires to the power source. Then the Vcc pin on the microcontroller is connected to the V pin of the first LED strip, respectively, the GND pin to GND. Microcontroller pin # 6 is connected to the DI data input pin of the first strip (this pin is programmatically defined and can be redefined).

If you are using Arduino Pro Mini, then connect the programmer to the serial port. Otherwise, just connect the USB cable from the computer to the microcontroller.

Step 7: Programming the microcontroller

In order to program the microcontroller, you need to download and install on your computer the Arduino IDE program equipped with the Adafruit NeoPixel library, which can be downloaded from the Adafruit website.

After installing the program, open the verification program code (sketch) called strandtest by going to the following menu items:

File → Examples → Libraries → Adafruit_NeoPixel → strandtest

In it, you need to edit line 15, namely, change the value 60 to 40, since the project uses 40 LEDs. The rest of the sketch code remains unchanged.

Then the program code is loaded into the microcontroller memory.

If you are using an Adafruit FLORA or Gemma microcontroller, then you will need to configure the microcontroller type in the Arduino IDE program, for this follow these instructions: https://learn.adafruit.com/add-boards-arduino-v164/setup

Step 8: Test Connections


Now is the time to check the connections and wiring. Plug in the power and if everything goes smoothly, all LEDs will light up according to the uploaded sketch.

If something doesn't work, check all connections from the microcontroller to the last LED strip of the LED strip.

Step 9: finishing touches

Before installing the star on the Christmas tree, you need to secure the microcontroller and battery to the back of the star. For fixing, you can use adhesive tape or suitable screws. It is also required to attach a mount with which the star will be securely installed on the tree.

LED Christmas tree toys - Wi-Fi controlled Christmas balls
This tutorial describes how to create glowing Christmas tree toys that can be controlled over a Wi-Fi network. To connect to toys, you can use a computer or smartphone with your favorite browser. You can set the color, flicker speed and mode.



Christmas tree decorations have their own web server. All software code runs on Wemos / ESP8266 microcontroller. All else that is required is a 5 Volt power supply (USB) and a Wi-Fi network.
This instruction, which contains step-by-step steps, starts with three code examples. The first example is a simple Arduino sketch from Autodesk schematics using a NeoPixel LED ring. This example is basic for this project. The second code example is a web server using the Wemos microcontroller. The third code example explains how to execute various functions at specific intervals.
Following these coding examples, the creation of a toy model design is described, which is a completely symmetrical geometry with 20 sides. The design and shape were created in Fusion 360 and then 3D printed.
At the end, after assembly, the final program code is described, which is a combination of the three examples at the beginning of this instruction.
Although this manual describes how to create an ornament from New Year's decorations, the web interface is not limited to these features. It can be used for a variety of other projects. In fact, anything that runs under the control of Arduino microcontrollers can be controlled over a Wi-Fi network.

Step 1: Materials Required


Necessary materials:

  • Microcontroller Wemos D1 Mini Pro or Wemos D1 Mini
  • WS2812b led strip, 30 led / meter, IP30 or miniature programmable pixels
  • USB cable - micro-USB
  • Wires
  • Super glue
  • Powder Glitter
  • 5 volt USB power supply

Use a suitable USB power supply. Each LED draws a maximum of 60mA, so 20 LEDs draw 1.2A (6W) at full power. In this project, an Ikea Koppla USB power supply was used. It is equipped with 3 USB ports and provides 3.2A at 5V.

Step 2. Autodesk Schematic: NeoPixel LED Ring Connection Example


Building anything with WS2812 LEDs and an Arduino microcontroller is really an easy task. But this can seem intimidating if you've never worked with an Arduino before. Some experience in programming and electronics will come in handy. It's not that hard.
And you don't have to buy an Arduino microcontroller to try your hand. There are websites where you can simulate the operation of a microcontroller. One of them is the Autodesk Circuits website. This example is made on an Arduino microcontroller using a NeoPixel LED ring, and is the basis of this Christmas project.
The program code for the microcontroller looks simple, but at the same time it shows many possibilities of coding the Arduino microcontrollers:

  • The program code uses the external library "Adafruit NeoPixel". Therefore, there is no need to worry about changing the color of the LEDs. All you need to do is use the library functions.
  • The program code defines the values ​​of 12 RGB colors in 3 arrays. These are the 12 colors used in the web interface to control the LED strip.
  • Also, there is a self-defined function. This is the "setColor" function that can be called from anywhere in the program.

This code contains one array of 12 colors (numbered 0 through 11). For this project, 12 colors were chosen because the resulting code contains and recognizes one button for each color:

Color 0: amber (FFC200)
color 1: orange (FFA500)
color 2: cinnabar (E34234)
color 3: red (FF0000)
color 4: magenta (FF00FF)
color 5: purple (800080)
color 6: indigo (4B0082)
Color 7: blue (0000FF)
color 8: aquamarine (7FFFD4)
color 9: green (00FF00)
color 10: greenish (7FFF00)
color 11: yellow (FFFF00)

If you like, you can change the colors by changing the RGB values. Other color codes can be found on Wikipedia.

Step 3. Hello world!


After programming the Arduino controller to work with WS2812 LEDs, it's time to create a simple web server based on the controller. This requires a Wemos microcontroller (with ESP8266) containing a Wi-Fi adapter. The Wemos controller can be connected to a computer using a USB cable. There is no need to use additional USB adapters. This is the advantage of the Wemos controller over the ESP8266-12 module.
The Wemos controller can be programmed using Arduino software. But this will require adding additional boards to the Arduino IDE using the Boards Manager function. This is documented in the Wemos controller documentation.
After completing these steps, you can select the Wemos board to program in the Arduino IDE. To do this, select the Wemos controller (+ the corresponding COM port) and load the following code into it:

Just before compiling and downloading the code, change the network credentials.
This is a very basic web server. The Wemos controller connects to the Wi-Fi network and starts the web server with only one page. Use a serial monitor to get the IP address of your web server.

Step 4: Connect

A little soldering is required to create the circuit. But thanks to the use of the WS2812b LED strip, it is kept to a minimum.
Solder the pins to the Wemos controller board. For this, the contacts on the board "D2", "+ 5V" and the contact "GND" are used. This means that the pins only need to be soldered on one side of the board.
Then solder three different colored wires to the LED strip (ground, signal and + 5V).
Then remove the plastic from the USB connector on the wire. As such, there is no room for this connector. Add 2 extra wires to the USB cable (twisted in the picture): one to the "+ 5V" wire and one to the "GND" wire. They are directly used to power LEDs. Remember to insulate these wires.
Connect additional "+ 5V" wires from the USB cable to the LED strip. Ditto for the "GND" wire. Connect the signal wire from the LED strip to the D2 pin on the Wemos controller board. Finally, connect the USB cable to the Wemos controller board.
There is no ground wire connected to the pin on the Wemos controller board. This ground pin is directly connected to the USB connector. It is connected with the additional "GND" wire.

Step 5: Example of how timers work

In the first NeoPixel code example for Arduino (NeoPixel LED ring), color changes are made in the main loop. This requires a delay in the main loop, or the color change will be too fast. During this delay, the Wemos controller simply waits and does not execute any other commands. Except for background processes, for example, handles a Wi-Fi network connection.
The end product will run a web server to control the LEDs. Because of this, there should be no expectations inside the code, because this will give an insensitive web interface.
In the example below, the LEDs are controlled by an internal "osTimer" timer, which is determined by the "os_timer_setfn" function and then activated by the "os_timer_arm" function. The value 1000 used is specified in milliseconds. Using this value, the Wemos controller's timer will execute the “timerCallback” routine every second. This procedure increases the color value and changes the colors of the LEDs. As a result, all these actions are performed outside the main loop.
Remember that the code inside "osTimer" must be very short as it must be executed before the next timer is started.
Program code: This code also contains a function named "setColor", which can take 3 values, used to change the color of all LEDs at the same time.

Step 6: regular convex polyhedron



There are different shapes of Christmas tree decorations. While the design was being selected, some geometric shapes were accidentally found. And one type of geometry attracted attention: the regular polyhedron. It is absolutely symmetrical. This makes it ideal for Christmas toys. Only five types are known:
1. Triangular pyramid (4 sides)
2. Cube (6 sides)
3. Octahedron (8 sides)
4. Dodecahedron (12 sides)
5. Icosahedron (20 sides)
The icosahedron was chosen. It has the largest number of sides. There will be one WS2812 LED on each side, and there will be 20 in total.
The use of WS2812 LED strips limits the size of the geometry. The distance between the LEDs is 33 mm (30 LEDs per meter). This is equal to the upper limit for the sides of each equilateral triangle. After creating a paper prototype, an icosahedron size of about 75 mm was developed. This gives enough room for a Wemos controller and 20 LEDs.

Step 7: Working in Autodesk Fusion 360






Creation of a standard icosahedron starts with 3 rectangles on each axis. These should be golden rectangles. A golden rectangle is a rectangle whose sides are in the golden ratio (approximately 1.618). We can calculate the sides for a 75mm golden rectangle using the Pythagorean theorem, the sides are 65 x 40mm.
Each corner of the rectangles is a corner of 5 triangles.

Draw the path of the LED strip before pasting the LEDs. This will help her not to overlap.
Start by gluing the LEDs inside the large 3D printed part, with the last LED at the end of the strip. In this project, hot glue was used for fixing. Be careful to bend the LED strip carefully during assembly so that it does not get damaged.
This version uses two pieces of LED strip. One with 5 LEDs and one with 15 LEDs. But it is quite possible to use one LED strip of 20 LEDs. This saves time and does not require soldering.
Connect the "+ 5V" and "GND" wires from the LED strip to the USB cable. The signal wire connects to the "D2" output on the Wemos controller board. The earth is connected internally. Remember to check the LEDs before closing your Christmas toy.
To prevent the parts from separating, glue is used. Place the Wemos controller board inside the large 3D printed part. Make a hole for the USB cable to pass through and glue both pieces together.

Step 10: web server


The Arduino sketch file attached at the end of this section contains all the code for the web server on the Wemos controller. Change the "ssid" and "password" variables before loading the code.
About the code

Some parts of the code require a little explanation:

#include
#include
#include
#include
#include
#include
These are all the libraries used in this sketch for the Arduino.

#define NUM_PIXELS 20
Adafruit_NeoPixel pixels (NUM_PIXELS, D2, NEO_GRB | NEO_KHZ800);
There are 20 LEDs which are connected to the "D2" pin on the Wemos controller board.

int R = (255,255,227,255,255,128,075,000,127,000,127,255,000);
int G = (194,165,066,000,000,000,000,000,255,255,255,255,000);
int B = (000,000,052,000,255,128,130,255,212,000,000,000,000);
These are 12 colors (color 0 to 11) and are used for LEDs. Corresponding HEX values ​​are used for buttons. There are 13 values ​​in this array. The last value in the array turns off the LED (# 000000 = black). You can change these colors if you like.

String buttonColor = ("white", "black");
boolean ColorState = (1,1,1,1,1,1,1,1,1,1,1,1,1); // initial colors
All 12 buttons have "Status". If the button has the value "True", then the corresponding LED displays the corresponding color. When a button is pressed, the state of that button changes. This also changes the text color of that button (like black or white).

int waitTimes = (50, 100, 150, 200, 250, 500, 750, 1000, 1500, 2000, ...
int waitTime = 5; // default values
There are two buttons for changing the timer value ("faster" and "slower"). The default value for "waitTime" is 5. This value gives a timer interval of 500 milliseconds.

int nextColor (int lastColor)
{
foundColor = numColors; // nothing found return value
countColors = 0; // count number of searches inside the loop
do
{
currentColor + = 1;
countColors + = 1;
if (currentColor> numColors) (currentColor = 0;)
if (ColorState) (foundColor = currentColor;)
}
while (currentColor! = lastColor
&& foundColor == numColors
&& countColors< numColors+1);
return (foundColor);
}
This function finds the next color to display from the "colorState" array. It starts the search at position number "lastColor" and returns the next index value in the colorState array with the value 1.
Example. In the next array, color 2-7 is off (white text). Running this function with a value of 0 returns 1. Using this function with a value of 1 returns 8. This is the next color that is in the "colorState" array with a value of "True".
Color 0: amber (FFC200)
Color 1: orange (FFA500)
Color 2: scarlet (E34234)
Color 3: red (FF0000)
Color 4: Purplish Red (FF00FF)
Color 5: magenta (800080)
Color 6: indigo (4B0082)
Color 7: blue (0000FF)
Color 8: greenish blue (aquamarine) (7FFFD4)
Color 9: green (00FF00)
Color 10: chartreuse (light green) (7FFF00)
Color 11: yellow (FFFF00)
Colors are always displayed in a fixed order. When all 12 colors are off, it means that all LEDs are also off (value 000000).

// interrupt os-timer
void timerCallback (void * pArg)
if (! buttonSparkle)
{
// Sparkle Off = Blink
}
else
{
// Sparkle
}
There are 2 operating modes: "Sparking" and "Blinking". And they each have a different code path inside the OS timer.
The blinking mode has the simplest code. It gets the next color by calling the nextColor function. Then all LED colors are changed to this color.
The sparking mode is very different. It always starts with the first available color in the "ColorState" array. Then the nextColor function is called for each LED. Changing the color of the LED quickly gives a sparkling effect.

Void showPage ()
{
webPage + = "