停车场寻车系统
上个星期用了一周左右做了一个停车场寻车系统的项目,可以识别车牌,通过手机app查询车辆信息
手机app采用的依旧是点灯科技,通过物联网接入,这次更加深入了解了blinker的组件,就给车库加了查询功能。
ESP8266代码:
#define BLINKER_WIFI
#include
#include
char auth[] = "**************"; // blinker app提供的秘钥
char ssid[] = "Mr.Robot";// wifi 名字
char pswd[] = "************";// wifi 密码
int incomedate=0;
// 新建组件对象
BlinkerButton Button1("btn-abc");
BlinkerNumber Number1("num-abc");
BlinkerNumber TEMP("tem");
#define TEXTE_2 "tex-pi2"
BlinkerText Text2(TEXTE_2);
int counter = 0;
int a=0,a1=0,a2=0,a3=0,a4=0,a5=0,a6=0,a7=0,a8=0;
void dataRead(const String & data){
uint32_t BlinkerTime = millis();
BLINKER_LOG("input=",data);
if(data=="苏E·82L84")
{
Serial.println("查询成功");
TEMP.print(a);
Text2.print(data);
}
if(data=="桂A·R397")
{
Serial.println("查询成功");
TEMP.print(a1);
Text2.print(data);
}
if(data=="鲁F·8L620")
{
Serial.println("查询成功");
TEMP.print(a2);
Text2.print(data);
}
if(data=="湘A·BA597")
{
Serial.println("查询成功");
TEMP.print(a3);
Text2.print(data);
}
if(data=="蒙E·PF927")
{
Serial.println("查询成功");
TEMP.print(a4);
Text2.print(data);
}
if(data=="川B·029PQ")
{
Serial.println("查询成功");
TEMP.print(a5);
Text2.print(data);
}
if(data=="京K·98410")
{
Serial.println("查询成功");
TEMP.print(a6);
Text2.print(data);
}
if(data=="陕K·7555")
{
Serial.println("查询成功");
TEMP.print(a7);
Text2.print(data);
}
if (Serial.available() > 0)//串口接收到数据
{
incomedate = Serial.read();//获取串口接收到的数据
if (incomedate == 'H')
{
a=1;
}
if (incomedate == 'Q')
{
a=2;
}
if (incomedate == 'W')
{
a=3;
}
if (incomedate == 'E')
{
a=4;
}
if (incomedate == 'R')
{
a=5;
}
if (incomedate == 'T')
{
a=6;
}
if (incomedate == 'Y')
{
a=7;
}
if (incomedate == 'U')
{
a=8;
}
if (incomedate == 'I')
{
a1=1;
}
if (incomedate == 'O')
{
a1=2;
}
if (incomedate == 'P')
{
a1=3;
}
if (incomedate == 'A')
{
a1=4;
}
if (incomedate == 'S')
{
a1=5;
}
if (incomedate == 'D')
{
a1=6;
}
if (incomedate == 'F')
{
a1=7;
}
if (incomedate == 'G')
{
a1=8;
}
if (incomedate == 'J')
{
a2=1;
}
if (incomedate == 'K')
{
a2=2;
}
if (incomedate == 'L')
{
a2=3;
}
if (incomedate == 'Z')
{
a2=4;
}
if (incomedate == 'X')
{
a2=5;
}
if (incomedate == 'C')
{
a2=6;
}
if (incomedate == 'V')
{
a2=7;
}
if (incomedate == 'B')
{
a2=8;
}
if (incomedate == 'N')
{
a3=1;
}
if (incomedate == 'M')
{
a3=2;
}
if (incomedate == '1')
{
a3=3;
}
if (incomedate == '2')
{
a3=4;
}
if (incomedate == '3')
{
a3=5;
}
if (incomedate == '4')
{
a3=6;
}
if (incomedate == '5')
{
a3=7;
}
if (incomedate == '6')
{
a3=8;
}
if (incomedate == '7')
{
a4=1;
}
if (incomedate == '8')
{
a4=2;
}
if (incomedate == '9')
{
a4=3;
}
if (incomedate == '`')
{
a4=4;
}
if (incomedate == '!')
{
a4=5;
}
if (incomedate == '@')
{
a4=6;
}
if (incomedate == '#')
{
a4=7;
}
if (incomedate == '$')
{
a4=8;
}
if (incomedate == '%')
{
a5=1;
}
if (incomedate == '^')
{
a5=2;
}
if (incomedate == '&')
{
a5=3;
}
if (incomedate == '*')
{
a5=4;
}
if (incomedate == '(')
{
a5=5;
}
if (incomedate == ')')
{
a5=6;
}
if (incomedate == '_')
{
a5=7;
}
if (incomedate == '+')
{
a5=8;
}
if (incomedate == '}')
{
a6=1;
}
if (incomedate == '{')
{
a6=2;
}
if (incomedate == ']')
{
a6=3;
}
if (incomedate == '[')
{
a6=4;
}
if (incomedate == '=')
{
a6=5;
}
if (incomedate == '|')
{
a6=6;
}
if (incomedate == ';')
{
a6=7;
}
if (incomedate == '<')
{
a6=8;
}
if (incomedate == '>')
{
a7=1;
}
if (incomedate ==',')
{
a7=2;
}
if (incomedate == '.')
{
a7=3;
}
if (incomedate == '?')
{
a7=4;
}
if (incomedate == '*')
{
a7=5;
}
if (incomedate == '~')
{
a7=6;
}
if (incomedate == ':')
{
a7=7;
}
if(incomedate == '-')
{
a7=8;
}
}
}
void setup()
{
// 初始化串口
Serial.begin(115200);
BLINKER_DEBUG.stream(Serial);
BLINKER_DEBUG.debugAll();
Blinker.begin(auth, ssid, pswd);
Blinker.attachData(dataRead);
}
void loop()
{
Blinker.run();
}
通过yolov2+K210识别车牌,串口通信将信息发送到STM32。
通过K210识别车牌,发送到STM32端,红外感应到将信息存入数组,然后打包发送到ESP8266端,ESP8266接收信息并设置标志,再通过MQTT接入手机app,手机app下发相关指令进行查询。
其实这个项目难就难在车牌的识别以及数据的匹配,车牌识别用到了YOLOV2算法与深度学习的开发板K210,这样的处理速度更快,更准确。数据匹配采用模拟数据库的方法进行匹配。在数据匹配的过程中,要注意"c1"和c’1’两种方式是完全不同的一个引号才能叫匹配,两个引号找的是地址。