• No results found

Ultrasonic sensing design and implementation for detecting and interacting with human beings in an AI system

N/A
N/A
Protected

Academic year: 2021

Share "Ultrasonic sensing design and implementation for detecting and interacting with human beings in an AI system"

Copied!
78
0
0

Loading.... (view fulltext now)

Full text

(1)LiU-ITN-TEK-A--12/030--SE. Ultrasonic sensing design and implementation for detecting and interacting with human beings in an AI system Peter Faltpihl 2012-06-01. Department of Science and Technology Linköping University SE-601 74 Norrköping , Sw eden. Institutionen för teknik och naturvetenskap Linköpings universitet 601 74 Norrköping.

(2) LiU-ITN-TEK-A--12/030--SE. Ultrasonic sensing design and implementation for detecting and interacting with human beings in an AI system Examensarbete utfört i Elektroteknik vid Tekniska högskolan vid Linköpings universitet. Peter Faltpihl Handledare Allan Huynh Examinator Qin-Zhong Ye Norrköping 2012-06-01.

(3) Upphovsrätt Detta dokument hålls tillgängligt på Internet – eller dess framtida ersättare – under en längre tid från publiceringsdatum under förutsättning att inga extraordinära omständigheter uppstår. Tillgång till dokumentet innebär tillstånd för var och en att läsa, ladda ner, skriva ut enstaka kopior för enskilt bruk och att använda det oförändrat för ickekommersiell forskning och för undervisning. Överföring av upphovsrätten vid en senare tidpunkt kan inte upphäva detta tillstånd. All annan användning av dokumentet kräver upphovsmannens medgivande. För att garantera äktheten, säkerheten och tillgängligheten finns det lösningar av teknisk och administrativ art. Upphovsmannens ideella rätt innefattar rätt att bli nämnd som upphovsman i den omfattning som god sed kräver vid användning av dokumentet på ovan beskrivna sätt samt skydd mot att dokumentet ändras eller presenteras i sådan form eller i sådant sammanhang som är kränkande för upphovsmannens litterära eller konstnärliga anseende eller egenart. För ytterligare information om Linköping University Electronic Press se förlagets hemsida http://www.ep.liu.se/ Copyright The publishers will keep this document online on the Internet - or its possible replacement - for a considerable time from the date of publication barring exceptional circumstances. The online availability of the document implies a permanent permission for anyone to read, to download, to print out single copies for your own use and to use it unchanged for any non-commercial research and educational purpose. Subsequent transfers of copyright cannot revoke this permission. All other uses of the document are conditional on the consent of the copyright owner. The publisher has taken technical and administrative measures to assure authenticity, security and accessibility. According to intellectual property law the author has the right to be mentioned when his/her work is accessed as described above and to be protected against infringement. For additional information about the Linköping University Electronic Press and its procedures for publication and for assurance of document integrity, please refer to its WWW home page: http://www.ep.liu.se/. © Peter Faltpihl.

(4) Preface. This document describes my master thesis project, which was performed at Embedded Intelligent Solutions (EIS) in Göteborg during the spring of 2012. The eld of this thesis is Electronics Design in embedded systems. My studies were performed under the department of science and technology at Linköpings University. I would specially like to thank Per Söderstam, my supervisor at EIS, for help throughout the project. I would also like to thank the rest of the employees at EIS, for having me there and being very helpful and kind. Finally, I thank Qin-Zhong Ye and Allan Huynh, my examiner and supervisor at the university.. 1.

(5) Abstract. This thesis covers the work performed to implement a Sonar sensor solution to detect human beings on a robotic lamp. A previously available solution was evaluated, but had to be redesigned due to faulty electronics. New hardware was developed, together with software to control this hardware. A software implementation of this new Sonar sensor system was also developed, on the robotic lamp itself. The nature of this thesis was very practical, so this report will focus on describing the dierent design stages that were performed, together with a wide discussion about future improvements and work, in order to achieve a robotic lamp that interacts with a human in an interesting manner.. i.

(6) Acronyms ASF DC EIS ESD GPIO IDE LED MCU PCB PIR RGB. Atmel Software Framework Direct Current Embedded Intelligent Solutions Electro Static Discharge General Purpose Input/Output Integrated Development Environment Light Emitting Diode Microcontroller Printed Circuit Board Passive Infrared Red, Green, Blue. ii.

(7) Glossary Analog to digital converter. Used to convert an analog signal (voltage) to digital information. In this case, this device is built in the MCU. Arduino A complete hardware and software platform based on an Atmel ATMega microcontroller. DAC Digital to analog converter. Embedded system An embedded system is a complete system which is developed to perform a specic task. Usually involving system architecture, software and hardware design. Examples: remote control, computer keyboard, electronic toys/robots Evaluation board A demonstration hardware platform that some manufacturers oer in order to easily start working with a new piece of hardware ISR Interrupt Service Routine. A routine that the Microcontroller (MCU) runs when an interrupt has been initiated. LDO Low Dropout regulator (LDO) is a linear voltage regulator which can be used to transform a high voltage input to a stable lower voltage. MATLAB A piece of software and programming language used for mathematical and engineering tasks. ADC. iii.

(8) Glossary. Peripheral. Pull-up resistor. RS232. RS422. Servo Sonar. TVS TWI. Glossary. A auxiliary device which is embedded into the microcontroller and handles connectivity with the external world. Examples: handling input/output functionality, setting up communication protocols A resistor which is connected to the positive TTL voltage. This is used so that when a line is not driven low, it is pulled high by this resistor. A serial communication protocol which often uses three wires for transmission. One for receiving, one for transmitting and one for common reference/ground. A serial communication protocol which uses dierential transmission. (Dierential meaning two complementary signals, each on a separate wire) A small rotary actuator often used to move parts in robots, radio-controlled vehicles etc. In this text, always means active sonar. A technique for detecting objects using sound. In this case, sound with a frequency of 40 kHz is used (which is above what the human ear can hear) Transient Voltage Suppressor. A device designed for protecting electronic circuitry from Electro Static Discharge (ESD) damage. Two Wire Interface. A serial communication protocol which is supported by hardware on most Atmel AVR microcontrollers. This protocol is fully compatible with the I2C protocol. Uses open-collector outputs so that multiple devices with dierent voltage levels can use the bus simultaneously.. iv.

(9) Contents Acronyms. ii. Glossary. iii. 1 Introduction 1.1 Problem . . . . . . . . 1.2 Aim . . . . . . . . . . 1.3 Restrictions . . . . . . 1.4 Method . . . . . . . . 1.4.1 Hardware used 1.4.2 Software used . 1.5 About EIS . . . . . . . 1.6 Assumptions . . . . . . 1.7 Structure . . . . . . . 2 System overview 2.1 Hardware . . . . . 2.1.1 Lower part . 2.1.2 Upper part 2.2 Software . . . . . . 2.2.1 ASF . . . . 2.2.2 Platform . . 2.2.3 Devices . . 2.2.4 Services . . 2.2.5 Lamp . . .. . . . . . . . . .. . . . . . . . . .. . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . .. . . . . . . . . .. 1 2 4 4 4 4 5 5 5 5. . . . . . . . . .. 7 7 8 9 10 10 10 11 12 12. 3 Old sonar solution 13 3.1 Hardware overview . . . . . . . . . . . . . . . . . . . . . . . . 13. v.

