What kind of Pie Raspberry Pi RDXA Talk
What kind of Pie?
Raspberry Pi RDXA Talk Mark Hazel (K 2 MTH) (MTHazel 2151@yahoo. com) (K 2 MTHDDNS. net)
The Culprit Raspberry-Pi
What is a Raspberry Pi? A small, inexpensive computer the size of a deck of playing cards Uses your old computer's monitor, keyboard and mouse Intended as an educational tool to teach computer and computing fundamentals Keeps the learner off the family computer
What the heck is a Raspberry Pi ? (The Wiki answer…. ) The Raspberry Pi is a low cost, credit-card sized computer that plugs into a computer monitor or TV, and uses a standard keyboard and mouse. It is a capable little device that enables people of all ages to explore computing, and to learn how to program in languages like Scratch and Python. It’s capable of doing everything you’d expect a desktop computer to do, from browsing the internet and playing high-definition video, to making spreadsheets, word-processing, and playing games. What’s more, the Raspberry Pi has the ability to interact with the outside world, and has been used in a wide array of digital maker projects, from music machines and parent detectors to weather stations and tweeting birdhouses with infra-red cameras. We want to see the Raspberry Pi being used by kids all over the world to learn to program and understand how computers work.
So What does thing do Really? 1. 2. 3. 4. Ok, it’s a neat little Linux Computer It’s really Cheap! Its incredibly flexable I runs under a highly stable OS. (Much more stable than Microsoft. Ugh… 5. Did I mention its cheap?
How much does a Raspberry Pi Cost? About $35. 00 Yes…. $35. 00 But as always there’s always a catch!
You’re gonna need other stuff! The Basics…. And Also…. The catch is the monitor has to be an HDMI compliant Monitor. Sorry, that’s how they built them…. .
But after some initial Configuration… You can run your Pi in “Headless Mode”. Ok, Maybe not that kind of headless. Maybe this kind…. Which just means…. Minimal Connections. No keyboard, Mouse or Monitor attached. Everything runs via Telnet, or VNC
How did all this get started? The story begins with a couple of Engineers and Educators discussing how most students have no idea how a modern computer works. Oh they’ll tell you they know all how to use an “Xbox” or “Nintendo Wii” or some other such thing. But they had absolutely no idea how the inner workings of a modern computer are configured. No idea of the hardware involved or how it was interconnected. (What’s a bus? Ram? Rom, Eprom? Or what the heck is I/O) They had no programming skills, not even any basic electronics skills.
So…. They Went to work! The Raspberry Pi launched in 2012, and there have been several iterations and variations released since then. The original Pi had a single-core 700 MHz CPU and just 256 MB RAM, and the latest model has a quad -core 1. 4 GHz CPU with 1 GB RAM. The main price point for Raspberry Pi has always been $35 and all models have been $35 or less, including the Pi Zero, which costs just $5.
Vorige Les Eenvoudige schakelingen Knipper LED Dimmen (8 segmenten display) Drukknop Analoog signaal meten Raspberry-Pi 13
GPIO: connector P 1 Raspberry-Pi 14
LED en PI Pi: 5 V pin 2 GND pin 6 3, 3 V elke IN/OUT 5 V max 250 m. A 3, 3 V max 50 m. A Advies: 3 -5 m. A Raspberry-Pi 15
GPIO programmeren sudo apt-get install python-dev sudo apt-get install python-rpi. gpio Raspberry-Pi 16
Python program: pinker. py #!/usr/bin/python # Led tss pin 18 en GND # Wim Peeters import RPi. GPIO as GPIO import time GPIO. setwarnings(False) GPIO. setmode(GPIO. BCM) GPIO. setup(18, GPIO. OUT) while (True): GPIO. output(18, True) time. sleep(0. 5) GPIO. output(18, False) time. sleep(0. 5) Raspberry-Pi 17
Drukknop Naar GPIO 1 (3, 3 V) Naar GPIO 23 → pin 16 Naar GND pin 6 Raspberry-Pi 18
Meten van een spanning De PI heeft geen analoog digotaal convertor (ADC) Truuk: – Vervang Spannings meting door tijdsmeting Raspberry-Pi 19
Condensator: C Kan elektrische lading opslagen En vrijgeven. → maar dat duurt een tijd Symbool: Eenheid: Farad (F) Raspberry-Pi 20
Weerstand en Condensator in serie Vin -VR -VC=0 VR = wet van Ohm VR=IR VC =Vin(1 -e-t/RC) Met τ=RC Raspberry-Pi 21
Laden: opgeladen na 5 RC t=RC Raspberry-Pi 22
Ontladen: na 5 RC t=RC Raspberry-Pi 23
Met de PI Opgepast: kortsluiting! Pin 1: 3, 3 V Pin 6: GND GPIO 24 – (pin 18) Raspberry-Pi 24
In onze Website duwen? Raspberry-Pi 25
meet. py: eenmalige meting Raspberry-Pi 26
website-meeting. sh Raspberry-Pi 27
Uitvoeren + redirect naar webserver Raspberry-Pi 28
Vandaag Eenvoudige schakelingen –. . . – Temperatuur meten – Reageren op licht – Servo motor Raspberry-Pi 29
Temperatuur meten NTC-thermistor M 891 Raspberry-Pi 30
NTC: Negatieve Temperatuur Coëfficiënt (weerstand) Weerstand neemt toe met dalende Temperatuur NTC 10 K T = 10 K 25 Raspberry-Pi 31
Exponentieel verband ( ) Lineair benaderen temp = -(temp/20)+66 Raspberry-Pi 32 BENADERENDE RECHTE
Raspberry-Pi 33
Temperatuur Raspberry-Pi 34
Reageren op Licht Fotoweerstand THT Perkin Elmer VT 93 N 2 Raspberry-Pi 35
LDR: hoe meer licht hoe kleiner de weerstand In onze schakeling < 500: veel licht >1000: weining licht Raspberry-Pi 36
Raspberry-Pi 37
Meting: <500 licht, >1000 donker Raspberry-Pi 38
Oefening Als donker: LED aan Als Licht: LED uit Raspberry-Pi 39
Oplossing GPIO. setup(18, GPIO. OUT) # LED op Pin 6, GPIO 18 … zie vorige oefening. . # Hoofdprogramma while (True): licht = RCtime(24) # We meten op GPIO 24 if licht < 500: print("Het is licht, zet de led uit") GPIO. output(18, False) # Led uit else: print("Het is donker, zet de led aan") GPIO. output(18, True) # Led aan Raspberry-Pi 40
Servo motor MC-1811 Technische specificaties Instelkoppel bij 4, 8 V 15 Ncm Lagertype Glijlagers Stekkersysteem JR Servo-technologie Analoge servo Fabrikantnr. MC 1811 Servo-type Micro-servo Raspberry-Pi 41
Breedte van de puls bepaalt positie Raspberry-Pi 42
Aansluiting Voeding: – 5 V: Pin 2 – GND: Pin 6 – Control: pin 22 GPIO 25 Weerstand 1 K Control Raspberry-Pi 43
Via Duty cycle op 100 Hz: 10 ms period Duty=10% geeft pulse 1 ms = hoek 0 Duty=20% geeft pulse 2 ms = hoek 180 Duty=15% geeft pulse 1 ms = hoek 90 Raspberry-Pi 44
Run pi@raspberrypi ~/LES 5 $ sudo. /servo. py Duty moet tussen 10 en 20 liggen, we starten op 15 Duty=10% geeft pulse 1 ms = hoek 0 Duty=20% geeft pulse 2 ms = hoek 180 Duty=15% geeft pulse 1 ms = hoek 90 Duty: 10 Duty: 20 Duty: 15 Duty: 10 Raspberry-Pi 45
#!/usr/bin/python # # pin 1 3, 3 V --> 2 K 2, LDR 48 k, pin 18 (gpio 24) --> GND (pin 6) # pin 2 5 V --> Servo # pin 6 (gpio 18) --> R 470 --> LED --> GND (pin 6) # pin 22 (gpio 25) --> R 1 K --> signal servo # Wim Peeters import RPi. GPIO as GPIO import time GPIO. setwarnings(False) GPIO. setmode(GPIO. BCM) servopin = 25 GPIO. setup(servopin, GPIO. OUT) pwm = GPIO. PWM(servopin, 100) # pin en frequency, geeft 10 ms/periode pwm. start(15) # start op 5% Raspberry-Pi 46 en 20 liggen, we starten op 15" print "Duty moet tussen 10
Oefening: servo sturen met LDR Zelfde hardware … vb output Het is licht, zet de led uit en servo naar links Het is donker, zet de led aan en servo naar rechts Het is licht, zet de led uit en servo naar links Het is donker, zet de led aan en servo naar rechts Raspberry-Pi 47
Oplossing …. zie vorige oefening # Hoofdprogramma while (True): licht = RCtime(24) # We meten op GPIO 24 if licht < 500: print("Het is licht, zet de led uit en servo naar links") GPIO. output(18, False) # Led uit pwm. Change. Duty. Cycle(10) # Beweeg de Servo naar links else: print("Het is donker, zet de led aan en servo naar rechts") GPIO. output(18, True) # Led aan pwm. Change. Duty. Cycle(20) # Beweeg de Servo naar rechts 2 ms puls Raspberry-Pi 48
Raspberry pi als FM zender Star Wars Raspberry-Pi 49
Pifm. tar. gz van icrobotics. ci. uk wget http: //www. icrobotics. co. uk/wiki/images/c/c 3/Pifm. tar. gz pi@raspberrypi ~/LES 5/pifm $ sudo. /pifm sound. wav 103. 2 Raspberry-Pi 50
Pi grafisch Remote: VNC server sudo apt-get tightvncserver sudo tightvncserver Raspberry-Pi 51
Raspberry-Pi 52
Raspberry-Pi 53
sudo apt-get install pistore Raspberry-Pi 54
PI als Mediacenter: Rasp. BMC http: //www. raspberrypi. org/downloads Raspberry-Pi 55
Raspberry-Pi 56
- Slides: 56