当前位置:网站首页>【毕业设计】基于ESP32的在线墨水屏桌面摆件 -物联网 单片机 嵌入式
【毕业设计】基于ESP32的在线墨水屏桌面摆件 -物联网 单片机 嵌入式
2022-08-09 23:39:00 【Mdc_stdio】
0 前言
这两年开始毕业设计和毕业答辩的要求和难度不断提升,传统的毕设题目缺少创新和亮点,往往达不到毕业答辩的要求,这两年不断有学弟学妹告诉学长自己做的项目系统达不到老师的要求。
为了大家能够顺利以及最少的精力通过毕设,学长分享优质毕业设计项目,今天要分享的是
基于STM32自行车智能无线防盗报警器
学长这里给一个题目综合评分(每项满分5分)
- 难度系数:3分
- 工作量:4分
- 创新点:4分
🧿 选题指导, 项目分享:
1 简介
使用了合宙的ESP32C3开发板,设计了一款可拆卸的桌面模式屏摆件,通过wifi联网,可实现时间、天气、古诗、图片四种模式的显示。通过按键实现不同模式间的切换和更新。
2 主要器件
- ESP32C3开发板
- 墨水屏模块
- MOSFET-N+AO3400A
- 按键微动开关 664.3
- PCB插座_2.54_2x8/16P 立式
3 实现效果
4 实现原理
4.1 硬件部分
墨水屏模块
使用2.9寸墨水屏,单片价格在15左右
项目在软件方面驱动墨水屏使用的是GxEPD2库,在GxEPD2库中选择适当的对于型号即可。如下所示:
GxEPD2_BW<GxEPD2_290, GxEPD2_290::HEIGHT> display(GxEPD2_290(/CS=5/ 7, /DC=/ 4, /RST=/ 5, /BUSY=/ 6)); // 屏幕型号1
GxEPD2_BW<GxEPD2_290_T5, GxEPD2_290_T5::HEIGHT> display(GxEPD2_290_T5(/CS=5/ 7, /DC=/4, /RST=/5, /BUSY=/6)); //屏幕型号2
底座模块
底座模块主要是起一个连接开发板和墨水屏模块的作用。
焊接PCB插座来实现墨水屏模块的拔插,焊接排母来实现与ESP32C3开发板的连接,焊接按钮来进行显示控制。
ESP32C3开发板
使用合宙的ESP32C3开发板,开发板买经典款或者简约款都可以。
经典款比较方便,因为使用简约款注意的技术细节会比较多,容易遇到坑。
排针朝上焊接就行,因为排针排母连接,这个项目用完拔下来做其他项目也很方便。
4.2 软件部分
编程软件Arduino
编程软件用的Arduino,环境配置参照网上资料。
开发板添加
使用到的库
本项目使用的库有:
- ArduinoJson库: 解析Json数据,项目里的天气、古诗、名言等信息都是通过一些API获得,保存在返回的json数据中。
- GxEPD2库:驱动墨水屏
- Timezone库:通过NTP获取时钟需要用到
- U8g2库:图像显示库
库的话可以在项目->加载库->管理库 中搜索下载。
5 部分核心固件代码
// wifi连接UDP设置参数
WiFiUDP Udp;
time_t getNtpTime() //通过NTP获取时间
{
IPAddress ntpServerIP; // NTP server's ip address
while (Udp.parsePacket() > 0)
; // discard any previously received packets
// Serial.println("Transmit NTP Request");
// get a random server from the pool
WiFi.hostByName(ntpServerName, ntpServerIP);
sendNTPpacket(ntpServerIP);
uint32_t beginWait = millis();
while (millis() - beginWait < 1500)
{
int size = Udp.parsePacket();
if (size >= NTP_PACKET_SIZE)
{
Serial.println("Receive NTP Response");
Udp.read(packetBuffer, NTP_PACKET_SIZE); // read packet into the buffer
unsigned long secsSince1900;
// convert four bytes starting at location 40 to a long integer
secsSince1900 = (unsigned long)packetBuffer[40] << 24;
secsSince1900 |= (unsigned long)packetBuffer[41] << 16;
secsSince1900 |= (unsigned long)packetBuffer[42] << 8;
secsSince1900 |= (unsigned long)packetBuffer[43];
return secsSince1900 - 2208988800UL + timeZone * SECS_PER_HOUR;
}
}
Serial.println("No NTP Response :-(");
return 0; // 无法获取时间时返回0
}
// 向NTP服务器发送请求
void sendNTPpacket(IPAddress &address)
{
// set all bytes in the buffer to 0
memset(packetBuffer, 0, NTP_PACKET_SIZE);
// Initialize values needed to form NTP request
// (see URL above for details on the packets)
packetBuffer[0] = 0b11100011; // LI, Version, Mode
packetBuffer[1] = 0; // Stratum, or type of clock
packetBuffer[2] = 6; // Polling Interval
packetBuffer[3] = 0xEC; // Peer Clock Precision
// 8 bytes of zero for Root Delay & Root Dispersion
packetBuffer[12] = 49;
packetBuffer[13] = 0x4E;
packetBuffer[14] = 49;
packetBuffer[15] = 52;
// all NTP fields have been given values, now
// you can send a packet requesting a timestamp:
Udp.beginPacket(address, 123); // NTP requests are to port 123
Udp.write(packetBuffer, NTP_PACKET_SIZE);
Udp.endPacket();
}
void initNTP()
{
// Login suceeded so set UDP local port
Udp.begin(LOCALPORT);
// Set the time provider to NTP
setSyncProvider(getNtpTime); //同步时间
}
6 最后
边栏推荐
猜你喜欢
dlopen failed: library "libtaml.so" not found
Digital wallets, red sea ecological rapid introduction of small programs can help capture device entry wisdom
ES6 Beginner to Mastery #13: Extension Methods for Arrays 2
游泳馆系统次卡的设置有哪些细节?
2022金九银十工作潮,怎么样才能成功跳槽面试拿到高薪呢?
JVM Memory and Garbage Collection - 10. Direct Memory
Why don't suggest you run in Docker Mysql?
MATLB|And her ups and downs and finally reached the peak of life [Romantic Journey]
上交所实时行情文件汇总
deepstream学习笔记(三):deepstream-imagedata-multistream解析与接入适配yolov5模型测试
随机推荐
Golden Warehouse Database KingbaseGIS User Manual (6.4. Geometry Object Access Function)
阿里云短信服务开通
Golden Warehouse Database KingbaseGIS User Manual (6.6. Geometric Object Verification Function, 6.7. Spatial Reference System Function)
Redis 大 key 要如何处理?
ECCV 2022 | 微软开源TinyViT :搞定小模型的预训练能力
【Infiltration tool】Browser data export tool
游泳馆系统次卡的设置有哪些细节?
Jpa 查询view or 无主键的table
Redis-基本介绍/linux下环境配置/配置文件
EL表达式
Eureka自我保护
NTP SERVICE TASK 在GWserver配置、启用NTP服务,为当前环境提供时钟同步服务,Client主机可以从该服务器同步时间。
[C language] Address book "Static Memory Version"
技术分享 | 接口自动化测试如何处理 Header cookie
基于 LSTM 的分布式能源发电预测(Matlab代码实现)
从TRPO到PPO(理论分析与数学证明)
dlopen failed: library "libtaml.so" not found
【obs】obsqsv11 硬编 及与metartc codec对比
聚焦热点 | ISC 2022软件供应链安全治理与运营论坛圆满落幕
arm-4-裸板开发