DIY Ambilight for Desktop

DIY Ambilight for your Desktop

hello, friends welcome to our blogs today we learn how we make our own DIY Ambilight for Desktop It’s a cool project and looks so pretty 

in this project I used WS2812 led strip 93 pieces (you select led to your display size ) 




first, we cut the strip according to our display and stick the backside corner of the display and remember the arrow direction on the strip shows in the same direction

ambiant display wiring

Now connect all led strip with a small wire 

I connect the female connector at the start of the led strip due to the connector I unplug Arduino any time when I need I plug again. the connector has 3 color wire (Red, Green, White )

Red and white is for power supply purpose and Green is for Data 

Arduino code for DIY Ambilight for Desktop

					#include <Arduino.h>

// --- General Settings
const uint16_t 
	Num_Leds   =  93;         // strip length
const uint8_t
	Brightness =  255;        // maximum brightness

// --- FastLED Setings
#define LED_TYPE     WS2812B  // led strip type for FastLED
#define COLOR_ORDER  GRB      // color order for bitbang
#define PIN_DATA     6        // led data output pin
// #define PIN_CLOCK  7       // led data clock pin (uncomment if you're using a 4-wire LED type)

// --- Serial Settings
const unsigned long
	SerialSpeed    = 115200;  // serial port speed
const uint16_t
	SerialTimeout  = 60;      // time before LEDs are shut off if no data (in seconds), 0 to disable

// --- Optional Settings (uncomment to add)
#define SERIAL_FLUSH          // Serial buffer cleared on LED latch
// #define CLEAR_ON_START     // LEDs are cleared on reset

// --- Debug Settings (uncomment to add)
// #define DEBUG_LED 13       // toggles the Arduino's built-in LED on header match
// #define DEBUG_FPS 8        // enables a pulse on LED latch

// --------------------------------------------------------------------

#include <FastLED.h>

CRGB leds[Num_Leds];
uint8_t * ledsRaw = (uint8_t *)leds;

const uint8_t magic[] = {
#define MAGICSIZE  sizeof(magic)

// Check values are header byte # - 1, as they are indexed from 0
#define LOCHECK    (MAGICSIZE + 1)
#define CHECKSUM   (MAGICSIZE + 2)

enum processModes_t {Header, Data} mode = Header;

int16_t c;  // current byte, must support -1 if no data available
uint16_t outPos;  // current byte index in the LED array
uint32_t bytesRemaining;  // count of bytes yet received, set by checksum
unsigned long t, lastByteTime, lastAckTime;  // millisecond timestamps

void headerMode();
void dataMode();
void timeouts();

// Macros initialized
	#define SERIAL_FLUSH while(Serial.available() > 0) {; }

#ifdef DEBUG_LED
	#define ON  1
	#define OFF 0

	#define D_LED(x) do {digitalWrite(DEBUG_LED, x);} while(0)
	#define D_LED(x)

#ifdef DEBUG_FPS
	#define D_FPS do {digitalWrite(DEBUG_FPS, HIGH); digitalWrite(DEBUG_FPS, LOW);} while (0)
	#define D_FPS

void setup(){
	#ifdef DEBUG_LED
		digitalWrite(DEBUG_LED, LOW);

	#ifdef DEBUG_FPS

	#if defined(PIN_CLOCK) && defined(PIN_DATA)
		FastLED.addLeds<LED_TYPE, PIN_DATA, PIN_CLOCK, COLOR_ORDER>(leds, Num_Leds);
	#elif defined(PIN_DATA)
		FastLED.addLeds<LED_TYPE, PIN_DATA, COLOR_ORDER>(leds, Num_Leds);
		#error "No LED output pins defined. Check your settings at the top."


	Serial.print("Ada\n"); // Send ACK string to host

	lastByteTime = lastAckTime = millis(); // Set initial counters

void loop(){ 
	t = millis(); // Save current time

	// If there is new serial data
	if((c = >= 0){
		lastByteTime = lastAckTime = t; // Reset timeout counters

		switch(mode) {
			case Header:
			case Data:
	else {
		// No new data

void headerMode(){
	static uint8_t
		hi, lo, chk;

	if(headPos < MAGICSIZE){
		// Check if magic word matches
		if(c == magic[headPos]) {headPos++;}
		else {headPos = 0;}
		// Magic word matches! Now verify checksum
			case HICHECK:
				hi = c;
			case LOCHECK:
				lo = c;
			case CHECKSUM:
				chk = c;
				if(chk == (hi ^ lo ^ 0x55)) {
					// Checksum looks valid. Get 16-bit LED count, add 1
					// (# LEDs is always > 0) and multiply by 3 for R,G,B.
					bytesRemaining = 3L * (256L * (long)hi + (long)lo + 1L);
					outPos = 0;
					memset(leds, 0, Num_Leds * sizeof(struct CRGB));
					mode = Data; // Proceed to latch wait mode
				headPos = 0; // Reset header position regardless of checksum result

void dataMode(){
	// If LED data is not full
	if (outPos < sizeof(leds)){
		ledsRaw[outPos++] = c; // Issue next byte
	if(bytesRemaining == 0) {
		// End of data -- issue latch:
		mode = Header; // Begin next header search;

void timeouts(){
	// No data received. If this persists, send an ACK packet
	// to host once every second to alert it to our presence.
	if((t - lastAckTime) >= 1000) {
		Serial.print("Ada\n"); // Send ACK string to host
		lastAckTime = t; // Reset counter

		// If no data received for an extended time, turn off all LEDs.
		if(SerialTimeout != 0 && (t - lastByteTime) >= (uint32_t) SerialTimeout * 1000) {
			memset(leds, 0, Num_Leds * sizeof(struct CRGB)); //filling Led array by zeroes;
			mode = Header;
			lastByteTime = t; // Reset counter

I use Arduino nano if you want to use Arduino Uno code also works I use nano because its size is small.

upload code in Arduino, if you have in ensuring that install, fasted library if all ok your code upload in Arduino in show message of done upload


wiring diagram

Software settings

first, install prismatik software and follow these steps as steps given in the video Tutorialls

Screenshot 12

Leave a Comment