我用的micropython,写了一个小程序,定时把mcp9808的温度数据发送到我的服务器上做温度监控。
我写了一段每隔5分钟deepsleep然后工作个10s钟这样。
然后,最可恨的是,半夜一点钟左右开始掉线(为什么就是在马上要睡觉前掉呢?) 8266实际上依然每5分钟reset一次,但是连不上网!必须断电~~~~
今天更猛了,断电重启一会也掉线~~~~~为啥啊~~必须换芯片了么?8266便宜啊~~
离线
可能是供电问题,或者是程序问题触发了wdt复位。
我换一个电源试试,wdt在mciropython环境下怎么能给他干掉?
离线
估计不是硬件问题,micropython对wifi支持的不太稳定,我的esp32温度采集用arduino做的已经稳定运行几个月了,https://kekemuyu.com/device
我改arduino试试
离线
估计不是硬件问题,micropython对wifi支持的不太稳定,我的esp32温度采集用arduino做的已经稳定运行几个月了,https://kekemuyu.com/device
个人网站还要ICP备案呢?~~~~?
离线
估计不是硬件问题,micropython对wifi支持的不太稳定,我的esp32温度采集用arduino做的已经稳定运行几个月了,https://kekemuyu.com/device
跑着呢,看看明天啥情况。是不是arduino更稳定一些。
离线
估计不是硬件问题,micropython对wifi支持的不太稳定,我的esp32温度采集用arduino做的已经稳定运行几个月了,https://kekemuyu.com/device
新情况出现,在auduino IDE 中 ESP.deepsleep, MQTT服务器接收不到任何信息,注释掉后用delay 就没事请,反复实验发现就是 ESP.deepsleep的问题。
离线
void loop() {//主循环
String msg = "";//用于存放
reconnect();//确保连上服务器,否则一直等待。
client.loop();//MUC接收数据的主循环函数。
client.setServer(mqtt_server, port);//端口号
client.setCallback(callback); //用于接收服务器接收的数据
while (Serial.available() > 0)
{
msg += char(Serial.read());
delay(2);
}
int msglen = msg.length();
if (msglen > 0)
{
Serial.println(msg);
char msgArr[msglen+1];
msg.toCharArray(msgArr,msglen + 1);
client.publish(topic_name,msgArr);
}
Serial.println("wake up MCP9808.... "); // wake up MCP9808 - power consumption ~200 mikro Ampere
tempsensor.wake(); // wake up, ready to read! // Read and print out the temperature, also shows the resolution mode used for reading.
Serial.print("Resolution in mode: ");
Serial.println (tempsensor.getResolution());
float c = tempsensor.readTempC();
Serial.print("Temp: ");
Serial.print(c, 4); Serial.print("*C\t");
delay(20000);
Serial.println("Shutdown MCP9808.... ");
tempsensor.shutdown_wake(1); // shutdown MSP9808 - power consumption ~0.1 mikro Ampere, stops temperature sampling
Serial.println("");
delay(200);
char temp[25];
dtostrf(c,3,3,temp);
client.publish("register",MAC_char_STA);
client.publish(MAC_char_STA, temp);
Serial.println(MAC_char_STA);
// ESP.deepSleep(20e6);
}
离线
好了,原因找到了,没加delay(XXXX)
等一会就好了。
离线
估计不是硬件问题,micropython对wifi支持的不太稳定,我的esp32温度采集用arduino做的已经稳定运行几个月了,https://kekemuyu.com/device
效果不错,至今为止都还可以接受。而且arduino的库很多啊,开发也很简单~!!!!
离线
新增情况,D1 mini模块 8266 掉线~会不会是设备多了,家庭路由器顶不住了?
离线
家庭路由器,接触的终端一多就不行,有点中终端设备掉线现象,正在研究mesh,最后一个怎么连到网络上呢?
离线