• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

Mr Hacine

Q&A Forum › Category: Questions › Mr Hacine
0 Vote Up Vote Down
Hacine Benchoubane asked 4 years ago

Hello
Thank you for your books quality. I would like to know whether you have a project where:

  • we can remotely (through the internet) trigger outputs of an ESP8266 by a smart phone for example,
  • and receive informations on the ESP8266 GPIO state in the same smart phone used to trigger outputs
  •  So the link between ESP8266 and smart phone is bi-directional, we can trigger outputs and receive GPIO status.

Thank you so much.
Hacine
 

9 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 4 years ago

Hi Hacine.
When you say that you want the link to be bi-directional, are you referring to web socket protocol?
You can check the “Build Web Servers” eBook – it includes several examples of how to control GPIOs and update the state on the web page (using web sockets and other methods).
Regards,
Sara
 

0 Vote Up Vote Down
Steve Mercer answered 4 years ago

What you are requesting sounds exactly like MQTT. There are many tutorials on the RandomNerd site.

0 Vote Up Vote Down
Hacine Benchoubane answered 4 years ago

Hello, WebSocket is OK BUT I CANNOT CONTROL THROUGH THE INTERNET OVER A LONG DISTANCE. I need  a design that allows me to control a GPIO output of ESP8266 that is situated in another city for example by using the internet and at the same time having feedback. Exactly like WebSocket but with larger applications by using the internet.
 
Thank you.

0 Vote Up Vote Down
Steve Mercer answered 4 years ago

That is true. You would need to open your router as well as the router the ESP8266 is connected to which is not something most people want.
 
This is why I suggested MQTT. It’s a secure protocol to connect to a central broker (HiveMQ has an open source broker). Could you tell me why you don’t want to use MQTT?

0 Vote Up Vote Down
Steve Mercer answered 4 years ago

I do believe I forgot to mention that some cloud brokers provide web socket connections including CloudMQTT.

0 Vote Up Vote Down
Hacine Benchoubane answered 4 years ago

Hello,
 
I have absolutely no problem using MQTT. Can you please send me specific projects names using MQTT with HIveMQ so that I can test them  and use them ?

0 Vote Up Vote Down
Steve Mercer answered 4 years ago

I’m afraid I don’t have anything for you. Check the HiveMQ community forum.
 
Random Nerd Cloud MQTT tutorial recommends Digital Ocean which gives you a $100 credit to use for 60 days which you can cancel at any time. That tutorial has all the code you need to begin testing. The good thing about Digital Ocean is that you get a VM that can run Ubuntu (and maybe even Docker) which you can install a MQTT Broker as well as anything else you may want like a web server. Everything appears to be $5/month to start so dedicated brokers appear pretty expensive compared to Digital Ocean.

0 Vote Up Vote Down
Steve Mercer answered 4 years ago

I have been doing more research and you may want to try ngrok. Whilst MQTT is way cool and more extensible, if all you need is to connect via web sockets to one device then ngrok is one way to do it.

0 Vote Up Vote Down
Sara Santos Staff answered 4 years ago

Hi Hacine.
 
The “Extra” section on the eBook contains a chapter explaining how to do that using Ngrok. See page 583.
 
If you want to use Ngrok with a web server that uses WebSocket protocol, I recommend reading this discussion first: https://rntlab.com/question/rgrok-and-esp8266-webserver/
Basically, you need to use HTTP instead of HTTPS for the WebSocket protocol. Everything is explained on that thread.
 
I hope this helps.
Regards,
Sara

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [eBook Updated] Learn Raspberry Pi Pico/Pico W with MicroPython eBook – Version 1.2 May 26, 2025
  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.