User Tools

Site Tools


xmas:esp8266

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
xmas:esp8266 [2025/11/30 22:04] mlivolsixmas:esp8266 [2025/11/30 22:54] (current) mlivolsi
Line 1: Line 1:
-==== Xlights with ESP8266 as an Infrared Transmitter ====+======= Xlights with ESP8266 as an Infrared Transmitter =======
  
 WARNING: This article is going to be HUGE.. Huge Jerry .. Huge !!! WARNING: This article is going to be HUGE.. Huge Jerry .. Huge !!!
  
-Terminology: +**Terminology:** 
  
 IR - Infrared IR - Infrared
-Hacks will be denoted by: {{:xmas:skull.png?200|}}+Hacks will be denoted by: {{:xmas:skull.png?50|}}
  
 Target Audience: You got these cool piece of LED hardware (in my case, floodlights), and you want to control them with Xlights, but Don’t want to open them up, so you need to be able to control them with Xlights and IR. Target Audience: You got these cool piece of LED hardware (in my case, floodlights), and you want to control them with Xlights, but Don’t want to open them up, so you need to be able to control them with Xlights and IR.
  
-=== Grabbing the IR Codes ===+===== Grabbing the IR Codes =====
  
 NOTE: The setup is totally throw-away. You only need the IR codes NOTE: The setup is totally throw-away. You only need the IR codes
Line 22: Line 22:
   * Arduino IDE   * Arduino IDE
   * Your piece of crap IR transmitter   * Your piece of crap IR transmitter
-{{:xmas:xmiter.png?200|}}+{{:xmas:xmiter.png?100|}}
  
-Wiring the breadboard+===== Wiring the breadboard =====
  
  
-{{:xmas:breadboard.png?200|}}+{{:xmas:breadboard.png?400|}}
  
 EE people.. Please don’t beat up on me.. For the love of Pete. EE people.. Please don’t beat up on me.. For the love of Pete.
-Arduino Sketch+ 
 + 
 +===== Arduino Sketch ===== 
 My sketch isn’t mine. It was written by someone FAR FAR smarter than me.. I have a slightly modified version of it here: My sketch isn’t mine. It was written by someone FAR FAR smarter than me.. I have a slightly modified version of it here:
-https://github.com/mlivolsi63/Arduino-with-Infrared/blob/master/IR_nano_receive.ino+ 
 +[[https://github.com/mlivolsi63/Arduino-with-Infrared/blob/master/IR_nano_receive.ino | Code ]]
  
 Once you have everything running, go to your serial monitor and record the hex codes. Once you have everything running, go to your serial monitor and record the hex codes.
-WARNING: Each transmitter will be different. For my reference, the codes were as follows: + 
-Red +**WARNING**: Each transmitter will be different. For my reference, the codes were as follows: 
-0xC + 
-Yellow +^ Color ^ Code ^ 
-0x5E +| Red | 0xC | 
-Green +Yellow 0x5E | 
-0x4A +Green 0x4A | 
-Blue +Blue 0x42 | 
-0x42 +On 0x47 | 
-On +Off 0x43 | 
-0x47 +Brighter 0x45 | 
-Off +Dim 0x46 | 
-0x43 +Red Built in Effect 0x16 | 
-Brighter +Blue Built in Effect 0x19 | 
-0x45 +Green Built in Effect 0xD | 
-Dim +Bright White 0x1C | 
-0x46 +Cycle Colors 0x40 | 
-Red Built in Effect +Teal 0x15 | 
-0x16 +Orange 0x7 |
-Blue Built in Effect +
-0x19 +
-Green Built in Effect +
-0xD +
-Bright White +
-0x1C +
-Cycle Colors +
-0x40 +
-Teal +
-0x15 +
-Orange +
-0x7+
  
  
 Cool Feature: The sketch will give you the instructions on how to transmit Cool Feature: The sketch will give you the instructions on how to transmit
  
-Wiring the ESP8266+===== Wiring the ESP8266 =====
 {{:xmas:esp8266_wiring.png?800|}} {{:xmas:esp8266_wiring.png?800|}}
 +
 +Again EE people.. I know.. I know..byte me. Pin D6 transmits at 3.3V, and just putting that resistor seemed to keep the diode from blowing up. The transmitter is weaker than I’d like, but I’d rather protect it and it’s tolerable.
 +Programing the ESP8266
 +
 +“My pain is your gain”
 +
 +The ESP8266 will act as a web-server and an IR transmitter. 
 +The codely goodness can be found here:
 +https://github.com/mlivolsi63/Arduino-with-Infrared/blob/master/IR_nodeMCU_OPC.ino
 +
 +IF YOU DONT WANT TO READ THE COMMENTS BELOW, FINE.. BE LIKE THAT.. JUST REMEMBER TO CHANGE THE WIFI SID AND PASSWORD
 +
 +There are plenty of examples of running a web server on the NodeMCU, just some notes about the web aspect.
 +Xlights “talks” when using OPC on port 7890
 +The manufacturer of my unit (esp8266)  specifies a baud rate of 9600 bits.
 +OPC - Open Pixel Control
 +
 +Before writing the program above, ChatGPT gave me an example program to run on Linux as an OPC server. I took that code, tested it with Xlights,  and then modified it for the NodeMCU.
 +
 +There’s a good article about OPC here:
 +http://openpixelcontrol.org and it will explain the protocol.
 +Caveats:
 + Xlights will always send a command of 0 - so there’s no way to control that.
 +Data lengths should always be a multiple of 3. In my case, I specified 12, but I’m only using 3 bytes 
 +
 +{{:xmas:skull.png?50|}} Hack: Since I can’t send commands, the above code does the following:  
 +In the first set of RGB colors (the 3 integers), if the first int (red) is less than or equal to 5, that’s an instruction to turn ON the LEDS.
 +In the first set of RGB colors (the 3 integers), if the third (blue) int is less than or equal to 5, that’s an instruction to turn OFF the LEDS.
 +
 +===== Programing Xlights =====
 +
 +The Arduino script gave me the IP address, but you can also check your router for the IP address (dhcp).
 +**NOTE:** The message data size is 12, but I only configured 2 models, so I’m only sending 6 bytes in the message (see OPC protocol above)
 +
 +{{:xmas:xlights1.png?400|}}
 +
 +==== Mode Specification ====
 +
 +{{:xmas:xlights2.png?400|}}
 +
 +==== Sequencing:====
 +
 +In Xlights, I start the channel with a value of ‘1’ using the fade tool with a color of RED. This instructs the code to run the LED command to power on the floodlights
 +I end with a value of ‘1’ for color blue, which instructs the code to send an “off” command to the floodlights.
 +
 +
 +**Other thoughts**
 +
 +I should have added an LED to my box to give me a visual if I’m connected to the Internet. 
 +I created these tamponish looking devices to transmit to the RGB floodlights. I split the signal in two to control two flood lights (and that way, they’ll always be synched).
 +
 +{{:xmas:infrared.png?200|}}
 +
  
  
  
  
xmas/esp8266.1764540259.txt.gz · Last modified: by mlivolsi