A place users can post their projects. If you have a small project and would like your own dedicated place to post and have others chat about it then this is your spot.

User avatar
By ShantanuJ
#51075
rom wrote:easiest way would be a GET Request from the Client every say 200-500ms. Answer with the ADC Value of the Potentiometer. Look for the TCP Server example and substitute conn:send(ADC_Value).



Hey. Thank You for your advise.

Actually, I have not established a Client-Server platform.

I have defined all end devices as servers. If I implement the Client-Server protocol, I will need to have an extra device acting as a server. Currently I have 2 WiFi modules. One has a Bulb to turn on and off. The other has a Potentiometer and a Led.

I am receiving the changed Potentiometer values from the POT. But for that I need to click a button (command from android) to receive the updated value of the POT. I do not want to do that. As soon as the value exceeds a threshold, I should get a notification.
I tried looping it inside a IF loop. But then the updated value just keeps on flashing on the Android screen. It needs to just Flash once saying "threshold crossed" and then stop.
User avatar
By rom
#51092 I would think about a simple TCP Connection with Socket, in your case TCPConnection Client in Java for your Android Phone and simply send the data raw to the phone, it needs to connect to the socket though.
You can't send from a server when there is no client connected to a socket.

I tried it already with this kind of connection and I got an example if you're interested. It works well but I couldn't send data back to the esp on a simple TCP Connection except with AT Firmware and a Telnet Connection.

So you have to connect with the Phone/Application to the ESP8266 server constantly because there is also a timeout on keep-alive connections of 1-5minutes, I'm not sure if it's settable to unlimited on both sides.
User avatar
By ShantanuJ
#51164 Ok Thank you. I will try that.
Also I am facing one more problem.

When I connect 1 NodeMcu v3 module and connect to the wifi, the Module gets one particular IP address. for eg. 192.168.21.220

But as soon as I connect another NodeMcu module on the same WiFi, the new module gets a proper IP address, BUT the 1st NodeMcu module looses its IP and changes to some weird IP address. Such as 192.168.2.209. The NETWORK address is also changing. How is that possible? Network address should not change.

And as soon as I disconnect the 2nd NodeMcu module, the 1st Module regains its original IP address of 192.168.21.220.

Super Confused!!
User avatar
By rom
#51797 The only thing you need to consider is: HTTP Get Data Transmission is tested for a very long time now and seems to work pretty good and reliable over long time spans. I don't know about mqtt implementation, just that there is a mqtt client library for the esp8266 sdk. I heard that people had problems with it so I avoided it to not get stuck into details.

I tested esp8266 for get transmissions to an android phone for up to 168000 bytes a second.(168kbyte/sec) It works without problems and connection problems. If you need to transmit more to an android device like 1mbyte or more(you risk to get slower speeds at greater range) then the only improvement(more of a hope) I see is mqtt server on android and client on esp8266, because there is no chance of upgrading ram on the soc. :)