Controlling Lights via WIFI Access Point from an Esp8266 Web Server
TAGS: electronics; software; ESP8266; Arduino; WIFI Web Server
Why I Did This
I wanted to make an ESP8266 into a WIFI access point so that anyone who connects to it could control its webpage server; I figured that a fun example could be to control a string of holiday scenery lights (so any passerby stranger could change the flickering mode of the lights).
![](articleAssets\Access-Point-Web-Server-Esp8266-Control-Lights\Esp8266-Control-Lights_4.jpg)
Light mode control via local webpage.
Design Walkthrough
Parts: Arduino WIFI compatible microcontroller (Espressif Esp8266); SG90 servo; lights with mode contro
I've seen some tutorials that show you how to make controlled systems via html, but they
seemed to center on changing the webpage to a different one if I changed a settings; I
instead wanted to setup a system where the webpage just updated the same page statically, so
I tried ChatGPT's help. I used
the ChatGPT tool to help me generate the Arduino Esp8266 html code and control
functions. ChatGPT is neat tool for cutting through the logistics of googling for coding
tutorials, but it’s far from perfect. I had to ask and re-ask it many times to find me
proper html code for updating webpage integer values before I chose a different programming
direction.
The Esp8266 created an open WIFI access point that allowed a connected user access to the
192.168.4.1 webpage where they can click a button to activate the microcontroller’s servo.
The servo (which is attached beside the holiday light’s button to change modes) will rotate
its arm a few degrees to manually press the light’s button, thereby changing the light
display
mode.
![](articleAssets\Access-Point-Web-Server-Esp8266-Control-Lights\Esp8266-Control-Lights_1.jpg)
A servo is glued to the green/black light-control-box over the button.
![](articleAssets\Access-Point-Web-Server-Esp8266-Control-Lights\Esp8266-Control-Lights_2.jpg)
The webpage contains just a simple button for triggering the servo.
The system in action, switching light modes.
Lessons Learned and Future Changes
Servos are clunky. The servo can work, but it requires precise pre-positioning in order to work properly; otherwise, if you reset the microcontroller it can automatically rotate towards the button and freeze. It would be better to open the light’s control piece (near the button) and wiring a jumper line from the button to an Esp8266 I/O port, then program the same effects as clicking the button.References
ChatGPT AI tool: https://chat.openai.com/