CS4101 Introduction to Embedded Systems Lab 11: Sensors

Slides:



Advertisements
Similar presentations
Introduction to LEGO RCX robotics and Robot Sumo
Advertisements

Introduction to LEGO NXT robotics and Robot Sumo
Touchdevelop api api acceleromete r measure acceleration Disclaimer: This document is provided as-is. Information and views expressed in this document,
CS4101 嵌入式系統概論 Program Organization Prof. Chung-Ta King Department of Computer Science National Tsing Hua University, Taiwan ( Materials from MSP430 Microcontroller.
Chung-Ta King National Tsing Hua University
Georgia Department of Education. Information Technology Pathways.
Introduction to Robotics Tutorial 7 Technion, cs department, Introduction to Robotics Winter
Lab 6: Sensor Based Planning Lab TA: Neil Abcouwer Sid Soundararajan.
An ipad is like an a portatil computer, the functions of the ipad are similar of the functions of the iphone or the ipod touch but bigger, with a better.
Session 1.1. Windows Phone Topics Session 1.1 Windows Phone The Windows Phone Device.
EG1003: Introduction to Engineering and Design Sensors.
CS4101 嵌入式系統概論 Freescale Tower System Prof. Chung-Ta King Department of Computer Science National Tsing Hua University, Taiwan ( Materials from
TOUCHLESS TOUCH SCREEN
TouchDevelop Create apps for all your devices
Computer Science Lego Robotics Lab 07 Page 51. CS Lego Robotics Lab 07 (Updated ) Objectives: 1.Extend the Lego robot with three sensors. 2.Program.
Holistic Mobile Game Development with Unity 2015 Taylor & Francis. All rights Reserved.
2009 International Symposium on Ubiquitous Computing System at Beijing, China Hiroaki Kimura, Sota Matsuzawa, and Tatsuo Nakajima Department of Computer.
LAB 8: Program Design Pattern and Software Architecture
3/17/2014 Richard Kuo Assistant Professor
What do all these numbers mean?.  Get your computers!
Multi-modal exploration of rugged digital terrain on mobile devices Antoni Moore, School of Surveying Mariusz Nowostawski, Department of Information Science.
ScanShot : Detecting Document Capture Moments and Correcting Device Orientation Jeungmin Oh, Woohyeok Choi, Joohyun Kim, Uichin Lee (Dept. of Knowledge.
Enhanced Gaming and Pointing Final Project David Dryjanski Andrew Pinkham April 22, 2005.
Scratch pong challenge Pong is a classic 1970s video game  Open the pongv1.sb2 file in Scratch  Click the.
Ambient Light Sensor The ambient light sensor is something that can detect the brightness of the phone screen. This is helpful for if your eyes are hurting.
LAB 13: IO Driver Chung-Ta King National Tsing Hua University CS 4101 Introduction to Embedded Systems.
ICDV, MSR and GPS data description Camille Catalano ICDV data MSR data GPS data.
1.Accelerometer:Accelerometer in an iPhone. Definition: An accelerometer is a sensor which measures the tilting motion and orientation of a mobile phone.
EG1003: Introduction to Engineering and Design Laboratory 4: Sensors.
Department of Electrical Engineering, National Taiwan Ocean University I2C Bus 5/16/2013 Richard Kuo Assistant Professor.
Dept. Computer Science, Korea Univ. Intelligent Information System Lab. 1 In-Jeong Chung Intelligent Information System lab. Department.
Chapter 8 Sensors and Camera. Figure 08.01: The Accelerometer can gauge the orientation of a stationary device.
Lesson 4 Accelerometer.
ROBOTC for CORTEX Teacher Training © 2011 Project Lead The Way, Inc. Automation and Robotics VEX.
Introduction In this lab , we will learn
Outline Introduction to sensors
Recall Our TWR-K60D100M Primary SW1 Connector SW2 SW3(Reset) Secondary
Outline Introduction to NuMaker TRIO Programming environment setup
Lab 7 Basic 1: Game of Memory
Introduction In this lab , we will learn
Introduction In this lab, we will learn
Outline Introduction to digital-to-analog converter (DAC)
CS4101 嵌入式系統概論 General Purpose IO
Outline Analog to digital conversion (ADC) of NuMaker TRIO
CS4101 Introduction to Embedded Systems Lab 10: Tasks and Scheduling
CS4101 Introduction to Embedded Systems Lab 6: Low-Power Optimization
CS4101 Introduction to Embedded Systems Lab 12: Task Synchronization
CS4101 Introduction to Embedded Systems Lab 1: General Purpose IO
CS4101 Introduction to Embedded Systems Lab 13: Task Synchronization
Prof. Chung-Ta King Department of Computer Science
CS4101 Introduction to Embedded Systems Lab 9: NuMaker ADC and LCD
CS4101 嵌入式系統概論 General Purpose IO
National Tsing Hua University CS4101 Introduction to Embedded Systems Lab 2: Timer and Clock Prof. Chung-Ta King Department of Computer Science National.
National Tsing Hua University CS4101 Introduction to Embedded Systems Lab 3: Interrupt Prof. Chung-Ta King Department of Computer Science National Tsing.
National Tsing Hua University CS4101 Introduction to Embedded Systems Lab 6: Serial Communication Prof. Chung-Ta King Department of Computer Science National.
Atom-Based Embedded System Design at CUHK
CS4101 嵌入式系統概論 I/O Drivers Prof. Chung-Ta King
Laboratory 7: Sensors Matthew R. Gaglio, Feb 2007.
Lesson 4 Accelerometer.
CS4101 Introduction to Embedded Systems Lab 8: Arduino DAC and PWM
Patent Liability Analysis
Android Topics Sensors Accelerometer and the Coordinate System
CS150 Introduction to Computer Science 1
Robotics System Lecture 4: Gyro Sensor
Robotics System Lecture 4: Gyro Sensor
CS4101 Introduction to Embedded Systems Lab 2: Basic IO and Timer
Structure diagrams for lab 13
Prof. Chung-Ta King Department of Computer Science
÷ 5 = 29 How many 5s are there in 1? Great!
÷ 2 = 24 How many 2s are there in 4?
Presentation transcript:

CS4101 Introduction to Embedded Systems Lab 11: Sensors Prof. Chung-Ta King Department of Computer Science National Tsing Hua University, Taiwan

Introduction In this lab , we will learn To use accelerometer of NuMarker to detect gestures To use gyroscope of NuMarker to detect tilts

MPU-6050 3-axis accelerometer 3-axis gyroscope

MPU-6050: Accelerometer Two bytes (high and low) to present each axis Read_MPU6050_AccY(void): LowByte =MPU6050_ReadByte(MPU6050_ACCEL_YOUT_L); HighByte =MPU6050_ReadByte(MPU6050_ACCEL_YOUT_H); AccY = (HighByte<<8) | LowByte ;

MPU6050 - Gyroscope Similar to the accelerometer Read_MPU6050_GyroX(void): LowByte = MPU6050_ReadByte(MPU6050_GYRO_XOUT_L); HighByte = MPU6050_ReadByte(MPU6050_GYRO_XOUT_H); GyroX = (HighByte<<8) | LowByte ;

MPU6050.h/.c (Library/NuMakerLib/Include,Source) #define MPU6050_I2C_SLA 0xD0 #define MPU6050_I2C_PORT I2C1 void MPU6050_WriteByte(uint8_t MPU6050_reg, uint8_t MPU6050_data) { uint8_t data[1]; data[0]=MPU6050_data; I2C_writeBytes(MPU6050_I2C_PORT, MPU6050_I2C_SLA, MPU6050_reg, 1, data); } uint8_t MPU6050_ReadByte(uint8_t MPU6050_reg){ I2C_readBytes(MPU6050_I2C_PORT, MPU6050_I2C_SLA, return(data[0]);

smpl_I2C_MPU6050 (SampleCode/NuMaker-TRIO) int32_t main(){ int16_t accX, accY, accZ; int16_t gyroX, gyroY, gyroZ; SYS_Init(); Init_MPU6050(); I2C_Open(I2C1, I2C1_CLOCK_FREQUENCY); while(1) { accX = Read_MPU6050_AccX(); accY = Read_MPU6050_AccY(); accZ = Read_MPU6050_AccZ(); printf("Acc: %6d, %6d, %6d, ", accX,accY,accZ); gyroX = Read_MPU6050_GyroX(); gyroY = Read_MPU6050_GyroY(); gyroZ = Read_MPU6050_GyroZ(); printf("Gyro: %6d, %6d, %6d", gyroX,gyroY,gyroZ); }

Lab: Basic 1 Use your NuMaker to cast lots (搖籤) Shake your NuMarker left and right very hard for preparation. Then, make a sudden up-down move to cast the lots. Print the cast lot on the display, which is a word from “Bad”, “Good”, and “Great”, depending on the intensity of the left-right shake: If the intensity is low, print ‘Bad’. If the intensity is medium, print ‘Good’. If the intensity is high, print ‘Great’.

Lab: Basic 2 Game of ball rolling There is a ball and a destination flag on the display. The player has to control the ball by tilting the device (right, left, up, down) to move close to the flag. If the ball touches the destination flag, the game is won. A new game is then started with the ball and the flag at new random locations. You have to protect the ball from going through the screen boundaries by setting proper conditions. Sample

Lab: Bonus Enhance Basic 2 to add obstacles. You have to make sure that there is at least one path from the starting position of the ball to the destination flag.