activity monitoring design goel

28
 1 Activity Monitoring Design using Ultrasonic Sensors Submitted By: Saurabh Goel

Upload: hariharankalyan

Post on 03-Nov-2015

18 views

Category:

Documents


0 download

DESCRIPTION

njgjhtgjgj

TRANSCRIPT

  • 1

    Activity Monitoring Design using Ultrasonic Sensors

    Submitted By:

    Saurabh Goel

  • 2

    Table of Contents

    1. Introduction.3

    i) Ultrasonic Sensor Concept3

    ii) Construction of the system4

    iii) System operation...4

    2. Hardware Description.5

    i) Altera DE2 Board.5

    ii) MaxSonar Sensor..6

    iii) 8 Channel 8 bit ADC.7

    iv) Ethernet Cable...8

    v) IC-7404 inverters..8

    vi) Modular Connector...8

    3. NIOS II Code Configuration...9

    i) Functions...9

    4. Steps to create project in Quartus and Nios Softwares.11

    i) Create Design Project with Quartus II11

    ii) Run Project Configuration with NIOS II19

    5. Design Snapshots..23

    6. Conclusion.28

    7. References.28

  • 3

    Chapter 1

    Introduction

    A new system of ultrasonic measurement is designed to detect the posture and activity of a person. The goal is to

    accomplish this task while maintaining the privacy of the individual in the home. As the average population age increases

    worldwide, automated tools to ensure quality of life become increasingly necessary and valuable. Elderly individuals who

    are living alone have a high risk of undetected injury that reduces the ability to maintain independence while providing

    safety. Undetected falls are a leading cause of hospitalization so remote monitoring of activity and pose of individuals can

    be used to increase safety and reduce risk of injury. Three basic elements of activity recognition are: 1) Collection of raw

    data using sensors and supporting low power embedded circuitry. 2) Filtering noisy low-level sensor data. 3) Inferring

    activity based on low-level sensor data and previously gathered information with the help of various machine-learning

    algorithms and data mining techniques. The ultrasonic system is desirable because it does not have wearable components.

    It can also be used in the bathroom and bedroom without the need for additional privacy filtering required by video based

    systems. The sensors are also able to work in the dark without loss of resolution.

    Ultrasonic Sensor Concept:

    The system consists of detecting a person according to height information. Sensors detect the distance of the nearest

    vertical object by measuring the round trip time of a reflection as shown in Fig. 1.1. Changes in the distance between the

    sensor and the subject are captured and stored on a remote computer. Activity and pose are monitored, and alarms are

    triggered, if at-risk behavior is detected.

    Fig 1.1 Usage of ultrasonic Rx-Tx modules on ceiling

    Three different cases are shown in Fig. 1.1. In case A the subject is standing so the distance detected is the average of

    the reflections from the top of the head. Calibration is performed on the room to determine where furniture is placed. This

    is illustrated as case C to provide the reference signal for the room provided furniture is not regularly moved. The

    assumption is furniture is not regularly moved. In case B the distance is midway between standing and not present so the

    subject is assumed to be sitting which can also be further verified by evaluation of the static room configuration. If the

  • 4

    subject is walking, the (X, Y) sensor detecting the person changes. The rate at which two adjacent sensors detect activity

    provides the speed of walking. If the subject falls down, there is a sudden transition from A to a small distance off the

    floor. The rate of transition decides whether the subject has fallen or not. Additionally, multiple sensors are evaluated

    since the person is probably be prone and activating more than one output. Emergency calls are made in such cases.

    Construction of the System:

    Ultrasonic sensors are employed on the ceiling of the room to be monitored. In a time frame of 160 milliseconds, the

    whole room is scanned by the sensors. The location and height of the individual is determined by measuring the difference

    between the transmitted and the received signal timings. Every 10 milliseconds a sensor is triggered to sense the height.

    An ultrasonic sensor generates an analog signal proportional to the distance at 10mV per inch, which is converted to the

    proportional digital signal by the ADC. If the distance sensed by the sensors differ from the default values continuously,

    then a person is assumed to be present and doing some activity. If sensors distance differ from default distances and

    remains constant for a period of time, then it is assumed a person is present in the room and needs attention, emergency

    signal is issued.

    Fig 1.2 High level block diagram

    System Operation:

    Fig 1.2 shows the high level diagram of the system. The FPGA sends an active high signal to the ultrasonic sensor to turn

    it on and sets the multiplexer line of the 8 channel ADC. The ADC receives the analog signal from the sensor and

    converts it to a digital value on a scale of 1 to 100. After ADC completes the conversion, a digital value is sent to the

    FPGA. The digital values from all the sensors are received in a time frame of 160 milliseconds, then FPGA determines if

    some activity is present inside the room. If an emergency is detected, the remote nursing station is notified.

    In this chapter the high level design of the system is discussed and high level block interactions are described. In

    subsequent chapters implementation details of the system are presented where interaction between various blocks is

    achieved. Chapter 2 presents various hardware components used in the system and the interconnections. Chapter 3

    presents software details like how and when hardware components are triggered. Chapter 4 consists of a description of the

    steps to create the Activity Monitoring Project with Quartus and Nios. Chapter 5 contains snapshots of the design built in

    the test lab.

  • 5

    Chapter 2

    Hardware Description

    This chapter lists the hardware components along with the characteristics and interconnections used to setup the Activity

    Monitoring system.

    1. Altera DE2 Board(1)

    User Manual link: ftp://ftp.altera.com/up/pub/Webdocs/DE2_UserManual.pdf

    Fig 2.1 Altera DE2 Board

    Altera DE2 Board is used initially for the testing purposes since it provides hardware such as

    Altera Cyclone II 2C35 FPGA device, USB Blaster (on board) for programming and user API control, both

    JTAG and Active Serial (AS) programming modes are supported, 8-Mbyte SDRAM, 4-Mbyte Flash memory (1

    Mbyte on some boards) , RS-232 transceiver and 9-pin connector, 50-MHz oscillator and 27-MHz oscillator for

    clock sources, 18 red user LEDs, 9 green user LEDs, 18 toggle switches and makes it very convenient to develop

    the system from scratch and test all possible options using the hardware from a single board without consuming

    much time and economically. If the test configuration suits best for the system, design can always be ported to

    custom FPGA. In addition to these hardware features, the DE2 board has software support for standard

    I/O interfaces and a control panel facility for accessing various components.

    For the Activity Monitoring system design, following hardware components from Board were used.

    i) Altera Cyclone II 2C35 FPGA: This processor drives all the hardware used in the system and responsible for making decisions on the basis of inputs received from the

    hardware devices.

    ii) 50-MHz oscillator and 27-MHz oscillator: They are used to generate the clock signals for the nios_processor and sdram.

    iii) 8-Mbyte SDRAM: Object file is stored on sdram and provides heap and stack memory to the processor.

    iv) Expansion Header 0: It is used as an output PIO port. Trigger signals to 16 sensors and RD and CS signals of two ADCs used in the system are sent from this port. +3.3v pin is used set the reference voltage of ADC ICs. Out of 36 PIO pins, 16 were used to send

    trigger to sensors, 4 were used to set control signals of ADCs.

  • 6

    v) Expansion Header 1: It is used as an input PIO port. It receives 8 bit data from ADC outputs and INT signal of ADC to check whether result after conversion is ready. Out of 36 PIO pins, 16 pins were used to receive data from 2 ADCs used in the system and 2

    pins for INT signal of ADCs. vi) RS-232 transceiver: It is used to send emergency message or Log message to the java

    application hosted on some other computer.

    2. LV-MaxSonar-EZ0 High Performance Sonar Range Finder(16) Datasheet link: http://www.maxbotix.com/uploads/LV-MaxSonar-EZ0-Datasheet.pdf

    Fig 2.2 LV-MaxSonar EZ0

    These sensors are selected because they can be triggered in Free run operation can continually measure

    and output range information and it is designed for protected indoor environments and gives reliable and

    stable range data. They operate at a frequency of 42 KHz and readings can occur up to every 50mS, (20-

    Hz rate).

    PIN Connections:

    i) GND: Connected to common ground of DE2 board, ADCs and all other sensors. ii) +5: connected to %v external regulated power supply. iii) TX: not used iv) RX: Connected to GPIO_0 of Altera DE2 Board. When this pin is set high, sensor sends

    an ultrasonic beam and receives the reflected beam.

    v) AN: This is connected to input signal of 8 channels ADC. After reflected beam is received by the sensor, analog signal proportional to distance traversed is returned.

    vi) PW: not used vii) BW: not used

    3. High Speed 8-Channel 8-Bit ADC(2) Datasheet Link: http://www.analog.com/static/imported-files/Data_Sheets/AD7824_7828.pdf

    AD7828 is a high speed, multichannel, 8-bit ADC with a choice of eight multiplexed analog inputs. A

    half-flash conversion technique gives a fast conversion rate of 2.5 s per channel, and the parts have a built-in track-and-hold function capable of digitizing full-scale signals of 10 kHz (157 mV/s slew rate) on all channels. It operates from a single 5 V supply and have an analog input range of 0 V to 5 V, using

    an external 5 V reference. It is fast, easy-to-use digital interface which allows connection to most popular

    microprocessors with minimal external components. No clock signal is required for the ADC.

  • 7

    Fig 2.3 8 Channel 8 bit ADC

    PIN Connections:

    i) AIN1-AIN8: 8 Input analog signals. They are connected to AN pin of 8 Ultrasonic

    sensors.

    ii) DB0-DB7: 8 bit digital output after conversion. They are connected to 8 pins of GPIO_1.

    Valid data is present at these pins after conversion i.e. when INT goe low.

    iii) RD: to get a digital output data from IC transition of RD from high to low should be

    made. It is connected to GPIO_0 of Altera DE2 Board.

    iv) INT: It is connected to GPIO_1 of Altera DE2 Board. In C code this pin is continuously

    checked for active low to see if results after conversion are ready since RD high to low

    transition.

    v) GND: Connected to Common Ground of the system.

    vi) VDD: Connected to 5v external regulated power supply.

    vii) A0, A1, A2: Multiplexer lines which select only one input among 8 AN signals from

    sensors for the analog to digital conversion. They are connected to GPIO_0 of Altera

    DE2 Board.

    viii) CS: Chip select line. It should be set active low to get valid output from ADC. It is

    connected to GPIO_0.

    ix) RDY: not connected.

    x) Vref(+) : Connected to 3.3V pin of GPIO_0. It sets the reference level for comparison.

    xi) Vref(-) : Connected to GND pin of GPIO_0. It sets the reference level for comparison.

    4. Ethernet Cable Cat 5 (16)

    Fig 2.4 Ethernet Cable wires

  • 8

    They are used to connect Ultrasonic sensors to the central hub where ADC and DE2 boards are placed.

    Out of 8 wires only 4 are used for the following:

    i) Brown color wire connects +5V pin of sensor to external regulated power supply.

    ii) Orange Color wire connects GND pin of sensor to Common Ground of the system.

    iii) Orange/White color wire carries the analog signal from AN pin of sensor to AIN1..AIN8

    pins of ADC.

    iv) Brown/White color wire connects output from NOT gate to RX pin of sensor.

    5. IC 7404-6 inverters(3)

    Datasheet Link: http://pdf1.alldatasheet.com/datasheet-pdf/view/82662/ETC/7404.html

    Fig 2.5 IC 7404 Inverters

    Since outputs from GPIO pins of Altera DE2 Board are unbuffered, inverters are used to avoid distortion of

    the t(fall) of the signals sent from GPIO_0 pins intended for RX pins of Sensors. Therefore active low signal

    is sent from DE2 Board to trigger the active high RX pin of sensors.

    6. Modular Connector plug and jack

    Fig 2.6 RJ-45 Modular Connector Plug and Jack

    They are used to connect Ethernet cables from sensors to central hub.

    Next Chapter talks about Nios software code that is used to drive the hardware components discussed in this

    chapter.

  • 9

    Chapter 3

    NIOS II code configuration

    This chapter explains the software code written in NIOS IDE to trigger the hardware components described in chapter 2.

    The code is responsible for turning ON and OFF of ultrasonic sensors and reading the digital values from ADC. The code

    is also responsible for making decisions on the basis of values received from the sensors and sends emergency messages

    to RS232 serial port, which is connected to JAVA application on the host computer and sends message to the remote

    nursing station over the Ethernet. The functions used to drive the hardware components are explained in the chapter.

    FUNCTIONS:

    1) void main()

    This is the entry point of the code when object file is executed on the NIOS processor. It sets Baud

    rate of serial port to 9600 by calling serial_init() function. Default values of sensors are recorded in

    global array def[ ] by calling read_defaults() function. In an infinite while loop following tasks are

    performed:

    i) Turn off all sensors by calling turn_off_all_sensors() function.

    ii) Sense the values from sensors into array data[ ] by calling sense_all_data() function.

    iii) Check_all_data() function is called which returns the suspicious sensor number.

    iv) Suspicious sensor number obtained in above step is compared to previous suspicious

    sensor number, if both sensor values remains same for given period of time then

    emergency message is sent to the RS232 port and waits for sensor values to come to

    default otherwise control remains in infinite loop.

    2) void read_defaults()

    This function loads default values sensed by ultrasonic sensors into global array def[ ]. For setting the

    default value of each sensor, following steps are performed:

    i) Rx pin of the corresponding sensor is set high to turn it ON which in turn sends analog

    signal to ADC.

    ii) Mux inputs (3 bits) are set to receive the digital signal from the sensor which is activated.

    iii) sensor_initialisation1() or sensor_initialisation2() function is called which returns default

    value of sensor read from ADC after conversion from analog to digital is complete.

    3) int sensor_initialisation1() or int sensor_initialisation2()

    This function returns the digital value read from ADC after mux input lines are set. Two functions

    correspond to two ADCs used in the system. Following steps are performed to see if value is ready at

    ADC output lines.

    i) CS line is set low to enable the ADC chip.

    ii) RD is also set low to set ADC in read mode.

    iii) INT pin is checked to see if results after conversion are ready. Wait for INT to go low.

    iv) 8 bit value is read from DATA pins of ADC.

    v) CS and RD are set to active high.

    4) void pose(int val, int def)

    This function decides the pose of the person in the room on the basis of sensors present and default

    values. If present value is within 20% of default value then a person is assumed to be in STAND

  • 10

    pose. If it is between 40% and 80% then SIT pose is assumed and between 20% and 40% LYING

    DOWN is assumed.

    5) void serial_init(unsigned int baud)

    This function initializes the serial RS232 port for sending emergency or log messages to JAVA

    application. Sets the baud rate for message transmission.

    6) void turn_off_all_sensors()

    This function sets Rx pin of all Ultrasonic sensors to active low to turn them OFF.

    7) int read_cycle1() or int read_cycle2()

    This function returns the digital value read from ADC after mux input lines are set. Following steps

    are performed to see if value is ready at ADC output lines.

    i) CS line is set low to enable the ADC chip.

    ii) RD is also set low to set ADC in read mode.

    iii) INT pin is checked to see if results after conversion are ready. Wait for INT to go low.

    iv) 8 bit value is read from DATA pins of ADC.

    v) CS and RD are set to active high.

    8) void sense_all_data()

    This function loads present values sensed by ultrasonic sensors into global array data[ ]. To set

    present value of each sensor, following steps are performed:

    i) Rx pin of the corresponding sensor is set high to turn it ON which in turn sends analog signal to ADC.

    ii) Mux inputs(3 bits) are set to receive the digital signal from the sensor which is activated.

    iii) read_cycle1() or read_cycle2() function is called which returns default value of sensor read from ADC

    after conversion from analog to digital is complete.

    9) int check_all_data()

    For all the sensors present in the room, it tests whether their readings varies from default values and

    sends the corresponding sensor number. It is called by main() function to continuously check for

    emergency.

    10) void write_to_rs(char *msg,int msg_len)

    This function receives message and message length to be sent over the serial RS232 port. In case of

    emergency EMR message is sent and for storing log messages onto the hard disk string containing

    sensor readings is sent.

    11) void write_data_sensors()

    This function constructs string containing sensor readings in a specific format and call write_to_rs()

    function to write it to RS232 serial port. The string format is:79(23) 89(50) 78(10) 67(23)

    Where 79, 89, 78, 67 are readings from the sensors and in brackets difference from default values is

    written for the corresponding sensor.

    12) void print_all_data()

    This function prints the readings from all the sensors and difference with their default values on the

    console for the debugging and testing purpose.

  • 11

    Chapter 4

    Steps to create Project in Quartus and Nios Software

    This chapter describes a step by step approach to design Activity Monitoring Project using Quartus and Nios

    Eclipse IDE. In order to create Activity Monitoring project on your machine, following software should be

    installed on your machine.

    1) Quartus II 9.1sp2 web edition: To make the hardware connections discussed in chapter 2 and load the

    System Object file (.sof) onto the Altera DE2 Board.

    The software can be downloaded from Alteras website (www.altera.com) at following URL.

    https://www.altera.com/download/software/quartus-ii-we/9.1

    2) Nios II 9.1 Software build tools for Eclipse: To run the code explained in chapter 3 on the Nios

    Processor. Before running Nios configuration SOF file should be loaded on DE2 board to get the

    correct physical addresses of the pins.

    The software can be downloaded from Alteras website (www.altera.com) at following URL:

    http://www.altera.com/support/ip/processors/kits/ips-nios2-dev-kits.html

    1. Creating Design Project with Quartus II i) After installing Quartus II software, click on Quartus icon created on your Desktop.

    Create a new project by selecting Create New Project (New Project Wizard) from the dialog box.

    Fig 4.1 Open a new project in Quartus

  • 12

    ii) Browse to the directory where you want to create a new project and name the project as Activity Monitoring and click next.

    Fig 4.2 Create a project in Quartus

    iii) Select Device Family as Cyclone II, speed grade 6 and EP2C35F672C6 from the list of available devices and click Next

    Fig 4.3 Select FPGA to use in Quartus

  • 13

    iv) We dont need any EDA tools for this project. Proceed to next screen by clicking next.

    Fig 4.4 Skip EDA tools section while creating project in Quartus

    v) Next screen will show the summary of the settings and devices you selected. Click finish to create a new project.

    Fig 4.5 Summary after project is created

  • 14

    vi) From the file menu click new and select Block Diagram/Schematic File from design Files and click ok.

    Fig 4.6 Create Schematic files in Quartus

    vii) Open the SOPC builder and add NIOS II processor, JTAG UART, SDRAM Controller, External Clocks for DE2 Board Peripherals, RS232 UART and Parallel I/O ports for the following connections of Two

    ADCs and 16 Ultrasonic Sensors.

    Hardware Component Name Width(bit) I/O port

    ADC1 ADC1_mux 3 output

    ADC1 ADC1_cs 1 output

    ADC1 ADC1_rd 1 output

    ADC1 ADC1_data 8 input

    ADC1 ADC1_int 1 input

    ADC2 ADC2_mux 3 output

    ADC2 ADC2_cs 1 output

    ADC2 ADC2_rd 1 output

    ADC2 ADC2_data 8 input

    ADC2 ADC2_int 1 input

    Sensors RX1..RX16 1 per

    sensor

    output

    Table 4.1 Connections created in SOPC builder

    Click on Generate to generate the sopc file. This will create the nios_core block in the schematic file with the connections selected in sopc builder.

  • 15

    Fig 4.7 SOPC Connections

    viii) Right click>>insert>>symbol in schematic file to connect the symbols/hardware pins with the connections generated in sopc builder. Select the input or output symbol for each connection from

    Libraries>>pin>>input/output/bidir.

    Fig 4.8 Add Symbols to SOPC connections

    ix) For the symbols generated for each connection in SOPC builder, set pin_name according to the following table.

    SOPC Builder Connection Hardware pin_name/ symbol name

    ADC1_data GPIO_1[7..0]

    ADC1_int GPIO_1[8]

    ADC2_data GPIO_1[17..10]

    ADC2_int GPIO_1[18]

    UART_RXD_to_the_rs232_0 UART_RXD

  • 16

    ext_clk_27_to_the_clocks CLOCK_27

    ext_clk_27_to_the_clocks CLOCK_50

    clk_0 system_clk_from_the_clocks output

    ADC1_cs GPIO_0[8]

    ADC1_rd GPIO_0[9]

    ADC1_mux GPIO_0[28..26]

    ADC2_cs GPIO_0[18]

    ADC2_rd GPIO_0[19]

    ADC2_mux GPIO_0[35..33]

    RX1 GPIO_0[0]

    RX2 GPIO_0[1]

    RX3 GPIO_0[2]

    RX4 GPIO_0[3]

    RX5 GPIO_0[4]

    RX6 GPIO_0[5]

    RX7 GPIO_0[6]

    RX8 GPIO_0[7]

    RX9 GPIO_0[10]

    RX10 GPIO_0[11]

    RX11 GPIO_0[12]

    RX12 GPIO_0[13]

    RX13 GPIO_0[14]

    RX14 GPIO_0[15]

    RX15 GPIO_0[16]

    RX16 GPIO_0[17]

    UART_TXD_from_the_rs232_0 UART_TXD

    zs_addr_from_the_sdram_0 DRAM_ADDR[11..0]

    zs_ba_from_the_sdram_0 DRAM_BA[1..0]

    zs_cas_n_from_the_sdram_0 DRAM_CAS_N

    zs_cke_from_the_sdram_0 DRAM_CKE

    zs_cs_n_from_the_sdram_0 DRAM_CS_N

    zs_dq_from_the_sdram_0 DRAM_DQ[15..0]

    zs_dqm_from_the_sdram_0 DRAM_DQM[1..0]

    zs_ras_n_from_the_sdram_0 DRAM_RAS_N

    zs_we_n_from_the_sdram_0 DRAM_WE_N

    DRAM_CLK_from_the_clocks VGA_CLK

    Table 4.2 SOPC connections link to DE2 Board Symbols

    GPIO_0 is used as output port and GPIO_1 is used as input port.

  • 17

    Fig 4.9 Schematic after SOPC components are connected to DE2 symbols

    x) From assignments tab select Import Assignments and browse to the directory where assignments.csv is stored. This will assign pin numbers to the pin_name configured in previous step.

    Following block diagram shows the pin assignments after importing.

    Fig 4.10 Pin Assignments

  • 18

    xi) By selecting processing>>start compilation starts the compilation of the project. This will take time depending on your computer Configuration. If errors are present in the project, compilation is stopped.

    After successful Compilation, system object file is created and compilation summary is

    generated.

    Fig 4.11 Compilation Summary

    xii) Start Programmer and browse to the project directory to select the system object file (sof) generated. Clicking on start button will load the object file onto the DE2 board which generates the physical

    addresses to used by the NIOS software in next step.

    Fig 4.12 Programmer screen to load the sof file

  • 19

    2. Run Project configuration with NIOS II i) After installing NIOS II software, click on Nios icon created on your Desktop. From the file

    menu select new>>Nios II Application and BSP from Template. For the SOPC information file

    name: browse to the directory where project created with Quartus II is stored and select .sopcinfo

    file. In project Name text box type Acticivity_Monitoring and from the template select Blank

    Project.

    Fig 4.13 create blank project in NIOS

    ii) Select a board support package in the next window to Activity_Monitoring.bsp and click on Finish. This will import new project into the workspace, build C library, update toolchain and generate makefile for the project.

    Fig 4.14 create BSP project

  • 20

    iii) Build the Board Support Package library by right click on Activity_Monitoring.bsp>>Build Project. This step will invoke make all command on the project and get the physical addresses of

    the DE2 Board pins from the sopcinfo file.

    Fig 4.15 Build BSP project

    iv) Right click on Activity_Monitoring folder>>new>>C source File will allow you to create a new C file where the code explained in Chapter 2 should be written.

    Fig 4.16 Create new C source file

  • 21

    v) Write the C code which triggers Ultrasonic sensors one at a time , measures their default values when no obstacle is present, sense the real time values and makes a decision whether emergency

    is present or not. In case of emergency send emergency message to rs232 port or send log

    messages when some activity is detected.

    Fig 4.17 Sample C source File

    vi) The following table shows the Physical addresses generated in the system.h file for the connections set in SOPC builder in Quartus project. (only those addresses which are needed in the

    C code are shown below)

    SOPC

    Connection

    Connection Base

    Address

    ADC1_cs 0x1101060

    ADC1_data 0x11010a0

    ADC1_int 0x11010b0

    ADC1_rd 0x1101070

    ADC1_mux 0x1101050

    ADC2_cs 0x1101120

    ADC2_data 0x1101140

    ADC2_int 0x1101150

    ADC2_rd 0x1101130

    ADC2_mux 0x1101110

    RX1 0x1101040

    RX2 0x1101080

    RX3 0x1101090

    RX4 0x11010c0

    RX5 0x11010d0

    RX6 0x11010e0

    RX7 0x11010f0

    RX8 0x1101100

    RX9 0x1101160

    RX10 0x1101170

  • 22

    RX11 0x1101180

    RX12 0x1101190

    RX13 0x11011a0

    RX14 0x11011b0

    RX15 0x11011c0

    RX16 0x11011d0

    RS232 0x11011e8

    Table 4.3 Physical addresses of connections created in SOPC builder

    system.h file can be found in Activity_Monitoring.bsp folder.

    vii) After writing and saving C code using the addresses from system.h file, build the project by

    selecting Activity_Monitoring>>Build Project.

    Fig 4.18 Build Activity_Monitoring project in NIOS

  • 23

    viii) Run the Nios project by selecting Run menu and select Nios II Hardware from the window as

    shown in figure and click OK. This will invoke make all command on the project and search for

    valid launches of the configuration.

    Fig 4.19 Select Run Configuration

    ix) Select the valid launch from the list and click OK. If sof file generated with Quartus II is loaded

    on the DE2 Board, Activity Monitoring project is launched on the target board and if hardware

    connections are correct, default value of sensors are recorded when no obstacle is present and in a

    time frame of 160 milliseconds sensors are triggered continuously to give the digital values to

    Nios processor to make a decision what activity is going on inside the room.

  • 24

    Chapter 5

    Design Snapshots

    Fig 5.1 Altera DE2 Board when no connections are present

    Fig 5.2 Central Hub containing ADC and inverter connections on Breadboard and Altera DE2 Board beneath

    Breadboard. Two 40 pin GPIOs of DE2 Board are connected to Breadboard. It also shows one sensor connected

    to hub through Ethernet.

  • 25

    Fig 5.3 Front View of Central Hub. It can support twelve connections to Sensor boxes through Ethernet.

    Fig 5.4 Rear View of Central Hub. It can support four connections to sensor boxes through Ethernet and White

    cable is the USB Blaster cable which is used to load the system object file and configuration code on DE2 Board.

    Two Black cables are power supplies for DE2 Board and breadboard (Sensors power).

  • 26

    Fig 5.5 Sensor box. It contains LV-Maxsonar EZ0 and RJ-45 plug. This box is connected to Central hub

    through Ethernet.

    Fig 5.6 Internal connections in sensor box. VCC, GND, AN and RX pins of EZ0 are connected 1, 2, 7

    and 8 pins of RJ-45 plug.

  • 27

    Fig 5.7 Sensor boxes connected to Central hub in test room. In actual implementation they should be separated

    sufficiently so that Ultrasound beams of neighboring sensors don not interfere with each other.

  • 28

    Conclusion In this report, a novel design of Activity Monitoring using Ultrasonic sensors is presented. The design is a fixed

    part of the infrastructure; it does not require the user to wear additional devices. Ultrasonic sensors create a

    system that

    is robust and dynamic. The system can learn from the changing environment and also update the room

    configuration. The approach is a novel one and has a lot of scope for further refinement and development.

    Enhancements to the deployment of the ultrasonic sensing method are in progress to satisfy the safety and

    independence needs of the ever-growing elderly community.

    Initially system is developed with Altera DE2 Board which provides many hardware features to test different

    options. After four months of Developing and testing, design with hardware devices such as Nios Processor,

    sdram, GPIO pins, RS232 port, ADCs, inverters and sensor boxes connected to central hub through Ethernet was

    finalized.

    References 1) http://lslwww.epfl.ch/pages/teaching/cours_lsl/sl_info/Labo5.a.pdf

    2) http://www.hirstbrook.com/book/chapter%2016%20sample.pdf

    3) http://parts.digikey.com/1/parts-datasheet/ic-adc-8bit-h-ad7824-7828-analog-devices-datasheet

    4) http://www.alteraforum.com/

    5) http://www.alteraforum.com/forum/showthread.php?t=20368