These are chat archives for esp8266/Arduino

26th
Jul 2015
fhernand
@fhernand
Jul 26 2015 10:28 UTC
@Links2004 what are the pins for Serial1? And how can I find that out?
fhernand
@fhernand
Jul 26 2015 10:33 UTC
ok, so Serial is usually "UART0, which is mapped to pins GPIO1 (TX) and GPIO3 (RX)", and Serial 1 "uses UART1, TX pin is GPIO2." But what is the RX pin of UART1?
Markus
@Links2004
Jul 26 2015 10:34 UTC
not usable its used for the flash so Serial1 can only send data out (perfect for debugging messages)
fhernand
@fhernand
Jul 26 2015 10:34 UTC
makes sense, thanks
d-anders
@d-anders
Jul 26 2015 10:35 UTC
hi links, websockets work nicely for me
Markus
@Links2004
Jul 26 2015 10:36 UTC
:)
d-anders
@d-anders
Jul 26 2015 10:37 UTC
i was a bit naive and tried to send from a ticker interrupt and then in constantly crashed. but when i set a flag and sent from main loop everything worked well
fhernand
@fhernand
Jul 26 2015 10:37 UTC
In your client example, you call
void loop() {
    webSocket.loop();
}
Markus
@Links2004
Jul 26 2015 10:38 UTC
the ticker problem is normal, all blocking operations in there crashed.
yes?
d-anders
@d-anders
Jul 26 2015 10:38 UTC
yeah
i thought that the send might just be fast enough, but i guess it isnt
fhernand
@fhernand
Jul 26 2015 10:39 UTC
is the usage to send data something like this?
void loop() {
    webSocket.loop();
    webSocket.sendTXT("Test",4);
}
d-anders
@d-anders
Jul 26 2015 10:39 UTC
you dont need the 4
Markus
@Links2004
Jul 26 2015 10:39 UTC
@d-anders its not a timing problem, if yield is called it crash.
d-anders
@d-anders
Jul 26 2015 10:39 UTC
or maybe
sendtxt needs to know which client to send to fhernand, broadcastTXT sends to all
Markus
@Links2004
Jul 26 2015 10:40 UTC
@fhernand you will send many data in this case but yes it will work. the 4 is not needed for "strings"
webSocket.sendTXT is the client no broadcastTXT there
d-anders
@d-anders
Jul 26 2015 10:41 UTC
ahh, sorry
i think it is called sendTXT in the server as well
Markus
@Links2004
Jul 26 2015 10:42 UTC
the server need the id like: webSocket.sendTXT(id, "test");
yes, webSocket.sendTXT("test"); for the client
d-anders
@d-anders
Jul 26 2015 10:44 UTC
anyway, nice code links, i have not had a crash yet that has depended on the wsserver
Markus
@Links2004
Jul 26 2015 10:45 UTC
good to hear that :)
d-anders
@d-anders
Jul 26 2015 10:45 UTC
going to hook up a ds18b20 to it now
fhernand
@fhernand
Jul 26 2015 10:51 UTC

ok, I tried it out, I usually get this exception, for LoadProhibitedCause:
[SETUP] BOOT WAIT 4...
[SETUP] BOOT WAIT 3...
[SETUP] BOOT WAIT 2...
[SETUP] BOOT WAIT 1...
LmacRxBlk:1
LmacRxBlk:1
LmacRxBlk:1
[WSc] Connected to url: /
[WSc] get text: Test
[WSc] get text: Test
Fatal exception (28):
epc1=0x4021ba99, epc2=0x00000000, epc3=0x00000000, excvaddr=0x000000ca, depc=0x00000000
rm match
del if0
bcn 0
del if1
usl
sul 0 0

ets Jan 8 2013,rst cause:4, boot mode:(3,0)

wdt reset
load 0x40100000, len 29512, room 16
tail 8
chksum 0xba
load 0x3ffe8000, len 1532, room 0
tail 12
chksum 0x84
ho 0 tail 12 room 4
load 0x3ffe8600, len 6320, room 12
tail 4
chksum 0xc5
csum 0xc5
r‚