(10) CONTENTS. CONTENTS. 3.2 Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 3.3 Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 4 New sonar solution 4.1 New design . . . . . . . . . . . . 4.1.1 Restrictions of The Lamp 4.1.2 Desired behavior . . . . . 4.1.3 Required data . . . . . . . 4.1.4 Data requirements . . . . 4.2 Sensor choice . . . . . . . . . . . 4.3 Algorithms . . . . . . . . . . . . . 4.3.1 Loneliness detection . . . 4.3.2 Following . . . . . . . . . 4.4 Number of sensors . . . . . . . . 4.5 Placement . . . . . . . . . . . . . 4.6 New sonar board . . . . . . . . . 4.6.1 Requirements . . . . . . . 4.6.2 Subsystems . . . . . . . . 4.6.3 Board layout . . . . . . .. . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . .. 16 16 16 18 18 19 19 20 20 21 22 23 24 24 24 30. 5 Software 5.1 Sonar board software . . . . 5.2 Main board software . . . . 5.2.1 Sonar class . . . . . 5.2.2 MissNosy personality 5.2.3 Evaluation Methods. . . . . .. . . . . .. . . . . .. . . . . .. . . . . .. . . . . .. . . . . .. . . . . .. . . . . .. . . . . .. . . . . .. . . . . .. . . . . .. . . . . .. . . . . .. . . . . .. 33 33 34 35 35 35. . . . . . . . .. 37 37 37 38 38 38 40 40 41. . . . . .. . . . . .. 6 Implementation 6.1 Old sonar prototype . . . . . . 6.2 Old sonar failure . . . . . . . . 6.3 New sensor tests . . . . . . . . 6.3.1 Sensor data testing . . . 6.3.2 Person detection testing 6.4 New sonar prototype . . . . . . 6.5 New sonar prototype 2 . . . . . 6.6 Final implementation . . . . . .. vi. . . . . . . . . . . . . .. . . . . . . . .. . . . . . . . .. . . . . . . . .. . . . . . . . .. . . . . . . . .. . . . . . . . .. . . . . . . . .. . . . . . . . .. . . . . . . . .. . . . . . . . .. . . . . . . . .. . . . . . . . .. . . . . . . . .. . . . . . . . .. . . . . . . . ..

(11) CONTENTS. CONTENTS. 7 Result 42 7.1 New sonar solution . . . . . . . . . . . . . . . . . . . . . . . . 42 7.1.1 Test results . . . . . . . . . . . . . . . . . . . . . . . . 42 7.2 The Lamp's behavior . . . . . . . . . . . . . . . . . . . . . . . 43 8 Discussion 8.1 Multiple lamps . . . . . . . . 8.2 Reasons for a new design . . . 8.3 Sensor choice . . . . . . . . . 8.4 Sensor signal choice . . . . . . 8.5 New sonar board . . . . . . . 8.6 Sensor update rate . . . . . . 8.7 New vs old sonar - advantages 8.8 Curiosity level . . . . . . . . . 8.9 Number of persons . . . . . . 8.10 PIR sensors . . . . . . . . . . 8.11 Faulty electronics . . . . . . . 9 Conclusion. . . . . . . . . . . .. . . . . . . . . . . .. . . . . . . . . . . .. . . . . . . . . . . .. . . . . . . . . . . .. . . . . . . . . . . .. . . . . . . . . . . .. . . . . . . . . . . .. . . . . . . . . . . .. . . . . . . . . . . .. . . . . . . . . . . .. . . . . . . . . . . .. . . . . . . . . . . .. . . . . . . . . . . .. . . . . . . . . . . .. . . . . . . . . . . .. . . . . . . . . . . .. . . . . . . . . . . .. 44 44 44 45 45 46 47 47 48 48 48 48 50. 10 Further work 52 10.1 Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 10.2 Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 A Upper LED Board Schematics. 56. B Old Sonar Board Schematics. 59. C New Sonar Board Schematic. 62. D Sonar sensor Tests 63 D.1 One sensor test . . . . . . . . . . . . . . . . . . . . . . . . . . 63 D.2 All sensors test . . . . . . . . . . . . . . . . . . . . . . . . . . 64. vii.

(12) Chapter 1 Introduction. Figure 1.1: The Lamp The Relight>Relate project was started by EIS in 2009, as an attempt to design a lamp that stands out from the general denition of a lamp[1]. This project will here on forth be referred to as "The Lamp". The Lamp was intended to make people feel compassion, interest, happiness; much more like. 1.

(13) 1.1.. PROBLEM. CHAPTER 1.. INTRODUCTION. a pet than a lamp. This was achieved with it's cute appearance and capability to interact with people. There was continuous work performed on The Lamp up until late 2010, when the project was put on ice. Unfortunately, The Lamp was not nished by then. The mechanical parts and The Lamp's outer shell (see gure 1.1 on the preceding page) have been nished, same goes for most of the electronic components needed. However, one big part is still missing... 1.1. Problem. The Lamp has a great eect on people, who are often surprised to see that it interacts with them. In its current state however, The Lamp can only perform a very poor interaction. In order to achieve a more advanced and interesting interaction, The Lamp has to gather more data about it's environment: • Is there anyone near The Lamp?. This is the most important data. Being able to have a dierent behavior when alone or near people is crucial to the eect of The Lamp's behavior. • Person arriving? This is used when a person is closing in on The Lamp, such as the example scenario: "The Lamp is shy, and looks away when a person approaches The Lamp". • Person leaving? In the same way as person arriving, this is an important piece of information for showing sympathy, sadness or any other emotion when being left alone by a person. • Where is the person? The Lamp has an eye, which it can move around inside its body to act as if The Lamp is looking in dierent directions. When a person approaches The Lamp, it might for example be nosy, and look straight at the person curiously. When the person moves around, The Lamp should be able to follow this person with its eye. Having this data about a nearby person allows for many dierent actions, such as:. 2.

(14) 1.1.. • • • • •. PROBLEM. CHAPTER 1.. INTRODUCTION. Greet a person Become scared of an approaching person Show shyness by looking away from a person Be nosy and look straight at the person Follow a person that is leaving with a sad look. In order to gather this information, data about the surroundings is required. The Lamp was designed with two types of sensors, supposed to achieve sucient information about The Lamp's vicinity: • Passive Infrared (PIR) Sensors. Used for determining if a person is in the surrounding area • Sonar sensors Used for more precise information about a persons location Upon starting this thesis, the Sonar sensors were not implemented in the system, but there was a hardware platform available (chapter 3 on page 13). The PIR sensors were fully implemented, meaning that the only information The Lamp could get about it's vicinity was through the PIR sensors. This had proved to be a big problem, because the PIR sensors have certain drawbacks: • They can only detect movement, not presence of a person • Sensitivity. They can be very sensitive to movement not only close to The Lamp, but also "background movement" such as other persons moving further away, which is not interesting to The Lamp. • Accuracy They are not very accurate - they cannot be used for nding the position of a person This means that The Lamp could only detect a persons presence while it was moving, but could not know where that person was. This made the interaction very poor, because the behavior of The Lamp became very limited.. 3.

(15) 1.2.. AIM. 1.2. CHAPTER 1.. INTRODUCTION. Aim. This thesis aims to evaluate and implement a Sonar sensor system in The Lamp, to such an extent that The Lamp will be able to detect and follow a person with it's eye. Furthermore, a prototype behavior is to be implemented in order to demonstrate this capability, following a person as accurately as possible. The accuracy should be high enough so that a person is convinced that The Lamp is looking directly at the person. 1.3. Restrictions. There are two main restrictions for this thesis: • Sonar sensors. The type of sensors are limited to Sonar sensors.. • Hardware modications. No hardware other than the Sonar board may be modied. This covers both the electronics and mechanical parts.. 1.4. Method. The work is split into four main parts: • Old Sonar system. Implementation of the previously available Sonar hardware. • New Sonar hardware design New design of the Sonar system. • New Sonar software design New software for controlling the new Sonar board. • Software implementation Implementation of the new Sonar system on The Lamp. 1.4.1. Hardware used. The prototyping was built on an Atmel EVK1100 evaluation board and an Arduino Duemilanove[2] [3]. The implementation was then realized on an Atmel AVR32UC3A1512 MCU.(More details in 2.1 on page 7). 4.

(16) 1.5.. ABOUT EIS. 1.4.2. CHAPTER 1.. INTRODUCTION. Software used. The Integrated Development Environments (IDEs) used in this thesis are the following: • Atmel AVR32 Studio 2.6 • Atmel AVR studio 5.0. For schematic and Printed Circuit Board (PCB) layout, Altium Designer Release 10 was used. 1.5. About EIS. EIS is a consultant rm located in Göteborg, who specialize in embedded systems. They have about 60 employees in Göteborg, but are also stationed in ve other locations around Sweden. They are a part of the Semcon group, a global company with 2800 employees worldwide. 1.6. Assumptions. Readers of this report are expected to have basic technical knowledge, with some knowledge in general electronics and embedded systems. Typical examples would be rst grade students of the Electronics Design program. 1.7. Structure. Most abbreviations, technical terms and references are click-able in PDF format. Chapter 2 on page 7 describes how The Lamp is built up. Chapter 3 on page 13 is a description of the previously available Sonar system. Chapter 4 on page 16 goes through the design of the new Sonar sensor system. Chapter 5 on page 33 describes the dierent softwares designed in this thesis. Chapter 7 on page 42 goes through what result was reached. Chapter 8 on page 44 discusses the result.. 5.

