Where do the brilliant colors come from? LOTO oscilloscope measures WS2812B LED light source

Publisher:RoboPilotLatest update time:2021-07-01 Source: eefocusKeywords:LOTO Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Whether you agree or not with the "RGB performance increased by 300%", it is undeniable that the bright colors are very cool. It has become a consensus among merchants on the market that products with "lights" are definitely more expensive than those without "lights".


On the market, there is a kind of RGB LED lamp bead. It is cheap, only a few cents each, and if you buy more, the price may be as low as 1 cent each. It does not require an additional "huge" control circuit to drive it. With various cheap microcontrollers and simple components, a single IO interface can be connected in series to allow hundreds or thousands of lamp beads to emit colors independently. It has low power consumption and a good refresh rate, which is highly recommended by DIY players.

This is the WS2812 series, which is an "intelligent externally controlled LED light source that integrates control circuit and light-emitting circuit."


So how is it implemented? There are many related documents and source codes, but the actual control method is still unclear. This article takes WS2812B-4 as an example. It is the mini version of WS2812. Its performance is not as fast as the standard 6-pin one, but it is small in size and has good performance, and can make the dot pitch smaller.


Let us understand it, and then we will know why we need to use the LOTO oscilloscope to clearly analyze how it is controlled by the microcontroller and emits brilliant colors.


Let's take a look at the official documentation first~

 


A brief introduction to time units will be provided to facilitate the explanation later.

ms is millisecond = 0.001 second us is microsecond = 0.000,001 second ns is nanosecond = 0.000,000,001 second

Now let's start the main text. To summarize, if you want to make a WS2812B-4 LED light up in the fastest possible way, it takes 1960ns (1 bit) * 24 (8 bits for each of the three colors of red, green and blue) + 280us = 47040ns (47.04us) + 280us = 327.04us.


That is, a single WS2812B-4 LED can change colors 3 times per millisecond, or about 3,000 times per second, without considering afterglow.


After that, each expansion of WS2812B-4 LED requires an additional 47.04us of color data, so 60 refreshes per second require 16.66ms = 16,666us – 280us = 16,386us /47.04us = 348 LEDs.


        This number of series connections allows us to easily complete the desired design when designing a small DIY RGB light source. This is why WS2812 is highly recommended.


        But such a fast speed makes it difficult for us to see how it works. It is absolutely impossible to see the actual situation with a multimeter, because it is too fast and the voltage appears to be 0. So how can we see how the LED is driven by the circuit? We can only use an oscilloscope.


        Professional oscilloscopes are very expensive, with many costing tens of thousands, hundreds of thousands, or even millions. These prices are hard for us DIY players to afford. After all, money is hard to earn, and second-, third-, or fourth-hand ones don’t save money and may even result in failure.


Here comes the protagonist of this article, the LOTO oscilloscope. With it, we can get the analysis results of a professional oscilloscope on the computer at a cost of only a few hundred yuan. Of course, you get what you pay for. The bandwidth and sampling are comparable to the price, but general DIY does not require such a professional one. Therefore, LOTO allows you to easily understand and learn circuit principles in daily scenarios without spending a lot of money. It is really worth the money.


As shown in the picture, this perf board uses an STC8G microcontroller and one IO port to drive two WS2812B-4s, making the first one emit green and the second one emit red, and they have a breathing and flashing effect, but you can't see it in the picture.

Because it is a 5V high-level circuit, you need to use a 10X probe. Let's use the 1ms time domain to look at it first. There is only a small spike. The 9600bps communication in 1ms is very clear. Now when I look at the us level, I can only see such a spike. I can only say, it is really fast.

Switching to the 0.1ms gear, we can see continuous ripples, but they are still too dense. We can see that the blue channel A is twice as long as the yellow channel B. This is the 1 group of 24-bit ripples that LED1 forwards to LED2 after receiving 2 groups of 24 bits.

0.1ms is still too "slow", let's go to 10us, which is 0.000,010 seconds. Because it is too fast, triggering is used here to intercept the high level. Otherwise, it is not easy to find the waveform if it flashes too fast. You can see the obvious waveform, but it is still unclear, so let's continue.

1us mode, now you can see the waveform clearly. How about the voltage change of 0.000,001 seconds clearly displayed to you?

You may wonder why the waveform is not flat? Is there something wrong with the oscilloscope? Let's try the oscilloscope first to see if it is the problem. Most oscilloscopes have a standard square wave generation function to facilitate our calibration.

        Look at the picture below. This is a standard square wave of 1000 Hz. Hmm, it is very flat, which proves that the oscilloscope is fine. That is, the output of STC8G is the waveform shown in the above picture.

We continue and add labels. We can see that the first high level is 0.323us. This is the waveform representation of the first color of the 8-bit binary color of the high level sent by our microcontroller. 00011101 is the green value of our first light.

Let's zoom out a little and look at all the waveforms. The first group of the first 8 waveforms is green G, the second group is red R, and the third group is blue B.

Then let's take a look at the waveform forwarded by the first WS2812 to the second one. It can be seen that only 150ns have passed before the second WS2812 has received the forwarded waveform signal! It's really fast.

The above is our analysis of the waveform of WS2812B-4 using LOTO virtual oscilloscope. If there is no oscilloscope, you can only blindly adjust the frequency in the microcontroller to adapt the data of WS2812. With LOTO oscilloscope, it is much more convenient. I wonder if you feel the convenience of oscilloscope.

Keywords:LOTO Reference address:Where do the brilliant colors come from? LOTO oscilloscope measures WS2812B LED light source

Previous article:How to self-check oscilloscope failure
Next article:Keysight/Agilent MSO9104A oscilloscope maintenance and startup abnormality case

Latest Test Measurement Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号