diff --git a/arc_design_contest/2019/XDU-Intelligent-Safety-Welding-Table-based-on-ARC b/arc_design_contest/2019/XDU-Intelligent-Safety-Welding-Table-based-on-ARC new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/arc_design_contest/2019/XDU-Intelligent-Safety-Welding-Table-based-on-ARC @@ -0,0 +1 @@ + diff --git a/arc_design_contest/2019/XDU-Intelligent-Safety-Welding-Table-based-on-ARC1/1 b/arc_design_contest/2019/XDU-Intelligent-Safety-Welding-Table-based-on-ARC1/1 new file mode 100644 index 00000000..aab73926 --- /dev/null +++ b/arc_design_contest/2019/XDU-Intelligent-Safety-Welding-Table-based-on-ARC1/1 @@ -0,0 +1 @@ +come on diff --git a/arc_design_contest/2019/XDU-Intelligent-Safety-Welding-Table-based-on-ARC1/README.md b/arc_design_contest/2019/XDU-Intelligent-Safety-Welding-Table-based-on-ARC1/README.md new file mode 100644 index 00000000..2f6fd637 --- /dev/null +++ b/arc_design_contest/2019/XDU-Intelligent-Safety-Welding-Table-based-on-ARC1/README.md @@ -0,0 +1,78 @@ +# Intelligent Safety Welding Table based on ARC +The project is an intelligent safety welding platform based on Synopsys ARC EM processor. When the laboratory personnel are operating the welding table, the instrument works normally. Judging by human infrared sensor, when the operator leaves, the voice module reminds to close the welding platform. If the soldering table is not closed after the operator has been away for a period of time, the power is automatically cut off through the relay module. This project also includes flame sensor, smoke sensor, and GSM module. When the flame sensor and the smoke sensor sense a certain amount of smoke and fire light in the laboratory, the processor immediately determines that there may be a fire, giving priority to the welding table through the relay There are hidden dangers in voice broadcasting through power outage and voice module, and text messages are sent to laboratory administrators through GSM module to inform them to check the hidden dangers in time. +* [Introduction](#introduction) + * [Project context](#project-context) + * [System Architecture](#system-architecture) + * [Function](#function) +* [Hardware and Software Setup](#hardware-and-software-setup) + * [Required Hardware](#required-hardware) + * [Required Software](#required-software) + * [Hardware Connection](#hardware-connection) +* [User Manual](#user-manual) + * [Before Running This Application](#before-running-this-application) + * [Run This Application](#run-this-application) + * [DemoVideo](#demovideo) +## Introduction +### Project context +With the progress and development of science and technology, more and more colleges and universities are committed to cultivating college students' scientific literacy and strengthening practical skills and entrepreneurial ability. The establishment of innovation laboratory for college students has become the main place and platform for college students to impart knowledge, develop intelligence, cultivate college students' scientific quality and skills, cultivate college students' innovative spirit, entrepreneurial consciousness, innovative entrepreneurial ability and so on. It has an irreplaceable and unique role, stimulates students' innovative thinking and innovative consciousness, but also constructs innovative educational culture, and comprehensively improves students' innovative experimental ability. However, with the increase of laboratory students and the difficulty of management, it is also gradually becoming more and more difficult. There are some hidden dangers, such as irregular use of sockets and sockets, electric soldering iron, hot air gun, and other laboratory instruments and equipment have not been turned off from time to time, and it is easy to cause fire accidents. +![0](https://github.com/BOLDNESS97/embarc_applications-arc_design_contest-2019-XDU-Intelligent-Safety-Welding-Table-based-on-ARC/blob/master/pic/anquanyinhuan1.jpg) +Based on an analysis of 95 laboratory accidents in colleges and universities at home and abroad from 2010 to 2015 (66 in mainland China), a similar conclusion was drawn: 68% of explosions and fires, 12% of leakage, 11% of biosafety, 2% of poisoning and 7% of others. The main reason that triggered the safety accident was also the violation of the experimental operation rules or careless experimental operation, accounting for 52% of the total number of accidents, resulting in 40% of the deaths and 65% of the injuries or poisoning. +### System Architecture +![00](https://github.com/BOLDNESS97/embarc_applications-arc_design_contest-2019-XDU-Intelligent-Safety-Welding-Table-based-on-ARC/blob/master/pic/yingjianlianjie.jpg) +### Function + * Intelligent real-time monitoring + * Voice real-time broadcast + * Security hazard alarm + * send information in real time + * Automatic control circuit + ## Hardware and Software Setup +### Required Hardware +* 1 DesignWare ARC EM Starter Kit(EMSK) +* 1 Diffuse photoelectric switch. +* 1 SIM900A SMS module +* 1 SIM card +* 1 All the way optical coupling isolation relay +* 1 SDCard +* 1 TTS voice module +* 1 Smoke sensor module +* 1 Flame sensor module +* 1 buzzer +* **The physical picture shown below** +![00](https://github.com/BOLDNESS97/embarc_applications-arc_design_contest-2019-XDU-Intelligent-Safety-Welding-Table-based-on-ARC/blob/master/pic/waiguan.jpg)![00](https://github.com/BOLDNESS97/embarc_applications-arc_design_contest-2019-XDU-Intelligent-Safety-Welding-Table-based-on-ARC/blob/master/pic/neibulianjie.jpg) +### Required Software +* Metaware or ARC GNU Toolset +* Serial port terminal, such as putty +### Hardware Connection +| link module | attended mode | +| --------------------------------------------------|----------------------------------| +| All the way optical coupling isolation relay | GPIO | +| SIM900A SMS module | UART | +| TTS voice module | UART | +| Diffuse photoelectric switch | GPIO | +| Smoke sensor module | GPIO | +| Flame sensor module | GPIO | +| buzzer | GPIO | +## User Manual +### Before Running This Application +The hardware resources are allocated as following table. + +| Hardware Resource | Function | +| -------------------------------------------| ------------------------------------------------------------| +|All the way optical coupling isolation relay| used to realize the shutdown of the circuit | +| SIM900A SMS module | For sending text messages remotely | +| TTS voice module | For voice broadcast prompts | +| Diffuse photoelectric switch | Used to detect the human body. | +| Smoke sensor module | Used to detect smoke | +| Flame sensor module | Used to detect open fire | +| buzzer | Beehive prompt | +### Run This Application +#### Makefile +- Target options about EMSK and toolchain: + + BOARD ?= emsk + BD_VER ?= 22 + CUR_CORE ?= arcem7d + TOOLCHAIN ?= gnu +# DemoVideo +[Link](https://v.youku.com/v_show/id_XNDI5MTMzNDc2OA==.html?spm=a2h3j.8428770.3416059.1) + diff --git a/arc_design_contest/2019/arc/4 b/arc_design_contest/2019/arc/4 new file mode 100644 index 00000000..aab73926 --- /dev/null +++ b/arc_design_contest/2019/arc/4 @@ -0,0 +1 @@ +come on diff --git a/arc_design_contest/2019/arc/main.c b/arc_design_contest/2019/arc/main.c new file mode 100644 index 00000000..1cd34891 --- /dev/null +++ b/arc_design_contest/2019/arc/main.c @@ -0,0 +1,210 @@ +#include "arc.h" +#include "arc_builtin.h" +#include "string.h" +#include "stdio.h" +#include "embARC.h" +#include "embARC_debug.h" +#include "embARC_toolchain.h" +#include "embARC_error.h" + +/* middleware level*/ +/* application level */ + +#include "board.h" +#include "dev_uart.h" + + + +#define uchar unsigned char +#define uint unsigned int +#define HEADLEN 5 //数据包头的长庿 + +static volatile int t0 = 0; + +static DEV_GPIO_PTR port_example; +static DEV_GPIO_PTR port_huoyan; +static DEV_GPIO_PTR port_yanwu; +static DEV_GPIO_PTR port_hongwai; +static DEV_GPIO_PTR port_jidianqi; +DEV_UART *dev_uart0 = NULL; +DEV_UART *dev_uart2 = NULL; +uint8_t *phoneNum = "00310035003600380036003000330038003500350031"; +uint8_t *msg ="75914F3C7740706B8BF7901F639267E5"; +uint32_t rd_avail = 0; +int cmd; +int cmd1; + +static void delay_ms(volatile int z) //1ms +{ + volatile uint32_t x,y; + for(x=1400;x>0;x--) + for(y=z;y>0;y--); +} + +void yuyin(char text[]) +{ + //char text[]={"欢迎光临"}; + uint8_t length; + char ecc = 0x00; //定义校验字节 + uint8_t i=0; + length =sizeof(text); //需要发送文本的长度 + + uint32_t baudrate = 115200; + dev_uart2 = uart_get_dev(DW_UART_2_ID); + dev_uart2->uart_open(baudrate); + + while(text[length++]); + { + char head[HEADLEN] = {0xfd,0x00,0x00,0x01,0x00}; + head[2] = length + 2; + for(i = 0; i<5; i++) //依次发送构造好皿个帧头字芿 + { + ecc=ecc^(head[i]); //对发送的字节进行异或校验 + printf("head[%d]=%d\r\n",i,head[i]); + + } + printf("length=%d\r\n",length); + + dev_uart2->uart_write(head, 5); + for(i = 0; iuart_write(text, length); + //dev_uart2->uart_write(ecc, 1); + delay_ms(300); + } + + +} + +void send(uint8_t *phoneNum, uint8_t *msg) +{ + DEV_UART *dev_uart0 = NULL; + uint32_t baudrate = 115200; + dev_uart0 = uart_get_dev(DW_UART_0_ID); + dev_uart0-> uart_open(baudrate); + + uint8_t i; + uint8_t pnum[64]; + int8_t *cmd[5]={"AT+CMGF=1\r\n", "AT+CSCS=\"UCS2\"\r\n", + "AT+CSCA?\r\n", "AT+CSMP=17,167,0,25\r\n",}; + snprintf(pnum, 64, "AT+CMGS=\"%s\"\r\n", phoneNum); + for(i = 0; i < 4; i++) + { + dev_uart0->uart_write(cmd[i], strlen(cmd[i])); + delay_ms(100); + } + dev_uart0->uart_write(pnum, strlen(pnum)); + delay_ms(100); + dev_uart0->uart_write(msg, strlen(msg)); + delay_ms(100); + uint8_t end[]={0x1a,0x00}; + dev_uart0->uart_write(end, strlen(end)); +} + +int main(void) +{ + + uint32_t data; + uint32_t hdata; + uint32_t ywdata; + uint32_t hwdata; + uint32_t jiddata; + cpu_lock(); /* lock cpu to do initializations */ + board_init(); /* board level init */ + cpu_unlock(); /* unlock cpu to let interrupt work */ + /////////////////////////////////////////////////////////////////////////打开C口 蜂鸣器 + port_example = gpio_get_dev(DW_GPIO_PORT_C);//定义port_c接口 + port_example->gpio_open(0x10000);//open C[16] + port_example->gpio_control(GPIO_CMD_SET_BIT_DIR_OUTPUT, (void *)0x10000);//设置portC[16]为输出 + + + /////////////////////////////////////////////////////////////////////////打开C口 火焰输入1 2 + port_huoyan = gpio_get_dev(DW_GPIO_PORT_C);//定义GPIO C[17]控制火焰端口的输入 + port_huoyan->gpio_open(0x20000);//open C[17] + port_huoyan->gpio_control(GPIO_CMD_SET_BIT_DIR_INPUT, (void *)0x20000);//设置C[17]输入 + + + /////////////////////////////////////////////////////////////////////////打开C口 烟雾输入 + port_yanwu = gpio_get_dev(DW_GPIO_PORT_C);//定义GPIO C[18]控制烟雾端口的输入 + port_yanwu->gpio_open(0x40000);//open C[18] + port_yanwu->gpio_control(GPIO_CMD_SET_BIT_DIR_INPUT, (void *)0x40000);//设置C[17]输入 + +/////////////////////////////////////////////////////////////////////////打开C口 控制红外感应模块的输入 + port_hongwai = gpio_get_dev(DW_GPIO_PORT_C);//定义GPIO C[19]输入 + port_hongwai->gpio_open(0x80000);//open C[19] 0x80000 + port_hongwai->gpio_control(GPIO_CMD_SET_BIT_DIR_INPUT, (void *)0x80000); + + /////////////////////////////////////////////////////////////////////////打开A口 控制继电器的输出 + port_jidianqi = gpio_get_dev(DW_GPIO_PORT_A);//定义GPIO A[19]输入 + port_jidianqi->gpio_open(0x80000);//open A[19] 0x80000 + port_jidianqi->gpio_control(GPIO_CMD_SET_BIT_DIR_OUTPUT, (void *)0x80000); + + //initialize the uart0 which is on PMOD1 J3 for TXD J4 for RXD + + while(1) + { + port_huoyan->gpio_read(&hdata, 0x20000); //读取火焰的端口1 + + port_yanwu->gpio_read(&ywdata, 0x40000); //读取烟雾的端口1 + + port_hongwai->gpio_read(&hwdata, 0x80000); //读取红外的端口 人不在 + //**************************检测火灾***************************************** + if(hdata==0||ywdata==0) //检测到火焰与烟雾时,低电平有效,触发蜂鸣器 + { + delay_ms(5000); + port_example->gpio_write(0x00000, 0x10000); + port_example->gpio_read(&data, 0x10000); + EMBARC_PRINTF(" gpio read after write is :%x\n", data); + port_jidianqi->gpio_write(0x80000, 0x80000); + delay_ms(7000); + + char texta1[]={" 疑似着火,请检查 "}; + yuyin(texta1); + send(phoneNum, msg); //发短信 + delay_ms(1000); + } + else + { + //**************************检测人是否在***************************************** + if(hwdata==0) //人在 + { + port_example->gpio_write(0x10000, 0x10000); // 蜂鸣器不叫 + port_example->gpio_read(&data, 0x10000); + EMBARC_PRINTF(" gpio read after write is :%x\n", data); + port_jidianqi->gpio_write(0x00000, 0x80000); //继电器正常 + port_jidianqi->gpio_read(&jiddata, 0x80000); + EMBARC_PRINTF(" gpio read after write is :%x\n", jiddata); + cmd1=0; + + } + else //人不在,语音提醒 + { + delay_ms(5000); + char texta2[]={" 离开请关焊台 "}; + yuyin(texta2); + delay_ms(7000); + port_jidianqi->gpio_write(0x80000, 0x80000); + port_jidianqi->gpio_read(&jiddata, 0x80000); + EMBARC_PRINTF(" gpio read after write is :%x\n", jiddata); + + } + + } + + delay_ms(5000); + } + return E_SYS; /* system error */ + } + + + diff --git a/arc_design_contest/2019/picture/3 b/arc_design_contest/2019/picture/3 new file mode 100644 index 00000000..aab73926 --- /dev/null +++ b/arc_design_contest/2019/picture/3 @@ -0,0 +1 @@ +come on diff --git a/arc_design_contest/2019/picture/anquanyinhuan1.jpg b/arc_design_contest/2019/picture/anquanyinhuan1.jpg new file mode 100644 index 00000000..54d37c86 Binary files /dev/null and b/arc_design_contest/2019/picture/anquanyinhuan1.jpg differ diff --git a/arc_design_contest/2019/picture/anquanyinhuan2.jpg b/arc_design_contest/2019/picture/anquanyinhuan2.jpg new file mode 100644 index 00000000..55cad201 Binary files /dev/null and b/arc_design_contest/2019/picture/anquanyinhuan2.jpg differ diff --git a/arc_design_contest/2019/picture/neibulianjie.jpg b/arc_design_contest/2019/picture/neibulianjie.jpg new file mode 100644 index 00000000..6fbf4ee9 Binary files /dev/null and b/arc_design_contest/2019/picture/neibulianjie.jpg differ diff --git a/arc_design_contest/2019/picture/waiguan.jpg b/arc_design_contest/2019/picture/waiguan.jpg new file mode 100644 index 00000000..165f9db0 Binary files /dev/null and b/arc_design_contest/2019/picture/waiguan.jpg differ diff --git a/arc_design_contest/2019/picture/yingjianlianjie.jpg b/arc_design_contest/2019/picture/yingjianlianjie.jpg new file mode 100644 index 00000000..4fa4e2ba Binary files /dev/null and b/arc_design_contest/2019/picture/yingjianlianjie.jpg differ