极客工坊

 找回密码
 注册

QQ登录

只需一步,快速开始

【库和教程】ESP8266 WIFI模块实现远程wifi控制(持续更新)

  [复制链接]
发表于 2015-3-13 12:44:22 | 显示全部楼层
ITEAD创易工作室 发表于 2015-3-13 09:51
uno内存太小,ESP抓取的信息量太大。建议用mega

看了w5100和enc28j60的用法,把长串的字符分段打印这样就可以少占内存了,但是试过esp的库,分段打印不成,是否这个库还可以优化呢。
回复 支持 反对

使用道具 举报

发表于 2015-3-13 12:50:03 | 显示全部楼层
在坛子里遇到有几个和我一样的问题,UNO+ESP+Yeelink比较困难的,我的体会是否可以将esp直接挂软串,这样在程序下载是不必将串口腾空,这样debug也可以用硬串了。这个只是建议,不管如何ESP-WiFi性价比还是很好的。
回复 支持 反对

使用道具 举报

发表于 2015-3-13 13:01:24 | 显示全部楼层
我原来用的是UNO+W5100(也用过ENC28J60)+DTH22+BMP085上yeelink,看到ESP后认为WiFi会在使用上更方便,自由度更大,今天着手在移植,就是去掉W5100换成ESP8266,前面遇到的其他问题不说了,今天又遇到了使用BMP085需要加载wire.h,加载了Wire.h后程序编译不报错,运行也不报错,但是数据不上传,看到有个回应是AT+CIPSEND=0了(正常是241),想问楼长这个问题出在了哪儿了,是否资源上有冲突了,如何能绕过这个问题。
回复 支持 反对

使用道具 举报

发表于 2015-4-1 17:08:20 | 显示全部楼层
为什么我 mega2560  IDE1.05版本的 编译提示出错。。。。而且错误特别多

{bits= 0;}      说这句话就有错误,这是怎么回事啊?
回复 支持 反对

使用道具 举报

发表于 2015-4-2 12:58:04 | 显示全部楼层
按照楼主的代码和方式,用mega2560  IDE 1.05   串口显示器出现乱码(如图) 怎么解决啊

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x
回复 支持 反对

使用道具 举报

发表于 2015-4-2 22:51:29 | 显示全部楼层
例子每一语句代表的意思,,,不是看的很懂,,尤其是最后一个例子。。。有[i]是啥意思??等等,,要是全部注释,对像我这样的新手就很好了啊
回复 支持 反对

使用道具 举报

发表于 2015-5-8 09:25:11 | 显示全部楼层
我用uno连接esp8266,采用wifitest程序,并且修改了uno与esp8266通讯波特率为15200,把串口缓冲器加大,用D2 D3做软串口连接外部USB-TTL,监控发现显示AT+RST过10几秒显示Module have no response。这说明与模块通讯不上,请问这是怎么回事?
回复 支持 反对

使用道具 举报

发表于 2015-5-30 00:47:31 | 显示全部楼层
请教一下,用UNO板子上传温湿度,不改#define SERIAL_BUFFER_SIZE 500  时候还能debug到发送yeelink的api的地方。
如果修改了就直接卡死在AT+RST了,会是什么原因?
回复 支持 反对

使用道具 举报

发表于 2015-6-14 14:26:11 | 显示全部楼层
本帖最后由 brealisty 于 2015-6-14 14:27 编辑

楼主为什么编译提示debugserial not declare
回复 支持 反对

使用道具 举报

发表于 2015-6-14 20:54:37 | 显示全部楼层
崩溃了,,怎么改都只显示AT+RST。。。yeelink也没有任何数据
用的LM35,0模拟口读取温度。因为debugserial提示有错,所以改成了serial。麻烦帮看看啊~~~实在是感激不尽~~~!!!
#define SSID       "323"                //type your own SSID name
#define PASSWORD   "abc123abc123"                                //type your own WIFI password


#include "uartWIFI.h"
#include <SoftwareSerial.h>
WIFI wifi;

extern int chlID;        //client id(0-4)

// for yeelink api
#define APIKEY         "f9722******4d5fece00" //省略了

//replace the device ID and sensor ID for temperature sensor.
#define DEVICEID0       35782 // replace your device ID
#define SENSORID0       52997 // replace your sensor ID

char server[] = "api.yeelink.net";   // name address for yeelink API

unsigned long lastConnectionTime = 0;          // last time you connected to the server, in milliseconds
boolean lastConnected = false;                 // state of the connection last time through the main loop
const unsigned long postingInterval = 5*1000; // delay between 2 datapoints, 5s
String returnValue = "";
boolean ResponseBegin = false;


int LM35PIN=0;                        //Connect D25 to data pin of DHT11

int temperature;