(17) 1.7.. STRUCTURE. CHAPTER 1.. INTRODUCTION. Chapter 9 on page 50 gives a conclusion to the thesis. Chapter 10 on page 52 lists some further work to be done.. 6.

(18) Chapter 2 System overview This chapter will give an introduction to the dierent parts of The Lamp. The Lamp can lean and raise/lower it's body, change it's color and intensity, change the size of it's eye beam and move it's eye beam around it's head. 2.1. Hardware. The Lamp has the following hardware features (gure 2.1 on the next page): • A body full of Red, Green, Blue (RGB) Light Emitting Diodes (LEDs),. • • • • • •. meaning The Lamp can change the color of its' body in order to express emotions. A very bright LED which acts as an eye, which can change intensity A red LED which illustrates a heartbeat, which can change its' rate depending on The Lamps mood Three motors in its' base, which allows The Lamp to rise up and down and lean in all directions A Servo for moving the eye up and down A Servo for moving the eye left and right A Servo for focusing the eye, making the beam appear smaller or bigger on the outer plastic shell. The Lamp can be divided into two main parts; the upper and lower part. Besides these two main parts, it has an plastic outer shell which gives it its' characteristic look. The upper and lower boards communicate with each other through a RS422 protocol.. 7.

(19) 2.1.. HARDWARE. CHAPTER 2.. SYSTEM OVERVIEW. Figure 2.1: System overview 2.1.1. Lower part. The lower part of The Lamp includes the three motors, the PIR sensors and the lower board which connects to them.. 8.

(20) 2.1.. HARDWARE. CHAPTER 2.. SYSTEM OVERVIEW. Lower board. The lower board consists of the main MCU, which controls the motors and is responsible for handling the software related to the behavior of The Lamp. PIR sensors. There are six sensors evenly distributed at the base of The Lamp. They are placed so that each sensor is covering 60 degrees (equation 2.1). 360◦ = 60◦ 6. (2.1). Motors. The three Direct Current (DC) motors are responsible for moving the whole body of The Lamp. The motors are controlled through three motor drivers, which are controlled by the MCU on the lower board. 2.1.2. Upper part. The upper part, which is the focus of this thesis, consists of a MCU (of AVR32 type), a Servo controller, all the LEDs and driver circuitry for controlling them. The Sonar board connects to this upper board, and the upper board is responsible for handling the Sonar data. Upper board. The main components of the upper board are the MCU, RGB LEDs and various connectors. LED board. The LED board consists of 96 RGB LEDs and four LED drivers which are controlled from the MCU. The LED drivers communicate with the MCU through a serial protocol. Servo board. The servos are controlled through a dedicated controller, the Polulu SSC03A[4]. A RS232 serial protocol is used to communicate with this controller.. 9.

(21) 2.2.. SOFTWARE. CHAPTER 2.. SYSTEM OVERVIEW. Sonar board. This is the central part of this thesis. The Sonar board is described more throughly in chapter 3 on page 13 and chapter 4 on page 16. 2.2. Software. The software is divided in four layers (gure 2.2 on the next page): • Platform. Abstracts the hardware drivers from Atmel Software Framework (ASF) into an object oriented interface. • Device Represents devices in The Lamp, such as servos and LEDs. This helps use these devices in a more logical structure, with easy to use interface. • Services This layer provides application resources and management. Acts as a layer that connects devices into usable services for application. • Lamp The application layer, where all the behavior and control logic is handled. 2.2.1. ASF. The Atmel Software Framework (ASF)[5] is used to implement every member in Platform, to get access to peripherals and core functionality of the MCU. 2.2.2. Platform. The main parts of interest in this thesis are: • GPIOControl. Used for access to the Sonar board • InterruptControl Used for controlling interrupts which are needed to gather data from the Sonar board.. 10.

(22) 2.2.. SOFTWARE. CHAPTER 2.. SYSTEM OVERVIEW. Figure 2.2: Software structure 2.2.3. Devices. This is where the Sonar is implemented.. 11.

(23) 2.2.. SOFTWARE. 2.2.4. CHAPTER 2.. SYSTEM OVERVIEW. Services. The services are handling the control of the devices. 2.2.5. Lamp. This is where all the actual behavior takes place. This layer mainly uses services to control the devices.. 12.

(24) Chapter 3 Old sonar solution This chapter will describe the basics of the old Sonar system. 3.1. Hardware overview. The old Sonar design consists of the following main parts (gure 3.1):. Figure 3.1: Old sonar board. • Receiver. Two receivers placed on the left/right side of the board. Used for listening to the returning sound waves. These signals are very weak, and are amplied and rectied in several stages.. 13.

(25) 3.2.. OPERATION. CHAPTER 3.. OLD SONAR SOLUTION. • Transmitter. One transmitter placed in the center of the board. Sends out sound of 40 kHz. • Amplier The digital signal that the MCU sends to the board is amplied. More details can be found in the schematics in Appendix B on page 59. 3.2. Operation. This board does not have any logic, so everything has to be controlled from the main MCU on the upper mainboard. The board consists of one transmitter and two receivers. The transmitter sends out sound during a short period of time, and then the MCU on the upper mainboard listens to the two receivers. The MCU counts the time it takes for both receivers to receive the sound that has bounced back. When the time it takes for the sound to travel from the transmitter to the target (a person) and then back to the receiver is known, this time can be translated into a distance using equation 3.1. t∗v 2 d = distance, t = time, v = speed of sound = 343.2 m/s d=. 3.3. (3.1). Usage. Figure 3.2 on the next page describes the way of using the Sonar board, where the following signals are used: • BURST. Used for sending the sound • TSF Signal that turns on the amplier for the sound • Sonar1 Signal from Sonar 1 • Sonar2 Signal from Sonar 2. 14.

(26) 3.3.. USAGE. CHAPTER 3.. OLD SONAR SOLUTION. Figure 3.2: Sonar timing diagram Usage: 1. Send sound on the BURST line while turning the transmitter on with TSF. 2. Turn o the transmitter with TSF low. Start listening for the returning sound on both Sonar lines. 3. After a while, stop listening for the returning sound. Transform time into distance. 4. Repeat. 15.

(27) Chapter 4 New sonar solution After the failure of the old Sonar board (discussed in section 8.2 on page 44 and section 6.2 on page 37, ), a new design of the whole Sonar system was performed. 4.1. New design. In order to design a new Sonar system, it was necessary to rst specify what this new Sonar system was to achieve. How was The Lamp meant to be used, and what was the Sonar system required to add to The Lamps functionality? In order for this thesis to maintain focus on the implementation of a Sonar sensor solution, the design of the new Sonar system was preferred to use as many ready-to-use components as possible. 4.1.1. Restrictions of The Lamp. There are certain restrictions on how The Lamp can be used. Some of these are due to the design of The Lamp and some are due to the desired usage of The Lamp. The Lamp has been mainly used on exhibitions and fairs. The Lamp also has certain mechanical limitations in its design, which are beyond the limits of this thesis to address. This created a number of restrictions and demands: • 180 degree rotational movement. 16.

