element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Arduino
  • Products
  • More
Arduino
Arduino Forum ESP8266 as an IOT style device
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Arduino to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Verified Answer
  • Replies 6 replies
  • Answers 1 answer
  • Subscribers 391 subscribers
  • Views 874 views
  • Users 0 members are here
  • arduino iot
  • esp8266
Related

ESP8266 as an IOT style device

theresajayne
theresajayne over 5 years ago

I have been racking my Brain on how to implement what i am looking to use. Obviously I am using Arduino rather than any of the Node MCU Lua etc,

What I am after:

 

It will be controlling a machine that I have buttons for but also I want to have an APP on a phone that can control it from anywhere.

 

I can program Android so that is not a problem and I can have PHP on the web as an api interface.

 

The Process would be as follows, Device is not paired, It goes into server mode and announces its own SSID, The app would connect to this and would (like an alexa) allow entering of local Wifi credentialsonce it is connected then it will connect to the remote server and register itself along with the APP id so that this device can only be controlled by this current device.

In the case of losing internet the device will try say 10 times at ever growing times and if it still does not connect it will again go into connect mode, however if the device has already registered on the php server then although any app can enter credentials it will revert to the id of the master controlling app when reconnected.

 

The problem i have is how do i allow the app "using http/s" to instant control the device, I need an almost 0 latency response, someone has suggested make the ESP do a get from the server and when it times out reget, so as soon as the message comes in from the app it can respond, part of the mechanism is an up / down linear actuator and if it doesnt stop in time the carried items could be damaged so I need this level of control possibly from across the globe.

 

How would be the best way to implement this connectivity and is there any hidden clever way of doing this sort of client-server-client connectivity.

  • Sign in to reply
  • Cancel

Top Replies

  • Sean_Miller
    Sean_Miller over 5 years ago +4 verified
    When I need a low latency, "virtual wire" as in the case of replacing an RC transmitter, I go with the Xbee platform . But, for IoT where I just need a couple of pins per device such as for Home Automation…
  • BigG
    BigG over 5 years ago +1
    Suggest trying PubNub, if latency is important. There's an Arduino library out there. Alternatively, look at Google's Firebase. Good for mobile app linkage. Quite a few Arduino libraries for Firebase out…
  • shabaz
    0 shabaz over 5 years ago

    Hi Theresa,

     

    As I understand (I may have misunderstood) after the initial configuration (using the ESP8266 as a WiFi access point with web server, and a local handset connecting as a WiFi client to it), any subsequent commands are to be sent from anywhere in the world, from a mobile app, through a server in the cloud, i.e.   handset->cloud service->ESP8266.

    In that case, there's no way to have almost zero-sec latency, because the path is outside of your control. There are network delays in each leg, as well as server delays in the cloud (for the packet to get inside the OS and into the app, as well as the time for the app to get CPU cycles or be started up (depending on the cloud service you're using) plus any circuit connection set-up delays if you're using mobile for any leg (applies to other mediums too, not just mobile). Keeping the TCP connection open as you're suggesting I think, could be an option, but it still won't be anywhere near real-time if you're controlling moving machinery. The modern way to resolve this is to have local intelligence so that the ESP8266 (or any other device) can autonomously decide to take over and make a decision to stop the actuator.

    That may require a device with higher compute performance and different or more sensors. Along with all of that comes other issues to be considered, e.g. reliability, redundancy, etc.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
  • BigG
    0 BigG over 5 years ago

    Suggest trying PubNub, if latency is important. There's an Arduino library out there.

     

    Alternatively, look at Google's Firebase. Good for mobile app linkage. Quite a few Arduino libraries for Firebase out there too.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • theresajayne
    0 theresajayne over 5 years ago in reply to shabaz

    Sort of, the idea is that to start the "IOT" device is in host mode, and is used to connect and then the device switches to Client mode connecting to the house wifi and talking to the master server on the interwebs

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • shabaz
    0 shabaz over 5 years ago in reply to theresajayne

    Hi Theresa,

    I see; yes, that's as I expected. The information above applies to this scenario. As BigG suggests, there's some frameworks you can run on the local hardware (e.g. ESP8266) to provide you with local control capability. Similarly, there's AWS GreenGrass, but it needs a more powerful device running Linux.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Sean_Miller
    0 Sean_Miller over 5 years ago

    When I need a low latency, "virtual wire" as in the case of replacing an RC transmitter, I go with the Xbee platform.

     

    But, for IoT where I just need a couple of pins per device such as for Home Automation, I go ESP8266 as you are thinking.  It definitely has latency, but under a second typically.  It feels darn near immediate when just sending a web socket command on the LAN.

     

    Here you will find code for the ESP8266 to catch Web Socket commands with the IoT platforms IFTTT, Push Bullet, and Alexa:

    Home Automation Mojo You Must Know Part 2: Notification

     

    Here you will find code for handling direct Web Socket communication back and forth across different devices:

    Episode 376: 4D Gaming with the MATRIX Creator (overview video)

    4D IoT Game Engine Blog (circuits and code blog)

     

    These blogs may seem a little daunting, but they cut through about 40+ hours of research to get working socket code for the ESP8266.  The code and circuits are good to have in Maker's IoT tool kit.

     

    See ya',

    Sean

    • Cancel
    • Vote Up +4 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
  • clem57
    0 clem57 over 5 years ago

    theresajayne Cannot give specifics, but I like this https://www.instructables.com/id/GETTING-STARTED-WITH-IoT-With-ESP8266-MicroControl/  which can give you the overview perceptive. Hope that helps.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube