zcbzjx 发表于 2012-11-18 08:15:47

通过Microduino相关模块上传随机数据到Yeelink

本帖最后由 弘毅 于 2012-11-30 20:40 编辑

发现Yeelink的又一个用法,就是可以测试联网产品,比如我昨天晚上我想测试Microduino的稳定性,咋个测嘞,想半天,最后用了这个方法。这次测试的模块为-328P、-FT232R、-ENC28J60、-HR911105A

图一 Microduino-组合图

图二 Microduino这次测试模块排队(正面)
图三 Microduino这次测试模块排队(背面)
求大家了,别拍砖我焊功,多鼓励我,我会焊得更好
图四 整体翻个个
Arduino代码如下:

#include
#define OUT
#define REQUEST_RATE 15000 // milliseconds
// ethernet interface mac address
static byte mymac[] = {
0x74,0x69,0x69,0x2D,0x30,0x31 };

// remote website name
char website[] PROGMEM = "api.yeelink.net";
char urlBuf[] PROGMEM = "/v1.0/device/XXXX/sensor/XXXX/datapoints";
char apiKey[] PROGMEM = "U-ApiKey: XXXXXXXXXXXXXXXXXXXXXXX";

byte Ethernet::buffer;
static long timer;

// called when the client request is complete
static void my_result_cb (byte status, word off, word len) {
Serial.print("<<< reply ");
Serial.print(millis() - timer);
Serial.println(" ms");
Serial.println((const char*) Ethernet::buffer+off);
}

void setup () {
Serial.begin(256000);
Serial.println("");
randomSeed(analogRead(0));
if (ether.begin(sizeof Ethernet::buffer, mymac) == 0)
    Serial.println( "Failed to access Ethernet controller");

if (!ether.dhcpSetup())
    Serial.println("DHCP failed");

ether.printIp("My IP: ", ether.myip);
// ether.printIp("Netmask: ", ether.mymask);
ether.printIp("GW IP: ", ether.gwip);
ether.printIp("DNS IP: ", ether.dnsip);

if (!ether.dnsLookup(website))
    Serial.println("DNS failed");
ether.printIp("Server: ", ether.hisip);

timer = - REQUEST_RATE; // start timing out right away
}

void loop () {
   ether.packetLoop(ether.packetReceive());
if (millis() > timer + REQUEST_RATE) {
    timer = millis();
    Serial.println(">>> REQ");
    static char buf;
    get_send_string(buf);
    if (!ether.dnsLookup(website))
      Serial.println("DNS failed");
    ether.printIp("Server: ", ether.hisip);
    ether.httpPost (urlBuf, website, apiKey, buf, my_result_cb);
}
}
void get_send_string(OUT char *p){
uint16_t Tc_100 = random(0,1000);
Serial.println(Tc_100);
uint8_t whole, fract;
whole = Tc_100/10 ;// separate off the whole and fractional portions
fract = Tc_100 % 10;
sprintf(p,"{\"value\":%d.%d}",whole,fract);
}

好久没玩Yeelink了,发觉device已经到了4位数了,会不会和QQ一样,我以前注册的2位的会升值嘞。
Yeelink作证,一个晚上都工作得很好,早上的断点是我拔下来拍照产生的。

图五 Yeelink显示Microduino工作得很好点这儿到Yeelink看实时状况

最后排了个简短视频:视频拍得很烂,轻拍,多鼓励。。。。。
http://v.youku.com/v_show/id_XNDc2NDY5MjY4.html

erjiang 发表于 2012-11-19 15:39:01

定,这套小玩意堪比kickstarter上面的同类项目了,加油,国产精品

弘毅 发表于 2012-11-19 16:10:39

:lol插上网线对比后。。确实小巧

ttyp 发表于 2012-11-19 16:38:42

测试稳定性的想法不错:lol

zx_1923 发表于 2012-12-7 16:53:06

谢谢张老师的帖子,又学习了不少啊

ranqingfa 发表于 2013-3-16 22:28:55

yelink不错啊看样子,俺也要玩玩

darkorigin 发表于 2013-4-29 21:49:08

你这个焊工都还有人来拍砖? 很不错的焊工了。呵呵
其实可以用酒精洗一下,之后简直就是标准的焊工啊

timberg 发表于 2013-4-30 08:41:06

楼主的传感器在工作吗?
看不到数据。

不知道是不是 yeelink 有问题,
注册以后不能登录,修改密码N次,都说登录密码错

timberg 发表于 2013-4-30 08:42:44

本帖最后由 timberg 于 2013-4-30 08:53 编辑

打算捣鼓 cosm.com 了
yeelink 还是不能上

zcbzjx 发表于 2013-4-30 18:47:39

timberg 发表于 2013-4-30 08:42 static/image/common/back.gif
打算捣鼓 cosm.com 了
yeelink 还是不能上

yeelink是可以上的,前几天还做了个关于灰尘和温湿度的小应用,可以加入它的群问问,貌似QQ群号为113978926
页: [1]
查看完整版本: 通过Microduino相关模块上传随机数据到Yeelink