Markus
@Links2004
Jul 26 2015 10:52 UTC
what is your ws server doing?
simply echo?
fhernand
@fhernand
Jul 26 2015 10:53 UTC
yes, it's the one at echo.webserver.org
Markus
@Links2004
Jul 26 2015 10:53 UTC
k will try it.
fhernand
@fhernand
Jul 26 2015 10:53 UTC
sorry, wcho.websocket.org
echo.websocket.org
Markus
@Links2004
Jul 26 2015 10:58 UTC
working fine by me, witch version of ESP8266 and websockets do you use?
fhernand
@fhernand
Jul 26 2015 11:00 UTC
ESP8266: 1.6.4-673-g8cd3697
Markus
@Links2004
Jul 26 2015 11:01 UTC
the latest version is: 1.6.5-947-g39819f0 can you update?
fhernand
@fhernand
Jul 26 2015 11:03 UTC
ok, I will do that. Where can I see the version of arduinoWebsockets?
Markus
@Links2004
Jul 26 2015 11:03 UTC
only by the sha1 git hash
fhernand
@fhernand
Jul 26 2015 11:06 UTC
ok, I downloaded it as zip on July 20th. I will clone it instead.
Markus
@Links2004
Jul 26 2015 11:13 UTC
i did some more tests and sending in each loop to echo.webserver.org is a bit over kill, we also echo back in the event handler,
at some point the ESP tcp core is overloaded and stops the connection, but no crash.
d-anders
@d-anders
Jul 26 2015 11:19 UTC
if it keeps crashing maybe you should check your power supply fhernand
fhernand
@fhernand
Jul 26 2015 11:20 UTC
ok, right, I will check that
d-anders
@d-anders
Jul 26 2015 11:34 UTC
i ran mine using a cheap bench supply, but it was unstable
fhernand
@fhernand
Jul 26 2015 12:36 UTC
ok, updated esp8266, arduinoWebsockes and using a stable power supply now. It does not crash anymore. Thanks guys!
fhernand
@fhernand
Jul 26 2015 12:52 UTC

LmacRxBlk:1 happens sometimes. I implemented the solution to #50, but it still occurs. Excerpt from debug output:
[WS][0][sendFrame] ------- send massage frame -------
[WS][0][sendFrame] fin: 1 opCode: 1 mask: 1 length: 4
[WS][0][sendFrame] text: Test
:wr

:rch 24, 6

LmacRxBlk:1
LmacRxBlk:1
LmacRxBlk:1
:er -8 6 1

