These are chat archives for esp8266/Arduino

9th
Jul 2016
Martin Ayotte
@martinayotte
Jul 09 2016 00:28
@mkeyno , BTW, I forgot to mentioned it earlier, why are you not using I2C ADC directly such as MCP3208 or ADS1015, you won't need any Arduino Mini ? How many inputs you need ? which resolution ?
Sven337
@sven337
Jul 09 2016 09:47
@martinayotte @mkeyno an SPI ADC is something to look at too, due to the lack of HW I2C support on ESP8266
also, hi everyone, I'm new here.
I'm trying to use setSleepMode(WIFI_MODEM_SLEEP), but I observe no reduction in power consumption. The SDK documentation suggests that it automatically sleeps. I am in STA mode. Any idea what could be wrong?
SteveToulouse
@SteveToulouse
Jul 09 2016 10:03
MCP3208 is SPI, unless I missed something
Ivan Grokhotkov
@igrr
Jul 09 2016 10:53
@sven337 isn't modem sleep the default mode when you are in WiFi.mode(WIFI_STA)?
So you need to compare with setSleepType(NONE_SLEEP) (don't remember the exact name of the constant)
Mehrdad K
@mkeyno
Jul 09 2016 11:00
Hi Ivan , can you please explain what is the benefition when we put the function in different section of ram (ICACHE_RAM_ATTR)
if it is due to speed , how much we get faster processing
Sven337
@sven337
Jul 09 2016 11:06
@igrr modem sleep is the default mode as far as I'm aware, yes. Going to NONE_SLEEP changes nothing at all to the current draw, so I suspect modem sleep isn't working automatically for some reason. I was wondering if anyone had investigated.
Mehrdad K
@mkeyno
Jul 09 2016 11:12
@martinayotte actually I intend to put weight of sensor reading and processing on Arduino part and keep ESP light to do web processing
Sven337
@sven337
Jul 09 2016 11:18
@igrr OK I think I got it - you need a delay() in loop(). Then, after a period of inactivity, the chip will automatically do something to wifi such that it still works, but responds to pings with greater delay, and power consumption does go down. 70mA->50mA -- far from what I expected, but better than nothing
you can observe it by pinging the module while it's in the modem sleep mode - you'll get your answers in ~300ms, then after a few pings you'll get them in ~3ms, that happens when the module leaves modem sleep
light sleep/modem sleep: same observation.
so I guess the conclusion is: always sleep in your loop if you want some power savings
andig
@andig
Jul 09 2016 12:33
@igrr could you give a hint what needs be done to compile aketch including lwip from the included sources? I'd like to play with the lwip debugging options to better understand the timeout. Also, do you know which lwip version is included by espressiv? It seems 1.4.1 has a number of fixes that will also improve 3G/slow network support.
Martin Ayotte
@martinayotte
Jul 09 2016 13:14
@SteveToulouse , yes MCP3208 is SPI, apologize, I have so many PDF in my Specs folder :-)
andig
@andig
Jul 09 2016 13:21
Found it: lwip is 1.4.0: https://github.com/esp8266/Arduino/blob/18f66e99693020a758b8f5ac92e042cbdecb7760/tools/sdk/lwip/include/lwip/init.h. Wondering if theres any chance for espressif to upgrade that to 1.4.1?
Ivan Grokhotkov
@igrr
Jul 09 2016 13:49
We have already updated it for the esp32 sdk. The plan is to update it for the ESP8266 in 2.0 release of the sdk. Sorry to say, I can not give any timeline for that release.
andig
@andig
Jul 09 2016 14:00
Anyway, good to know, thanks. I guess I can then stop my poking in the dark and treat the timeouts as known limitation of the 1.5 line. The chances are probably good this will be remedied by 2.0 then.
Sven337
@sven337
Jul 09 2016 14:25
@igrr: are you an Espressif employee? I didn't know. Cool!
Stavros Korokithakis
@skorokithakis
Jul 09 2016 14:31
hey guys
i'm trying to update my ESP OTA, and i'm getting "no response from device", even though i can ping it. i've never seen that happen before, what could be wrong?
Michael Miller
@Makuna
Jul 09 2016 14:33
@mkeyno ICACHE_RAM_ATTR puts the code in RAM, so when the code is going to be called it doesn't have to fetch it from flash first. Normally you don't care that much, but it can cause small delays due to fetching the code. So for ISR and time critical code it's required.
Martin Ayotte
@martinayotte
Jul 09 2016 14:41
@skorokithakis , do you a ArduinoOTA.handle() in your loop() ?
Stavros Korokithakis
@skorokithakis
Jul 09 2016 14:41
@martinayotte yes, the same code worked perfectly on another wifi network
i can discover it, mdns works, i can ping it
i wonder if it never reaches ArduinoOTA.handle() because the mqtt connection freezes
Martin Ayotte
@martinayotte
Jul 09 2016 14:43
That is possible, comment the mqtt. What are you seeing with the trace in onError() ?
Stavros Korokithakis
@skorokithakis
Jul 09 2016 14:43
i think that's it, actually
@martinayotte it's a pcb without a serial connection, so i'm trying to avoid plugging it in, hence all the OTA hassle :/
Martin Ayotte
@martinayotte
Jul 09 2016 14:44
In debug phase, it become troublesome ...
Stavros Korokithakis
@skorokithakis
Jul 09 2016 14:45
yes :/
Stavros Korokithakis
@skorokithakis
Jul 09 2016 14:51
ah yes, it's rebooting before it can't connect to mqtt :/
and mqtt has a .local or .lan domain, can i somehow override the lookup there?
dnsmasq to the rescue, address= overrode it
andig
@andig
Jul 09 2016 14:56
Maybe the async mqtt client could help you as well
Stavros Korokithakis
@skorokithakis
Jul 09 2016 14:56
@andig what's that?
based on what @me-no-dev has wonderfully prepared
Stavros Korokithakis
@skorokithakis
Jul 09 2016 14:58
oh wow
this looks fantastic
basically, mqtt is optional for this, so i want the esp to do a best-effort connect
which is hard to do with the synchronous mqtt client
andig
@andig
Jul 09 2016 14:59
Didnt try it yet but love the async web server, so give it a shot
Stavros Korokithakis
@skorokithakis
Jul 09 2016 15:04
i definitely will, thanks
Mehrdad K
@mkeyno
Jul 09 2016 15:05
thanks Michael @Makuna for your tip, as you may remember this related to question that I ask you earlier and intend to use some fast function to read data from flash and manipulate it , my loop so simple but have tight timing and normal function not work very well
Stavros Korokithakis
@skorokithakis
Jul 09 2016 15:06
@ivankravets could this library be added to platformio? https://github.com/marvinroger/async-mqtt-client i'm not sure what's necessary, but there is a library.json there, if that's what's required
Ivan Kravets
@ivankravets
Jul 09 2016 15:08
@skorokithakis this library is already added http://platformio.org/lib/show/346/AsyncMqttClient
Stavros Korokithakis
@skorokithakis
Jul 09 2016 15:09
@ivankravets oh, thank you, i did a search for "async" and it wasn't found, but a search for "mqtt" finds it
thank you
ah, "async" is not in the keywords, i see
Ivan Kravets
@ivankravets
Jul 09 2016 15:10
async in keywords :)
Stavros Korokithakis
@skorokithakis
Jul 09 2016 15:11
yeah, asyncmqttclient isn't in there
Ivan Kravets
@ivankravets
Jul 09 2016 15:15
you can use async*
Stavros Korokithakis
@skorokithakis
Jul 09 2016 15:17
will do, thanks
andig
@andig
Jul 09 2016 15:26
Gents, is platformio a better choice than arduino ide?
would be especially interested in parallel build and no rebuild unless changed?
And of course support for the esp8266 tools like the exception decoder and ota?
andig
@andig
Jul 09 2016 17:46
answering myself: platformio rocks. almost no issues and a speed deamon.
@igrr regarding unmounting spiffs before OTA: it would be helpful to know if the OTA updates sketch or filesystem. Could this be indicated in the onStart event as parameter?