• 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

Which concept for speed control?

Q&A Forum › Category: ESP8266 › Which concept for speed control?
0 Vote Up Vote Down
Ole Tidemann asked 4 years ago

Hi
I am attaching a speed control sensor to a GPIO on ESP8266 board for measuring speed on cars passing. It works. I want to read out the speed on my IPhone. Both are connected to my local network. The IPhone shall automatically be updated with the speed of the next car, when it passes. How do I do?  I have seen the videos Unit 1 and Unit 11 in module 4. They are good and Unit 11 works in practice, thanks. But I am unsure how to translate this into my target application? The main challenge is, that the cars are passing by asynchronously in time and not very often. I only want to update the IPhone screen, when a car is actually passing and I do not want to poll the ESP8266.
Conceptually, I would then think that the ESP8266 should be a client and then a webserver should be running on the IPhone. But then I think I need to have a (simple) server running on the IPhone. I have not found a good and simple concept for that. I have installed a very simple test http client on the ESP8266. It works. It is able to contact test servers on the internet, but I have not been able to establish contact to a simple 3rd party server running locally on the IPhone or a PC on the same network. And anyway, I kind of like the idea of the ESP8266 being the host (webserver) and then sending the simple HTML GUI to the IPhone like in the Unit 11 video. But again, then I do not know how to solve the automatic car initiated update, as least not in an beautiful way. Ideally, I would like the ESP8266 to stay in deep-sleep mode and then only wake up when a car comes by and generates some input on the sensor, but then I think that the ESP8266 must run as a client. And then we are back to the not so simple server issues on the IPhone. I do not want to use products like Home assistant etc.
 I would like to get some hints how to move on.
Best wishes, Ole

Question Tags: #WEBSERVER #CLIENT
1 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 4 years ago

Hi Ole.
 
Your issue is easy to solve.
 
The ESP8266 can be the web server, and a browser on your iPhone can be the client.
You just need to use server-sent events. Server-sent events are updates sent by the server to the client. The client doesn’t need to poll anything to the server. The server does that automatically. So, you can see the web interface being updated automatically.
 
We have this tutorial about server-sent events with the ESP8266: https://randomnerdtutorials.com/esp8266-nodemcu-web-server-sent-events-sse/
 
See if you can use that concept with your project. I think that is exactly what you are looking for.
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.