回到首页 返回首页
回到顶部 回到顶部
返回上一页 返回上一页

为防御疫情而造《智慧食堂人员监控和分流系统》 简单

头像 北极星白金 2020.05.23 903 1

步骤1 构思和图纸设计

设计思想:利用传感器控制和提前对食堂就餐人数进行确认和预警。为疫情期间的人流量的监控和提前分流起到了智能化。

project-image
project-image

步骤2 核心设备组装

安装各种传感器,并有序的,合理的排线。注意各引脚的链接。

project-image

步骤3 结构件制作和组装

熟练使用各种制作工具,对模型的结构件进行制作。此模型用到激光切割机,3D打印机和木工制作工具

project-image
project-image
project-image

步骤4 编程和写入

利用mind+软件进行程序的编写,在编写时要注意各变量的协调和配合。

project-image

步骤5 设备最后组装及调试

最后成品的封装和各部件的调试,封装前一定要按照先内部到外部,先底面到顶面的顺序。一一的测试和调控。

project-image
代码
代码
/*!
 * MindPlus
 * uno
 *
 */
#include <DFRobot_Servo.h>
#include <DFRobot_URM10.h>
#include <DFRobot_NeoPixel.h>
#include <DFRobot_Libraries.h>
#include <DFRobot_SSD1306_I2C.h>
#include <DFRobot_LiquidCrystal_I2C.h>

// 动态变量
volatile float mind_n_JinRuZongShu, mind_n_ChuQuZongShu;
// 函数声明
void DF_ChuShiHuaChengXu();
void DF_YiLouChuKouJianCe();
void DF_YiLouRuKouJianCe();
void DF_YiLouDaTingDengFengKong();
void DF_YiLouJianCeKongZhi();
void DF_JiShuXianShi();
// 静态常量
const chCode chBuf[] = {
	{0x5b8c,0xe5ae8c,0xCDEA,{0x00,0x00,0x01,0x00,0x01,0x00,0x7f,0xfc,0x40,0x04,0x00,0x00,0x3f,0xf8,0x00,0x00,0x7f,0xfc,0x04,0xc0,0x0c,0xc4,0x08,0xc6,0x30,0x44,0x40,0x7c,0x00,0x00,0x00,0x00}},
	{0x6210,0xe68890,0xB3C9,{0x00,0xd0,0x00,0xc8,0x3f,0xfe,0x20,0xc0,0x20,0x40,0x3e,0x48,0x22,0x48,0x22,0x58,0x22,0x70,0x42,0x62,0x42,0x62,0x5c,0xb6,0x81,0x1c,0x00,0x00,0x00,0x00,0x00,0x00}},
	{0x5c31,0xe5b0b1,0xBECD,{0x00,0x00,0x08,0x58,0xff,0x4c,0x00,0x40,0x7f,0xfc,0x42,0x50,0x42,0x50,0x7e,0x50,0x08,0xd0,0x2e,0x90,0x4a,0x92,0x49,0x12,0x0b,0x16,0x32,0x1c,0x00,0x00,0x00,0x00}},
	{0x9910,0xe9a490,0xB2CD,{0x08,0x00,0x0f,0x7c,0x28,0x48,0x7e,0x70,0x44,0x78,0x19,0x84,0x31,0x00,0x4f,0xe0,0x30,0x18,0xdf,0xf6,0x10,0x10,0x1f,0xf8,0x10,0xf0,0x1e,0x0c,0x00,0x00,0x00,0x00}},
	{0xff1a,0xefbc9a,0xA3BA,{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x30,0x00,0x00,0x00,0x30,0x00,0x30,0x00,0x00,0x00,0x00,0x00}},
	{0x6b63,0xe6ada3,0xD5FD,{0x00,0x00,0x7f,0xfc,0x00,0x80,0x00,0x80,0x10,0x80,0x10,0x80,0x10,0x80,0x10,0xfc,0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80,0xff,0xfe,0x00,0x00,0x00,0x00}},
	{0x5728,0xe59ca8,0xD4DA,{0x00,0x00,0x06,0x00,0x04,0x00,0x7f,0xfe,0x08,0x00,0x08,0x40,0x10,0x40,0x30,0x40,0x37,0xfc,0x70,0x40,0x90,0x40,0x10,0x40,0x10,0x40,0x1f,0xfe,0x00,0x00,0x00,0x00}},
	{0x8fdb,0xe8bf9b,0xBDF8,{0x00,0x00,0x41,0x10,0x61,0x10,0x21,0x10,0x17,0xfc,0x01,0x10,0xe1,0x10,0x21,0x10,0x2f,0xfe,0x23,0x10,0x26,0x10,0x24,0x10,0x50,0x00,0x0f,0xfe,0x00,0x00,0x00,0x00}},
	{0x8fd8,0xe8bf98,0xBBB9,{0x47,0xfc,0x20,0x40,0x10,0x40,0x00,0xc0,0xe1,0xe0,0x21,0x58,0x22,0x4c,0x24,0x44,0x28,0x40,0x20,0x40,0x30,0x40,0x58,0x00,0x0f,0xfe,0x00,0x00,0x00,0x00,0x00,0x00}},
	{0x53ef,0xe58faf,0xBFC9,{0x00,0x00,0xff,0xfe,0x00,0x10,0x00,0x10,0x3f,0x10,0x21,0x10,0x21,0x10,0x21,0x10,0x21,0x10,0x3f,0x10,0x20,0x10,0x00,0x10,0x00,0x10,0x00,0xf0,0x00,0x00,0x00,0x00}},
	{0x5165,0xe585a5,0xC8EB,{0x00,0x00,0x04,0x00,0x06,0x00,0x02,0x00,0x03,0x00,0x03,0x80,0x02,0x80,0x06,0xc0,0x04,0x40,0x0c,0x20,0x18,0x20,0x30,0x10,0x60,0x0c,0x40,0x04,0x00,0x00,0x00,0x00}}
};
// 创建对象
Servo                     servo_3;
DFRobot_SSD1306_I2C       oled12864;
DFRobot_NeoPixel          neoPixel_11;
DFRobot_NeoPixel          neoPixel_12;
DFRobot_URM10             urm10;
DFRobot_Tone              DFTone;
DFRobot_LiquidCrystal_I2C lcd1602;


