ESP8266 Websocket communication

Contributors: Constantin Colac





Project Description

Hey folks, 

Our dear Sune discovered that ESP8266 supports websocket communication and told me to check it out. In short the main benefit of websockets is a crazy small latency of communications. My early tests showed a latency of 2-8ms. But the big issue I am having right now is that the NODEMCU seems to clug up after some time.

Anybody interested in joining me on this project?

Poject Updates

Update #1 - ESP8266 Websockets - The browser hijacked the electric motor

Constantin Colac
31 May 2016
1 year ago


Ok guys I finally have somthing to show you. After a few days of trial and failure I finally managed to control an electric motor with my browser.


A little about the setup

So what I have is a NODEMCU (ESP8266 board) that acts as a Wi-fi access point (hotspot) to which I connect with my computer. Then I use javascript to setup a websocket connection between my browser and the ESP unit. Once the connection it open I am sending (at staggering 2ms interval) the value of the html range slider to the esp. The esp then converts that into a PWM signal that is sent to the motor controller that controls the motor. 


The code that I used in the video (very dirty code):

The Farday Motion Source Code:

The roadmap

So far I have proofed that the websocket communication is lightning fast and quite reliable. The next step is to take our source code and implement the websockets communication there. After that we would have to implement the websockets on our ios and android apps. 


As always contributers are very much welcome! 


Update #2 - Integration with Core Code.

Constantin Colac
23 Jun 2016
1 year ago

I am glad to announce that I managed to integrate the async websocket communication protocol to the Faraday Motion Core Software. 


The results I got are quite impressive. I managed to get stable behaviour while sending messages to the ESP8266 and back to the browser at a rate of 15 miliseconds. The back and forth message sending has a latency of about 7 milisecond. It's great to see that we will be able to communicate with the spine 100 times faster then now. 

Now the time has come to do a live test. So the roadmap looks like this: 

  1. Update my Spine's NodeMCU with the Websocket feature.
  2. Serve a webpage that will intercept the phone's orientation and send the websocket command to the ESP8266 (more info)
  3. Go for a drive and see how it feels.

Sounds exciting right? More updates will come soon. Contributions and feedback is always welcome!


Hey guys. Tonight I will upload some videos of the working thing. Stay tuned..