ShuDudu's Home was started in 2011, but the web data is lost, so now begin again, I would like to make some friends, I hope you like ShuDudu's home.
Current position: ShuDudu > Other >

Kashima light produced less paper Summary

Wednesday on April 15th, 2020Other

Recently Kashima light the fire seems to be the way, so I bought all kinds of things to make yourself a pattern Well, of course, your own path slightly ~ ~ ~

First put Figure ~

Placed in the bed look great right! The key can also change color! Breathing light oh

Figure ~ is not believed

Well, it is done for show off, here listen to me talk about this past life Kashima lamp life it ~

Most begin to see that something is in the bar, to see after someone posted it on himself to do a wanted, so he did. In fact, this is the most central thing in acrylic on board portray, is a good moment to God, hand flick is also not a good moment for God, but not the same but maybe God for it. For me is very simple engraved lines on the board, I use a pen engraved lines, paste it feel than what is recommended on the wood chisel stone chisel probably vary a lot better ~ it ~

Not many things used: acrylic plate, hook knife, hot-melt adhesives, hot melt adhesive guns, files (file metalworking), light bar, knife, score lines T

Well, this is pre-used. I buy a 30cm x 30cm acrylic board, so I cut it to two 15cm x20cm reticle board, the rest of the base 10cm x30cm just made. In order to facilitate the direct I buy light bar, such as I-opportunity source comparison, $ 15 meter light bar, a total of four kinds, three different white (white, white, warm white) and one common anode RGB 5055 SMD tri-color LED light bar, each have bought 3 meters, our readers, then you can buy it according to their needs - the end of the article you can also find details, see my custom ~ ~

In fact, the reticle is relatively simple (how to say my hobby is painting it), the comparison is giving me a headache problem breathing light before with MCU too, are programs found on the Internet, where there are many dissatisfied regrettable I do not understand can not be changed. So I think that this write a, starting with the Raspberry Pi and Pi4j want this thing to realize, after all, now I mainly write java, but then, because writing code in the IDE does not come in raspberry and very troublesome I gave up and returned to the microcontroller road again.

Before using a STC15F104E microcontroller, because it only 8DIP, with four P3 can be connected to the right side just lights, but because his internal clock is not very accurate (it may be because the problem batch) leading to the eventual realization of the lamp Article flashing very clear, so I switched to STC12C4052AD plus 12MHz crystal. Another reason for using the versatility of these devices is that he has the PWM function, but then I looked up the data sheet only two PWM find it, for our tri-color LED lights for less all the way. Sure enough, ah still have to write the code yourself.

Before someone manually in code to achieve a three-way PWM, but my thoughts and pwm nothing to do. In the computer if the color of a color code is split into three RGB values ??to my favorite powder blue, for example (see here if you have looked familiar readers, I am honored to tell you, my ID paste it is 1hu2rui), its color code is R = B0, G = E0, B = E6, is converted to a decimal R = 176, G = 224, B = 230. We all know that the white color code color code all the biggest --FFFFFF, that is, RGB is 255. My idea is to cycle 255 times, RGB three colors light a different length of time, because the human eye's persistence of vision, when it reached speeds can be achieved when different display colors fast enough. And after my calculations (not accurate), the time interval between each of the two should be less than 160s, which is very good for microcontrollers achieve Well ~

Core code word is like the following (C51)

if (r = 0) {Red = 1;} else {Red = 0; r--;} if (g = 0) {Green = 1;} else {Green = 0; g--;} if (b = 0) {Blue = 1;} else {Blue = 0; b--;}

r, g, b is a value of a color, Red, Green, Blue color is defined in three control pins (the sbit)

So executed once finished the above code, a number of times on the record, referred to 255 reload the r, g, b three values ??(that is reassigned).

This is a program on the timer interrupt inside, so no matter where the main program to execute, you can ensure that the refresh rate of the lamp, thus ensuring the accuracy of color.

Part of the show's finished, talk about the next generation gradient color value of things. In fact, this gradient is very simple, nothing more than a value from 0 to 255 is added, the decrease came back, Red, for example, Re is red value. The following is added to the code 255

while (Re = 255!) {Re ++; delayms (ds);}

delayms This function is used to delay, because the generated values ??and display colors are two separate modules, so give them a certain response time, I is controlled by the global variable ds. Here is the code reaches zero:

while (Re = 0!) {Re--; delayms (ds);}

So procedures, the algorithm would like to see achieved is very good. I wrote this program turned many times the data sheet, the data sheet proved to be a good thing, we must make good use ah ~

Well Finally, the package is constructed and the minimum system control portion I ~ separate out, the image is seen on the board and the light source, the control portion I is built in breadboard, small pieces can be attached to just breadboard in the battery case, as shown ~

The battery case is black matter, with four AAA batteries, a set of the above cable is connected to the light bar ~

Well, it is probably the case - in fact, this kind of thing does not lie in how to make the results of how fast hardware works great, I think more important is how to become a demand there is something real, that is what I admire those technical house , programmers, and a large touch their reasons - they can through their own hands, put out of thin air, there is no demand into tangible things.

Finally, thank you to read the reader, like tap praise ~

Thank you ~

Copyright Protection: ShuDudu from the original article, reproduced Please keep the link: https://www.shududu.com/other/Kashima-light-produced-less-paper-Summary.htm