Skip to content

Latest commit

 

History

History
108 lines (84 loc) · 3.05 KB

File metadata and controls

108 lines (84 loc) · 3.05 KB

NeoPixel94V GRB Stick

Wiring: As coded this program uses SPI_0

1. ./mvnw clean package
2. cd target/distribution
3. sudo ./runNeopixel.sh OPT parms........
   Parm -t traceLevel

NOTE:

At present this code uses the SPI. The timing is calculated for the Pi4 hardware.

NEOPIXEL WS2812B uses the following timing to represent a '1' or a '0' bit. To accomplish in SPI, a '1' sends a byte0b11111000 and a '0' sends a byte 0b11000000. When the array of bytes are sent via SPI at a specific frequency the WS2812B interprets the bytes as correctly timed 0's and 1's. To accomplish the SPI frequency is set to 8500_000 for older Pis and 8650_000 for Pis with the RP1 chip.

Note; While the Pi5 with a RP1 chip is able to maintain the required
SPI frequency, the older Pis are not as stable.  You can improve the 
possibility of using a NeoPixel with older Pi by the following:
Add to /boot/config.txt or /boot//firmware/config.txt
core_freq=500
core_freq_min=500

For an alternative see :
https://www.pi4j.com/examples/jbang/jbang_pi4j_spi_led_matrix/

Pulse duration to represent a one or a zero. int32_t highTime0NanoSeconds, 400 ns int32_t lowTime0NanoSeconds, 850 ns int32_t highTime1NanoSeconds, 800 ns int32_t lowTime1NanoSeconds, 450 ns

RED LEDSTRIP 0x00FF00; Transmits 8 short, 8 long, 8 short

GREEN LEDSTRIP 0xFF0000 Transmits 8 long, 8 short, 8 short

BLUE LEDSTRIP 0x0000FF Transmits 8 short, 8 short, 8 long

800/400

300/900

Composition of 24bit data:

G7 G6 G5 G4 G3 G2 G1 G0 R7 R6 R5 R4 R3 R2 R1 R0 B7 B6 B5 B4 B3 B2 B1 B0

Note: Follow the order of GRB to sent data and the high bit sent at first.

The NeoPixel94V class assumes the above order Green Red Blue. The code method Render() uses this assumption when inflating the LEDs integer bits to individual bytes.

If your LED strip uses a different order within the 24 bits the render function must be modified.