void setup()
{

  wifi.begin();
  bool b = wifi.Initialize(STA, SSID, PASSWORD);
  if(!b)
  {
    Serial.println("Init error");
  }
  delay(5000);  //make sure the module can have enough time to get an IP address
  String ipstring  = wifi.showIP();
  Serial.println(ipstring);                //show the ip address of module

}

void loop()
{
  char message[400];
   // if you're not connected, and ten seconds have passed since
  // your last connection, then connect again and send data:
  if((millis() - lastConnectionTime > postingInterval)) {

  //read dht11
  int chk = lm35_read(0);
  if(chk==0)
  {

                sendData(DEVICEID0,SENSORID0,temperature);
        

  }

  }

  // if there's incoming data from the net connection.
  // send it out the Serial port.  This is for debugging
  // purposes only:
  if(wifi.ReceiveMessage(message))
  {
      Serial.println(message);   
  }


  delay(10);

}

// this method makes a HTTP connection to the server:
void sendData(int device_id,int sensor_id,int thisData) {
  // if there's a successful connection:
  if (wifi.ipConfig(TCP,server, 80)) {
    Serial.println("connecting...");
    // send the HTTP PUT request:
    String cmd;
        cmd = "POST /v1.1/device/";          //我的这里是1.1
        cmd += String(device_id);
        cmd += "/sensor/";
        cmd += String(sensor_id);
        cmd += "/datapoints";
        cmd += " HTTP/1.1\r\n";
        cmd += "Host: api.yeelink.net\r\n";
        cmd += "Accept: *";
        cmd += "/";
        cmd += "*\r\n";
        cmd += "U-ApiKey: ";
        cmd += APIKEY;
        cmd += "\r\n";
        cmd += "Content-Length: ";
        int thisLength = 10 + getLength(thisData);
    cmd += String(thisLength);
        cmd += "\r\n";
        cmd += "Content-Type: application/x-www-form-urlencoded\r\n";
        cmd += "Connection: close\r\n";
        cmd += "\r\n";
        cmd += "{\"value\":";
        cmd += String(thisData);
        cmd += "}\r\n";


        Serial.println(cmd);

    wifi.Send(cmd);
    // note the time that the connection was made:
    lastConnectionTime = millis();
  }
  else {
    // if you couldn't make a connection:
    Serial.println("connection failed");
    Serial.println("disconnecting.");
    wifi.closeMux();
  }
}

int getLength(int someValue) {
  // there's at least one byte:
  int digits = 1;
  // continually divide the value by ten,
  // adding one to the digit count for each
  // time you divide, until you're at 0:
  int dividend = someValue /10;
  while (dividend > 0) {
    dividend = dividend /10;
    digits++;
  }
  // return the number of digits:
  return digits;
}




int lm35_read(int pin)
{
  int data = analogRead(0);
  temperature = (125*data)>>8;
  Serial.print(temperature);
  return true;
}
回复 支持 反对

使用道具 举报

发表于 2015-6-29 11:25:08 | 显示全部楼层
ITEADLIB_Arduino_WeeESP8266-master库例子中,Serial1是定义了什么?
ESP8266 wifi(Serial1);这句啥意思?
回复 支持 反对

使用道具 举报

发表于 2015-7-3 19:12:09 | 显示全部楼层
请问楼主,我用STC80C58尝试写ESP8266的驱动文件,我将AT指令用串口发出(参照你给ESP8266库的设置过程),能是能连上网络,但是wifi串口调试软件不能连上ESP8266,你给的安卓遥控软件也不用连接,请问是什么回事
回复 支持 反对

使用道具 举报

发表于 2015-8-3 14:40:13 | 显示全部楼层

请问大家一个问题,我在测试 “(二)ESP8266 wifi模块上传数据到yeelink平台“ 的程序的时候,发生mega2560可以采集到温湿度传感器的数据,但是不能将数据传上yeelink的情况,这是为什么呢?有没有什么解决方案。串口数据如图所示,我使用的元件和推荐的一样。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x
回复 支持 反对

使用道具 举报

发表于 2015-8-4 10:23:55 | 显示全部楼层
各位大神,我在测试“(二)ESP8266 wifi模块上传数据到yeelink平台“ 的程序的时候,发现用版主的设备号和传感器号可以将数据成功传到网上,但是将APIKEY、设备号和传感器号换成自己申请的,就发现无法传到网上,这是为什么呢?哪位可以给我解答一下,急。。。。。,下图是串口反馈信息。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x
回复 支持 反对

使用道具 举报

发表于 2015-9-29 13:35:37 | 显示全部楼层
大神,想问下你分享的视频中,一键配置是怎么做的?求分享  谢谢
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则 需要先绑定手机号

Archiver|联系我们|极客工坊

GMT+8, 2024-5-3 06:16 , Processed in 0.056599 second(s), 26 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表