当前位置:网站首页>Storage system lighting sorting
Storage system lighting sorting
2022-07-18 03:01:00 【cetclyb】
In the storage system , In order to improve the efficiency of manual picking , Many enterprises have added the light picking function in the warehouse , That is, add light guidance on the existing shelves , The operator selects materials on the corresponding shelf according to the light . Now, the light guide signs installed on the warehouse location in the market are generally specially made equipment , The function fully meets the requirements , But the price is generally high . Combined with the current market WS2812 The application of light band is widespread , use WS2812 Make a light picking Guide , Meet the requirements in function , The effect is better than the existing , The cost is lower than now .
1: System diagram 
The core controller is stm32 Series of microcontrollers , Later, it can be replaced by domestic single chip computers .
signal communication , In order to adapt to a variety of scenarios , Currently implemented support 485 signal communication ,232 Communication and network port communication .
Light strip selection WS2812B The lamp strip of the wick , The length of the light strip is determined according to the actual location , The length supported by the controller can be set freely .
Power supply , Considering the convenience of on-site implementation , The power supply range of the equipment ranges from 5V~24V.
2: Communication protocol and program processing
The communication protocol uses its own protocol , After the hardware interface is determined in the hardware layer ,WMS The system needs to send data in the format of the Protocol , After the controller receives the data , Normal inspection , Feed back the same frame data to WMS System , At the same time, start to light up ; Abnormal inspection , Set the corresponding exception code at the exception position , Then give feedback to WMS System , Do not perform light .
The communication protocol is defined as follows 
Send the following instructions to the main control board from the communication interface 
The meaning of this instruction is as follows :
AA : Indicates the beginning of the frame
00 15 : from 21 Start with a light
00 05: bright 5 Lights
00 : Wait for the order to turn off the light
00 00 30 : The light is blue 30
00 00 00 : Off color
00 : Normal frame
00 00 : crc test , This frame is for the convenience of testing , Left check .
BB: End of the frame
Actual test board function test , Use serial port to test , The data sent from the serial port is shown in the figure 
In this picture , Three light guidance frames have been sent , The actual guidance light is shown in the figure below : 
First frame command : from 1 The light starts 5 The light is green ;
Second frame command : from 11 The light starts 5 The lights are red ;
The third frame command : from 21 The light starts 5 Lights are blue .
The serial port communication receiving data of the control board is executed in the serial port interrupt , Analyze every character received , The receiving procedure is as follows
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)
{
UNUSED(huart);
if(huart == &huart1)
{
// Receive status identification ,0: Wait for the agreement header ;1: Protocol receiving ;2: Protocol reception completed , To be processed .
switch(recv_flag)
{
case 0:
recv_overtime:
if(recv == 0xAA){
recv_delay = RECV_DELAY;
recv_flag = 1;
recv_length = 0;
recv_buff[recv_length]=recv;
recv_length ++;
}
break;
case 1:
if(RECV_DELAY == 0){
// Receive inter character delay timeout
recv_flag = 0;
goto recv_overtime;
}
recv_delay = RECV_DELAY;
recv_buff[recv_length]=recv;
recv_length ++;
if(recv_length == 16){
if(recv == 0xBB){
recv_flag = 2;
}else{
recv_flag = 0;
}
}
break;
default:
break;
}
HAL_UART_Receive_IT(&huart1, (uint8_t *)&recv, 1);
}
}
After receiving, process the data in the main program , The procedure is as follows :
// Cancel the display function after timeout in the Protocol
WS_ClearWHLED();
// Data received , To be processed
if(recv_flag == 2)
{
//RC522_Test(recv_flag);
if(spisend_flag == 0)
{
// Display data analysis and processing
WS_CreateWHLED();
HAL_IWDG_Refresh(&hiwdg);
// The received data is replied to the sender
for(i = 0; i < 16; i++)
{
send_buff[i]= recv_buff[i];
}
HAL_UART_Transmit(&huart1,send_buff,16,0xFFFF);
recv_flag = 0;
}
}
Specific data processing
void WS_CreateWHLED()
{
int i;
U16 pt, len;
// Timeout automatically cancels the display
if(recv_buff[5] != 0)
{
led_flag = 1;
led_delay1s = recv_buff[5] + 1;
}
else
led_flag = 0;
pt = (recv_buff[1] << 8) + recv_buff[2] - 1;
len = (recv_buff[3] << 8) + recv_buff[4];
if((0 <= pt) && (pt < LEDNUMB))
{
if((pt + len) > LEDNUMB)
len = LEDNUMB - pt;
for(i = 0; i < len; i++)
{
ledGRB[3*pt + 3*i] = recv_buff[6];
ledGRB[3*pt + 3*i + 1] = recv_buff[7];
ledGRB[3*pt + 3*i + 2] = recv_buff[8];
}
}
//WS2812B Show
WS_led();
}
void WS_ClearWHLED()
{
int i;
I16 pt;
U16 len;
if(led_flag == 1)
{
if(led_delay1s == 0)
{
led_flag = 0;
pt = (recv_buff[1] << 8) + recv_buff[2] - 1;
len = (recv_buff[3] << 8) + recv_buff[4];
if((0 <= pt) && (pt < LEDNUMB))
{
if((pt + len) > LEDNUMB)
len = LEDNUMB - pt;
for(i = 0; i < len; i++)
{
ledGRB[3*pt + 3*i] = recv_buff[9];
ledGRB[3*pt + 3*i + 1] = recv_buff[10];
ledGRB[3*pt + 3*i + 2] = recv_buff[11];
}
}
WS_led();
}
}
}
3:WS2812B data display
WS2812B Refer to the manual for data transmission waveform , In this procedure SPI + DMA Interrupt mode to implement the interface .WS2812 One bit of is used spi One of the byte simulation .
The parameter configuration is as follows 
WS2812 Bit value 1 yes SPI Corresponding byte Value 0XF8, Position as 0 Is the corresponding value 0XC0.
WS2812 By bit conversion spi Function of
U8 WS_code[2] = {
0XC0, 0XF8};
void WS_GetData(U8 *data, U16 len)
{
int i, j, k = 0;
for(i = 0; i < len; i++)
{
for(j = 7; j >= 0; j--)
{
senddata[k] = WS_code[(data[i] >> j) & 0x01];
k ++;
}
}
}
void WS_led()
{
WS_GetData(ledGRB, GRBNUMB);
//SPI_Send(senddata, SENDLen);
//SPI_Send_IT(senddata, SENDLen);
SPI_SendDMA_IT(senddata, SENDLen);
}
void SPI_SendDMA_IT(U8 *pData, U16 Size)
{
spisend_flag = 1;
HAL_SPI_Transmit_DMA(&hspi1, senddata, SENDLen);
}
//spi Interrupt after sending
void HAL_SPI_TxCpltCallback(SPI_HandleTypeDef *hspi)
{
UNUSED(hspi);
if(hspi == &hspi1)
{
spisend_flag = 0;
HAL_SPI_DMAStop(hspi);
}
}
thus , Complete the function of receiving data and lighting .
Last , Installation implementation and use effect , The scheme is superior to the existing special equipment on the market in light indication ; The disadvantage is that after the operator finishes sorting , Feedback results , Special equipment claps the lamp directly ( Key ) feedback , The scheme needs to be in PDA Feedback .
边栏推荐
- 【流放之路-第一章】
- Envoyez votre code dans l'espace et développez "le plus grand travail" avec Huawei Cloud
- 「开源摘星计划」Harbor高可用集群设计及部署(实操+视频),基于离线安装方式
- Zhiyuan community weekly 89: Yann Lecun and other writers responded to Marcus' symbolic reasoning debate; Zhu Songchun's new work of aligning AI value with science's official website headlines; Ma Yi,
- “代码写的越急,程序跑的越慢”
- H5实现生成urlscheme并从H5跳转到小程序
- July 11, 2022 - July 17, 2022 (UE4 video tutorials and documents)
- Vector
- HCIP笔记(1)
- Unit MySQL appears in MySQL Solution of service could not be found
猜你喜欢

