Light NeoPixel with 555 Timer IC (Part I)

NeoPixels (Adafruit’s comprehensive introduction) are 24-bit RGB-colored (GRB to be exact) LEDs, which can be strung together and controlled with 1-wire serial digital signal.

Considering how stringent the timing of the digital signals are (according to WS2812B datasheet), it’s pretty amazing that Julian (his youtube video) was able to light up NeoPixels with a single 555 timer IC, without any help from MCUs.

With today’s ultra-high transistor counts electronics components, small MCU ICs are cheaper, lower energy and much more powerful than a good old 555 timer IC. Nonetheless, it is an interesting electrical engineering design problem to solve.

In this article, I am going to explain how to calculate RC component values and how to generate pulse width modulation (PWM) signals for NeoPixel’s 1-wire data protocol, again only using 555 timer IC.

RC Step Response

One important equation to know when dealing with RC charging/discharging is the step response of an RC circuit. (In case you need to refresh memory, calculating voltage V(t) of the capacitor, here is a good tutorial from Khan Academy).

Basically, the voltage on the capacitor V(t) has this nice equation that connects a voltage ratio with charge/discharge time, scaled with the RC time constant:

Image for post
Image for post

Intuitively, let’s try out this equation at two end points.

  • At intial time: t1=t0, V(t1) = V(t0), the right hand side equals 1. The left hand side equals e⁰, which is also 1.
  • At final time: t1=Infinity, V(t1) reaches VF (final), the right hand size goes to zero. So does the left hand side, e^-Infinity tapers down to zero.

VF is the step response’s final value. It is a constant that can be 5V (step-up) or 0V (step-down) for example. The same equation applies in both cases.

τ = R*C is usually called the time constant. Since e^(-3) =5%, you always hear 3τ time. That’s when the voltage on the capacitor is approaching and only 5% less than the final value.

Use 555 Astable Configuration

A typical 555 astable circuit configuration is shown below.

Image for post
Image for post
Image for post
Image for post

The design equations show two RC time constants at work. One determines the high time, because the capacitor is charged through two series resistors R1 and R2. The other determines the low time, because the discharge path only involves R2 resistor.

So where does the 0.69 come from?

Image for post
Image for post
(img from https://howtomechatronics.com/how-it-works/electronics/555-timer-ic-working-principle-block-diagram-circuit-schematics/)

That’s because of the voltage divider inside 555. The voltage on the capacitor is charged and discharged to two voltage levels: 2/3VF (to RESET, i.e. output low) and 1/3VF (to SET, i.e. output high)

Image for post
Image for post
image from https://howtomechatronics.com/how-it-works/electronics/555-timer-ic-working-principle-block-diagram-circuit-schematics/

To charge C1 from 1/3VF to 2/3VF determines the high time:

Image for post
Image for post

So

Image for post
Image for post

Similarly, to discharge C1 from 2/3VF to 1/3VF determines the low time:

Image for post
Image for post

Notice that VF, V0 and VT take different values in these two cases, but the voltage ratio turns out to be 1/2 in both cases. So 0.69 comes from ln(2), which is inherent 555, its 1/3 and 2/3 voltage divider.

The external resistors on the charge/discharge current path determines two different RC time constant, thus two adjustable high time and low time.

WS2812B Timing

WS2812B is the controller inside the NeoPixel. According to its datasheet

Image for post
Image for post
Image for post
Image for post

digital BIT-1 or BIT-0 are sent with different high time, low time values.

Julian’s trick is to have 555 generate BIT-1 all the time, in order to shift 24-bit GRB values for each NeoPixel. Then follow it by a longer than 50μs pause, which allows the bits to take effect and light up the NeoPixels.

The high time for BIT-1 amounts to 0.8μs. According to our astable formula, that requires a RC time constant of 0.8μs/ln2 =1.15μs. For example, R=3.6k and C = 330pF can give that RC time constant.

It turns out that the real NeoPixel component is a lot tolerant, in terms of the high time timing.

(to be continued)

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store