(28) 4.1.. •. •. •. •. NEW DESIGN. CHAPTER 4.. NEW SONAR SOLUTION. The Lamp can only rotate 180 degrees. This means that The Lamp has a front side, in which it can look at any direction, but also a back side, where it cannot look at all. Placement The previous limitation states that one side of The Lamp is in a "dead zone". In order to reduce the visible eect of this, The Lamp should be placed with its front toward the audience. In an exhibition, this would most often mean that The Lamp is placed against a wall of the showcase, or just with its front turned toward where the crowd is. Distance to persons There is often quite much movement in an exhibition environment. The Lamp should only react on persons which are that close, so that they can be assumed to interact with The Lamp. The range of many Sonar sensors is long, often so long that people walking far away in the background could be detected. Therefore, the distance that The Lamp can "see", has to be limited. A reasonable maximum distance is about 2 meters. This distance is not xed but just a preliminary approximation, which is due to change. The minimum distance, due to the fact that The Lamp can lean, is measured to be about 0.5 meters. Number of persons The goal is to be able to detect whether one or multiple persons are close to The Lamp. In order to get a clear interaction between The Lamp and surrounding persons, there has to be a maximum person limit. There are two main reasons for this limit:  Space Too many people will not t close to The Lamp  Detection In order to dierentiate between one and multiple persons, the maximum number of persons has to be limited. A preliminary limit of 3 persons is chosen. This number was worked out from typical exhibition situations, and should be further investigated and tested. Multiple Lamps Because of the nature of Sonar technology, multiple sources will interfere with each other. Having two or more units running in the same. 17.

(29) 4.1.. NEW DESIGN. CHAPTER 4.. NEW SONAR SOLUTION. area is not possible, unless sucient distance or opposite direction can be achieved. 4.1.2. Desired behavior. There are a couple of basic behavioral criteria, on which a more advanced behavior and personality can be built upon. The following actions were chosen as a base: • Greet. When a person comes close within a certain range, The Lamp should detect this and perform a visual greeting. • Part When a person leaves the area, The Lamp should detect this and perform a visual sequence, for example "The Lamp is left alone and becomes sad". • Follow When a person is in The Lamp's vicinity, The Lamp should be able to follow the person with its eye. • Prioritize When multiple persons are in The Lamp's vicinity, The Lamp should be able to choose which person to give its attention. 4.1.3. Required data. The information that The Lamp needs to have about its vicinity in order to achieve the behavior in section 4.1.2 is: • Number of persons. In order to decide whether The Lamp is alone, or if there are any persons nearby. • Distance to persons Needed to prioritize persons, but also for other behavioral decisions, such as "The Lamp gets scared if a person is too close". • Position of persons In order to look at a person, The Lamp will have to turn either left or right.. 18.

(30) 4.2.. SENSOR CHOICE. CHAPTER 4.. NEW SONAR SOLUTION. • Speed of persons. Needed if The Lamp wants to act dierently depending on how fast persons are moving.. 4.1.4. Data requirements. The requirements on the data that is gathered through the Sonar solution is presented here. Stability. In order for The Lamp to move uently and precisely, data stability is important. A system where no signal processing has to be performed, in order to receive stable data, was desired. Resolution. The quality of The Lamp's behavior is aected by the resolution of the data. For example, the algorithm for following a person (section 4.3.2 on page 21) will work more accurately if the resolution of the range data is higher. Data rate. The rate of which new data is gathered from the Sonar sensors is an important factor. If the data rate is too slow, The Lamp will not have smooth and uent movements, and may even miss a person that is moving in its vicinity. 4.2. Sensor choice. The types of sensors that were considered were ready-to-use products, that would detect the closest target and have the distance to this target ready to read by the MCU on the upper mainboard. Several Sonar sensors were considered: • MaxBotix (several)[6] • Parallax PING)))[7]. 19.

(31) 4.3.. ALGORITHMS. CHAPTER 4.. NEW SONAR SOLUTION. • Devantech SRF02[8]. The Sonar sensor chosen from MaxBotix range was the MaxBotix MB1300 XL-MaxSonar AE0. MaxBotix have a range of sensors with greater accuracy and more documentation than any other that were found, but at a cost - they were the most expensive sensors. The MB1300 sensor had the best beam width for detecting persons, and was the sensor MaxBotix recommended for detecting persons[6]. The most interesting features of the MaxBotix MB1300 sensor[6]: • Low average current consumption: 3.4 mA • Fast rate of updating (10 Hz) • A lot of data processing is performed, in order to guarantee a good. stable reading. • Combined transmitter/receiver (tranceiver) in a small physical size • 1 cm resolution • Multiple dierent interfaces to choose from, when reading data from. the sensor. 4.3. Algorithms. These algorithms were developed to make sure that the Sonar sensor solution would perform the necessary tasks. 4.3.1. Loneliness detection. The Lamp needs to know whether there is a person in it's vicinity or not. A threshold value is used to dene a level of curiosity. This value will determine how far The Lamp can see, and can be varied for dierent personalities. If the desired behavior is shy, The Lamp may only be desired to react when persons are very close, but if the behavior is curious, it will react on persons further away as well.. 20.

(32) 4.3.. ALGORITHMS. CHAPTER 4.. NEW SONAR SOLUTION. When any Sonar sensor detects a value that is lower than the curiosity threshold, The Lamp is not alone. If all sensors give values higher than the curiosity threshold, The Lamp is alone. 4.3.2. Following. This algorithm was partially designed before choosing the number of sensors, and was nalized when the number of sensors was chosen( section 4.4 on the following page).. Figure 4.1: Left: Person is standing to the left. Right: The Lamp turns left, until straight at person. When following a person, The Lamp is facing the person as straight-on as possible. This means that The Lamp's eye-light is facing the person, giving the person the impression that The Lamp is looking at him/her. When only sensors on one side of The Lamp are detecting a person, The Lamp will directly know in which direction to turn toward the person. When The Lamp has turned enough so that only the middle sensor/sensors are detecting the person, The Lamp is still not looking straight at the person. This situation needs a ner detection of whether a person is straight ahead of The Lamp, or not. Figure 4.1 shows the theoretical operation of this algorithm: A person is. 21.

(33) 4.4.. NUMBER OF SENSORS. CHAPTER 4.. NEW SONAR SOLUTION. standing just a little to the left or right of The Lamp's center, so that only two sensors placed in the middle detect the person. The dierence in distance between the two sensors will be detected, and The Lamp will turn until both sensors give the same distance value. When this occurs, The Lamp should be facing the person straight on. The complete algorithm is described in gure 4.2.. Figure 4.2: Following algorithm. 4.4. Number of sensors. The Lamp has 10 holes around it's neck (gure 1.1 on page 1). These holes were designed for placing the Sonar sensors, because the sound cannot travel through the plastic shell. The Lamp has a front and back direction (section 4.1.1 on page 16), and in order for it to mimic human behavior, it should not have "eyes in it's back". Because of this, a maximum of 180 ◦ angle of sight is desired.. 22.

(34) 4.5.. PLACEMENT. CHAPTER 4.. NEW SONAR SOLUTION. Since The Lamp has 10 holes symmetrically placed around it's neck, that leaves 5 holes to cover the desired range of 180 ◦ . Each sensor has approximately 60 ◦ beam width at distances from about 1-3 meters[6]. In order to cover the 180 ◦ area, at least 3 sensors are required. To allow the following-algorithm (section 4.3.2 on page 21) to work, two sensors need to be facing the same direction. These two criteria sets the requirement to a total of 4 sensors. 4.5. Placement. Placing the sensors has to be done as shown in gure 4.3 due to the demands covered in section 4.4 on the previous page and section 4.3.2 on page 21: • A total of four sensors • Two sensors facing the same direction. Figure 4.3: Placement of the sensors This placement will result in two sensors being the center of The Lamp, with one sensor on each side symmetrically.. 23.

(35) 4.6.. NEW SONAR BOARD. 4.6. CHAPTER 4.. NEW SONAR SOLUTION. New sonar board. The upper mainboard has limited connectivity possibilities, only four General Purpose Input/Outputs (GPIOs) are available (appendix A on page 56). Each Sonar sensor needs one control signal and one data signal at least, four sensors will require a total of eight GPIOs. These sensors run at 5 V (for maximum beam width, which is desired), which is not available from the upper mainboard. In order to run four Sonar sensors in the desired way, a new Sonar board has to be designed. This board should handle all controlling of the sensors, handle their data output and send this data to the main board. 4.6.1. Requirements. Requirements for the new Sonar board are: Power from 24 V supply voltage from the upper board Control each sensor with a digital signal Read the analog voltage level from each sensor Send data in a digital form to the upper mainboard Have the same form factor as the old Sonar board, in order to t mechanically • Have the same placement of connectors as the old Sonar board, to connect to the upper mainboard • • • • •. 4.6.2. Subsystems. The design of each subsystem is described here. Power supply. The main board is running on 24 V, and the MaxBotix Sonar sensors require 5 V for maximum reach and lobe width. The sensors consume an average of 3.4 mA and a peak (when transmitting) of 100 mA[6]. The MCU normally only consumes a few mA at most, meaning that the current supply should be able to deliver:. 24.

