Close

Hardware serial port monitor with WiFi

Back to overview

Arduino connects to the TX line (of a router, RPI) and display serial data on smartphone over WiFi

Discussions

ww.manchmal wrote 02/14/2017 at 06:40 point

Dear Frenky, thanx for sharing Your "brainware"! Can You please explain what the lua code "function newdata(serialData)" should do and when or where will this func be called? I  think, serial data coming from Ardu should be collected here?! Greetings from Germany, WolgaWibr

  Are you sure? yes | no

keshavadk wrote 05/10/2016 at 11:30 point

I have interfaced Arduino with ESP8266 wifi module and LCD. I want to send text from Webpage and it should get displayed on LCD. Can anyone please suggest me the arduino code and web code.

  Are you sure? yes | no

Johanescobar wrote 03/15/2016 at 21:59 point

How i will connect esp8266 oled and arduino?,  can u give us  wiring map? 

  Are you sure? yes | no

shekhar.sabale wrote 11/22/2015 at 10:11 point

sir please suggest me any other serial device or ic  which has serial port ...:-)

  Are you sure? yes | no

shekhar.sabale wrote 11/21/2015 at 13:11 point
sir i m getting"ESP8266 serial sniffer:"on my ip address...first arduino transmits "HII"properly..as i can see it on com port...i do all the connections..uploading code to the second arduino then lua code on esp without any error..but i still dont getting data on webserver..give me a direction..thank you

  Are you sure? yes | no

shekhar.sabale wrote 11/20/2015 at 13:32 point

okay sir ...:-)

  Are you sure? yes | no

Frenky wrote 11/20/2015 at 13:30 point

Try to understand what my code does. Because it works.
You code is totally different...

  Are you sure? yes | no

shekhar.sabale wrote 11/20/2015 at 13:06 point

what can i do now...?i m confused:-(

  Are you sure? yes | no

Frenky wrote 11/20/2015 at 12:58 point

Perhaps this will help? http://goo.gl/50yA6d

  Are you sure? yes | no

shekhar.sabale wrote 11/20/2015 at 12:35 point

error is like this:unprotected error in call to Lua API (init.lua:16:attempt to concatenate global 'encoder1count' (a nil value))

  Are you sure? yes | no

shekhar.sabale wrote 11/20/2015 at 12:09 point

hii sir ....code--

wifi.setmode(wifi.STATION)
wifi.sta.config("ELITE","rutujajoshi123%")
print(wifi.sta.getip())




if data=="encoder1count" then
    uart.on("data") 
    print("Received from Arduino:", data)
end 
srv=net.createServer(net.TCP) srv:listen(80,function(conn)
    conn:on("receive",function(conn,payload)
   --print(payload) -- for debugging only
    --generates HTML web site
    conn:send('HTTP/1.1 200 OK\r\nConnection: keep-alive\r\nCache-Control: private, no-store\r\n\r\n\
        \
        '..encoder1count..'')
    conn:on("sent",function(conn) conn:close() end)
    end)
end)  
i have connected one rotary encoder to the arduino...n then to to the esp...i m getting data arduino to esp and printing it in serial monitor bt i want it on webpage...as i send something stable value cnt=100 its showing on webpage when i connected encoder its printing on serial monitor bt not on webpage...i think continous data is being rejected by webpage...kindly give some suggestions...i almost reached thank you..;-)

  Are you sure? yes | no

Frenky wrote 11/18/2015 at 11:19 point

There is a better way to upload mysite.html. Copy the code in notepad. Save it as mysite.html. Then use "Upload File" option in LuaLoader to upload it to ESP: 

  Are you sure? yes | no

shekhar.sabale wrote 11/18/2015 at 10:37 point

i have uploaded this file i think this is ok..showing"s2.html:1: only one tcp server allowed"......one question sir for uploading html file is it another way or same like lua?..:-(..i have paste it in editor then save it as "s2.html' then write same in blank box below "upload file"..is it right way to download html file??

  Are you sure? yes | no

Frenky wrote 11/18/2015 at 09:51 point

mysite.html does not containt LUA code so you cant just execute it. It is used as a response string for web server.

Try to upload this code on ESP and tell me if it's working?

-- A simple http server
srv=net.createServer(net.TCP)
srv:listen(80,function(conn)
conn:on("receive",function(conn,payload)
print(payload)
conn:send("Hello, NodeMcu.")
end)
conn:on("sent",function(conn) conn:close() end)
end)

  Are you sure? yes | no

shekhar.sabale wrote 11/18/2015 at 08:44 point

i uploaded mysite.html code to the esp in lualoader when i did "dofie"it is showing error like "mysite.html:1: unexpected symbol near '<' "what is that exactly??

  Are you sure? yes | no

Frenky wrote 11/18/2015 at 08:21 point

When you open IP location in browser you should see a green text "ESP8266 serial sniffer:".

If you don't see that then there is something wrong with the code on ESP... Or the IP is wrong...

If you loaded NodeMCU then you probably have USBtoSerial adapter? Try running the following command on ESP:
print(wifi.sta.getip())

to see what is the IP of the ESP. Then reupload init.lua with the correct IP (in the first line of code).

And also check what is your gateway and netmask by running "ipconfig" in windows cmd. And correct that values in init.lua if needed.

  Are you sure? yes | no

shekhar.sabale wrote 11/18/2015 at 07:50 point

i have used  another arduino as serial device...which will send "hii"serially...

void setup() {
Serial.begin(9600); }



void loop() {
Serial.print("HI!");
delay(1000); }

then i  have connect 1) rx of first arduino to 11 pin of second arduino..and

2)tx of first arduino to 10 pin of second arduino

3)rx tx of second arduino to tx rx of esp respectively...

~first i programmed 1 st arduino with above program

then ~ second one with your serial code as you posted in comment

then ~ in esp firstly i set ssid and passward of my wifi then download your mysite.html code then init.lua code thats all i did it ...esp's blue light is being flickring but on obtained ip it doesn't show anything..plz help

  Are you sure? yes | no

Frenky wrote 11/17/2015 at 14:52 point

ESP should be connected to arduino's pins 1 and 2. Which are hardware serial port like this:


  Are you sure? yes | no

Frenky wrote 11/17/2015 at 14:48 point

No connections are not ok.

On the top of the arduino code are instructions:

RX is digital pin 10 (connect to TX of other device)
TX is digital pin 11 (connect to RX of other device)

The "other device" is the device tha you wan't to listen to.


  Are you sure? yes | no

shekhar.sabale wrote 11/17/2015 at 14:14 point

yes sir i did all of it...it doesn't work..connections are ok n??

  Are you sure? yes | no