Aula-03-Bluetooth-control-using-Lego-Mindstorms

Download Report

Transcript Aula-03-Bluetooth-control-using-Lego-Mindstorms

EN1002 Engenharia Unificada I

FERRAMENTAS E EXEMPLOS DE PROJETO COM O LEGO MINDSTORMS Centro de Engenharia, Modelagem e Ciências Sociais Aplicadas

Bluetooth control using Lego Mindstorms for Educational Engineering The Agenda:

     

Wireless technology overview Bluetooth protocol LabVIEW Lego Mindstorms NXT Project implementation Project planning

1

Wireless Technology

Frequency- hopping

Frequency- hopping

Wi-fi Hops about every 0.1 sec Bluetooth is hopping every 625 microseconds and as fast as 3200 hops a second when initially connecting.

Hopping Benefits are: bandwidth can be utilized more efficiently Security level (difficult to intercept)

In order to avoid collisions with other Bluetooth transmitters in the same area, Bluetooth uses pseudo-random generation algorithm to identify the frequency hopping pattern between two devices. The hopping pattern is based on the Bluetooth Device Address information, a unique identifier that is assigned to every Bluetooth transmitter.

OSI reference model and Wireless

The Physical layer of the OSI model is a physical infrastructure of the network.

the Data Link Layer receives information on its software side from higher layers, places this information inside of "frames", and finally gives this frame to the Physical Layer, for transmission.

The data link layer of the 802 protocols is split into: Medium Access Control sub-layer which determines who gets to transmit next LLC (Logical Link Control) sub-layer, hiding the differences between the different 802 variants and make them indistinguishable for the network layer.

Bluetooth Protocol

Bluetooth Physical Layer (RF)

• Utilizes the license free 2.4GHz

ISM radio band • Pseudo-random frequency hopping scheme with 1600 frequency hops per second (FHSS) 79 carriers (f=2402+k MHz, k=0,…,78) Power classes : • Performing Gaussian Frequency Shift Keying modulation – I : max output power : 100mW (20dBm) => 100m – II : max output power : 2.5mW (4dBm) => 20m – III : max output power : 1mW(0dBm) => 10m

Bluetooth Protocol

Baseband Layer

• Enables RF to form a piconet (physical channel shared among several devices) • Up to 7 slaves can be connected to 1 master • Provides 2 different kind of physical links, with their corresponding packets – Synchronous Connection-Oriented (SCO) – Asynchronous Connection-Oriented (ACL) • Responsible for assembling the Bluetooth packet header information, and for applying error checking and data whitening Baseband: The Baseband and Link Control Layer enables the RF link Bluetooth units in a piconet. This layer uses inquiry and paging procedures to synchronize the transmission between different Bluetooth devices.

Bluetooth Protocol

Link Manager Protocol (LMP)

• Responsible for link set-up between devices, including security functions : – Authentication – Encryption • Controls and negotiates baseband packet size • Controls power modes and connection states Link Manager Protocol (LMP): The link manager protocol is responsible for setting up link channels between Bluetooth devices after performing security methods like authentication and encryption by generating, exchanging and verifying linking and encryption keys and negotiating baseband packet size.

Bluetooth Protocol

Logical Link Control and Adaptation Protocol (L2CAP)

Its role is to adapt upper protocols over the Baseband : – Multiplexing capability – Segmentation and reassembly operations Permits to transmit and receive upper layer data packets up to 64kB in length Also permits per-channel flow control and retransmission In standard Bluetooth hardware, the lower three layers are implemented in firmware or in hardware, and are generally not accessible to Bluetooth developers. Instead, Bluetooth developers interact with the host controller layer (HCI) which resides at a boundary between the host operating system (such as Windows or Linux) and the Bluetooth hardware. Above the HCI layer is the Logical link Control and Adaptation Protocol (L2CAP) is an abstraction layer above the HCI and LMP layers, handling application functionality for upper-layer protocols.

Bluetooth Protocol

SDP - Service Discovery Protocol: Using SDP, device information, services allowed and characteristics of the services are queried between Bluetooth enabled devices.

RFCOMM Cable Replacement Protocol: RFCOMM is a serial line emulation protocol.

TCS Binary, AT Commands are used to establish speech and data calls between devices and control mobile phones and modems respectively (Telephony Control Protocol).

