Close

Making two ESPs talk. One step closer.

A project log for Remote Control Mini Blimp!

Mini blimp flies through hoops! Features 3 DC motors/ propellers, battery charging, and wireless communication.

sophi-kravitzSophi Kravitz 12/17/2017 at 23:414 Comments

Today I connected a Feather (Adafruit's HUZZAH + some other niceties) with a giant red joystick. The joystick switches ON-OFF via 4 microswitches rather than proportional movement. That's OK, the motor drivers I've started out deliver an ON-OFF signal as well. All 4 switches work and have been tested using the onboard LED on the ESP8266 (on the HUZZAH). 

Working on making one ESP8266 (connected to joystick) talk to the other ESP8266 (connected to motors + blimp).  Found a project on Instructables to get started with. Now the motors are controlled by joystick :)

There's some massive lag here, not really sure why. 

Discussions

Paul Andrews wrote 12/21/2017 at 19:02 point

I like the sound of the ESP-NOW protocol, particularly if it avoids having to set up a router connection.

Having said that, I'm dubious that the lag is in the wifi communication (yes, it will introduce lag, I am just dubious that it would be noticeable). In my application I use web sockets to communicate between an ESP and a web browser running on my phone. I don't see noticeable lag.

Looking at the code on instructables, this line is particularly suspect:

  client.connect(server, 80);   // Connection to the server

It does that in the loop. This adds client connection setup time to any interaction. In addition the classes used are synchronous, which could impact the ability of your ESPs to do things other than communicate - they will either block loop() from being called for the duration of a message, or (if the method is called from within loop()) will block it from continuing until the message is sent or received.

You might look at using UDP for communication - it will avoid the TCP overhead. Just googling "esp8266 udp" turns up several examples that might be useful.

In addition you might also take a look at asynchronous implementations of these protocols. me-no-dev has developed asynchronous web server, web sockets, TCP and UDP (https://github.com/me-no-dev/ESPAsyncUDP). You can even use Alexa to control your blimp with these libraries and fauxmoESP (https://bitbucket.org/xoseperez/fauxmoesp) .

  Are you sure? yes | no

Jarrett wrote 12/21/2017 at 17:19 point

Oh yeah, I think I mentioned this in Hackchat, but for posterity:

The lag might be because of all the management frames and junk in the wifi communication. I think ESP-NOW might solve that:

https://www.youtube.com/watch?v=6NsBN42B80Q

It also removes the need for a router/access point.

More info:

http://espressif.com/en/products/software/esp-now/overview

  Are you sure? yes | no

Jarrett wrote 12/21/2017 at 17:17 point

Huzzah!

  Are you sure? yes | no

Ted Yapo wrote 12/18/2017 at 00:23 point

All the weight is in the controls!

  Are you sure? yes | no