(36) 4.6.. NEW SONAR BOARD. CHAPTER 4.. NEW SONAR SOLUTION. Figure 4.4: New sonar design overview. 4 ∗ 3.4 = 13.6 mA avg. (4.1). 4 ∗ 100 = 400 mA peak. (4.2). The total requirements on the power supply are then: • 5 V down from 24 V • Average current of at least 30 mA (with a LED that indicates power,. MCU and average current of the sensors included). • Peak current of 400 mA. A commonly used device that should suite these needs is a LDO. A ST L7805[9] was chosen for evaluation, for the following reasons: • Previous experiences. Previous experience with similar devices makes it more comfortable to use this type of device • Availability These devices are readily available in many forms, from many component distributors. As EIS are often using Farnell for their component purchases, the availability of the item with Farnell was considered as well. 25.

(37) 4.6.. NEW SONAR BOARD. CHAPTER 4.. NEW SONAR SOLUTION. • Price. Although cost is not a big issue in this thesis, these devices are often one of the cheaper solutions for this type of voltage regulation • Ease of use These devices do not require a lot of components to work, which makes the design easier and neater • Current capability These devices are often capable of delivering high currents (up to a couple amperes). There are dierent packages available for this device, but since space is not an issue in this design, the typical TO220 package was chosen in this evaluation. This package has good thermal capabilities, which prevents it from overheating, and if it would be required, a heat sink is easy to nd for this package to reduce the heat even more. The data sheet ([9], page 7) states that the thermal resistance junctionambient is 60 ◦ C/W. This means that the device temperature will rise 60 ◦ with each watt of power that is dissipated in the device. The data sheet ([9], page 7) also states that the maximum operating temperature is 125 ◦ C. The rise in temperature can now be calculated: The voltage drop in the LDO: 24 − 5 = 19 V. (4.3). The peak power dissipation, at 400 mA: 19 V ∗ 400 mA = 7.6 W. (4.4). The average power dissipation, at 30 mA: 19 V ∗ 30 mA = 570 mW. (4.5). The average power dissipation is the interesting parameter to look at, due to the very short time that the peak power is dissipated. The temperature rise in the device due to this power dissipation is calculated in equation 4.6. 570 mW ∗ 60◦ C/W = 34.2◦ C. 26. (4.6).

(38) 4.6.. NEW SONAR BOARD. CHAPTER 4.. NEW SONAR SOLUTION. The temperature of the device in an ambient temperature of 30 ◦ C: 34.2◦ C + 30◦ C = 64.2◦ C. (4.7). This temperature is well below the specied maximum temperature of 125 ◦ C. Hence no heat sink will be required, and this device should t well in the design. This device requires two external capacitors, which are chosen according to the data sheet[9]. Microcontroller. In order to work with something familiar, simple and cheap, an Atmel AVR ATTiny24 MCU was chosen as the central part of the design. This MCU has the necessary peripherals to control the Sonar sensors and communicate with the upper board[10]: • TWI communication support in hardware • Sucient amount (more than four) of ADC channels • Internal oscillator, for simplicity. Connections. The Sonar board has to connect to the upper mainboard and the four Sonar sensors. The sensors each require the following connections: • • • •. Vcc Gnd Analog output Trigger signal. Four connections to each sensor are necessary. For simplicity, ordinary header connectors with 100 mil (2.54 mm) spacing were chosen. They are mounted as edge connectors (lying down), instead of the normal through-hole mounting. This is because the wires connected to these will be less interfering with the mechanical parts of The Lamp, if they are placed in this direction. In order to connect the Sonar board to the main board, two pieces of 2x4 connection sockets with 2mm spacing are to be used. These connectors are. 27.

(39) 4.6.. NEW SONAR BOARD. CHAPTER 4.. NEW SONAR SOLUTION. identical to the ones used on the old Sonar board, and may not be replaced in order for the new board to t. Finally, in order to program the MCU, a 3x2 connector with 100 mil(2.54 mm) spacing was used. ESD protection. The Lamp was designed so that the Sonar sensors are meant to be placed in the holes around The Lamp's neck. When placed like this, the sensors are vulnerable to ESD damage. This damage can occur when a person happens to touch The Lamp. In order to protect the Sonar board, as well as the upper mainboard, from damage due to ESD, some protection was required. If an ESD discharge is passed through a Sonar sensor, it can travel through any line to the Sonar board, and then through to the upper mainboard. Therefor, all signal lines from the Sonar sensors are to be protected from such discharges. In order to simplify the addition of these components to the board layout, a small size was decided as high priority. The technique chosen for ESD protection was a TVS diode. The reasons for choosing this technique were mainly the availability in small packages and overall good protection compared to some other commonly used techniques[11]. The specic TVS device was chosen because it was one of the smallest available (at Farnell, with a reasonable price) with the correct parameters. This device has the following relevant[12] specications[13]: • Reverse standard voltage: 5 V. This voltage should be greater to, or equal, the operating voltage (which is 5 V in this design) • Clamping voltage: 10 V This is the maximum voltage across the TVS when the transient current is 1 A. This value should be chosen as low as possible so that the device connected to this line (the MCU) suers as little (or none) damage as possible. • Size: SOD323 package, 2.7 x 1.35 mm • Bidirectional. 28.

(40) 4.6.. NEW SONAR BOARD. CHAPTER 4.. NEW SONAR SOLUTION. This means that the TVS works in both directions, meaning it can suppress both positive and negative voltage spikes. (It also means that it can be mounted in any direction) Low pass ltering. Analog signals (were rst meant to be used instead of the serial interface, section 8.5 on page 47) going from the Sonar sensors to the Sonar board are traveling through long cables (> 1 m) where many sources of disturbance (motors, cables, servos) are present. In order to prevent this noise from resulting in incorrect readings, a low pass lter was introduced on every analog signal line. A simple low pass lter consisting of a resistor and a capacitor is sucient for this task. This was also recommended by MaxBotix themselves, in one of their tutorials[14]. Since the Sonar sensors only change their data output at most 10 times/second, the lter can be designed to lter the signal very intensively. The time constant for such a lter, is a parameter that determines how long time it takes for the voltage to change from one value to another. The time constant was calculated in equation 4.8 [15], using recommended values from MaxBotix[14]. t = R ∗ C = 10 k ∗ 100 n = 0.001 s. (4.8). Other components. The following additional components are also in the design: • A decoupling capacitor was added close to the MCU, to protect it from. noise. • A LED that indicates that the power supply is working, together with a current-limiting resistor.. 29.

(41) 4.6.. NEW SONAR BOARD. 4.6.3. CHAPTER 4.. NEW SONAR SOLUTION. Board layout. The full schematic on which this layout was based can be seen in Appendix C on page 62. Size. The size of the board was limited by the mechanical placement of parts in the head of The Lamp. The new board should be of roughly the same size as the old board. If it would be much smaller, the connectors to the main board would not t (they have a large separation). If it would be larger, the board itself might not t onto The Lamp. The old Sonar board as 100 x 32 mm and the new design was designed to 70 x 20 mm. With this size, the connectors can still t with the required spacing, and some excess board space on the sides is also present, which is good for mechanically inserting the Sonar board onto the main board. Placement. The LDO is placed on the edge so that it's legs can be bent outward and make room for a heat sink (if later required) for maximum cooling. The TVS diodes are placed as close to the connectors as possible, for maximum protection.. 30.

(42) 4.6.. NEW SONAR BOARD. CHAPTER 4.. NEW SONAR SOLUTION. Result. Figure 4.5: Sonar board top layer. Figure 4.6: Sonar board bottom layer Note that changes were made to the design after the board was fabricated (section 8.5 on page 46). 31.