Adopted Protocols: Bluetooth also supports PPP, TCP/UDP/IP, OBEX and WAP protocols to maximize interoperability.

Bluetooth Protocol

In order to accommodate the relatively low cost of a Bluetooth radio, the Bluetooth protocol stack is designed in a layered approach. The layered approach allows different portions of the protocol stack to be designed independently and tightly integrated into hardware, which is important for lightweight devices such as headsets that have limited memory availability. In this project, three lower layers can be attributed to Bluetooth USB dongle, while above it are host controller and adaptation protocols, which realized with Lego Fantom driver. Upper protocols are provided by operating system.

LabVIEW

Visual Programming: • Utilizes human visual system 􀂄 Should be more “natural” •Avoid syntax •People were already using graphical notations 􀂄 Flowcharts and Data flow, State-Transition Diagrams, Wiring Diagrams • Use these directly

LabVIEW example

This VI continuously generates two signals: a pure sine wave of variable frequency and amplitude and a white noise signal of a variable amplitude The noise is then added to the sine wave The sine wave with and without the noise are then shown in a time domain graph.

Additionally an FFT is calculated for both signals and the results are then shown in the frequency domain graph. Note that the square shaped functions are subroutines in the form of sub-VI’s

LabVIEW

LabVIEW advantages • Compiled language • Intuitive interface • Easy to learn • Widely used in industry for R&D and production automation • Build executables • Run VI’s as web site • In-built math functions and examples • Community of users and shareware resources

• • • •

Lego Mindstorms NXT

The LEGO Mindstorms® is a robotic building system consisting of: The NXT Intelligent Brick: the brain of the system Sensors and servo motors LEGO TECHNIC Elements Programming software

Lego Mindstorms NXT

iRobot Create, Roomba http://www.irobot.com/ 2 bump sensors Odometer IR wall sensor on right side Virtual wall infrared sensor Remote control infrared sensor Vacuum and motor control Serial interface RoombaDevTools Bluetooth Interface ($100)…

Lego Mindstorms NXT

Scribbler www.scribblerrobot.com

Sensors IR “ranger”; 2 receivers and emitter Stall sensor 3 light 2 “line” (IR pairs) 2 DC motors Programmed in PBasic Serial communication (up to 38400 baud) SD202 Bluetooth adapter ($100) Serial emulation Class 1

Lego Mindstorms NXT

Mindstorms in Engineering Educational Community MIT Media Lab http://www.media.mit.edu/ http://www.roboteducation.org/ http://www.ni.com/academic/mindstorm s/ http://www.engr.utexas.edu/dteach/ http://www.mindstorms.rwth-aachen.de/

Project Implementation

The system: PC with USB Bluetooth adapter, running control LabVIEW software and an NXT sensor equipped robotic vehicle

Project Implementation

LabVIEW control code

Project Implementation

LabVIEW Front Panel

Project Implementation

LabVIEW independent mode sequence, monitoring the events of two sensors until new pairing passkey from master arrives to Bluetooth mailbox.

Ultrasonic sensor event A Touch sensor event

Project Planning

Why project management?

By having good project management, we can Achieve the project goal on time and within the budget Keep the focus on the goal and work well Have a good practice for future work situations Present the project materials by acceptable engineering standards

Project Planning

The process of project development is full of uncertainties The more uncertainties you have, the less possible that the project can be successful Uncertainties can be reduced by having a good feasibility study before the project Background research Understand the resource required and acquired Risk analysis

Project Planning

Project Initiation document

• The purpose is to identify and document the exact requirements for the project • Much interaction must take place between the customer (e.g. advisor) and the developer (student) • Should be well documented since very often it serves as an agreement of the functions that will be provided by the system developed • The document is sometimes called user specifications or functional specifications.

• May form the basis for project commissioning

Project Planning

System design and specification

Split into two sub-phases: architectural and detailed design • Architectural design Define the overall organization of the system in terms of high-level components and their interaction • Detailed design Lower level modules in each component and their interfaces The document is sometimes called technical specifications

Project Planning

Implementation – Work breakdown – MS Project

• Split project into tasks and estimate time and resources required to complete each task • Minimize task dependencies to avoid delays caused by one task waiting for another to complete, considering the fact that concurrent organization of the tasks is limited since all the work is done by one student