It’s been a while since the last article and video about the ESP8266 but finally the article and video on how how to program QuinLED and then control it from your PC is here!
This post is part of a series
As is now quite common I’ve made a detailed video about how to flash, program and then control the board. I will type it out in text form in this article too, but being able to see how it works always works best in my opinion!
New boards designs coming soon!
Currently, all DirtyPCB links are down because of a change to their website, coincidentally we also moved to the new house and officially don’t have any internet yet which is why the FTP site is ALSO down. So currently there is no way to order boards.
I have been working on a slightly optimized and updated board design though. I already have the first “print” in and just need to make a few corrections to it before it can be released into the world. So hold on just a bit longer, I should have them available soon!
Programs, firmware and code ZIP file
I have uploaded an updated ZIP file which contains all the programs, firmware and code you are going to need to use QuinLED.
Click the giant icon below to start the download.
Since the last article I’ve acquired some convenient little USB adapters with a serial chip on-board which allow you to plug in and run an ESP-01 directly from your USB port. This saves a lot of time because you don’t have to fiddle with serial wires and such. Once you are done programming it, just plug it into a QuinLED board and you are done!
As can be seen in the video I have multiple of these little adapters of which I have modded one to always be in “flash mode”. That way I can very quickly flash an ESP-01, then plug it into a normal USB adapter, program it and them move it over to QuinLED.
*If you want more detailed instructions on how to use the flashing program, please look in the previous article (or watch the video)
Once you’ve flashed the ESP-01 you want to use on the QuinLED board (either using serial wires or the USB adapter) open up ESPlorer. You will need to have Java installed for it to work.
Connecting to the ESP-01
ESPlorer should automatically detect the COM port your ESP is connect to, if not, select the right port and click op “open”.
That should open the serial port and make the connection with the ESP-01 module. Hit the “heap” button (lower part of the window) a few times and see if you get a response back. Often the first and second time will be a bit of garbage but after that it should work.
Loading the needed code
I’ve prepared a “init.lua” file which holds the whole program needed to have the ESP-01 make a network connection and perform the dimming functions.
In ESPlorer click the open file button and load the “init.lua” file included in the ZIP file.
There is lots of code in there! In a general overview it’s structured like this:
- Default boot settings for all values
- WiFi settings (we will need to edit these)
- Network socket server
- Command interpret and PWM dimmer routine
That’s a very high level over view, but this series isn’t about programming!
Setting the correct WiFi network and password
In the code there is a line called:
This is the line we need to change to match the settings for your home WiFi network.
To change it edit the line to contain your WiFi network details such as:
Saving and running the code on the ESP-01
To save the code to the ESP-01, hit the “Save to ESP” button below the code screen. This will start the transfer of the code line for line to the ESP-01 module.
After that’s done, hit “Save&Compile” and when that completes hit the “Reset” button.
Now your ESP-01 will be running the new code and should be connected to your WiFi network!
Checking if everything works and finding the IP address
The code uses DHCP to ask an IP from the WiFi network. But which IP did the ESP-01 get?
Using the command:
The module will report back which IP it got. Try and ping it to see if you can reach it!
Now that programming is done, the next step is controlling QuinLED to dim your LED lights!
To control QuinLED I make use of a program called Netcat. This is a little tool which uses TCP sockets to send text data to another network device. In the case of my QuinLED code this is using TCP 43333.
There is no official way to install Netcat (or NC for short). Mostly I just dump the entire contents of the ZIP file (included in the ZIP file above) into a directory that’s in the path (such as c:\windows\system32). After that you can run the command from anywhere but just calling “nc.exe”.
Sending a dim command to QuinLED
In the ZIP file I have also included the command line way to send dimming commands to QuinLED!
It looks like this:
Fill in the correct IP number where it says IP.IP.IP.IP and try to see if the command works. If the ESP-01 receives the commands you should see some status messages scroll in the output window of ESPlorer.
If you did, that means everything is working and you are ready to connect the ESP-01 module to the QuinLED board. Or if it was already on there, you should have seen any connected LED strip dim to the desired value!
And that should be it, you now have a fully WiFi network controllable LED dimmer!
Next in this series is how to use the same setup and connect everything to Domoticz given it all a nice front-end and automation capabilities!