Markus
@Links2004
Jul 26 2015 13:39 UTC
yes thats the overload i write over. you send every loop a message, this message get echoed by the server and then goes to the event handler, there is it send back again, in the next loop you send a new message and you resive 2 new, this goes strait to over load. remove the echo in the event or send only one.
d-anders
@d-anders
Jul 26 2015 13:44 UTC
or add a delay after sending
Markus
@Links2004
Jul 26 2015 13:45 UTC
then the RX also is blocked
d-anders
@d-anders
Jul 26 2015 13:45 UTC
oh, i thought delay was non-blocking on esp8266
Markus
@Links2004
Jul 26 2015 13:46 UTC
its block the arduino task
and there the websocket is handled
d-anders
@d-anders
Jul 26 2015 20:10 UTC
watching an updating graph of my water getting called server over websockets - exciting stuff!
probonopd
@probonopd
Jul 26 2015 20:18 UTC
d-anders, how is WebSockets performance compared to HTTP POST requests?
d-anders
@d-anders
Jul 26 2015 20:22 UTC
havent tried using post or get
at the moment it is just updating every 2 seconds or so (using ds18b20)
for high freq stuff ws should be good though. no need to reestablish connection and no polling
d-anders
@d-anders
Jul 26 2015 20:27 UTC
with a quick sensor (or what you are getting data from) i guess you could easily do 100hz or so, but maybe @Links2004 knows?
probonopd
@probonopd
Jul 26 2015 20:28 UTC
i am trying to write a wifi-to-infrared remote control system and http seems too slow on the esp
it's not nice to wait for 2 secs after you have pressed a key
;)
d-anders
@d-anders
Jul 26 2015 20:28 UTC
websockets uste http as well
but keeps connection open
if you don't need to use a webinterface i guess you should go with raw tcp
probonopd
@probonopd
Jul 26 2015 20:29 UTC
yes, i wonder how much that improves things
d-anders
@d-anders
Jul 26 2015 20:29 UTC
a lot i guess
probonopd
@probonopd
Jul 26 2015 20:29 UTC
well i want a web interface for the remote control buttons
d-anders
@d-anders
Jul 26 2015 20:29 UTC
links websocket lib has worked perfectly for me
probonopd
@probonopd
Jul 26 2015 20:29 UTC
raw tcp is almost instant, i am using that too
only issue, the android devices i am targeting won't do websockets without additional software
d-anders
@d-anders
Jul 26 2015 20:30 UTC
?
sounds strange, old android?
i think newer android has websocket support in the browser
probonopd
@probonopd
Jul 26 2015 20:31 UTC
yes i am running android 2.3 and android 4
d-anders
@d-anders
Jul 26 2015 20:31 UTC
wow, 2.3 :)
probonopd
@probonopd
Jul 26 2015 20:31 UTC
embedded device, no chance to update
d-anders
@d-anders
Jul 26 2015 20:32 UTC
hm, if no websockets you have a slight problem
i guess you cant install any plugins either
probonopd
@probonopd
Jul 26 2015 20:32 UTC
i tink i could write a wrapper app
once i have time ;-)
d-anders
@d-anders
Jul 26 2015 20:34 UTC
what is it that you are trying to do?
probonopd
@probonopd
Jul 26 2015 20:34 UTC
on the tablet, have a html interface with buttons
when a button is touched, send a command to the esp
the esp will convert the command to an infrared remote signal
and switch channels on a tv, for example
ideally without much lag
d-anders
@d-anders
Jul 26 2015 20:35 UTC
ahhh, nice
probonopd
@probonopd
Jul 26 2015 20:35 UTC
actually the ui part hooks into a server
full of remote control codes
d-anders
@d-anders
Jul 26 2015 20:35 UTC
maybe skip the html
probonopd
@probonopd
Jul 26 2015 20:35 UTC
d-anders
@d-anders
Jul 26 2015 20:36 UTC
and do a java app on the tablet
these are easy to produce on the server...
from a crowdsourced database
d-anders
@d-anders
Jul 26 2015 20:37 UTC
you want the tablet (client) dumb ideally?
probonopd
@probonopd
Jul 26 2015 20:37 UTC
correct
d-anders
@d-anders
Jul 26 2015 20:37 UTC
yeah i can see why
too bad it doesnt support websockets then
no flash either i guess?
probonopd
@probonopd
Jul 26 2015 20:37 UTC
nope
probably i need to create a tiny app that basically just contains a webviw
and implement a javascript-to-android bridge for the sending function
(done that before with bluetooth)
d-anders
@d-anders
Jul 26 2015 20:38 UTC
not possible to root and update android?
probonopd
@probonopd
Jul 26 2015 20:39 UTC
possibly, but not sure. (don't like non-booting bricks)
d-anders
@d-anders
Jul 26 2015 20:39 UTC
right
probonopd
@probonopd
Jul 26 2015 20:40 UTC
but glad you like the websockets. will try them on the desktop
d-anders
@d-anders
Jul 26 2015 20:40 UTC
well, 1-2 secs lag is too much for a remote i guess. you will get unsure and send multiple commands
probonopd
@probonopd
Jul 26 2015 20:41 UTC
yes
d-anders
@d-anders
Jul 26 2015 20:43 UTC
is ch340 (usb->ttl) good for safe high baud rates?
i have a prolific but it is not completely stable flashing at bau rates >115200
and i just cant stand the wait anymore
probonopd
@probonopd
Jul 26 2015 21:10 UTC
silabs is
i can use the highest available baud rate for flashing reliably
921600
cp2102, still relatively cheap and never let me down
don't know about the ch340 (don't own one yet)
d-anders
@d-anders
Jul 26 2015 21:24 UTC
ok, i will try one of those