Example sketches for the new Arduino IDE for ESP8266

Moderator: igrr

User avatar
By muhammadumar6692
#85135 Hy Guys!

Hope all of you are fine. I have started a Project for Remote Control of my TV using Server-Client Techniques, as I have 2-TVs of Same Brand, Controlled with their own Remote & as well as a Single Remote as those are of same Brand. I have created an ESP8266 Access Point, from which I can send the Commands to other connected 2-ESPs (ESP-01) & the ESP-01 is Placed in front of each TV, so that I can send Control Command from my Phone/PC Web Browser to Server (The NodeMCU) & then NodeMCU Broadcast that Received Command to the other 2 ESPs (ESP-01). The Created Access point is Accessible by both ESP-01 & both are connected with NodeMCU Access Point. Now, I am facing Issues with Sending/Broadcasting the Specific Commands from NodeMCU Server to both ESP-01 Clients, so that both can Read the Command & can perform the Specific Task.

Any Help can be Appreciated.

Thanks in Advance.

Regards,
Muhammad Umar
User avatar
By btidey
#85149 One simple way is to set up a web server on each esp-01 that are listening for url requests containing the command to be actioned. The NodeMCU acts as AP, plus web server to receive the original requests. It then runs a client to pass on request to each ESP-01 sequentially.

This fits in with the normal web model that actions are originated by a client.

Another way would be to run a mqtt broker + message publisher on the NodeMCU and make each ESP-01 a MQTT message subscriber subscriber.
User avatar
By gregBaker
#87541 muhammadumar6692
If you are you still interested in DIY ESP "TV-Hubs" via ESP8266, I have built one myself. Here is a brief intro discussion document:

DIY ESP8266 TV Hub

I built a “TV remote controller” targeting both my Roku-4 connected to an old (dumb) Dynex TV via HDMI, as well as a newer TCL Roku Smart TV with a Polk sound-bar. Both systems are in different rooms but still on the same in-house WiFi network. The design uses an HTML web page as a remote controller served up by one of two TV-hubs. Each hub interfaces the end devices - TVs, Roku and sound-bar, via the in-house WiFi network. Two ESP8266 nodeMCUs are used as theTV-hubs, one for each TV setup due to their separate locations and their IR requirements. The simulated remote interface is simply an HTML/javascript based web page usable on all of our devices - computer, tablets and mobile phones.

Purpose: We [my wife and I] are old. She sees very poorly and often forgets how to navigate the Roku content via the myriad of physical remote - two Roku remotes, a Dynex TV remote and a Polk sound-bar remote.

Goals: Visually big remote-like UI with an additional ‘drop-down-menu’ for Roku favorite App selection/launching. Additionally, the hubs support voice commands from a nearby Alexa device.


Problem: After prototyping, Alexa posed a design limitation when using direct in-house WiFi network connection (vs. “AWS” skill technologies) to talk to the TV-hubs. For the Alexa to ESP8266 communications, I used a common development library, fauxmoESP, which limits the ESP’s number of end-points (an ESP8266 memory limitation) to only a few direct connections; I wanted near one hundred end-points in all.

Solution: I used only one end-point on each ESP8266 to mimic a ‘dimmable light’ device and used the ‘percent’ value , 0-100, as a sketch coded switch providing one hundred hub commands each. The drawback to this approach is the Alexa voice command that turns out to be something like “Alexa, set endpoint to 77,” a bit cryptic and awkward to say the least.

But wait! Alexa provides a solution to this problem in the form of ‘voice- controlled routines.’ Routines are integral to Alexa to provide custom voice controls for one or more device actions.
Example: “Alexa, livingroom on” ==> “Alexa, set endpoint to 77”

This method allows Alexa to mimic all twenty remote controller page buttons - on, off, mute, left, back, louder, softer, ...etc., and more with simple sayings like “Alexa, livingroom softer” for a TV setup independent volume down control.


Technologies:
- HTTP Async server
- Web sockets for remote controller page and TV-hub - HTTP ECP and IR controls with Roku and TVs
- TCP/UDP Alexa connections for voice control

Network Based Maintenance:
- Web based remote monitor for ESP
- SPIFFS management; upload, download, delete, ...
- Sketch image upload and ESP reboot


So, if this type of thing still interests you, let me know.; we can discuss such.
Greg.