// 主程序开始
void setup() {
	servo_3.attach(3);
	oled12864.setChCode(chBuf);
	lcd1602.begin(0x20);
	DF_ChuShiHuaChengXu();
}
void loop() {
	DF_YiLouChuKouJianCe();
	DF_YiLouRuKouJianCe();
	DF_YiLouJianCeKongZhi();
	DF_YiLouDaTingDengFengKong();
}


// 自定义函数
void DF_ChuShiHuaChengXu() {
	mind_n_JinRuZongShu = 0;
	mind_n_ChuQuZongShu = 0;
	servo_3.angle(abs(10));
	oled12864.begin(0x3c);
	oled12864.setCursorLine(1);
	oled12864.printLine("完成就餐:");
	oled12864.setCursorLine(2);
	oled12864.printLine("正在进餐:");
	oled12864.setCursorLine(3);
	oled12864.printLine("还可进入:");
	oled12864.setCursor(75, 0);
	oled12864.print("0");
	oled12864.setCursor(75, 1);
	oled12864.print("0");
	oled12864.setCursor(75, 2);
	oled12864.print("0");
	neoPixel_11.begin(11, 1);
	neoPixel_12.begin(12, 5);
	neoPixel_11.clear();
	neoPixel_12.clear();
	digitalWrite(8, LOW);
	mind_n_JinRuZongShu = 0;
	mind_n_ChuQuZongShu = 0;
	servo_3.angle(abs(10));
	oled12864.begin(0x3c);
	oled12864.setCursorLine(1);
	oled12864.printLine("完成就餐:");
	oled12864.setCursorLine(2);
	oled12864.printLine("正在进餐:");
	oled12864.setCursorLine(3);
	oled12864.printLine("还可进入:");
	oled12864.setCursor(75, 0);
	oled12864.print("0");
	oled12864.setCursor(75, 1);
	oled12864.print("0");
	oled12864.setCursor(75, 2);
	oled12864.print("0");
	neoPixel_11.begin(11, 1);
	neoPixel_12.begin(12, 5);
	neoPixel_11.clear();
	neoPixel_12.clear();
	digitalWrite(8, LOW);
}
void DF_YiLouChuKouJianCe() {
	if (((urm10.getDistanceCM(5, 4))<8)) {
		delay(500);
		servo_3.angle(abs(105));
		while (!((urm10.getDistanceCM(5, 4))>7)) {}
		servo_3.angle(abs(10));
		mind_n_ChuQuZongShu += 1;
		delay(700);
		DF_JiShuXianShi();
	}
}
void DF_YiLouRuKouJianCe() {
	if (((urm10.getDistanceCM(7, 6))<9)) {
		delay(700);
		if (((mind_n_JinRuZongShu - mind_n_ChuQuZongShu)>=9)) {
			while (!((urm10.getDistanceCM(7, 6))>8)) {
				DFTone.play(9, 988, 1000);
			}
		}
		else {
			while (!((urm10.getDistanceCM(7, 6))>9)) {}
			delay(700);
			mind_n_JinRuZongShu += 1;
			DF_JiShuXianShi();
		}
	}
}
void DF_YiLouDaTingDengFengKong() {
	if (((mind_n_JinRuZongShu - mind_n_ChuQuZongShu)==0)) {
		neoPixel_12.setBrightness(19);
		neoPixel_12.setRangeColor(0, 5, 0xFFFFFF);
		digitalWrite(8, LOW);
	}
	if ((((mind_n_JinRuZongShu - mind_n_ChuQuZongShu)>=1) && ((mind_n_JinRuZongShu - mind_n_ChuQuZongShu)<=3))) {
		neoPixel_12.setBrightness(70);
		neoPixel_12.setRangeColor(0, 5, 0xFFFFFF);
		digitalWrite(8, LOW);
	}
	if ((((mind_n_JinRuZongShu - mind_n_ChuQuZongShu)>3) && ((mind_n_JinRuZongShu - mind_n_ChuQuZongShu)<=9))) {
		neoPixel_12.setBrightness(255);
		neoPixel_12.setRangeColor(0, 5, 0xFFFFFF);
		digitalWrite(8, HIGH);
	}
}
void DF_YiLouJianCeKongZhi() {
	if ((((mind_n_JinRuZongShu - mind_n_ChuQuZongShu)>=0) && ((mind_n_JinRuZongShu - mind_n_ChuQuZongShu)<=3))) {
		neoPixel_11.setBrightness(255);
		neoPixel_11.setRangeColor(0, 1, 0x00FF00);
		servo_3.angle(abs(10));
	}
	if ((((mind_n_JinRuZongShu - mind_n_ChuQuZongShu)>3) && ((mind_n_JinRuZongShu - mind_n_ChuQuZongShu)<=8))) {
		neoPixel_11.setBrightness(255);
		neoPixel_11.setRangeColor(0, 1, 0xFFFF00);
		servo_3.angle(abs(10));
	}
	if (((mind_n_JinRuZongShu - mind_n_ChuQuZongShu)>=9)) {
		neoPixel_11.setBrightness(255);
		neoPixel_11.setRangeColor(0, 1, 0xFF0000);
		servo_3.angle(abs(105));
	}
}
void DF_JiShuXianShi() {
	lcd1602.clear();
	oled12864.setCursor(75, 0);
	oled12864.print(mind_n_ChuQuZongShu);
	oled12864.setCursor(75, 1);
	oled12864.print((mind_n_JinRuZongShu - mind_n_ChuQuZongShu));
	oled12864.setCursor(75, 2);
	oled12864.print((9 - (floor((mind_n_JinRuZongShu - mind_n_ChuQuZongShu)))));
}

材料清单

评论

user-avatar
  • 北极星白金

    北极星白金2020.05.25

    项目做得还不够完美,是否可以加入远程控制和人面识别功能,为恶意闯关的留下证据。

    0