为了准备2021硕士申请,我对一些喜欢的项目做了一些调查,并汇总在这里。
To prepare for my master’s application in 2021, I did some research on some of my favorite projects and summarized them here.
排名来源:QS2020, USNews2020, 上海交大2019,csrank.global.2010-2020
四个排名代表四种视角(QS->英国,USNews->美国,上海交大->中国,csrank->cs专业贡献)
以下信息部分摘自互联网,可能有错误!!
QS
: 9USNews
: 20上海交大
: 23csrank
: 73
申请模式:
两个志愿,录取时可以看到你的第二志愿。一年只能提交一次申请。
£33,250
条件
案例
£32,500
条件
QS
: 8USNews
: 21上海交大
: 15csrank
: 50
申请模式:
可以申请多次。申请由授课老师处理,不同院系不互通。
£28,530
条件
案例
£30,400
条件
QS
: 20USNews
: 28上海交大
: 31csrank
: 33
-
条件
案例
-
条件
QS
: 14USNews
: 23上海交大
: 13csrank
: 7 (参考清华8)
$56,550
条件
案例
$58,586
条件
QS
: 48USNews
: 82上海交大
: 95csrank
: 1
$50,100
条件
案例
QS
: 18USNews
: 7上海交大
: 8csrank
: 15
条件
QS
: 11USNews
: 34上海交大
: 67csrank
: 16
S$5,350.00
条件
条件
条件
QS
: 11USNews
: 43上海交大
: 73csrank
: 53
S$58,000.00
条件
S$3,350.00
条件
QS
: 29USNews
: 18上海交大
: 24csrank
: 18
12-24
月40
万/年条件
QS
: 6USNews
: 25上海交大
: 19csrank
: 10
条件
20-30
万
QS
: 18USNews
: 45上海交大
: 78csrank
: 28
20-30
万条件
Ranking Source:QS2020, USNews2020, ARWU2019,csrank.global.2010-2020
The four rankings represent four perspectives (QS->UK,USNews->US,ARWU->China,csrank->cs Industry)
The following information section is taken from the Internet and may contain errors!!
QS
: 9USNews
: 20ARWU
: 23csrank
: 73
Application mode:
Two choices. You can see your second choice when you are admitted.Applications can only be submitted once a year.
£33,250
Condition
Case
£32,500
Condition
QS
: 8USNews
: 21ARWU
: 15csrank
: 50
Apply Method:
You can apply multiple times.The application is handled by the instructor and is not interchangeable between different departments.
£28,530
Condition
Case
£30,400
Condition
QS
: 20USNews
: 28ARWU
: 31csrank
: 33
-
Condition
Case
-
Condition
QS
: 14USNews
: 23ARWU
: 13csrank
: 7
$56,550
Case
$58,586
Condition
QS
: 48USNews
: 82ARWU
: 95csrank
: 1
$50,100
Condition
Case
QS
: 18USNews
: 7ARWU
: 8csrank
: 15
Condition
QS
: 11USNews
: 34ARWU
: 67csrank
: 16
S$5,350.00
Condition
Condition
Condition
QS
: 11USNews
: 43ARWU
: 73csrank
: 53
S$58,000.00
Condition
S$3,350.00
Condition
QS
: 29USNews
: 18ARWU
: 24csrank
: 18
12-24
months400,000 RMB
/yearCondition
QS
: 6USNews
: 25ARWU
: 19csrank
: 10
Condition
QS
: 18USNews
: 45ARWU
: 78csrank
: 28
Condition
将blog从Typecho迁移到了Hexo。
Migrated blog from Typecho to Hexo.
]]>拜读了毛主席的实践论和矛盾论,第一次系统地接触了辩证唯物论这一方法论,深感其强大与自然。综合我自己先前的所经所悟,提炼出认知派生这一观点。
After reading Chairman Mao’s theory of practice and contradiction, it was the first time to systematically come into contact with the methodology of dialectical materialism, and I deeply felt its power and nature. Combining my own previous experience and understanding, I refined the view of cognitive derivation.
从巴甫洛夫的狗铃实验[1],到上世纪50年代费斯汀格的认知失调理论[2],再到1971年津巴多教授主导的斯坦福监狱实验[3],这一系列打破预期的心理学生理学实验,一步一步揭示出,人们心理的作用形式,似乎并非大多数人所认为的那样。实际上,这看似重大的心理学发现,其实早在两个世纪前,便已被马克思,恩格斯等人从社会学角度提出,并完善成为理论。后经列宁,斯大林等人通过实践进行完善。传入国内后,被毛泽东所集大成,结合了中国传统文化的底蕴,发展成为唯物辩证法的毛泽东思想。这一论理的形成,源自于这些人对自己所观察到的社会现象以及自己基于论理所实践的社会运动的归纳总结。而这一论理,又指导了中国共产党建国,扎实地完成国内资本原始积累地奇迹。
辩证唯物论是一套自洽的方法论,它能够有效地指导我们生活实践,从实践中总结论理,再将论理运用于实践的过程。而这一循环的高效运转,正是人类进化出认知的终极意义。
方法论是一种十分有效而重要的工具,它为人们提供了一套范式(习惯),帮助人们更有效地践行“社会实践->认识->论理->社会实践”这一模式。
[1] 巴甫洛夫 - 维基百科
[2] 認知失調 - 维基百科
[3] 斯坦福监狱实验 - 维基百科
From Pavlov’s dog bell experiment[1] to Festinger’s cognitive dissonance theory in the 1950s[2], to the Stanford prison experiment led by Professor Zimbardo in 1971[3], this A series of psychology students’ physical experiments that broke expectations reveals step by step that the role of people’s psychology does not seem to be what most people think. In fact, this seemingly important psychological discovery was actually put forward by Marx, Engels and others from a sociological point of view two centuries ago and perfected it into a theory. Later, Lenin, Stalin and others improved it through practice. After being introduced to China, it was collected by Mao Zedong, combined with the heritage of Chinese traditional culture, and developed into Mao Zedong’s thought of materialist dialectics. The formation of this theory stems from these people’s summary of the social phenomena they observe and the social movements they practice based on the theory. And this reasoning guided the founding of the Communist Party of China and solidly completed the miracle of domestic capital accumulation.
Dialectical materialism is a set of self-consistent methodology, which can effectively guide our life practice, conclude the theory from practice, and then apply the theory to the process of practice. The efficient operation of this cycle is precisely the ultimate meaning of human cognition.
Methodology is a very effective and important tool. It provides people with a set of paradigms (habits) to help people practice the model of “social practice -> knowledge -> theory -> social practice” more effectively.
[1] 巴甫洛夫 - 维基百科
[2] 認知失調 - 维基百科
[3] 斯坦福监狱实验 - 维基百科
分享一下改进版炸鸡块做法哦~
Share the improved version of fried chicken nuggets~
之前去欧洲旅游办签证,由于没有三个月的银行流水,不得已购买了旅行支票作为资金证明。可是到了欧洲才发现旅行支票很难使用,如果不了解行情会被骗收15%-20%的手续费。这篇Blog记录了我们发现的兑换旅行支票的坑和Tips!
Before I went to Europe for a tourist visa, I had to buy a traveler’s cheque as a proof of funds because I did not have a three-month bank flow. However, when I arrived in Europe, I found that traveler’s cheques were difficult to use. If I didn’t understand the market, I would be defrauded of 15%-20% handling fees. This blog records the pits and Tips we found in redeeming traveler’s checks!
[scode type=”info”]经验一: 尽可能不使用旅行支票[/scode]
[scode type=”info”]经验二: 旅支兑换最低手续费在4%左右[/scode]
若不想看经历,可直接调至文末兑换旅行支票的Tips处哦!
圣诞假和室友一行四人一起DIY游欧洲,去了意大利和奥地利两个国家,共5个城市。由于英国的银行卡还没有使用到三个月,无法通过打印流水来办签证,我们选择了另一种方法—购买American Express的欧元的旅行支票。殊不知啊,兑换和使用旅行支票真真是一个大坑。
最开始据旅行支票的官网上所说,欧洲很多城市的店铺里都能直接使用旅行支票,照这样来说,旅游时花掉它肯定比回英国后把它换回英镑划算的多(换回英镑的过程需要损失8%)。然鹅,出发前我们通过看他人的游记发现,欧洲现在很多店都无法直接花旅行支票(按我们后来实际旅行情况来看,只在威尼斯的好几家店看到了旅行支票的标识),于是我们决定去了就在机场红色标识的Change那里将它们全数换成欧元。
可到了第一站罗马找到了红色的Change后(如图),却发现700欧元只能给我们590多欧元。这可真的亏的不是一丁半点儿。我对象现场查到了American Express的电话,打过去发现人家现在在意大利没有设点,不过对方建议去银行换,说是可以毫无亏损(注意这也是个坑,,,)。由于有两人已经换了,为了止损,我们决定先不换剩下两人的700欧旅行支票,留着去银行换。
到了第三天,我们去了梵蒂冈那块儿玩,顺便去了附近American Express工作人员推荐的银行,还给中国银行打电话,结果均被告知不接受旅支。这可咋整?
这时刚好发现梵蒂冈周围有一堆change,于是又去问了问报价。其中有一家本来只报590多的,听见我们说另一家给了610多的价,说他们能给我们一个student discount,然后还算了算,报了个640。这下可好,我们开始发现这里面的门道了:其实哪有什么折扣,不过想找个借口吸引你罢了。这些change都是盈利性质的,你把旅支给了他们,他们再通过自己的途径卖给别的地方的American Express,中间可能有一点税收,但只要他们以比扣掉税收低的价格从你这里买下,他就一定能赚(一般还赚不少),不过是多赚点少赚点的区别罢了。而且当地有好几家change,我们主要发现了红色change标识的一家和蓝色的一家。若这家嫌你要求高不接受,那钱就让别家赚了呗。
所以这种时候,我们要想拿到高点的报价,就要掐准人家能接受的度(真的逼太狠了断了人家财路那就没辙了呀),然后通过让他们产生危机意识而提高报价。可以先问个几家,看他们一般会给多少,然后跟他说,别家给我了一个多少的价格。接下来这人可能就会开始打电话给上面的看能给个什么更高的价,叭叭一堆后给你一个略高一点的价格哈哈,你如果不太满意,可以再去找一家问问(不过要注意,如果是同一家的不同店面,要稍微注意点,毕竟他们上面的人可能是一个,说不定就记住你了)。一般来说,大致估估,如果说税可能是百分之二或三,那你起码还是得让人赚个20或30磅(当然你想试试再砍砍也可以,但可能难度会更大)。
于是我们最后两笔分别换的是640欧和645欧(645欧换了一家用类似方法换到的)。
以上就是所有关于旅支兑换的一些个人经历和小tips啦,当然这只是结合我们的个人体会总结的一些东西,还是要结合具体情况分析了。出去游玩肯定主要还是想多走走看看感受下,所以在经济条件允许的状况下也不建议大家在这件事上浪费太多时间,只要你自己觉得差不多能接受就行了。最后,还是想说,去意大利玩能不用旅行支票就还是别用了,毕竟真的挺麻烦还处处是坑!
[scode type=”info”]Experience One: Do not use traveler’s checks if possible[/scode]
[scode type=”info”]Experience Two: The minimum handling fee for travel exchange is around 4%[/scode]
If you don’t want to see the experience, you can directly transfer to the Tips where you can redeem traveler’s cheques at the end of the article!
During the Christmas holiday, I went to Europe with my roommates and a group of four on a DIY trip to 5 cities in Italy and Austria. Since the UK bank card has not been used for three months, it is not possible to apply for a visa by printing the record, so we chose another method-buying American Express’s Euro traveler’s cheque. As everyone knows, exchanging and using traveler’s checks is really a big pit.
According to the official website of traveler’s cheques, traveler’s cheques can be used directly in shops in many European cities. In this way, it’s definitely more cost-effective to spend it when traveling than to exchange it back in British pounds after returning to the UK. The British pound process requires a loss of 8%). Ran goose, we found through reading other people’s travel notes before departure that many stores in Europe cannot directly spend traveler’s checks (according to our actual travel situation later, we only saw the traveler’s check logo in several stores in Venice), so we When I decided to go, I changed all of them to Euros at the Red Marked Change at the airport.
But after I found the red Change at the first stop in Rome (pictured), I found that 700 euros could only give us more than 590 euros. This is really not the slightest loss. My subject checked the phone number of American Express on the spot. I called it and found that there is no location in Italy, but the other party suggested to change to the bank, saying that there is no loss (note that this is also a pit,,,). Since two people have already exchanged them, in order to stop the loss, we decided not to exchange the 700 Euro traveler’s cheques of the remaining two people, and kept them to the bank for exchange.
On the third day, we went to the Vatican to play. By the way, we went to the bank recommended by the staff of American Express nearby. We also called the Bank of China, but we were all told not to accept travel. How can this be neat?
At this time, I just found a bunch of changes around the Vatican, so I asked for a quote again. One of them originally only reported more than 590, but we heard that the other offered us a student discount of more than 610, and then it was a good deal and reported a 640. This is great, we are beginning to discover the doorway inside: there are actually no discounts, but I want to find an excuse to attract you. These changes are all profitable. You give them your travel, and they sell them to American Express elsewhere. There may be a little tax in the middle, but as long as they charge you at a lower price than the tax deducted If you buy it here, he will definitely make a profit (generally, he will make a lot of money), but it’s just the difference between earning more and less. And there are several changes in the local area. We mainly found the one with red change and the one with blue. If this family thinks that you are demanding and unacceptable, then the money will be made by others.
Therefore, at this time, if we want to get a higher offer, we have to pinpoint what is acceptable to others (it’s really too cruel to cut off people’s wealth, then it’s okay), and then let them have a sense of crisis. Increase the offer. You can ask a few companies first to see how much they generally give, and then tell him how much other companies give me a price. Next, this person may start to call the above to see what a higher price can be offered, and after a bunch of them, they will give you a slightly higher price. Haha, if you are not satisfied, you can ask another one. Ask (but be careful, if it is a different store in the same store, be careful, after all, there may be one person above them, maybe I will remember you). Generally speaking, if you say that the tax may be two or three percent, then you still have to earn a 20 or 30 pounds. (Of course, you can try to chop and chop again, but it may be more difficult. Big).
So our last two transactions were 640 Euros and 645 Euros respectively (645 Euros were replaced by a similar method).
The above is all the personal experiences and small tips about the exchange of travel expenses. Of course, these are just some things summarized based on our personal experience, we still need to analyze the specific situation. If you want to go out and play, you still want to walk around more to see how you feel. Therefore, it is not recommended that you waste too much time on this matter when economic conditions permit, as long as you feel that it is almost acceptable. Finally, I still want to say that if you don’t need traveler’s checks to play in Italy, you should not use it. After all, it is really troublesome and there are pits everywhere!
]]>一键激活win10家庭版,专业版,企业版,教育版 φ( ̄∇ ̄o)
Activate win10 Home Edition, Professional Edition, Enterprise Edition, Education Edition with one click φ( ̄∇ ̄o)
p.s. 如果不放心,请使用 方法二-源码安装
exe
程序->
仍然运行4
获取汉语翻译!!)脚本已发送到桌面
kms.bat
,如果不需要您可以删除它~
kms
或kms.bat
。->
仍然运行4
获取汉语翻译!!)您的激活码将保存在C:\Windows\kms.key
%temp%\kms.log
%temp%\kms.tried_keys
%temp%\kms.skms
%temp%\kms.ato
kms.bat
选择3
p.s. If you are not assured, please use Method Two-Source Installation
exe
program->
still running4
to get a Chinese translation!!)The script has been sent to the desktop
kms.bat
, you can delete it if you don’t need it~
kms
or kms.bat
in the run folder.->
still running4
to get a Chinese translation!!)Your activation code will be saved in C:\Windows\kms.key
%temp%\kms.log
%temp%\kms.tried_keys
on this machine%temp%\kms.skms
%temp%\kms.ato
kms.bat
and select 3
一分钟快速部署你自己的新型冠状病毒API ୧(๑•̀⌄•́๑)૭
Deploy your own new coronavirus API in one minute ୧(๑•̀⌄•́๑)૭
新型冠状病毒 实时数据 api
项目Git地址: iotcat/coro-api
项目npm地址: iotcat/coro-api
https://api.yimian.xyz/coro?province=山东
https://api.yimian.xyz/coro?city=泰安
https://api.yimian.xyz/coro?province=山东&city=泰安
nodeJS
支持express
任意版本git
任意版本1 | $ git clone https://github.com/iotcat/coro-api.git & cd coro-api |
1 | npm install |
1 | node index.js |
1 | http://localhost:17676 |
参数 | 描述 | 示例 |
---|---|---|
province | 省份(国家) | 山东 |
city | 城市 | 泰安 |
从index.js
第9行修改默认端口。
注释掉index.js
第13行。
1 | npm i -g pm2 |
将以下内容加入server{}
中
1 | location / { |
如果你不是从根目录映射,记得去index.js
中第11行app.get('/', f)
修改成你的路径。
爬虫使用coro-py, 请参考其文档。
本项目使用MIT协议,允许非署名商业非商业使用。武汉加油!中国加油!!❤
Novel coronavirus real-time data api
Project Git address: iotcat/coro-api
Project npm address: iotcat/coro-api
https://api.yimian.xyz/coro?province=Shandong
https://api.yimian.xyz/coro?city=泰安
https://api.yimian.xyz/coro?province=Shandong&city=Taian
nodeJS
supports any version of express
git
1 | $ git clone https://github.com/iotcat/coro-api.git & cd coro-api |
1 | npm install |
1 | node index.js |
1 | http://localhost:17676 |
Parameters | Description | Example |
---|---|---|
province | Province (Country) | Shandong |
city | city | Tai’an |
Modify the default port from line 9 of index.js
.
Comment out line 13 of index.js
.
1 | npm i -g pm2 |
Add the following content to server{}
1 | location / { |
If you are not mapping from the root directory, remember to go to the 11th line of index.js
and change app.get('/', f)
to your path.
The crawler uses coro-py, please refer to its documentation.
This project uses the MIT protocol, allowing non-signed commercial and non-commercial use. Go Wuhan! Go China! ! ❤
]]>自研香辣牛肉面做法~
Self-developed spicy beef noodle practice~
在英国留学,圣诞去欧洲旅游,DIY了意大利申根签证。现在游完归来,总结一份申根签攻略。
I studied in the UK, traveled to Europe on Christmas, and DIYed an Italian Schengen visa. Now come back from the tour, summarize a Schengen sign strategy.
Italy Consulate
joint travel confirmation letter
和护照复印件
joint travel confirmation letter
Booking Confirmation
上需要有paid
字样joint travel confirmation letter
和护照复印件
Booking
等知名网站订购最后展示一下我拿到的签证 ::aru:cheer::
Italy Consulate
joint travel confirmation letter
and a copy of passport
joint travel confirmation letter
paid
is required on Booking Confirmation
joint travel confirmation letter
and a copy of passport
Booking
Finally, let me show the visa I got~
先在这里留个空,以后慢慢填~
Leave a blank here first, then fill it in slowly~
φ( ̄∇ ̄o)
φ( ̄∇ ̄o)
]]>为了更清晰更直观的选择出明年居住的公寓,本文汇总了网络上对各公寓的评价信息,供决策参考。
In order to more clearly and intuitively choose the apartment to live in next year, this article summarizes the evaluation information of each apartment on the Internet for decision-making reference.
[scode type=”green”]大家积极在评论区补充哦,评论推荐使用qq邮箱[/scode]
[scode type=”yellow”]持续更新中…[/scode]
[scode type=”blue”]望大家能够补充更多房源,以便调查[/scode]
所有步行距离以Guild为中心!!
步行距离
: 8 min (西北)google地图
: Dover CourtOfficial Guide
: Dover Court优点
: 距Lidl近,安静,管理好,安全,定期有人清洁,social place好,楼下自习室很安静缺点
: 房间隔音一般,部分房间小,有的地方天花板低价格
: £155.54 pw (Last Year)步行距离
: 14 min (西)google地图
: Horizon Heights步行距离
: 13 min (西南)google地图
: St Luke’s View步行距离
: 11 min (西北)同学反映
: 不安静(老雷)步行距离
: 7 min (西北)步行距离
: 12 min (西)步行距离
: 12 min (南)步行距离
: 9 min (东)步行距离
: 9 min (东)步行距离
: 7 min (西)步行距离
: 9 min (西北) 步行距离
: 18 min (西南)步行距离
: 10 min (北)步行距离
: 10 min (西南)步行距离
: 13 min (西)步行距离
: 10 min (北)步行距离
: 18 min (西)步行距离
: 12 min (西北)其它
: 快递可以寄到Cambridge Court (梁斌)步行距离
: 8 min (南)google地图
: Cambridge Court缺点
: 隔音不好,地毯潮湿,条件差步行距离
: 21 min (西)缺点
: 一楼二楼隔音不好优点
: 回字形楼中间有一个小花园(娇娇,欣怡)[scode type=”green”] Everyone is actively adding in the comment area, comments recommend using qq mailbox[/scode]
[scode type=”yellow”]Continuously updating…[/scode]
[scode type=”blue”]I hope you can add more listings for investigation[/scode]
All walking distances are centered on Guild! !
walking distance
: 8 min (Northwest)google map
: Dover CourtOfficial Guide
: Dover CourtPros
: Close to Lidl, quiet, well managed, safe, cleaned regularly, good social place, quiet study room downstairsDisadvantages
: Room soundproofing is average, some rooms are small, and some places have low ceilingsPrice
: £155.54 pw (Last Year)walking distance
: 14 min (West)google map
: Horizon Heightswalking distance
: 13 min (southwest)google map
: St Luke’s ViewWalking distance
: 11 min (Northwest)Classmates' reflections
: Not quiet (Lao Lei)walking distance
: 7 min (Northwest)walking distance
: 12 min (West)Walking distance
: 12 min (South)walking distance
: 9 min (East)walking distance
: 9 min (East)walking distance
: 7 min (West)walking distance
: 9 min (Northwest)walking distance
: 18 min (southwest)walking distance
: 10 min (north)Walking distance
: 10 min (Southwest)walking distance
: 13 min (West)walking distance
: 10 min (north)walking distance
: 18 min (West)Walking distance
: 12 min (Northwest)Others
: Express can be sent to Cambridge Court (Liang Bin)walking distance
: 8 min (south)google map
: Cambridge CourtDisadvantages
: Poor sound insulation, damp carpets, poor conditionswalking distance
: 21 min (West)Disadvantages
: Sound insulation is not good on the first and second floorsAdvantages
: There is a small garden in the middle of Huizi Building (Jiaojiao, Xinyi)在英国留学与4个室友合租,为了更好的控制和监管公共支出,以及维持彼此之间的公共支出平衡,我利用迎新周三天时间设计并开发除了此ERP公共开支计划系统。希望此系统能够便捷接下来一年的生活,减少大家之间的矛盾,促使充满幸福感的公共支出项目持久化OωO
I studied in the UK and shared with 4 roommates. In order to better control and monitor public expenditures and maintain the balance of public expenditures between each other, I designed and developed this ERP public expenditure planning system during the welcome Wednesday. I hope that this system will make life easier for the next year, reduce conflicts between everyone, and promote the sustainability of public expenditure projects full of happiness OωO
前端基于一个网上找到的比特币网站平台模板,深度改造实现。值得一提的是,前端使用Ushio-js项目作为安全及日志插件,并得到了Ushio系统做背后支持。
后端使用php语言编写。提供5个接口,分别提供获取账户事件,获取内部流通信息,获取公共支出信息,获取周报表,操作的功能。
mail系统使用Yimian Mail API快速构建。
数据库使用yimian-db/mysql。构建了三个表,分别用于存储流水,公共支出详情,内部流通。
直接引用呓喵酱の图床代码,少量改写。
目前用额外网页简单实现,等待ushio-auth项目完成后统一整合。
没啥可说的,摆图,自己看
The front end is based on a Bitcoin website platform template found on the Internet, and a deep transformation is realized. It is worth mentioning that the front end uses Ushio-js project as a security and logging plug-in, and got Ushio The system does behind the scenes.
The backend is written in php language. Provides 5 interfaces, which respectively provide the functions of obtaining account events, obtaining internal circulation information, obtaining public expenditure information, obtaining weekly statements, and operating.
The mail system is quickly constructed using Yimian Mail API.
The database uses yimian-db/mysql. Three tables are constructed, which are used to store flow, public expenditure details, and internal circulation.
Directly quote the code of 呓喵酱の图床 with a small amount of rewriting.
At present, it is simple to implement with additional web pages, waiting for the ushio-auth project to complete the unified integration.
Nothing to say, show the picture, see for yourself
基于Home Assisstant搭建综合家庭照明系统,多媒体系统,水流系统的智慧家庭。技术点:天猫精灵交互,LoRa通信,MQTT协议,frp内网穿透,NAS存储,拨动开关电路改造。
Based on Home Assisstant, build a smart home with integrated home lighting system, multimedia system and water flow system. Technical points: Tmall Genie interaction, LoRa communication, MQTT protocol, FRP intranet penetration, NAS storage, and toggle switch circuit transformation.
结合所学知识,运用前沿技术,造福生活,是我长期以来的不懈追求。为了让家人体验到更加稳定、舒适智能的生活方式,同时也为了巩固憨实先前在学校smartfarm项目和我自己的ushio系统中所积累的技术基础以及架构经验,我决定在出国前,使用20到23整天时间,重构家中老旧的物联网系统。采用分层架构和面向接口、面向测试、面向文档开发原则,以稳定性(Available),可靠性(Reliable)为最优先指标,搭建一个运行目标3年以上的高度模块化的,易于远程操控的,开源的家庭软件硬件智能传感控制系统。
使用Arduino UNO作为计算单元。一方面,Arduino Uno拥有高可靠性,我之前的智慧窗帘系统使用Arduino Uno作为主控板,平稳运行1年半未出现硬件问题。另一方面,Arduino Uno拥有较大的RAM,无需为了争夺RAM而在单片机编程上煞费苦心。
Arduino UNO的缺陷主要是价格高,但是为保障长期稳定运行,这个成本是必要的。
使用ESP-01作为WiFi的通信模块。主要原因是之前学校课程使用过ESP-01搭建遥控小车,对其工作方式和性能比较了解,降低开发成本。
使用安信可 LORA RA-02 LORA作为LoRa节点和LoRa网关通信模块。原因是surf项目使用的就是这个模块,比较了解它。
智能音箱作为此物联网系统人机交互的最主要界面,发挥着举足轻重的作用。经研究,我使用天猫精灵方糖R作为家用智能音箱。一方面,天猫精灵的性价比摆在那里,非常便宜。第二,与小米开发小爱同学不同,阿里开发天猫精灵的目的是提供平台,它允许开发者以各种形式接入其网络,这一点对我至关重要。
初期设想: 单向控制+复位器。
实际实现:将原有单开改造为双开,一路与继电器串联,另一路与两个pin口相连。
采用WiFi+LoRa两种通信模式。在需要高速高质量通信的场景,如天猫精灵,手机,笔记本,使用WiFi作为通信手段。在WiFi信号不稳定的地方,使用LoRa进行通信。使用MQTT为应用层协议。
使用python3开源项目Home Assistant 为基础搭建本项目的主控系统。
多媒体主要由天猫精灵提供。此外,通过小米盒子,家庭网盘中的视频,图片,音乐实现了电视与音响上的播放。
dns.yimian.xyz提供dns解析服务。
通过挂载从老电脑上拆卸的闲置500G机械硬盘到老IBM服务器,实现存储系统的搭建。
对局域网内,由于家里都是win系统,使用smb作为共享协议实现文件传输,支持局域网内挂载。速度稳定,全网读写10MB/s左右。对外网访问,通过http,frp反代实现,但速度较慢。
2020.6 更新
基于先前积累的人体传感器数据,通过LSTM模型,使用keras训练神经网络,实现对开灯状态的预测。
Combining the knowledge I have learned and using cutting-edge technology to benefit life has been my unremitting pursuit for a long time. In order to let my family experience a more stable, comfortable and intelligent lifestyle, and to consolidate the technical foundation and architecture experience accumulated in the school smartfarm project and my own ushio system, I decided to use 20 to 23 before going abroad. All day long, reconstruct the old IoT system at home. Adopt a layered architecture and interface-oriented, test-oriented, and document-oriented development principles, with Available and Reliable as the highest priority indicators to build an operational target 3. A highly modular, easy-to-remote control, open source home software and hardware intelligent sensor control system for more than years.
Use Arduino UNO as the calculation unit. On the one hand, Arduino Uno has high reliability. My previous smart curtain system used Arduino Uno as the main control board, and it ran smoothly for one and a half years without hardware problems. On the other hand, Arduino Uno has a larger RAM, so there is no need to bother to program the microcontroller in order to compete for RAM.
The main disadvantage of Arduino UNO is its high price, but this cost is necessary to ensure long-term stable operation.
Use ESP-01 as the WiFi communication module. The main reason is that the ESP-01 has been used to build a remote control car in the previous school courses, and I have a better understanding of its working methods and performance to reduce development costs.
Use Anxinke LORA RA-02 LORA as the communication module between LoRa node and LoRa gateway. The reason is that this module is used in the surf project, so I understand it better.
As the most important interface for human-computer interaction in this Internet of Things system, smart speakers play a pivotal role. After research, I use Tmall Elf Sugar R as a home smart speaker. On the one hand, the price/performance ratio of Tmall Genie is very cheap. Second, unlike Xiaomi’s development of Xiao Ai, the purpose of Ali’s development of Tmall Genie is to provide a platform that allows developers to access its network in various forms, which is very important to me.
Initial idea: one-way control + reset device.
Actual realization: The original single-opening is transformed into double-opening, one is connected in series with the relay, and the other is connected with two pin ports.
Two communication modes of WiFi+LoRa are adopted. In scenarios that require high-speed and high-quality communication, such as Tmall Genie, mobile phones, and notebooks, use WiFi as a means of communication. In places where the WiFi signal is unstable, use LoRa for communication. Use MQTT as the application layer protocol.
Use the python3 open source project Home Assistant as the basis to build the main control system of this project.
Multimedia is mainly provided by Tmall Genie. In addition, through the Xiaomi box, the video, pictures, and music in the home network disk can be played on the TV and stereo.
dns.yimian.xyz provides dns resolution service.
By mounting the idle 500G mechanical hard disk removed from the old computer to the old IBM server, the storage system is built.
In the local area network, since the home is a win system, smb is used as a sharing protocol to realize file transfer and supports mounting in the local area network. The speed is stable, and the whole network reads and writes about 10MB/s. Access to the external network is realized through http and frp reverse generation, but the speed is slow.
2020.6 update
Based on the previously accumulated human sensor data, the LSTM model is used to train the neural network using keras to realize the prediction of the light state.
]]>本文详细介绍了XJTLU大学2019暑期科研SmartFarming Proj物联网架构的设计思路,实施情况以及缺陷反思。
This article introduces in detail the design ideas, implementation status and defect reflections of the SmartFarming Proj IoT architecture of XJTLU University’s 2019 summer scientific research.
为了探究农业物联网技术的可行性,Alam Mohammed导师希望我们能够提供一个稳定(Available)并可靠(Reliable)的物联网系统,以实现对农田的智能监控和管理。这个系统将能够适时地探测土壤以及空气中与植物健康相关的参数,处理并存储这些数据(由Alam提出)。同时,自动化控制的灌溉功能(由Caleb提出)以及一些数据展示方法(由Alam提出的可选需求)也被期待由本系统提供。
由于是针对农业物联网设计的小型科研项目,项目的目标是对农业物联网的可行性进行探究,愿景是模拟最普遍的小型农业物联网应用场景。因此本架构的定位是适用于大部分具备感知,控制和展示功能的小型农业物联网工程。
MQTT
: MQTT消息队列遥测传输(Message Queuing Telemetry Transport)是ISO 标准(ISO/IEC PRF 20922)下基于发布/订阅范式的消息协议。它工作在 TCP/IP协议族上,是为硬件性能低下的远程设备以及网络状况糟糕的情况下而设计的发布/订阅型消息协议[1]。
LoRa
: LoRa是当前市场上的一种新兴技术,其在1 GHz以下的公共频段中运行,用于远距离低功耗通信[2]。
本架构功能性需求主要包括土地数据采集,气象数据采集,灌溉系统控制,与无人机小组系统进行交互,网页控制台(可查看实时和历史传感数据,指标数据;能够控制系统)。
通信范围(测试)
:半径不低于1km通信范围(生产)
:半径不低于3km延时
:平均小于1s超时率
:不超过5%资源占用
:节点RAM不超过2k运行周期
:1分 (测试) | 15分 (生产)节点名称 | 硬件设施 | 软件集群 |
土地节点 Ground Nodes | Arduino Nano | Arduino.h |
SX1278 LORA模块 | SPI.h | |
LM35DZ 温度传感 | LoRa.h | |
土壤湿度传感 | LoRa-Socket.h | |
四分电磁阀 | LoRa-mqtt.h | |
vector.h | ||
气象站节点 Air Station | Arduino Nano | Arduino.h |
SX1278 LORA模块 | SPI.h | |
BME280 温度,湿度,大气压强传感 | LoRa.h | |
GY-30 光强传感 | LoRa-Socket.h | |
MQ-135 空气质量传感 | LoRa-mqtt.h | |
MQ-7 一氧化碳传感 | vector.h | |
雨量传感 | ||
LoRa 网关 LoRa Gateway | SX1278 | Arduino.h |
SPI.h | ||
WiFi.h | ||
LoRa.h | ||
LoRa-Socket.h | ||
LoRa-mqtt.h | ||
vector.h | ||
PubSubClient.h | ||
内网控制器/MQTT代理 Controler/MQTT Proxy | 树莓派3B - RASPBIAN | Python3.7 |
直流变频水泵 | NodeJS | |
sf-mqtt-proxy@npm | ||
sf-pump@npm | ||
forever@npm | ||
云服务器 Cloud Server | 华为云主机 - Centos7.4 | Nginx/1.12.2 |
NodeJS/12.4.0 | ||
Redis/3.2.12 | ||
sf-mqtt-broker@npm | ||
sf-web-api@npm | ||
forever@npm | ||
数据库 Database | 华为云数据库 | MySQL 5.7.23 |
按照生产场景预估,每15分钟产生一组数据集合,一组数据集合约占用253-291字节。按照291计算,每天将新增27.93KB数据。
为了优先确保通信以及服务的稳定性和可拓展性,我们选取分层模型作为架构的设计模式。整个系统分成多个层级,层级之间具备必要的交互行为。每个层级都独立运行,崩溃时会迅速重启,具备高度的可靠性。
安全上,采取内外网隔离的方法。内网中考虑到部分设备计算资源稀缺,与内网服务器的交互采用不加密的通信模式。内网服务器通过SSL加密的方式与云服务器进行交互。为了确保客户端的资料安全,云服务器API只接受具备SSL加密的HTTP和WebSocket请求。
本架构的主要目的是提供一个稳定(Available)并可靠(Reliable)的物联网系统,通过采集农田中的实时数据,结合通过无人机采集的图片以及CNN判断的植物健康情况,实现对灌溉系统以及植物健康状况的智能管理。本架构理论上适用于大部分农场环境。测试环境半径2~5km(取决于天线)以内,风力3级以下。本系统通过传感器获取农田数据,通过晶体管电路,继电器等控制灌溉系统,通过网页与API与管理者进行交互。
此图展示了此架构的抽象层级结构。正如其所指出的,此分层架构可明确为感知层,网络层,应用层三个横向操作层以及一个纵向错误处理层。
其中,感知层又可细化为环境层以及硬件层。环境层中包含植物,土壤,空气,水流等我们要检测和控制的自然物体,硬件层通过传感器、控制器等人造电气设备为系统对自然要素的交互行为(检测,控制)提供了底层技术可行性。当感知层实现对自然信息的交互后,相应的数字信息被传往网络层进行通信。相应的,感知层也会从网络层接受相应的控制信息,并根据这些指令做出相应的控制行为。
网络层分为三层。其中最低一层为预处理层,它的主要任务是对感知层采集的数据进行打包处理,转变成网络流通所适合的形式,如套接字。因此,预处理层需要少量的计算存储资源,比如单片机,EEPROM等。经过预处理层的封装后,数据被传往物理层。基于物理层中的网关、路由器等设备,这些数据包得以被有秩序的分发和传递。通信层中的MQTT协议的应用,使得这些数据包分发的管理更加高效与便利。此外,通信层中QoS服务质量检测体系的实施也使得网络层的性能更加的容错和可靠。
应用层主要负责一些应用层面的服务于业务逻辑,比如数据分析,事件处理等。在应用层的最底端,服务层在长期的运转着。服务层是应用层中最近接网络层的部分,它的主要目的是实时处理从网络层传入的数据,并对相应的请求及错误事件进行快速响应。同时,服务层也负责将传感器采集的数据进行整理分析并传递到数据库层进行存储。为了保证服务的可靠性,服务层的实现程序被注册为系统服务并由专门的守护进程进行守护。与服务层的长期运行不同,业务层则是按需唤起。当界面层有新的请求传入或服务层发生特定的事件时,业务层将会被调用并处理它们。除了一些基础的数据分析外,业务层也有权限向AI层进行分析请求。AI层通过分析从无人机传回的图像数据后,会传回一个判断结果给业务层。根据请求的具体内容,业务层会将图像识别结果,历史传感器数据等进行整理,并传递到界面层。界面层则主要用来提供不同形式的接口,比如HTTP接口和WebSocket接口,以方便客户端调用。
从拓扑结构来看,如上图所示,整个系统物理上可划分为土地节点,气象节点,LoRa网关,内网服务器,云服务器,数据库和用户终端。
从功能机制上看,整个系统包含:传感器模块,LoRa通信模块,LoRa网关模块,MQTT-Proxy代理模块,水泵控制模块,MQTT+数据处理模块,web接口模块,守护进程模块和数据库模块。
土地节点
土地节点部署于不同区域的农田中,用于探测土壤温度,湿度参数,并能够提供对相应位置水流电磁阀的控制。土地节点使用Arduino Nano作为计算单元,使用LoRa作为通信方式连接LoRa网关(和其它节点),使用电池供电。其数量较多,工作环境恶劣,无线通信不稳定,是系统中最大的不确定性来源。
气象节点
气象节点部署于农田特定位置,用于探测空气温度,湿度,大气压,降雨量,光照,NH3浓度,CO浓度等气象参数。气象节点使用Arduino Nano作为计算单元,使用LoRa作为通信方式连接LoRa网关(和土地节点),使用电池或有线供电。其工作环境较为恶劣,无线通信质量一般。
LoRa网关
LoRa网关部署于室内,为扩大有效通信半径,其天线可延伸至室外。LoRa网关通过LoRa连接各土地节点和气象节点,通过WiFi连接内网服务器。LoRa网关能够将通过LoRa传入的socket包转换为mqtt消息并传递给内网服务器,以及将内网服务器传来的mqtt消息转换为socket包通过LoRa发送至指定节点。
内网服务器
内网服务器是一个树莓派3B,它包含三个功能模块:MQTT-Proxy代理模块,水泵控制模块以及守护进程模块。
MQTT-Proxy代理模块能够接收由LoRa网关通过WiFi发送的mqtt消息,对其进行SSL加密并转发至云服务器。同时,MQTT-Proxy代理模块也将接受指定的来自云服务器的mqtt消息,将其解密并转发至LoRa网关。
水泵控制模块通过树莓派的GPIO通过继电器控制水泵的状态。与水泵控制模块直接与云服务器进行mqtt通信,不经过MQTT-Proxy代理。
守护进程模块运行在Linux上,用于监视MQTT-Proxy代理模块和水泵控制模块。当探测到模块停止运行时,守护进程模块会及时重启这些模块,以确保服务的稳定性和连续性。
云服务器
云服务器运行在位于北京的华为云上,包含MQTT+数据处理模块,web接口模块和守护进程模块。
MQTT+数据处理模块包含了层级结构中的Service层和Business层。这个模块通过mqtt与内网进行通信,通过mqtt, redis与web接口模块(和AI模块)进行交互。当收到来自内网的各种散列的数据后,本模块会自动对它们进行聚合,整理成一条一条的数据,存入数据库,并通过redis推送给web接口模块。此外,本模块会定时向各节点发送请求以获取它们的数据,这些请求将被追踪以计算延时。
web接口模块提供一系列的HTTP和WebSocket接口。这些接口可用于获取数据,发送指令,刷新数据以及获取推送消息。
守护进程模块运行在Linux上,用于监视MQTT+数据处理模块和web接口模块。当探测到模块停止运行时,守护进程模块会及时重启这些模块,以确保服务的稳定性和连续性。
LoRa通信模块用于在单信道情况下实现稳定可靠的socket通信。本模块包含LoRa-socket和LoRa-mqtt。
LoRa-socket是在LoRa-Arduino的基础上进行了数据包的封装,实现了简单的udp和tcp通信,让传统的LoRa通信更加可靠。通过在数据包的head添加收发ip地址,以及在数据包的最后添加hash校验值,LoRa-socket支持点对点通信和广播通信,并且具有强大的噪音处理能力和数据防篡改能力。
项目地址:iotcat/LoRa-socket
LoRa-mqtt是在LoRa-socket基础上对mqtt协议进行的一个简单再现。基于udp和tcp,LoRa-mqtt支持qos为0和1的mqtt通信。
项目地址:iotcat/LoRa-mqtt
本模块运行在内网服务器,实现了对内网mqtt的加密转发。
项目地址:iotcat/sf-mqtt-proxy
本模块运行在内网服务器,实现了通过GPIO对继电器水泵的控制。
项目地址:iotcat/sf-pump
本模块运行在云服务器,实现了对来自底层mqtt消息的数据聚合,处理和存储。
项目地址:iotcat/sf-mqtt-broker
本模块运行在云服务器,实现了功能性接口的提供。
项目地址:iotcat/sf-web-api
上图展示了土地节点(左),气象节点(右),水泵(下)的延时统计折线图。由图可以看出,土地节点的平均延时在730ms左右,气象节点延时在900ms左右,水泵的延时较低,在45ms左右。
Reference List:
[1] OASIS, (2015,12.10). MQTT Version 3.1.1 Plus Errata 01 [Online]. Available: https://docs.oasis-open.org/mqtt/mqtt/v3.1.1/errata01/os/mqtt-v3.1.1-errata01-os-complete.html
[2] Sinha, R.S., Wei, Y. and Hwang, S.H., “A survey on LPWA technology: LoRa and NB-IoT”, in Ict Express, 3(1), pp.14-21, 2017.
In order to explore the feasibility of agricultural Internet of Things technology, instructor Alam Mohammed hopes that we can provide a Available and Reliable Internet of Things system to realize intelligent monitoring and management of farmland. This system will be able to timely detect the parameters related to plant health in the soil and the air, process and store these data (proposed by Alam). At the same time, the automatic control irrigation function (proposed by Caleb) and some data display methods (optional requirements proposed by Alam) are also expected to be provided by this system.
As it is a small scientific research project designed for the agricultural Internet of Things, the goal of the project is to explore the feasibility of the agricultural Internet of Things, and the vision is to simulate the most common small-scale agricultural Internet of Things application scenarios. Therefore, the positioning of this architecture is applicable to most small agricultural IoT projects with sensing, control and display functions.
MQTT
: MQTT Message Queuing Telemetry Transport is a message protocol based on the publish/subscribe paradigm under the ISO standard (ISO/IEC PRF 20922). It works on the TCP/IP protocol suite and is a publish/subscribe message protocol designed for remote devices with low hardware performance and poor network conditions [1].
LoRa
: LoRa is an emerging technology in the current market, which operates in the public frequency band below 1 GHz for long-distance low-power communication [2].
The functional requirements of this architecture mainly include land data collection, weather data collection, irrigation system control, interaction with the drone group system, web console (can view real-time and historical sensor data, index data; be able to control the system).
Communication range (test)
: the radius is not less than 1kmCommunication range (production)
: the radius is not less than 3kmDelay
: average less than 1sTimeout rate
: no more than 5%Resource occupation
: Node RAM does not exceed 2kRun cycle
: 1 minute (test) | 15 minutes (production)Node name | Hardware facilities | Software cluster |
Ground Nodes Ground Nodes | Arduino Nano | Arduino.h |
SX1278 LORA module | SPI.h | |
LM35DZ temperature sensor | LoRa.h | |
土壤湿度传感 | LoRa-Socket.h | |
Four-point solenoid valve td> | LoRa-mqtt.h | |
vector.h | ||
weather station node Air Station | Arduino Nano | Arduino.h |
SX1278 LORA module | SPI.h | |
BME280 温度,湿度,大气压强传感 | LoRa.h | |
GY-30 light intensity sensor | LoRa-Socket.h | |
MQ-135 air quality sensor | LoRa-mqtt.h | |
MQ-7 carbon monoxide sensor< /a> | vector.h | |
rainfall sensor | ||
LoRa Gateway LoRa Gateway | SX1278 | Arduino.h |
SPI.h | ||
WiFi.h | ||
LoRa.h | ||
LoRa-Socket.h | ||
LoRa-mqtt.h | ||
vector.h | ||
PubSubClient.h | ||
Intranet Controller/MQTT Proxy Controler/MQTT Proxy | Raspberry Pi 3B-RASPBIAN | Python3.7 |
DC frequency conversion water pump | NodeJS | |
sf-mqtt-proxy@npm | ||
sf-pump@npm | ||
forever@npm | ||
Cloud Server Cloud Server | Huawei Cloud Host-Centos7.4 | Nginx/1.12.2 |
NodeJS/12.4.0 | ||
Redis/3.2.12 | ||
sf-mqtt-broker@npm | ||
sf-web-api@npm | ||
forever@npm | ||
Database Database | Huawei Cloud Database | MySQL 5.7.23 |
According to the production scenario, a data set is generated every 15 minutes, and a data set occupies about 253-291 bytes. According to 291 calculation, 27.93KB of data will be added every day.
In order to prioritize to ensure the stability and scalability of communication and services, we select layered model as the design mode of the architecture. The entire system is divided into multiple levels, with necessary interactions between levels. Each level runs independently, restarts quickly when it crashes, and has a high degree of reliability.
In terms of safety, the method of internal and external network isolation is adopted. Taking into account the scarcity of computing resources of some devices in the intranet, the interaction with the intranet server adopts an unencrypted communication mode. The intranet server interacts with the cloud server through SSL encryption. To ensure the security of the client’s data, the cloud server API only accepts HTTP and WebSocket requests with SSL encryption.
The main purpose of this architecture is to provide a stable (Available) and reliable Internet of Things system, which collects real-time data in farmland, combines pictures collected by drones and judged by CNN Plant health, realize intelligent management of irrigation system and plant health. This framework is theoretically suitable for most farm environments. The test environment is within a radius of 2~5km (depending on the antenna), and the wind is below level 3. This system acquires farmland data through sensors, controls the irrigation system through transistor circuits, relays, etc., and interacts with managers through web pages and APIs.
This figure shows the abstract hierarchy of this architecture. As pointed out, this layered architecture can be clearly defined as the perception layer, network layer, application layer, three horizontal operation layers, and a vertical error handling layer.
Among them, the perception layer can be further refined into environment layer and hardware layer. The environment layer contains plants, soil, air, water and other natural objects that we want to detect and control. The hardware layer provides the underlying technology for the system’s interactive behavior (detection, control) of natural elements through artificial electrical devices such as sensors and controllers. Sex. When the perception layer realizes the interaction of natural information, the corresponding digital information is transmitted to the network layer for communication. Correspondingly, the perception layer will also receive corresponding control information from the network layer, and make corresponding control actions according to these instructions.
Network layer is divided into three layers. The lowest layer is the preprocessing layer. Its main task is to package the data collected by the perception layer and transform it into a form suitable for network circulation, such as sockets. Therefore, the pre-processing layer requires a small amount of computing storage resources, such as a single-chip microcomputer, EEPROM, etc. After encapsulation by the preprocessing layer, the data is transmitted to the physical layer. Based on devices such as gateways and routers in the physical layer, these data packets can be distributed and transmitted in an orderly manner. The application of the MQTT protocol in the communication layer makes the management of these data packet distribution more efficient and convenient. In addition, the implementation of the QoS service quality detection system in the communication layer also makes the performance of the network layer more fault-tolerant and reliable.
Application layer is mainly responsible for some application-level services for business logic, such as data analysis, event processing, etc. At the bottom of the application layer, the service layer is running for a long time. The service layer is the closest part of the application layer to the network layer. Its main purpose is to process the incoming data from the network layer in real time and respond quickly to corresponding requests and error events. At the same time, the service layer is also responsible for sorting and analyzing the data collected by the sensors and passing it to the database layer for storage. In order to ensure the reliability of the service, the implementation program of the service layer is registered as a system service and guarded by a special daemon. Unlike the long-term operation of the service layer, the business layer is invoked on demand. When a new request comes in from the interface layer or a specific event occurs in the service layer, the business layer will be called and processed. In addition to some basic data analysis, the business layer also has the authority to make analysis requests to the AI layer. AI layer After analyzing the image data returned from the drone, it will send back a judgment result to the business layer. According to the specific content of the request, the business layer will organize the image recognition results, historical sensor data, etc., and pass them to the interface layer. Interface layer is mainly used to provide different forms of interfaces, such as HTTP interface and WebSocket interface, to facilitate client calls.
From the topological structure, as shown in the figure above, the entire system can be physically divided into land nodes, weather nodes, LoRa gateways, intranet servers, cloud servers, databases and user terminals.
From the perspective of functional mechanism, the entire system includes: sensor module, LoRa communication module, LoRa gateway module, MQTT-Proxy proxy module, water pump control module, MQTT+ data processing module, web interface module, daemon module and database module.
Land Node
Land nodes are deployed in farmland in different regions to detect soil temperature and humidity parameters, and can provide control of water flow solenoid valves at corresponding locations. The land node uses Arduino Nano as the computing unit, uses LoRa as the communication method to connect to the LoRa gateway (and other nodes), and uses battery power. Its large number, harsh working environment and unstable wireless communication are the biggest source of uncertainty in the system.
Weather Node
Meteorological nodes are deployed at specific locations in farmland to detect meteorological parameters such as air temperature, humidity, atmospheric pressure, rainfall, light, NH3 concentration, and CO concentration. The weather node uses Arduino Nano as the computing unit, uses LoRa as the communication method to connect to the LoRa gateway (and the land node), and uses battery or wired power. The working environment is harsh and the wireless communication quality is average.
LoRa Gateway
The LoRa gateway is deployed indoors. In order to expand the effective communication radius, its antenna can be extended outdoors. The LoRa gateway connects to various land nodes and weather nodes through LoRa, and connects to the intranet server through WiFi. The LoRa gateway can convert the socket packet incoming through LoRa into an mqtt message and pass it to the intranet server, and convert the mqtt message from the intranet server into a socket packet and send it to the designated node through LoRa.
Intranet server
The intranet server is a Raspberry Pi 3B, which contains three functional modules: MQTT-Proxy proxy module, water pump control module and daemon process module.
MQTT-Proxy proxy module can receive the mqtt message sent by the LoRa gateway via WiFi, encrypt it with SSL and forward it to the cloud server. At the same time, the MQTT-Proxy proxy module will also accept the specified mqtt message from the cloud server, decrypt it and forward it to the LoRa gateway.
Water pump control module The state of the water pump is controlled through a relay through the GPIO of the Raspberry Pi. The mqtt communication with the water pump control module directly communicates with the cloud server without passing through the MQTT-Proxy proxy.
Daemon module runs on Linux and is used to monitor the MQTT-Proxy proxy module and the water pump control module. When modules are detected to stop running, the daemon module will restart these modules in time to ensure the stability and continuity of services.
Cloud Server
The cloud server runs on Huawei Cloud located in Beijing and includes MQTT+ data processing module, web interface module and daemon module.
MQTT+data processing module includes the Service layer and the Business layer in the hierarchical structure. This module communicates with the intranet through mqtt, and interacts with the web interface module (and AI module) through mqtt and redis. After receiving various hashed data from the intranet, this module will automatically aggregate them, organize them into one piece of data, store it in the database, and push it to the web interface module through redis. In addition, this module will periodically send requests to each node to obtain their data, and these requests will be tracked to calculate the delay.
web interface module provides a series of HTTP and WebSocket interfaces. These interfaces can be used to get data, send instructions, refresh data, and get push messages.
Daemon module runs on Linux and is used to monitor MQTT+ data processing module and web interface module. When modules are detected to stop running, the daemon module will restart these modules in time to ensure the stability and continuity of services.
The LoRa communication module is used to realize stable and reliable socket communication in a single channel. This module includes LoRa-socket and LoRa-mqtt.
LoRa-socket encapsulates data packets on the basis of LoRa-Arduino, realizes simple udp and tcp communication, and makes traditional LoRa communication more reliable. By adding the sending and receiving ip address to the head of the data packet, and adding the hash check value at the end of the data packet, LoRa-socket supports point-to-point communication and broadcast communication, and has powerful noise processing capabilities and data tamper resistance.
Project address: iotcat/LoRa-socket
LoRa-mqtt is a simple reproduction of the mqtt protocol based on LoRa-socket. Based on udp and tcp, LoRa-mqtt supports mqtt communication with qos 0 and 1.
Project address: iotcat/LoRa-mqtt
This module runs on the intranet server and realizes the encrypted forwarding of the intranet mqtt.
Project address: iotcat/sf-mqtt-proxy
This module runs on the intranet server and realizes the control of the relay water pump through GPIO.
Project address: iotcat/sf-pump
This module runs on the cloud server and realizes the data aggregation, processing and storage of the underlying mqtt messages.
Project address: iotcat/sf-mqtt-broker
This module runs on the cloud server and realizes the provision of functional interfaces.
Project address: iotcat/sf-web-api
The figure above shows the line graphs of the delay statistics of the land node (left), the weather node (right), and the water pump (bottom). It can be seen from the figure that the average delay of the land node is about 730ms, the delay of the weather node is about 900ms, and the delay of the water pump is relatively low, about 45ms.
Click here to view the weather sensor data of 2019-7-31
Reference List:
[1] OASIS, (2015,12.10). MQTT Version 3.1.1 Plus Errata 01 [Online]. Available: https://docs.oasis-open.org/mqtt/mqtt/v3.1.1/errata01/os/mqtt -v3.1.1-errata01-os-complete.html
[2] Sinha, R.S., Wei, Y. and Hwang, S.H., “A survey on LPWA technology: LoRa and NB-IoT”, in Ict Express, 3(1), pp.14-21, 2017.
]]>最近在物联网开发中使用Arduino搭建LoRa网关和节点,发现在调用String时总遇到一些奇奇怪怪的现象。经过排查,发现是由于其它地方[]=运算符的重载所导致。
Recently, I have used Arduino to build LoRa gateways and nodes in the development of the Internet of Things, and I found that some strange phenomena are always encountered when calling String. After investigation, it was found that it was caused by overloading of the []= operator elsewhere.
为了方便,在开发节点时,我们使用了LoRa-Socket和ArduinoJSON作为依赖。我们发现这两个依赖分别使用时表现良好,但如果在同一个项目文件中使用,则会导致一些怪异的问题。
通过指针调用函数时String参数传递异常。代码如下:
1 | inline static void _onReceived(const String& msg, const String& from, const String& to, const String& type){ |
在这个案例中,我们发现msg等String在此函数中的数值是一切正常的,可是却没有能够成功传递到_f中。经过一系列骚操作,我们得出如下结论:
我们从而可以得出,这种怪异现象是由于与ArduinoJSON包的冲突所致。
在使用ArduinoVector制作String类型Vector时,我们也发现了String类型的不稳定现象。神奇的是,这种现象只出现在String的使用中,其它如int类型运作良好。
这些不稳定现象可以总结如下:
通过上述两个案例,我们可以初步总结出,这是由于[]=赋值运算符的重载与String有冲突。只要使用[]=重新定义String,即有可能出现String怪异的问题。
For convenience, we used LoRa-Socket and ArduinoJSON as dependencies when developing nodes. We found that these two dependencies perform well when used separately, but if used in the same project file, it will cause some weird problems.
When calling a function through a pointer, the String parameter passing is abnormal. code show as below:
1 | inline static void _onReceived(const String& msg, const String& from, const String& to, const String& type){ |
In this case, we found that the value of msg and other String in this function is all normal, but it was not successfully passed to _f. After a series of Sao operations, we come to the following conclusions:
We can conclude that this strange phenomenon is caused by the conflict with the ArduinoJSON package.
When using ArduinoVector to make a String type Vector, we also discovered the instability of the String type. The magic is that this phenomenon only occurs in the use of String, other types such as int work well.
These instabilities can be summarized as follows:
Through the above two cases, we can preliminarily conclude that this is due to the conflict between the overload of the []= assignment operator and String. As long as you use []= to redefine String, string weird problems may occur.
]]>本API基于华为云对象存储,使用华为CDN云加速,全球平均下载速度达10MB/s。API中已收录1100+张二次元图片,20+张Bing壁纸(每日自动抓取),150+张二次元头像,10+张图床上传图片。
This API is based on Huawei Cloud Object Storage and uses Huawei CDN Cloud acceleration. The global average download speed is 10MB/s. The API has included 1100+ two-dimensional pictures, 20+ Bing wallpapers (automatically captured daily), 150+ two-dimensional avatars, and 10+ pictures uploaded on the bed.
本API不承诺永久维护,使用前请务必斟酌使用风险!!
https://api.yimian.xyz/img
随机二次元图片
GET/POST /img?type=moe
随机Bing壁纸
GET/POST /img?type=wallpaper
随机二次元头像
GET/POST /img?type=head
随机图床图片
GET/POST /img?type=imgbed
随机1920x1080尺寸二次元图片
GET/POST /img?type=moe&size=1920x1080
名称 | 描述 | 格式 | 示例 |
---|---|---|---|
type | 图片种类 | moe /wallpaper /head /imgbed | type=moe |
size | 根据图片大小筛选 | ??x?? ;*x?? ;*x* ;??-??x?? ;??-??x??-?? ;??-??x* | display=1920x1080 ;display=1920x* ;display=1920-1950x230-500 ;display=1920-1950x* ; |
range | 尺寸误差范围 | number | range=100 |
id | 根据图片id筛选 | number | id=15 |
path | 根据路径提取图片 | abs path | path=wallpaper/img_··mal.jpg |
display | 是否以网页格式展示 | true /false (default) | display=true |
R18 | 是否显示18禁图片 | true /false (default) | R18=true |
二次元(默认)
GET/POST /img?type=moe
bing每日壁纸
GET/POST /img?type=wallpaper
每日自动更新中
二次元头像
GET/POST /img?type=head
呓喵酱图床
GET/POST /img?type=imgbed
こいぬちゃん
GET/POST /img?type=koino
EasyVer人机验证
GET/POST /img?type=easyver
如果本参数置为true,则会禁用302跳转,直接返回完整图片编码。本方法效率极低,速度很慢,请慎用。
false(默认)
GET/POST /img?display=false
true
GET/POST /img?display=true
使用本参数限制图片尺寸。本参数支持以下格式:
??x??
GET/POST /img?size=??x??
??x*
GET/POST /img?size=??x*
\x??*
GET/POST /img?size=*x??
\x**
GET/POST /img?size=*x*
??-??x??
GET/POST /img?size=??-??x??
??x??-??
GET/POST /img?size=??x??-??
??-??x??-??
GET/POST /img?size=??-??x??-??
??-??x*
GET/POST /img?size=??-??x*
\x??-??*
GET/POST /img?size=*x??-??
本参数规定允许的size的误差,需搭配size使用,默认为0。
对于??型size参数
GET/POST /img?size=??x??&range=100
对于??-??型size参数
GET/POST /img?size=??-??x??-??&range=100
对于*型size参数
GET/POST /img?size=*x*&range=100
每一个种类都有自己的id系统,同一种类下不同图片id唯一。
二次元
GET/POST /img?type=moe&id=15
bing每日壁纸
GET/POST /img?type=wallpaper&id=2019-07-28
二次元头像
GET/POST /img?type=head&id=15
呓喵酱图床
GET/POST /img?type=imgbed&id=529745e0
使用绝对路径直接提取图片,优先级高于type,效率最高。
GET/POST /img?path=xx/xx.xx
种类/图片文件名
imgbed/img_529745e0_900x900_8_null_normal.jpeg
是否显示18禁图片,默认为false。
GET/POST /img?type=xx&R18=true
若找不到指定的type类型,将会自动返回一个moe类型的图片。
返回JSON
1 | { |
每台设备每天全局调用上限500次!!
This API does not promise permanent maintenance, please be sure to consider use risks before use! !
https://api.yimian.xyz/img
Random two-dimensional picture
GET/POST /img?type=moe
Random Bing Wallpaper
GET/POST /img?type=wallpaper
Random two-dimensional avatar
GET/POST /img?type=head
Random bed pictures
GET/POST /img?type=imgbed
Random 1920x1080 size two-dimensional picture
GET/POST /img?type=moe&size=1920x1080
Name | Description | Format | Example |
---|---|---|---|
type | Image type | moe /wallpaper /head /imgbed | type=moe |
size | Filter by image size | ??x?? ;*x?? ;*x* ;??-??x?? ;??-??x??-?? ;??-??x* | display=1920x1080 ;display=1920x* ;display=1920-1950x230-500 ;display=1920-1950x* ; |
range | Size error range | number | range=100 |
id | Filter by image id | number | id=15 |
path | Extract pictures based on path | abs path | path=wallpaper/img_··mal.jpg |
display | Whether to display in web page format | true /false (default) | display=true |
R18 | Whether to display 18 prohibited pictures | true /false (default) | R18=true |
Two-dimensional (default)
GET/POST /img?type=moe
bing daily wallpaper
GET/POST /img?type=wallpaper
Automatically updated daily
Two-dimensional avatar
GET/POST /img?type=head
Miao meow sauce picture bed
GET/POST /img?type=imgbed
こいぬちゃん
GET/POST /img?type=koino
EasyVer man-machine verification
GET/POST /img?type=easyver
If this parameter is set to true, 302 jump will be disabled and the complete picture encoding will be returned directly. This method is very low and slow. Please use it carefully.
false (default)
GET/POST /img?display=false
true
GET/POST /img?display=true
Use this parameter to limit the image size. This parameter supports the following formats:
??x??
GET/POST /img?size=??x??
??x*
GET/POST /img?size=??x*
\x??*
GET/POST /img?size=*x??
\x**
GET/POST /img?size=*x*
??-??x??
GET/POST /img?size=??-??x??
??x??-??
GET/POST /img?size=??x??-??
??-??x??-??
GET/POST /img?size=??-??x??-??
??-??x*
GET/POST /img?size=??-??x*
\x??-??*
GET/POST /img?size=*x??-??
This parameter specifies the allowable size error, which needs to be used with size, and the default is 0.
For the?? type size parameter
GET/POST /img?size=??x??&range=100
For??-?? type size parameter
GET/POST /img?size=??-??x??-??&range=100
For *type size parameter
GET/POST /img?size=*x*&range=100
Each category has its own id system, and different image ids under the same category are unique.
*Two-dimensional *
GET/POST /img?type=moe&id=15
bing daily wallpaper
GET/POST /img?type=wallpaper&id=2019-07-28
Two-dimensional avatar
GET/POST /img?type=head&id=15
Miao meow sauce picture bed
GET/POST /img?type=imgbed&id=529745e0
Use absolute path to directly extract pictures, priority is higher than type, highest efficiency.
GET/POST /img?path=xx/xx.xx
Type/Picture File Name
imgbed/img_529745e0_900x900_8_null_normal.jpeg
Whether to display 18 prohibited pictures, the default is false.
GET/POST /img?type=xx&R18=true
If the specified type cannot be found, a moe type picture will be automatically returned.
Return JSON
1 | { |
]]>The maximum number of global calls for each device is 500 per day!!
基于NodeJS搭建的物联网系统,配合D1 MINI单片机,帮助你灰常快速实现物联~
The Internet of Things system based on NodeJS, combined with D1 MINI microcontroller, helps you quickly realize the Internet of Things~
正式开发文档见这里
适用于NodeJS的wIoT服务器控制组件,轻松物联
本项目旨在帮助不熟悉固件编程的网络开发者实现出自己的物联网应用。您仅需要一台网络内部的服务器(比如树莓派),以及若干个支持可联网(通过串口,WiFi,LoRa,蓝牙,Zigbee等)的单片机,即可轻松创建并管理属于您自己的物联网集群。
wiot-xx:xx:xx:xx:xx:xx
1234567890
http://192.168.0.1
,记录网页中的MAC地址,这将用于识别此单片机在你的项目文件夹下打开命令行,输入以下指令安装wiot:
1 | npm install wiot |
在你的项目文件夹中新建一个app.js文件,输入以下内容:
1 | var wiot = require('wiot'); //引入wiot依赖包 |
在项目文件夹中打开命令行,输入以下指令:
1 | node app.js |
如果一切顺利,你现在应该会发现你的板载led在闪烁了
也许你会觉得上述代码难以理解,这是正常的,由于delay功能在JS中难以实现。但是不用担心,这些问题将会由社区中的其它开发者帮你解决。
wIoT在实现基本的单片机控制同时,也提供了丰富的扩展功能。更神奇的是,任何人都可以在wIoT中编写自己的扩展并与全世界共享它们。在这里我们可以使用wIoT官方提供的led扩展轻松实现上例功能!
1 | var wiot = require('wiot'); //引入wiot依赖包 |
名称 | 默认值 | 描述 |
---|---|---|
MAC | “” | 单片机的MAC地址 |
pin | {D1: 0, D2: 0, D3: 0, D4: 0, D5: 0, D6: 0, D7: 0, D8: 0} | pin脚的模式, 0为INPUT, 1为OUTPUT, 2为INPUT_PULLUP |
hint | true | 是否显示状态提示 |
debug | false | 是否开启debug模式 |
ip | “default” | 指定单片机IP, 请在长时间搜索不到IP时尝试此选项 |
port | 8848 | Client的TCP Socket通信端口,默认8848 |
ip_range | “192.168.0” | IP搜索字段,请在长时间搜索不到IP时尝试此选项 |
localIP | “127.0.0.1” | 本机IP |
OnlyHTTP | false | 是否仅使用HTTP模式连接单片机 |
errDelayTime | 2000 | 遇到网络错误时重试间隔时间(毫秒) |
okDelayTime | 30 | 收到网络请求后延时等待时间(毫秒) |
resetDelayTime | 4500 | 向单片机发送重置指令后多久不再发送新消息(毫秒) |
noTryMaxTime | 15000 | 经过此时间单片机仍未响应则重新发送消息(毫秒) |
IntervalTime | 2000 | 监听行为心跳间隔 |
MaxToReScanTime | 180000 | 经过此事件单片机无响应则从新扫描IP地址(毫秒) |
MinResearchTime | 5000 | 搜索IP经过一此轮询后间隔时间(毫秒) |
IpScanTimeout | 1 | IP扫描时的Ping检测超时时间(秒) |
pingTimeout | 2 | 心跳Ping检测的超时时间(秒) |
MaxTraceBackTimes | 8 | 判断连接状态所向前追溯的历史心跳个数 |
例如:
1 | var MyMCU = new wiot.client({ |
.write(pin: wiot.pin/number, state: iot.state/number)
: 向指定pin口输出状态指令,状态可以是wiot.HIGH/wiot.LOW或PWM调制(0-255数字)wiot.read(pin: wiot.pin/number)
: 读取指定pin口状态,数字pin返回wiot.HIGH/wiot.LOW,模拟pin返回0-1024数值.on(event, handler)
client事件列表
begin
开始于单片机正常交互disConnected
与单片机断开连接reConnected
与单片机恢复连接1 | var MCU = new wiot.client({"MAC": "xx:xx:xx:xx:xx:xx"}); |
.pinOn(pin, event, handler)
pin事件列表
on
pin口电位从低到高off
pin口电位从高到低change
pin口电位变化1 | var MCU = new wiot.client({"MAC": "xx:xx:xx:xx:xx:xx"}); |
wiot.begin()
: 单片机准备完成后开始执行1 | MCU0 = new wiot.client({MAC: "xx:xx:xx:xx:xx:xx", pin: {D4: wiot.OUTPUT}}); |
wiot.loop()
: 循环执行的指令,适合于条件控制语句1 | MCU0 = new wiot.client({MAC: "xx:xx:xx:xx:xx:xx", pin: {D4: wiot.OUTPUT}}); |
wiot.register.set(status1, status2, function)
: 向注册表中添加一条规则, status可以是值或函数,当status1==status2时会触发function。wiot.register.set(status, function)
: 你也可以传入两个函数,其中status的返回值是bool型,变为true时触发function1 | var myLED = wiot.led(MyMCU, wiot.D4); |
wiot.led(MCU, pin)
: 声明一个led模块wiot.led.getStatus()
: 获取led状态wiot.led.set(status, time = 0, isSmooth = false)
: 设置led状态,起始状态,中间状态,最终状态,周期wiot.led.breath(period)
: 设置一个呼吸灯wiot.led.clear()
: 重置led1 | MCU0 = new wiot.client({MAC: "xx:xx:xx:xx:xx:xx", pin: {D4: wiot.OUTPUT}}); |
wiot.pir(MCU, pin)
: 声明一个PIR模块wiot.pir.getStatus()
: 获取PIR状态,返回值wiot.HIGH(有人),wiot.LOW(无人)事件触发器
wiot.pir.on(event, handler)
事件列表
detected
探测到人undetected
人体移动出探测范围change
状态改变,包括有人到无人和无人到有人1 | MCU0 = new wiot.client({MAC: "xx:xx:xx:xx:xx:xx"}); |
wiot.ir(MCU, pin)
: 声明一个IR模块,pin可以是模拟或数字端口wiot.ir.getStatus()
: 获取IR状态,返回值wiot.HIGH(有障碍),wiot.LOW(无障碍),或者0-1024数值(限模拟端口)事件触发器
wiot.ir.on(event, handler)
事件列表
detected
探测到障碍undetected
障碍消失change
状态改变1 | MCU0 = new wiot.client({MAC: "xx:xx:xx:xx:xx:xx"}); |
wiot.lightSensor(MCU, pin)
: 声明一个lightSensor模块, pin可以是模拟或数字端口wiot.lightSensor.getStatus()
: 获取lightSensor状态,返回值wiot.HIGH(有光),wiot.LOW(无光),或者0-1024数值(限模拟端口)事件触发器
wiot.light.on(event, handler)
事件列表
light
由暗到明dark
由明到暗change
状态改变1 | MCU0 = new wiot.client({MAC: "xx:xx:xx:xx:xx:xx"}); |
使用本模块向指定邮箱发送邮件。自豪地引用Yimian API构建!
wiot.mail(to, from = "wIoT")
: 声明一个mail模块,参数收件地址,发件人名称wiot.mail.send(subject, body)
: 发送邮件,需传入主题,邮件内容1 | var mail = wiot.mail("i@iotcat.me", "wIoT Test"); |
使用本模块向指定咕咕机发送消息。咕咕机是一款便携式私人打印机,详见官网。使用本模块需要在官网提前申请好自己的开发者ak, 详见这里。自豪地引用Yimian API构建!
wiot.guguji(ak, userID, memobirdID)
: 声明一个guguji模块,参数: 开发者ak, 用户id, 咕咕机idwiot.guguji.send(msg)
: 发送消息,需传入待发送的消息1 | var gugu = wiot.guguji("9e55121803474371bfa25d20e554b31f", "832598", "b3ee06a8bd9b49e1"); |
Node.js is a widely used programming language for web developers. To make use of wIoT, you should first install Node.js to your computer.
For windows user, you can follow the instruction in this website
After install Node.js and configure npm successfully, you should then use npm to download wIoT package by enter following command in your command window.
1 | npm install wiot |
Windows user can use cmd or powershell.It should be notice that this may report error for some users. The solution is to open your cmd window as administrator. You can right click on cmd and choose run as an administrator. You can also press windows+R and input cmd then press Ctrl+Shift+Enter to open it as administrator.
The default password for D1 MINI is 1234567890, enter the password and you should be able to connect to your MINI.
Congratulations, you have successfully connect your device to D1 MINI
However, this is not the end, you should now try to connect D1 MINI to your Wi-Fi
Use the device which had just been connected to D1 MINI and follow the steps below
Visit http://192.168.0.1 with the browser on your device
Normally, you would see a webpage like this:
In this page, you can see the MAC Address and wIoT version of your MINI
Again, please remember the MAC Address
From the page, you can see two blanks that ask the SSID and password of your Wi-Fi
Input information of the Wi-FI which you would like to connect your MINI, click Submit
If you have input the right SSID and password, you will see a page showing the message: Set Successfully!! Rebooting!!
Then, after a minute, you will see the SSID of D1 MINI has vanished
If you submitted the wrong message, do not try to directly reconnect to D1 MINI. Restart the whole procedure from the reset part of the last section
If you have successfully connect D1 MINI to your Wi-Fi, you can execute the example code below to realize a simple function of wIoT
Before executing the code, you should first connect a LED to D1 MINI with positive pole connect to pin D4 and negative pole connect to GND
1 | var wiot = require('wiot'); //Import wiot package from npm |
The LED is expected to blink after you execute the code
Name | Default Value | Declaration |
---|---|---|
MAC | “” | MAC Address of MCU |
pin | {D1: 0, D2: 0, D3: 0, D4: 0, D5: 0, D6: 0, D7: 0, D8: 0} | Mode of each pin, 0 is INPUT, 1 is OUTPUT, 2is INPUT_PULLUP |
hint | true | Whether print the status prompt |
debug | false | Whether open the debug mode |
ip | “default” | Specify MCU IP, please try this option when you cannot find IP for a long time |
port | 8848 | TCP Socket communication port for Client, default 8848 |
ip_range | “192.168.0” | IP search field, try this option if you cannot find IP for a long time |
localIP | “127.0.0.1” | local IP |
errDelayTime | 2000 | Retry interval when network error is encountered (milliseconds) |
okDelayTime | 30 | Waiting time after receiving the network request (milliseconds) |
resetDelayTime | 4500 | Waiting time for stop sending new messages after sending reset instructions to MCU (milliseconds) |
noTryMaxTime | 15000 | If the MCU fails to respond after this time, the message will be sent again (milliseconds). |
IntervalTime | 2000 | Interval between monitoring (heartbeat) |
MaxToReScanTime | 180000 | After this time, if the MCU has no response, it will scan the IP address again (in milliseconds). |
MinResearchTime | 5000 | Interval between each polling |
IpScanTimeout | 1 | Ping detection timeout for IP scanning (seconds) |
pingTimeout | 2 | Timeout of Heartbeat Ping detection (seconds) |
MaxTraceBackTimes | 8 | Determine the number of historical heartbeats traced back to the connection state |
1 | var MyMCU = new wiot.client({ |
.on(event, handler)
begin
It begins when MCU starts to interact normallydisConnected
Disconnect from MCUreConnected
Connection with MCU restored1 | js |
.pinOn(pin, event, handler)
on
Change output of pin from LOW to HIGHoff
Change output of pin from HIGH to LOWchange
Change the output of pin1 |
|
wiot.begin()
: Execute when MCU is ready1 |
|
+
wiot.loop()
: A loop command,Suitable for conditional control statements
1 |
|
wiot.register.set(status1, status2, function)
: Add a rule to register that status can be either value or function,
function would trigger if status1 == status2
The registry is designed to facilitate the use of various extension modules, See [extension module] below (# Sensor Extension Module).
wiot.register.set(status, function)
: You can also pass in two functions, where the return value of status is of type bool, it would trigger the function if it changes to true
1 |
|
wiot.led(MCU, pin)
: Declare a LED module
wiot.led.getStatus()
: Get status of LED
wiot.led.set(status, time = 0, isSmooth = false)
: Set led state, initial state, intermediate state, final state, period
wiot.led.breath(period)
: Set a breathing LED
wiot.led.clear()
: Reset LED
1 | var wiot = require('wiot'); //Import wiot package from npm |
wiot.pir(MCU, pin)
: Declare a PIR modulewiot.pir.getStatus()
: Gets the PIR state, returns the value wiot.high (have people), wiot.low (no people)wiot.pir.on(event, handler)
Events List
detected
Person detectedundetected
People out of the detective fieldchange
State change, includes from detected to undetected and from undetected to detected1 | var wiot = require('wiot'); //Import wiot package from npm |
wiot.ir(MCU, pin)
: Declare an IR module, pin can be analog or digital portwiot.ir.getStatus()
: Get IR state, return value wiot.high (with a barrier), wiot.low (with no barrier), or a value of 0-1024 (only for analog port)wiot.ir.on(event, handler)
Event List
detected
Barrier detectedundetected
Barrier vanishedchange
Change state1 | MCU0 = new wiot.client({MAC: "xx:xx:xx:xx:xx:xx"}); |
wiot.lightSensor(MCU, pin)
: Declare a lightSensor module, pin can be analog or digital portwiot.lightSensor.getStatus()
: Get lightSensor state, return value wiot.HIGH(light), wiot.LOW(dark), or a value of 0-1024 (limited to analog port)wiot.light.on(event, handler)
Event List
light
From dark to lightdark
From light to darkchange
Change state1 |
|
Use this module to send messages to the specified mailbox. Proudly built with reference to Yimian API!
wiot.mail(to, from = "wIoT")
: Declare an mail module with sender’s name and reveiver’s addresswiot.mail.send(subject, body)
: Send email with a subject and content1 | var mail = wiot.mail("i@iotcat.me", "wIoT Test"); |
Use this module to send messages to the specified cooing machine.Goo goo is a portable private printer, see official website.
To use this module, you need to apply for your own developer ak in advance on the official website. See here. Proudly reference Yimian API!
wiot.guguji(ak, userID, memobirdID)
: Declare a goo goo chicken module, parameter: developer’s ak, user id, cooing machine idwiot.guguji.send(msg)
: Send message, need to pass in the message to be sent1 | var gugu = wiot.guguji("9e55121803474371bfa25d20e554b31f", "832598", "b3ee06a8bd9b49e1"); |
中美贸易战的解不在美国,而是在我们自己身上。
The solution to the Sino-US trade war is not in the United States, but in ourselves.
关于谈判,党内争议比较大,但最终很有可能会拒绝做出让步。
当美关税抬升,国内相关产业链将大批转移至台湾及东南亚国家,累计将造成1亿人口的就业问题。与前几次的危机不同,这一次我们不但要提防房市泡沫的激化,也没有那麽多的基建可提供就业。从另一方面看,近几年来,中国的产能过剩问题主要通过出口得以解决,拿着贸易顺差来发展国内经济,以实现不可思议的经济增长。如今特朗普政府征加关税,将使得这一策略不再行得通。
如果在谈判中妥协,中方将丧失好不容易占来的第四次工业革命先机,并经济将会想日本,韩国一样任人摆布。
我认为,在不妥协的前提下,中共有三个破局之法。
为了缓解失业冲击的强度,央行将通过印人民币使人民币贬值来增进出口,吸引他国来补充美资撤离的空缺。
以上。。
Regarding negotiations, there are relatively large disputes within the party, but in the end it is very likely that they will refuse to make concessions.
When U.S. tariffs rise, related domestic industrial chains will be transferred to Taiwan and Southeast Asian countries in large numbers, which will cause employment problems for 100 million people. Unlike previous crises, this time we not only have to guard against the intensification of the housing market bubble, but also there is not so much infrastructure that can provide employment. On the other hand, in recent years, China’s overcapacity problem has been solved mainly through exports, and the trade surplus is used to develop the domestic economy in order to achieve incredible economic growth. Now that the Trump administration imposes tariffs, this strategy will no longer work.
If it compromises in the negotiation, China will lose the opportunity of the Fourth Industrial Revolution that it finally took over, and its economy will be at the mercy of Japan and South Korea.
I think that under the premise of no compromise, there are three ways to break the game.
In order to alleviate the intensity of the unemployment shock, the central bank will increase imports and exports by printing the renminbi to depreciate the renminbi, attracting other countries to supplement the vacancy of the withdrawal of US capital.
the above. .
]]>重整自己先前的mail模块,顺便封装了一个API出来,欢迎大家调用~
Reorganized my previous mail module and encapsulated an API by the way. Welcome everyone to call~
to
收信人邮箱地址subject
邮件主题body
邮件内容(建议使用html格式)from
发件人名称1 | https://api.yimian.xyz/mail |
1 | https://api.yimian.xyz/mail/?to=收信邮箱&subject=邮件主题&body=邮件内容&from=发件人名称 |
[scode type=”yellow”]如遇到GET传递邮件内容错误,请尝试使用POST[/scode]
state
::true
(成功)或false
(失败)[scode type=”dangerous”]每个IP每天请求上限50个[/scode]
to
recipient email addresssubject
mail subjectbody
email content (html format is recommended)from
sender name1 | https://api.yimian.xyz/mail |
1 | https://api.yimian.xyz/mail/?to=receiving mailbox&subject=mail subject&body=mail content&from=sender name |
[scode type=”yellow”] If you encounter an error in GET delivery of the mail content, please try using POST[/scode]
state
::true
(success) or false
(failure)[scode type=”dangerous”] There are 50 requests per day per IP[/scode]
]]>教你如何一步步迷上JS.. ╮(╯▽╰)╭
Teach you how to fall in love with JS step by step.. ╮(╯▽╰)╭
好嘀,只是一些总结
<script>
标签中,合理使用defer="defer"
(延迟执行),async="async"
(异步执行)var obj = preferredObj || backupObj;
提供后备值 ::aru:surprised:: arguements[]
获取参数function hh({})
直接传包含参数的对象,更加灵活push()
和pop()
push()
和shift()
unshift()
和pop()
sort()
可自定义比较函数为参数splice()
可太好用了吧arguments.callee
获取当前函数名指针arguments.callee.caller
获取调用当前函数的引用function.apply(this/*作用域*/, arguments)
或function.call(this, arg1, arg2...)
指定作用域运行函数function.length
获取其期待的参数个数toLocaleString()``toString()``valueOf()
返回代码,方便调试indexOf()``lastIndexOf()
查找元素出现位置trim()
删除字符串开头结尾空格RegExp
eval("")
可将字符串转译成代码并就地执行encodeURI()/decodeURI()
与encodeURIComponent()/decodeURICompoent()
处理urifunction(){}();
ceil()``floor()``round()
向上,向下,标准舍入Math.random()
大于零小于一随机数functionName: function(){}
直接定义函数(x)=>x+1
等价于function(x){return x+1;}
;(function(name, context, definition){moudle.exports = definition();})('funationName', this, function(){});
封装模块with
语句label
标签少用0.1 + 0.2 != 0.3
浮点型天坑,与C类似~26 == -27
利用按位非提高效率var obj2 = obj1;
实际是引用obj[var]
var sum = function sum(){};
在Safari中会报错new Number("25")
返回对象,而Number("25")
返回25Okay, just some summary
<script>
tag, reasonably use defer="defer"
(delayed execution) and async="async"
(asynchronous execution)var obj = preferredObj || backupObj;
to provide a backup value ::aru:surprised::arguements[]
to get parameters in the functionfunction hh({})
to pass parameters directly to functions, which is more flexiblepush()
and pop()
push()
and shift()
unshift()
and pop()
sort()
can customize the comparison function as a parametersplice()
is so easy to use, right?arguments.callee
arguments.callee.caller
to get a reference to call the current functionfunction.apply(this/*scope*/, arguments)
or function.call(this, arg1, arg2...)
to specify the scope to run the functionfunction.length
to get the number of expected parameterstoLocaleString(), toString(), and valueOf()
return code through the function to facilitate debuggingindexOf() and lastIndexOf()
to find the element’s appearancetrim()
delete spaces at the beginning and end of the stringRegExp
eval("")
can translate the string into code and execute it in placeencodeURI()/decodeURI()
and encodeURIComponent()/decodeURICompoent()
handle urifunction()()();
ceil(), floor(), round()
in Math up, down, standard roundingMath.random()
is a random number greater than zero and less than onefunctionName: function(){}
in the object to directly define the function(x)=>x+1
is equivalent to function(x){return x+1;}
;(function(name, context, definition){moudle.exports = definition();})('funationName', this, function()());
to encapsulate the modulewith
statementlabel
0.1 + 0.2 != 0.3
floating point tiankeng, similar to C~26 == -27
Use bitwise not to improve efficiencyvar obj2 = obj1;
is actually a referenceobj[var]
var sum = function sum(){};
will report an error in Safarinew Number("25")
returns the object, and Number("25")
returns 25