To realize the remote direct electromagnetic communication of consciousness, the Dongda team, together with the National University of Singapore and others, is expected to build an electromagnetic bra

The No.1 port and shipping AI enterprise in the world integrates Feitong, port and shipping AI products are mature, standardized and applied on a large scale, and advanced core technologies greatly im

ESP8266 lua入门

Adding an index by Oracle causes other users to lose their query permissions on this table

HCIP回顾(2)

PyGame - airplane battle (to be improved)

【云原生】基于Kubevela华为云的Terraform addon开发

Hcip notes (1)

03 key control LED

How can im make enterprise telecommuting simpler and more efficient?
随机推荐
RS485接线 | Modbus智能LED三色声光报警器 机房警示灯带蜂鸣器
08 use timer to control LED flashing
Getting started with esp8266 Lua
The No.1 port and shipping AI enterprise in the world integrates Feitong, port and shipping AI products are mature, standardized and applied on a large scale, and advanced core technologies greatly im
XPath Combat: climbing the learning ape land (Part 2)
加密市场的牛熊周期;NFT 定义的争论
51nod 1413 权势二进制
2022年7月11日-2022年7月17日(ue4视频教程和文档)
Event preview | Apache Doris x Apache seatunnel joint meetup to start registration!
Traverse the file (txt) under the folder and delete the last line
Fragment (III) using fragment in viewpager
斗地主包含抢地主环节
HCIP笔记(2)
第一百期:封装简答的flutter组件
有奖调研 | openEuler 开发者体验调研问卷
Spark中RDD、DataFrame和DataSet的区别与联系
Vector
Sequence table
No.1 port and shipping AI enterprises in the world have integrated fly pupil, and the mature and standardized AI products of port and shipping have been applied on a large scale, which has greatly imp
umi 3.0模版