Skip to content

XDU-Intelligent-Safety-Welding-Table-based-on-ARC #50

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
come on
Original file line number Diff line number Diff line change
@@ -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)

1 change: 1 addition & 0 deletions arc_design_contest/2019/arc/4
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
come on
210 changes: 210 additions & 0 deletions arc_design_contest/2019/arc/main.c
Original file line number Diff line number Diff line change
@@ -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 //���ݰ�ͷ�ij���

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); //��Ҫ�����ı��ij���

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++) //���η��͹�������֡ͷ���e
{
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; i<length; i++) //���η��ʹ��ϳɵ��ı�����
{
//�Է��͵��ֽڽ������У��
//SBUF = text[i];
if(i==length-1)
text[i] = ecc;
else
ecc=ecc^(text[i]);
printf("text[%d]=%d\r\n",i,text[i]);

}
printf("ecc=%d\r\n",ecc);
dev_uart2->uart_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 */
}



1 change: 1 addition & 0 deletions arc_design_contest/2019/picture/3
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
come on
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added arc_design_contest/2019/picture/neibulianjie.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added arc_design_contest/2019/picture/waiguan.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.