(43) 4.6.. NEW SONAR BOARD. CHAPTER 4.. NEW SONAR SOLUTION. Summary. The following specications summarize the design of the new Sonar board: • The four MaxBotix MB1300 sensors are connected through the serial. interface to the new Sonar board. • Each sensor is connected with 4 lines: VCC, GND, serial communica-. tion for distance reading and digital control signal.. • Two 2x4 connectors to the main upper board • Runs on 5 V, using an LDO to convert down from 24 V from the upper. mainboard. • Average current consumption < 15 mA • Peak current consumption of about 400 mA • Atmel ATTiny24 MCU • TVS diodes for ESD protection • TWI communication to upper mainboard MCU. 32.

(44) Chapter 5 Software This chapter will present the most important software developed in this thesis. 5.1. Sonar board software. The Sonar board software controls the Sonar sensors, receives data from them, and sends this data to the main board (gure 5.1 on the next page). The MCUs on the two boards communicate through a TWI protocol. There are no physical Pull-up resistor implemented for this protocol (internal in the MCU on the main board is used instead).. 33.

(45) 5.2.. MAIN BOARD SOFTWARE. CHAPTER 5.. SOFTWARE. Figure 5.1: New sonar timing 5.2. Main board software. The implementation of the sonar into the system of The Lamp is written solely in C++. This section roughly describes the function of the software implementation.. 34.

(46) 5.2.. MAIN BOARD SOFTWARE. 5.2.1. CHAPTER 5.. SOFTWARE. Sonar class. The sonar class holds a state-machine that handles the TWI communication protocol for receiving data from the Sonar board. The sonar class was implemented under the device layer (section 2.2 on page 10). The state machine is updated on interrupts from both SDA and SCL lines, through their ISRs. When all data is read, the sonar class pushes an "new data available" event to the system to notify that new data is present 5.2.2. MissNosy personality. The personality that is implemented in the Lamp layer, is called MissNosy and has three behaviors: • Greet arriving person. If a person has just arrived, rise up, change color to red and look at the person. • Look at person. Depending on whether a person is standing to the right or to the left of MissNosy, turn toward the person. If facing the person directly, do nothing.. • Look sad when being left. When a person has just left MissNosy alone, change color to blue, look down at the oor and decline to a sad sunken position.. 5.2.3. Evaluation Methods. In order for MissNosy to get information for the dierent behaviors, data from the Sonar sensors has to be translated to useful information. This translation is handled by evaluation methods. The following evaluation methods are implemented: • PersonApproaching. Returns true if a person is just approaching. • PersonPresent. Returns true if a person is present. 35.

(47) 5.2.. MAIN BOARD SOFTWARE. CHAPTER 5.. SOFTWARE. • PersonLeaving. Returns true if a person is just leaving. • PersonPosition. Returns -1 if a person is to the left, 0 if centered or 1 if the person is to the right. 36.

(48) Chapter 6 Implementation This chapter describes the dierent stages of implementation in chronological order. 6.1. Old sonar prototype. The old Sonar board was connected to the Evaluation board. A test program was written, using ASF following the scheme in gure 3.2 on page 15. The data was analyzed using an oscilloscope, which conrmed the functionality of the board, but also that the data was very noisy. This prototype conrmed that it was impossible to get a stable reading of the Sonar receivers by simply reading the values, using the proposed technique. Some sort of data processing was determined necessary, in order for The Lamp to make use of the data. This stage was the rst time a simple algorithm for following a person was conrmed, proving the concept of following a person using two sensors described in section 4.3.2 on page 21. 6.2. Old sonar failure. After conrming that the system was working, the Sonar board was connected to the main board instead, in order to work on The Lamp instead of the Evaluation board. At this point, the Sonar board started to fail. More details about the damage is discussed in section 8.11 on page 48.. 37.

(49) 6.3.. NEW SENSOR TESTS. CHAPTER 6.. IMPLEMENTATION. In order to repair the MCU that was damaged on the upper mainboard, the whole upper part of The Lamp was disassembled. 6.3. New sensor tests. Multiple tests were performed in order to validate the specications of the new Sonar sensors as well as testing performance on a human target. The Sonar sensors were connected to the Arduino, which was used to send data through to a PC for data collection. 6.3.1. Sensor data testing. In this test, only one sensor was tested at a time. A two meter high and one meter wide sign, made out of rm fabric, was used as a target. This sign was placed at distances from 0-2 meters while the data was studied. There were no recordings made of this data, because similar data was extracted from the next test session (section 6.3.2). This test proved that the 1 cm accuracy that was claimed by the manufacturer[6], was indeed achievable. Also, the test conrmed that the data gathered from the sensors was very stable. 6.3.2. Person detection testing. The goal of this test was to see how the sensors behave in a more realistic environment. This tested both their individual stability, but also their behavior when running together. This test was performed to determine whether all sensors could run at the same time, or if they had to be run sequentially. The Lamp was disassembled at this point, therefor a temporary mechanical solution was built to hold the sensors on The Lamp. This was required so that the intended placement of the sensors could be tested. A mannequin was dressed in a coat, in order to pose as a person for these tests (gure 6.1 on the next page). All four Sonar sensors were connected to the Arduino, which was connected to a computer running MATLAB, with a simple program that gathered data from the sensors. When running all of the sensors at once, the data was not as stable as when. 38.

(50) 6.3.. NEW SENSOR TESTS. CHAPTER 6.. IMPLEMENTATION. Figure 6.1: Test setup one sensor was running alone. This was caused by interference between the sensors, due to sound waves being reected from multiple sensors at once[14]. The way to resolve this issue is to run the sensors one, or a few, at a time. At rst, running two sensors at a time was tested. This gave some improvement, but still not the same result as when running one sensor.. 39.

