📜 ⬆️ ⬇️

Mood lamp!

A mood lamp (mood lamp) is an RGB lamp that changes color randomly. It was green, smoothly turned blue, then violet ... what color it will become at the next moment in time nobody knows)

image

Buy this problematic, do it yourself!)

')
This lamp is simple in design and will be an excellent souvenir. Components Used:
Lamp GRONO from the store IKEA. (299r.)
ATMEGA8-16PU microcontroller (66.)
RGB LED KAD1-9090BRGC-01/3 star (273.)
BUZ11 transistor (3 * 27r)
various small things (three 1W resistors, one 10K pull-up resistor, a block for ISP, a stabilizing chip 7805)

The light source used is a powerful RGB LED. The power of each color component is 1W. Details can be found in datasheet. The LED was found and purchased at Promelectronics (promelec.ru).

Lamp circuit:

image

To simplify the power line, the stabilizer and the ISP block are not shown in the diagram. Transistors are connected to the outputs of the PWM channels. There are three such channels in the microcontroller.

Ready fee:

image

The algorithm of the following. Color is randomly generated (three char variables). If all three values ​​are about the same, then we will have a white color at the output, which is not interesting, so the process of random color selection is repeated. When a color is obtained with a probability of 0.5, one of the channels will be extinguished (so that pure R, G or B colors would appear more often.) Then the amount of increase is calculated, which would come to the specified color in 255 steps. After that, the rate of departure to a new color is randomly determined (from 5 to 10 seconds). Well, then, due to the increment of the value in the PWM registers, we smoothly arrive at the generated color. Hold the color for some time, the cycle repeats. And so on to infinity.

Lamp in action:


Source code can be viewed here (Written in CodeVisionAVR)

The microcontroller switches the FUSE bits so that the clock frequency is 8 MHz from the built-in RC chain.

A similar project of foreign colleagues: www.electronics-lab.com/projects/games/005/index.html

What I would fix:
1) would take out the stabilizer beyond the lamp, it is heated and requires a large radiator
2) I would use small transistors and the microcontroller would solder immediately to the board. Then the board dimensions would be reduced and it would fit into the niche under the lamp.

Room for creativity:
The microcontroller has a lot of unused legs, and USART is not involved. You can add a MAX232 level converter to the board and you can connect a lamp to the computer’s COM port. (And if you use FT232 then to USB). Then writing the appropriate software can be done so that for example, when a new mail arrives, the lamp flashes red. Or for example to make an advanced ambilight.

The original article is here .
As usual, I remind you that this is the only copy-paste that is connected with the fact that the portal server is not able to absorb a large number of visitors and has some stability problems.

Source: https://habr.com/ru/post/65616/


All Articles