discovery lab school of computing & information system florida international university
TRANSCRIPT
![Page 1: Discovery Lab School of Computing & Information System Florida International University](https://reader036.vdocuments.site/reader036/viewer/2022081603/56649d8b5503460f94a722ec/html5/thumbnails/1.jpg)
Computer Science for
High School
Discovery LabSchool of Computing & Information System
Florida International University
![Page 2: Discovery Lab School of Computing & Information System Florida International University](https://reader036.vdocuments.site/reader036/viewer/2022081603/56649d8b5503460f94a722ec/html5/thumbnails/2.jpg)
Second Day Schedule» First Day Lecture Review» Introduction to Embedded Systems» Digital I/O» Serial Communication» Lunch» Discovery Lab Tour» Analog I/O» Practice » Q&A
![Page 3: Discovery Lab School of Computing & Information System Florida International University](https://reader036.vdocuments.site/reader036/viewer/2022081603/56649d8b5503460f94a722ec/html5/thumbnails/3.jpg)
First Day Lecture Review» Raspberry Pi
» Python
![Page 4: Discovery Lab School of Computing & Information System Florida International University](https://reader036.vdocuments.site/reader036/viewer/2022081603/56649d8b5503460f94a722ec/html5/thumbnails/4.jpg)
Introduction to Embedded Systems
» An embedded system is a computer system with a dedicated function
» Embedded systems control many devices in common use today
» Processing Cores ˃ microcontrollers or digital signal processors (DSP)˃ ATMega, PIC, ARM, etc.
![Page 5: Discovery Lab School of Computing & Information System Florida International University](https://reader036.vdocuments.site/reader036/viewer/2022081603/56649d8b5503460f94a722ec/html5/thumbnails/5.jpg)
Variety of embedded systems
» Consumer electronics
» Automobiles,
» Transportation systems
» Medical equipment
» Wireless sensor networking
» Home Automation
![Page 6: Discovery Lab School of Computing & Information System Florida International University](https://reader036.vdocuments.site/reader036/viewer/2022081603/56649d8b5503460f94a722ec/html5/thumbnails/6.jpg)
Arduino & mBed FRDM» Better Performance
» More GPIOs
» Accelerometer and Capacitive Slider Sensor
» One RGB LED
» Open SDA (Open-standard Serial and Debug Adapter)
![Page 7: Discovery Lab School of Computing & Information System Florida International University](https://reader036.vdocuments.site/reader036/viewer/2022081603/56649d8b5503460f94a722ec/html5/thumbnails/7.jpg)
FRDM Architecture
![Page 8: Discovery Lab School of Computing & Information System Florida International University](https://reader036.vdocuments.site/reader036/viewer/2022081603/56649d8b5503460f94a722ec/html5/thumbnails/8.jpg)
FRDM Pin-out
![Page 9: Discovery Lab School of Computing & Information System Florida International University](https://reader036.vdocuments.site/reader036/viewer/2022081603/56649d8b5503460f94a722ec/html5/thumbnails/9.jpg)
mBed FRDM board Development Set up
» Login ID : team00» Password : pw00team
» Plugin FRDM Board to USB port on PC
» https://mbed.org/handbook/Windows-serial-configuration
» http://mbed.org/handbook/mbed-FRDM-KL25Z-Getting-Started
» http://mbed.org/handbook/mbed-FRDM-KL25Z-Examples
![Page 10: Discovery Lab School of Computing & Information System Florida International University](https://reader036.vdocuments.site/reader036/viewer/2022081603/56649d8b5503460f94a722ec/html5/thumbnails/10.jpg)
» #include "mbed.h"
» DigitalOut myled(LED1);
» int main() {» while(1) {» myled = 1;» wait(0.2);» myled = 0;» wait(0.2);» }» }
Digital Out
* Try to change wait time
![Page 11: Discovery Lab School of Computing & Information System Florida International University](https://reader036.vdocuments.site/reader036/viewer/2022081603/56649d8b5503460f94a722ec/html5/thumbnails/11.jpg)
» The most common function of a diode is to allow an electric current to pass in one direction, while blocking current in the opposite direction˃ Protect circuits from high voltage surges
- Avalanche diodes˃ Regulate voltage - Zener diodes
˃ Electronically tune radio and TV receivers - Varicap diodes
˃ Generate radio frequency oscillations - Tunnel diodes, Gunn diodes, IMPATT diodes
˃ Convert light into either current or voltage - Photodiode
˃ Produce light - Light Emitting Diodes (LED)
Diode
![Page 12: Discovery Lab School of Computing & Information System Florida International University](https://reader036.vdocuments.site/reader036/viewer/2022081603/56649d8b5503460f94a722ec/html5/thumbnails/12.jpg)
LED (Light Emitting Diode)
![Page 13: Discovery Lab School of Computing & Information System Florida International University](https://reader036.vdocuments.site/reader036/viewer/2022081603/56649d8b5503460f94a722ec/html5/thumbnails/13.jpg)
Bread Board Set up
Bus(power line)
Vertically 5 pin
Connected
Vertically 5 pin
Connected
![Page 14: Discovery Lab School of Computing & Information System Florida International University](https://reader036.vdocuments.site/reader036/viewer/2022081603/56649d8b5503460f94a722ec/html5/thumbnails/14.jpg)
Bread Board Set up» Busser
˃ Pin (-) (e , 1)˃ Pin (+) (f , 6)
![Page 15: Discovery Lab School of Computing & Information System Florida International University](https://reader036.vdocuments.site/reader036/viewer/2022081603/56649d8b5503460f94a722ec/html5/thumbnails/15.jpg)
Bread Board Set up» Ground & Power line Connection
Dual Motor Driver
Voltage Regulator
LED
![Page 16: Discovery Lab School of Computing & Information System Florida International University](https://reader036.vdocuments.site/reader036/viewer/2022081603/56649d8b5503460f94a722ec/html5/thumbnails/16.jpg)
Bread Board Set up» Power Connection between Bread Board and FRDM
Power & Ground
![Page 17: Discovery Lab School of Computing & Information System Florida International University](https://reader036.vdocuments.site/reader036/viewer/2022081603/56649d8b5503460f94a722ec/html5/thumbnails/17.jpg)
Bread Board Set up» Power Connection between Bread Board and FRDM
Power & Ground
![Page 18: Discovery Lab School of Computing & Information System Florida International University](https://reader036.vdocuments.site/reader036/viewer/2022081603/56649d8b5503460f94a722ec/html5/thumbnails/18.jpg)
Bread Board Set up» Connect 4 LEDs
» White PTC5» Green PTC6» Yellow PTC10» Red PTC16
![Page 19: Discovery Lab School of Computing & Information System Florida International University](https://reader036.vdocuments.site/reader036/viewer/2022081603/56649d8b5503460f94a722ec/html5/thumbnails/19.jpg)
» Make LEDs blink with below patterns
» Make a led-control program which can control 4 leds with different blinking time˃ Using if else˃ Using switch case
Try to make patterns W R YG
![Page 20: Discovery Lab School of Computing & Information System Florida International University](https://reader036.vdocuments.site/reader036/viewer/2022081603/56649d8b5503460f94a722ec/html5/thumbnails/20.jpg)
Serial Communcation » #include "mbed.h"» » Serial pc(USBTX, USBRX); // tx, rx» PwmOut led(LED1);» » float brightness = 0.0;» » int main() {» pc.printf("Press 'u' to turn LED1 brightness up, 'd' to turn it down\n");» » while(1) {» char c = pc.getc();» if((c == 'u') && (brightness < 0.5)) {» brightness += 0.01;» led = brightness;» }» if((c == 'd') && (brightness > 0.0)) {» brightness -= 0.01;» led = brightness;» } » » }» }
Connect to your mbed Microcontroller with a Terminal program and uses the 'u' and 'd' keys to make LED1 brighter or dimmer
![Page 21: Discovery Lab School of Computing & Information System Florida International University](https://reader036.vdocuments.site/reader036/viewer/2022081603/56649d8b5503460f94a722ec/html5/thumbnails/21.jpg)
» What is it?˃ Controlling power to inertial electrical devices˃ Average voltage and current controlled by turning switch
» What for?˃ Modern electronic power switches˃ The main advantage of PWM is that power loss in the switching
devices is very low˃ Relatively low cost
Pulse-width Modulation
![Page 22: Discovery Lab School of Computing & Information System Florida International University](https://reader036.vdocuments.site/reader036/viewer/2022081603/56649d8b5503460f94a722ec/html5/thumbnails/22.jpg)
» Applications˃ Fans
˃ Pumps
˃ Robotic Servo
˃ Stepper Motor
˃ Telecommunication
Pulse-width Modulation
![Page 23: Discovery Lab School of Computing & Information System Florida International University](https://reader036.vdocuments.site/reader036/viewer/2022081603/56649d8b5503460f94a722ec/html5/thumbnails/23.jpg)
Pulse Width Modulation#include "mbed.h"
PwmOut led(LED1); int main() { while(1) { for(float p = 0.0f; p < 1.0f; p += 0.1f) { led = p; wait(0.1); } } }
![Page 24: Discovery Lab School of Computing & Information System Florida International University](https://reader036.vdocuments.site/reader036/viewer/2022081603/56649d8b5503460f94a722ec/html5/thumbnails/24.jpg)
Let’s Make a Ticker#include "mbed.h"
PwmOut led(LED1); int main() { while(1) { for(float p = 0.0f; p < 1.0f; p += 0.1f) { led = p; wait(0.1); } } }
![Page 25: Discovery Lab School of Computing & Information System Florida International University](https://reader036.vdocuments.site/reader036/viewer/2022081603/56649d8b5503460f94a722ec/html5/thumbnails/25.jpg)
Let’s Make a Ticker#include "mbed.h"
PwmOut led(LED1); int main() { while(1) { for(float p = 0.0f; p < 1.0f; p += 0.1f) { led = p; wait(0.1); } } }
* Try to connect Buzzer and change delay
![Page 26: Discovery Lab School of Computing & Information System Florida International University](https://reader036.vdocuments.site/reader036/viewer/2022081603/56649d8b5503460f94a722ec/html5/thumbnails/26.jpg)
Analog In#include "mbed.h" AnalogIn ain(p19);DigitalOut led(LED1);
int main() { while (1){ if(ain > 0.3) { led = 1; } else { led = 0; } } }
* Try to connect Buzzer and change delay
![Page 27: Discovery Lab School of Computing & Information System Florida International University](https://reader036.vdocuments.site/reader036/viewer/2022081603/56649d8b5503460f94a722ec/html5/thumbnails/27.jpg)
Analog Out#include "mbed.h" AnalogOut signal(p18); int main() { while(1) { for(float i=0.0; i<1.0; i+=0.1) { signal = i; wait(0.0001); } }}
* Try to connect Buzzer and change delay
![Page 28: Discovery Lab School of Computing & Information System Florida International University](https://reader036.vdocuments.site/reader036/viewer/2022081603/56649d8b5503460f94a722ec/html5/thumbnails/28.jpg)
Import Open Library
![Page 29: Discovery Lab School of Computing & Information System Florida International University](https://reader036.vdocuments.site/reader036/viewer/2022081603/56649d8b5503460f94a722ec/html5/thumbnails/29.jpg)
Motor Driver» Dual-H-bridge motor driver: can drive two DC motors» Motor supply voltage: 2–11 V» Logic supply voltage: 2–7 V» Output current: 1.2 A continuous (1.5 A peak) per motor» One PWM and One DigitalOut per DC motor» Logic High for Enabling This Driver
![Page 30: Discovery Lab School of Computing & Information System Florida International University](https://reader036.vdocuments.site/reader036/viewer/2022081603/56649d8b5503460f94a722ec/html5/thumbnails/30.jpg)
Motor Driver
![Page 31: Discovery Lab School of Computing & Information System Florida International University](https://reader036.vdocuments.site/reader036/viewer/2022081603/56649d8b5503460f94a722ec/html5/thumbnails/31.jpg)
Step-Up/Down Voltage Regulator» Input voltage: 2.7 V to 11.8 V» Fixed 5 V output with +5/-3% accuracy» Typical continuous output current: 500 mA to 1 A» The SHDN pin can be driven low (under 0.4 V) to power
down the regulator .
![Page 32: Discovery Lab School of Computing & Information System Florida International University](https://reader036.vdocuments.site/reader036/viewer/2022081603/56649d8b5503460f94a722ec/html5/thumbnails/32.jpg)
Q & A