(51) 6.4.. NEW SONAR PROTOTYPE. CHAPTER 6.. IMPLEMENTATION. A scheme was then developed, where sensors were sequenced so that only one sensor was running at a time. Each sensor was started by the Arduino, with an adjustable delay between each sensor. This delay parameter is very important; too short time and the sound waves from one sensor will still be able to interfere with the next sensor. On the other hand, if the delay is too long, the data-rate will be much slower, which will aect the performance of The Lamp. The test results are presented in section 7.1.1 on page 42, and test data in appendix D on page 63. 6.4. New sonar prototype. In order to test the new Sonar sensors with the desired functionality of the new Sonar solution, a rst prototype was developed. This prototype used the Arduino in place of the Sonar board, which was connected to the Evaluation board. The Servo controller was also connected to the Evaluation board, in order to allow The Lamp to turn sideways. The code was written mostly using the ASF directly, in order to determine what part of the drivers that would be necessary for controlling the sensors (all of these functionalities might not have been implemented in the higher level of The Lamp's software architecture). With these basic functionalities, it was possible to test the algorithm for following (section 4.3.2 on page 21). When a simple form of the algorithm for following was conrmed and data from the Sonar sensors was determined stable, the next step was to go from using the Evaluation board to the upper mainboard on The Lamp. 6.5. New sonar prototype 2. The progress continued with the Sonar sensors being connected to the Arduino, which was connected to the upper mainboard. The Lamp was built together, so that all functionalities of The Lamp could be utilized. In this prototype, a simple personality was developed, using more of The. 40.

(52) 6.6.. FINAL IMPLEMENTATION. CHAPTER 6.. IMPLEMENTATION. Lamp's functionalities than ever before. The personality had the following actions: 1. If no person is within range, look bored. This bored look was visualized by: • set the color of The Lamp's LEDs to blue • look down on the oor • move head slowly side to side, acting bored and sad. 2. When a person comes into range: • change the color of The Lamp's LEDs to red • look up at the person • follow the person 3. When a person moves out of range: go back to being bored The software was ported from the Evaluation board to the main board, using more of the available software from The Lamp's project, instead of using the ASF directly. This was done to allow most of the code to be reused in the nal implementation. 6.6. Final implementation. This stage implemented the same behavior as had previously been done (section 6.5 on the previous page), but using the nal mechanical parts and electronics. The Arduino was replaced by the new Sonar board. The software was redesigned, using the software implementation described in section 5.2 on page 34 and the Sonar sensors were mounted on The Lamp's plastic shell. With the plastic shell mounted, The Lamp should now be ready to be used. Further improvements in software are desirable to give The Lamp more fun actions and a more detailed behavior, but this is left as further work (section 10.2 on page 53).. 41.

(53) Chapter 7 Result 7.1. New sonar solution. The new sonar solution has very stable readings, even when working with targets that are normally hard to obtain stable results from (clothed persons). Tests results (Appendix D.1 on page 63, Appendix D.2 on page 64) show that the resulting stability with the new solution was very good, mostly only varying by 1 cm. 7.1.1. Test results. The tests in appendix D.2 on page 64 show that all sensors cannot run at once, and the solution was to control them sequentially. The order to run the sensors was chosen to: 3,1,4,2. The placement of the sensors can be found in section 4.5 on page 23. This sequence was chosen to minimize the occurance of two nearby sensors running after each other. The delay between starting sensors in this sequence was determined through the tests, and set to 40 ms. With 40 ms delay between the sensors, the data-rate of the sensors is: 1 = 6.25 readings/second 40ms ∗ 4. (7.1). Each sensor can be run at a maximum of 10 times/second, so this delay causes a noticeable degradation of the data-rate[6].. 42.

(54) 7.2.. 7.2. THE LAMP'S BEHAVIOR. CHAPTER 7.. RESULT. The Lamp's behavior. The simple personality which is implemented on The Lamp, is a big improvement to the audience of The Lamp. Instead of having a randomized behavior, The Lamp is now reacting in a logical manner depending on adjacent persons movements. The Lamp is following a person with enough speed, so that it does not loose track of a person if the person is not moving too fast (one can move fast, but not run around the lamp).. 43.

(55) Chapter 8 Discussion Certain aspects of this thesis are further discussed in this chapter. 8.1. Multiple lamps. Using Sonar sensor technology means that multiple units standing close to each other cannot run at the same time. If in the future, it is highly desired to have multiple units running together, there has to be investigations to show whether Sonar sensors are still usable, or some other technology has to be used. 8.2. Reasons for a new design. The main reasons for choosing to redesign the system, instead of trying to x the old design were: • Time. In order to fully investigate and correct the old Sonar board, the PCB would most likely have to be redesigned and manufactured. This would take up most of the time of this thesis. Furthermore, much signal processing would be required in order to make the data stable and usable, which is also a very time-consuming task. • Aim The aim of this thesis was not to redesign the Sonar board, but to implement a Sonar solution.. 44.

(56) 8.3.. SENSOR CHOICE. CHAPTER 8.. DISCUSSION. • Documentation. There was quite limited documentation of the Sonar board. Many design aspects such as power consumption, accuracy and resolution of the Sonar readings were lacking. This makes it hard to predict the behavior of the board, and fully verify it's functionality. The people who designed the board are no longer employees at glseis, which made it even more impossible to answer questions about the design. • Functionality Because there are only two Sonar receivers on the board, the functionality is limited. With these two alone, The Lamp has a very narrow view of sight. As described in section 4.3 on page 20, certain functionalities require more than two sensors. • Cost There was only one Sonar board available. The Sonar board is a 4-layer design with many expensive components, so it costs a lot to manufacture. In order for multiple units of The Lamp to use this solution, at least two or more new boards would have had to be manufactured. 8.3. Sensor choice. There was no equivalent competitor to the MaxBotix sensors. The two other sensors that seemed popular among robotics projects were in some way inferior. The Parallax PING)))[7] was not a combined transceiver - multiple units would not t in The Lamp's plastic casing. The Devantech SRF02[8] had no specication about resolution, which was an important parameter. MaxBotix seemed to be a better quality product, with more support and information available. Perhaps further investigations would have resulted in nding a harder to nd, smaller manufacturer. 8.4. Sensor signal choice. The MaxBotix AE0[6] sensors have three interfaces for reading the data output: • Serial data. Serial data sent with RS232 compatible protocol. 45.

(57) 8.5.. NEW SONAR BOARD. CHAPTER 8.. DISCUSSION. • Analog voltage. An analog voltage is set that represents the distance. • Analog envelope. The "raw data" from the sensor, for manual processing. The reason for choosing the analog voltage at rst was that it is a very simple and fast task to read an analog voltage on the MCU, instead of reading the serial data. A rst attempt was made to use the RS232 compatible serial interface, but was disgarded due to higher complexity. The stability of the readings using the analog level was determined good in the tests, which was the biggest fear with using the analog level. However, upon completing the new Sonar board, the digital interface was nally chosen after all. This was due to some unstability when running the whole system in the nal implementation. 8.5. New sonar board. There were a few design issues with the rst revision of the Sonar board. Because the boards still work with a minor tweak (one wire), it was not deemed necessary to redesign the board at this point. Voltage division. The Sonar board runs on 5 V(because the sensors need to be run at 5 V) and the upper mainboard MCU runs on 3.3 V. Therefore, when designing the new Sonar board, voltage division resistors(R5-R12, appendix C on page 62) were put on the board to make sure that the voltage to the upper mainboard would not exceed 3.3 V. Some revisions of the MCU on the upper mainboard are not tolerant to 5 V. In the nal implementation of the new Sonar board, an open-collector TWI communication protocol was implemented, which negates the need of these resistors. They are therefore not populated (R5, R7, R9, R11 are replaced with 0 Ohm resistors) on the board. Unusable port. One of the signals that was supposed to be used for controlling one sensor (PB3)[10] was not possible to use without disabling the option to program. 46.

(58) 8.6.. SENSOR UPDATE RATE. CHAPTER 8.. DISCUSSION. the MCU further. Therefore, a wire was used to change the output to one of the sensors from PB3 on the Attiny 84 MCU to PA4. Analog to digital change. When the new Sonar board was programmed and used in the system, it was noticed that, despite ltering, the data gained was a little unstable. The Lamp has many sources of disturbances, with all it's wires, motors and signals that are running around the sensors, which disturbed the analog level. When the scheme for controlling all sensors was developed and tested, it was determined that there was enough time to use the serial interface of the sensors instead. This change made the lters(R1-R4, C4-C7 in appendix C on page 62) on the new Sonar board redundant. The running version of the board has these unpopulated or replaced with 0 Ohm resistors. 8.6. Sensor update rate. It is hard to calculate what the minimum update rate is in order to get a good reaction time from The Lamp. This could perhaps have been further tested, but instead the result was determined to be proof enough that the actual update rate is sucient. 8.7. New vs old sonar - advantages. Since cost is not a major concern regarding the development of The Lamp, the reduction in cost is not of much use. Besides this advantage, there is much less processing required by the MCU on the upper mainboard. When more advanced behavior and other features are to be implemented in the future, this can make for quite an advantage. The simplicity of the new design, in respect to the old one, is a welcome change. If more boards are required, something breaks or someone wants to continue developing the hardware, it is much more clear what the purpose and function of the new Sonar board is.. 47.

(59) 8.8.. CURIOSITY LEVEL. 8.8. CHAPTER 8.. DISCUSSION. Curiosity level. Ideally, the maximum distance that The Lamp is interested in (the curiosity level, see section 4.3.1 on page 20) should be adjustable in the eld(without the need of a PC connected, without the need of an engineer), in order to customize The Lamp for dierent environments. This could be done with a simple external board that communicates with The Lamp. With a few buttons and a display, parameters could be adjusted easily. 8.9. Number of persons. The maximum detectable number of persons could be tweaked after using The Lamp for a while. How people will actually interact with The Lamp is hard to predict. 8.10. PIR sensors. Upon completing the Sonar sensor implementation, the PIR sensors are not mandatory to use at all. These were reported very troublesome and unstable by earlier employees that worked on The Lamp, therefore leaving them might be a pleasant change. 8.11. Faulty electronics. After producing the old Sonar board, there was only a short verication of it's functionality performed. This short verication was only made by the hardware designer in order to conrm that the board seemed to work correctly. There were no prolonged tests, nor any attempt at an implementation of this system. The following errors that occurred were likely to have been caught earlier if more tests were performed earlier. At rst, one of the sensors on the old Sonar board stopped responding. Shortly after, the other sensor stopped as well. Investigations showed that the MCU on the upper mainboard had been damaged, as well as the amplier that is used to amplify the sound to the transmitter. The damaged amplier was replaced, and the Sonar board was tested. At this. 48.

(60) 8.11.. FAULTY ELECTRONICS. CHAPTER 8.. DISCUSSION. point, no errors were found. Just before putting everything back together, the Sonar board was tested once again. During this testing, the same amplier that had previously been damaged, broke down once again. Much time was spent trying to investigate why the rst Sonar board behaved strangely, and later broke down. ESD damage was most likely not a reason, as both an ESD mat and bracelet was used at the workplace. The electronics broke down without anyone coming in contact with them, which would be strange for ESD damage. Tests were performed, that also excluded heat as a factor. Together with an employee at glseis, the most likely reason for the breakdown was instability that caused the devices to break down after running a period of time. Much thought was put into designing the new Sonar system. The old Sonar system was not sucient to implement all the desired functions. The design of the new system was aimed to make sure that the functionality would be sucient.. 49.

(61) Chapter 9 Conclusion This thesis has resulted in improvements to the abilities The Lamp has to detect and interact with persons in its vicinity. The old Sonar solution was determined to: • Deliver unstable data, which had to be processed a lot to be usable • Use an insucient amount of sensors for more advanced detection al-. gorithms. • Cost a lot of money to produce • Be very poorly documented • Have been developed by the same person who thought about imple-. mentation, resulting in a rather ill-tted solution for the application (The Lamp). The old Sonar board ended up breaking down, and because of the many aws of this design, a new design was initiated. The design of a brand new Sonar solution included: • New sensors, that are ready-to-use and easy to implement • New Sonar board, that controls the new sensors and takes away a lot. of work load on the MCU on The Lamp. • Software that controls the new sensors for minimum interference be-. tween sensors, while maintaining maximum update-rate of the sensors. 50.

(62) CHAPTER 9.. CONCLUSION. • Implementation of a simple personality to verify and demonstrate the. use of the new Sonar system. Many benets were gained by redesigning the whole Sonar system: • More number of sensors make possible more advanced behavior for The. Lamp, such as a wider eld of sight and possibilities to detect multiple persons. • A higher resolution in the distance data allows more accurate behavior. for The Lamp. • High stability in the distance data prevents unpredicted behavior of. The Lamp in certain situations. • Sensors that are ready-to-use require no data processing to operate,. allowing focus on implementation during this thesis.. • Further work and improvement on The Lamp is easier to perform, with. a simpler and more well documented Sonar system.. The result of this thesis can be easily observed by running The Lamp with the new Sonar system. Compared to the old system, which is lacking the Sonar implementation, The Lamp is interacting much more with persons in it's vicinity.. 51.

(63) Chapter 10 Further work 10.1. Hardware. • Mechanical improvement. When putting the plastic shell on The Lamp on/o, a lot of damage can be done to the upper main/LED board. The biggest issue for the Sonar part is that the Sonar sensors can be damaged. A dierent way of attaching the plastic shell should be revised. • Main board The redesign of the Sonar board has made some parts of the main board obsolete (mainly the DAC). Furthermore, the Sonar board should be connected to the TWI ports of the upper mainboard MCU. In the case of redesigning the upper mainboard, external Pull-up resistors should be added there as well. • Lower board Since this thesis has focused on the upper part of The Lamp, the lower board was not evaluated enough to nd any specic means of improvement. • External settings board With the possibility of switching between dierent personalities, or just wanting to change the curiosity level depending on the surroundings The Lamp is in, an external board could be of interest. This could either communicate with mobile devices, giving them some data and control of The Lamp, or just house a display and some buttons for setting various parameters. Or why not both?. 52.

(64) 10.2.. 10.2. SOFTWARE. CHAPTER 10.. FURTHER WORK. Software. • MissNosy. The MissNosy personality which has been started, can be much improved. • Further personalities When MissNosy is fully implemented, adding more personalities would be of interest. A suitable way of changing between personalities should also be investigated. One way of solving this is by using the serial port that is available on the lower board, but this requires a computer to connect to The Lamp. • Port to new version of ASF The version of the ASF used in the Relight Relate project, is very outdated. There has been some changes made in the ASF to t the project's needs, because some functionalities were not supported by the ASF. More benets that are not further investigated are sure to be gained by upgrading to the newest version of the ASF. • Implement algorithms for detecting multiple persons Algorithms for determining the following are thought of, but not yet implemented:  Whether multiple persons are in the area  Which person is closest  How fast are persons moving. 53.

(65) Bibliography [1] Semcon,. Relight>Relate. homepage.. public. relightrelate.com. [2] Atmel,. EVK1100. [3] Arduino,. Arduino Duemilanove.. evaluation. board. [www],. schematics.. http://www.. [www],. //www.atmel.com/dyn/resources/prod_documents/EVK1100_ SCHEMATICS_REVC.pdf, date 2012-01-10. http:. [www], http://arduino.cc/en/Main/ arduinoBoardDuemilanove, date 2012-03-22. [4] Polulu, Polulu Servo Controller. [www], http://www.pololu.com/file/ 0J37/ssc03a_guide.pdf, date 2012-02-01 [5] Atmel, ASF Source Code Documentation - UC3 A0/A1 Documentation. [www], http://asf.atmel.com/docs/latest/uc3a/html/index.html, date 2012-01-10 [6] MaxBotix,. (MB1300).. [www],. http://www. maxbotix.com/documents/MB1200-MB1300_Datasheet.pdf, date 2012XL-MaxSonar. AE0. 04-01. [7] Parallax, Parallax PING))). [www], http://www.parallax.com/tabid/ 768/ProductID/92/Default.aspx, date 2012-04-01 [8] Devantech,. [www], http://www. robot-electronics.co.uk/htm/srf02tech.htm, date 2012-05-01. [9] ST. Devantech. MicroElectronics,. SRF02.. TO220.. [www],. http: //www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_ LITERATURE/DATASHEET/CD00000444.pdf, date 2012-03-25 ST. L7805ABP. 54.

(66) BIBLIOGRAPHY. BIBLIOGRAPHY. [10] Atmel, ATtiny84. [www], http://www.atmel.com/devices/attiny84. aspx, date 2012-03-30 [11] Benny Lee,. An Overview of ESD Protection Devices. [www], http:// www.ce-mag.com/archive/01/Spring/Lee.html, date 2012-03-30. [12] Semtech,. [www], http://www.semtech. com/images/datasheet/tvs_diode_selection.pdf, date 2012-03-30. [13] NXP,. TVS Diode Application Note.. NXP PESDxL1BA bidicertional ESD protection diode.. [www], http://www.farnell.com/datasheets/682594.pdf, date 2012-03-30. [14] MaxBotix,. MaxBotix tutorials.. tutorials.htm, date 2012-04-15. [15] Electronics tutorials ,. [www], http://www.maxbotix.com/. Passive Low Pass Filters.. [www], http://www. electronics-tutorials.ws/filter/filter_2.html, date 2012-03-28. 55.

References

Related documents

To solve this problem, the upstream node will send its data to the plant actuator, which switches to the storage tank after some time delay, independent of inlet node mea-

The path distance tool calculates the accumulated cost of moving from each cell in a raster to a determined source cell, accounting for both the friction layer, the surface

Figure 8 - Result of visual odometry aids in navigation of Opportunity rover: path with visual odometry (green - G) and with only wheel odometry (blue - B) (top); Features

Modellen som bäst förklarar följdsymptomen barnen fick vid smitta av Cryptosporidium enligt Gibbs Variable Selection innehåller variablerna Vattnig diarré, Buk- eller

Eleverna känner sig alltså inte inspirerade av salen som den är nu, medan lärarna tycker att de använder sig av salen på ett bra sätt för att inspirera sina elever.. Mitt arbete är

The plate layout is used when creating a master plate that defines which drugs and which concentrations are to be placed in the different wells.. Then a plate is constructed based

Ursprungslandsprincipen skulle endast vara giltig vid tillhandahållandet av tjänster och inte tillämpas vid etablering. 50 Från principens tillämplighet medgavs även

samtidigt på att det i så fall krävs att lärare inte är rädda för konflikter utan kan se oenigheter som en resurs till lärande. Förutom empati pekar forskningen på att det