Skip to content

Commit b9bca0b

Browse files
author
Wayne Ren
authored
Merge pull request #11 from Mandywualmighty/master
Contribute XDU_Autofollowing-suitcase Application to embARC Applications
2 parents b68e96c + fc92a85 commit b9bca0b

File tree

22 files changed

+1334
-0
lines changed

22 files changed

+1334
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Copyright (c) 2016, Synopsys, Inc. All rights reserved.
2+
3+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
4+
5+
1) Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
6+
7+
2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8+
9+
3) Neither the name of the Synopsys, Inc., nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10+
11+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
# Auto-following Suitcase Application
2+
This application is designed to show how to develop an **Auto-following Suitcase** using embARC.A person holding a tag in hand,three ultra-wideband anchors should be installed inside the suitcase in an equilateral triangular shape with a side length of 20cm. The distance information measured by the UWB module is transmitted to EMSK through UART.Based on the principle of three-point positioning,the azimuth between the person and the suitcase can be obtained to achieve following.This suitcase can also monitor ambient temperature and air conditions.When the distance between the trunk and the owner exceed the preset ,the trunk will stop automatically,and then sound the alarm or call the mobile phone, so you don't have to worry about losing the trunk.This design is mainly suitable for flat and open indoor applications such as airport waiting halls.
3+
4+
* [Introduction](#introduction)
5+
* [Function](#function)
6+
* [System Architecture](#system-architecture)
7+
* [Hardware and Software Setup](#hardware-and-software-setup)
8+
* [Required Hardware](#required-hardware)
9+
* [Required Software](#required-software)
10+
* [Hardware Connection](#hardware-connection)
11+
* [User Manual](#user-manual)
12+
* [Before Running This Application](#before-running-this-application)
13+
* [Run This Application](#run-this-application)
14+
* [DemoVideo](#demovideo)
15+
16+
## Introduction
17+
**Smart Auto-following Suitcase**
18+
19+
### Function
20+
21+
- **Ambient temperature and air condition monitoring**
22+
23+
![image](https://github.com/Mandywualmighty/Auto-following-Suitcase-Application/blob/master/doc/screenshots/Temperature%20and%20PM2.5%20monitoring.png "Temperature and PM2.5 monitoring" )
24+
25+
- **obstacle avoiding**
26+
27+
![image](https://github.com/Mandywualmighty/Auto-following-Suitcase-Application/blob/master/doc/screenshots/obstacle%20avoiding.gif "obstacle avoiding")
28+
29+
- **Auto-following**
30+
31+
![image](https://github.com/Mandywualmighty/Auto-following-Suitcase-Application/blob/master/doc/screenshots/Auto%20following.gif "Auto-following")
32+
33+
- **Auto-alarm** (The device will sound the alarm when the distance between one and suitcase is longer than 4 meters, and call the mobile phone when it is longer than 5.5 meters)
34+
35+
![image](https://github.com/Mandywualmighty/Auto-following-Suitcase-Application/blob/master/doc/screenshots/Auto-alarm.gif)
36+
37+
38+
### System Architecture
39+
40+
![image](https://github.com/Mandywualmighty/Auto-following-Suitcase-Application/blob/master/doc/screenshots/System%20architecture.png "System architecture")
41+
42+
## Hardware and Software Setup
43+
### Required Hardware
44+
- 1 DesignWare ARC EM Starter Kit(EMSK)
45+
- 1 Digilent PMOD TMP2
46+
- 1 Dust Sensor(ZPH01)
47+
- 1 Display Screen(OLED)
48+
- 1 Buzzer
49+
- 1 GPRS Module(SIM900A)
50+
- 2 Motor Driver Module(TB6612FNG)
51+
- 4 Positioning Module(DWM1000)
52+
- 4 Wheel
53+
- 4 Motor
54+
- 1 SD Card
55+
- 3 Ultrasonic Sensor(HCSR04)
56+
57+
The list of hardware is shown in the picture following.
58+
59+
![image](https://github.com/Mandywualmighty/Auto-following-Suitcase-Application/blob/master/doc/screenshots/hardware.png)
60+
61+
### Required Software
62+
- Metaware or ARC GNU Toolset
63+
- Serial port terminal, such as putty, tera-term or minicom
64+
65+
### Hardware Connection
66+
1. The EMSK implement **Auto-folowing** smart device, it will process the data returned by positioning module and ultrasonic sensor,and send instructions to motor driver module.It can also monitor temperature and dust concentration of air,we can view these data on OLED.
67+
- Connect **Positioning module** to **J1**(Using UART interface), connect **Motor driver module** to **J3** and **J6**,connect **Ultrasonic sensor** to **J1** and **J3**.
68+
- Connect **PMOD TMP2** to **J4**(Using IIC interface), connect **ZPH01** to **J5**(Using uart interface),connect **OLED** and **GPRS** to **J2**(Using IIC interface),connect **Buzzer** to **J6**.
69+
2. Configure your EMSKs with proper core configuration.
70+
71+
## User Manual
72+
### Before Running This Application
73+
Download source code of **Auto-following Suitcase** from github.
74+
75+
The hardware resources are allocated as following table.
76+
77+
| Hardware Resource | Function |
78+
| ------------------- | ------------------------------------------------------------- |
79+
| PMOD TMP2 | Temperature sensor |
80+
| ZPH01 | Dust sensor |
81+
| OLED | Display screen |
82+
| SIM900A | Send messages or call |
83+
| TB6612FNG | Motor driver module |
84+
| HCSR04 | Dust sensor |
85+
| OLED | Ultrasonic sensor |
86+
| DWM1000 | Positioning module |
87+
88+
- Modify mux.c (/board/emsk/common/emsk_init.c)
89+
```
90+
line 107: change
91+
set_pmod_mux(PM1_UR_UART_0 | PM1_LR_SPI_S \
92+
| PM2_I2C_HRI \
93+
| PM3_GPIO_AC \
94+
| PM4_I2C_GPIO_D \
95+
| PM5_UR_SPI_M1 | PM5_LR_GPIO_A \
96+
| PM6_UR_SPI_M0 | PM6_LR_GPIO_A );
97+
to
98+
set_pmod_mux(mux_regs, PM1_UR_UART_0 | PM1_LR_GPIO_A \
99+
| PM2_I2C_HRI \
100+
| PM3_GPIO_AC \
101+
| PM4_I2C_GPIO_D \
102+
| PM5_UR_GPIO_C | PM5_LR_SPI_M2 \
103+
| PM6_UR_GPIO_C | PM6_LR_GPIO_A );
104+
```
105+
### Run This Application
106+
107+
Here take **EMSK2.2 - ARC EM7D** with GNU Toolset for example to show how to run this application.
108+
109+
#### Makefile
110+
111+
- Target options about EMSK and toolchain:
112+
113+
BOARD ?= emsk
114+
BD_VER ?= 22
115+
CUR_CORE ?= arcem7d
116+
TOOLCHAIN ?= gnu
117+
118+
- The relative series of the root directory, here the path of the Makefile is
119+
120+
#
121+
# root dir of embARC
122+
#
123+
EMBARC_ROOT = ../../..
124+
MID_SEL = common u8glib
125+
126+
127+
See [ embARC Example User Guide][40], **"Options to Hard-Code in the Application Makefile"** for more detailed information about **Makefile Options**.
128+
129+
#### Driver
130+
131+
Placing the drivers' source code in `driver` folder, you can see there are subfolders for ultasonic,GPRS,ZPH01,buzzer and temperature drivers.
132+
Placing the C source file and header file in the corresponding subfolder.
133+
134+
| folder/file | Function |
135+
| ------------------- | ------------------------------|
136+
| ultrasonic | ultrasonic driver |
137+
| temperature | temperature driver |
138+
| GPRS | GPRS driver |
139+
| ZPH01 | ZPH01 driver |
140+
| buzzer | buzzer driver |
141+
142+
143+
# DemoVideo
144+
145+
[Link](https://v.youku.com/v_show/id_XMzYyOTY0MjcwMA==.html?x&sharefrom=android&sharekey=47f57584b11aa1e3916e149dc1b044aa0)
146+
147+
[40]: http://embarc.org/embarc_osp/doc/embARC_Document/html/page_example.html " embARC Example User Guide"
80.5 KB
Loading
476 KB
Loading
88.5 KB
Loading
48.6 KB
Loading
83 KB
Loading
Binary file not shown.
Binary file not shown.
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
#include "embARC.h"
2+
#include "embARC_debug.h"
3+
#include "stdio.h"
4+
#include <string.h>
5+
#include "arc.h"
6+
#include "GPRS.h"
7+
#define I2C_SLAVE_ADDR2 0x01
8+
DEV_IIC *dev_iic_gprs=NULL;
9+
uint8_t *phoneNum = "00310038003700300030003800310033003000360031";
10+
uint8_t *msg = "4E3B4EBAFF0C4E3B4EBAFF0C621189818DDF4E224F604E86";
11+
12+
static void delay_ms(volatile int z) //1ms
13+
{
14+
volatile uint32_t x,y;
15+
for(x=1400;x>0;x--)
16+
for(y=z;y>0;y--);
17+
}
18+
19+
void call(void)
20+
{
21+
22+
dev_iic_gprs = iic_get_dev(DW_IIC_0_ID);
23+
dev_iic_gprs->iic_open(DEV_MASTER_MODE, IIC_SPEED_STANDARD);
24+
dev_iic_gprs->iic_control(IIC_CMD_MST_SET_TAR_ADDR, CONV2VOID(I2C_SLAVE_ADDR2));
25+
uint8_t i;
26+
int8_t *cmd[2]={"ATD18829283316;\r\n",};
27+
for(i = 0; i < 4; i++)
28+
{
29+
dev_iic_gprs->iic_write(cmd[i], strlen(cmd[i]));
30+
delay_ms(100);
31+
}
32+
uint8_t end[]={0x1a,0x00};
33+
dev_iic_gprs->iic_write(end, strlen(end));
34+
printf("end1\r\n");
35+
36+
}
37+
38+
void send(uint8_t *phoneNum, uint8_t *msg)
39+
{
40+
dev_iic_gprs = iic_get_dev(DW_IIC_0_ID );
41+
dev_iic_gprs->iic_open(DEV_MASTER_MODE, IIC_SPEED_STANDARD);
42+
dev_iic_gprs->iic_control(IIC_CMD_MST_SET_TAR_ADDR, CONV2VOID(I2C_SLAVE_ADDR2));
43+
44+
uint8_t i;
45+
uint8_t pnum[64];
46+
int8_t *cmd[5]={"AT+CMGF=1\r\n", "AT+CSCS=\"UCS2\"\r\n",
47+
"AT+CSCA?\r\n", "AT+CSMP=17,167,0,25\r\n",};
48+
snprintf(pnum, 64, "AT+CMGS=\"%s\"\r\n", phoneNum);
49+
for(i = 0; i < 4; i++)
50+
{
51+
dev_iic_gprs->iic_write(cmd[i], strlen(cmd[i]));
52+
delay_ms(100);
53+
}
54+
dev_iic_gprs->iic_write(pnum, strlen(pnum));
55+
delay_ms(100);
56+
dev_iic_gprs->iic_write(msg, strlen(msg));
57+
delay_ms(100);
58+
uint8_t end[]={0x1a,0x00};
59+
dev_iic_gprs->iic_write(end, strlen(end));
60+
printf("end\r\n");
61+
}
62+

0 commit comments

Comments
 (0)