Introduction To Arduino And Raspberry Pi

1y ago
7 Views
2 Downloads
4.45 MB
37 Pages
Last View : 1m ago
Last Download : 3m ago
Upload by : Cade Thielen
Transcription

Introduction to Arduino andRaspberry PiPresented by SEAS Computing FacilityMarch 24, 2018

Components

Jumper CablesMaleFemale

BreadboardDiagram fromTweaking4All

Push Button All four pins are connected when pressed on If off, the left and right are separated

Light Emitting Diode A diode is a component that only allowsflow of current in one direction A light emitting diode (LED) emits lightwhen current passes in the correctdirection

Circuit Basics Ohm’s Law: V IR V: Voltage (volts)I: Current (amperes)R: Resistance (ohms)LEDs have a maximum currentOhm’s Law (rewritten): I V / R To keep current (I) low, resistance (R) mustbe high enough

Raspberry Pi

What is a Raspberry Pi? Single-board computerDeveloped in the UKSeveral modelsInexpensive ( 5 for cheapest model, the Raspberry Pi Zero)Can be used with a computer monitor, keyboard, and mouse

What is Raspbian? Operating system optimized for the Raspberry PiBased on the Linux kernelCan be used like a desktop computer or through the terminal

Raspberry Pi 3 Model B

Connecting to the Internet Wired Connection: The SEASCF Raspberry Pis can instantly connect to theGW network from the SEH Studio Labs using an ethernet cable. This is theeasiest and fastest option.GWireless: Raspberry Pis cannot connect to GWireless.eduroam: Raspberry Pis can be connected to eduroam by modifying twoconfiguration files and running commands. Instructions: seascf.seas.gwu.edu/eduroam-connection It may be necessary to run /etc/init.d/networking stop before running/etc/init.d/networking start

Creating a Basic Python Program1. Open Terminal2. Type nano helloworld.py and press ENTER to open a new file in the nanotext editor3. Type print(“Hello, World!”)4. Use CTRL O and ENTER to save5. Exit with CTRL X6. Type python helloworld.py and press ENTER to run the program7. Hello, World! should appear

Connecting to a Breadboard

Connecting to a Breadboard

Connecting to a Breadboard

Building the LED Circuit Two jumper cablesLED220 Ω resistor

Building the LED Circuit Add a resistor to the breadboardConnect a wire from the redpower rail to one end of aresistor

Building the LED Circuit Connect the anode (long end) ofthe LED to the resistor

Building the LED Circuit Connect a wire from the cathode(short end) of the LED to the blueground rail of the breadboardThe LED should glow!

Blinking an LED1. Connect the cable from the resistor topin 21 of the breakout board2. Open Terminal3. Type nano blinky.py and pressENTER to open a new file in the nanotext editor4. Type the code5. Use CTRL O and ENTER to save6. Exit with CTRL X7. Type python helloworld.py andpress ENTER to run the programCode:import RPi.GPIO as GPIOimport timeGPIO.setmode(GPIO.BCM)GPIO.setup(21, GPIO.OUT)for i in range(0,100):GPIO.output(21, i % 2)time.sleep(0.25)GPIO.cleanup(21)

Arduino

What is an Arduino? Single-board microcontrollerOriginated in ItalyMany variations from different makersCannot be directly connected to a monitor, keyboard, mouse, etc.Does not normally have an operating system

Arduino Uno

Running a Basic Arduino Program1. Open the Arduino Desktop IDE (install required)a.2.3.4.5.6.7.There is also an Arduino Web IDE (account required)Connect the Arduino to the computer using a USB cableOpen example sketch from File Examples 01.Basics BlinkSelect the board type from Tools BoardSelect the port with the Arduino from Tools PortClick the upload buttonThe built-in LED near pin 13 should start to blinkPrograms will stay on the Arduino until overridden by another program.Programs start whenever the Arduino is powered on or reset.

Running a Basic Arduino ProgramCode:// the setup function runs once when you press reset or power the boardvoid setup() {// initialize digital pin LED BUILTIN as an output.pinMode(LED BUILTIN, OUTPUT);}// the loop function runs over and over again forevervoid loop() {digitalWrite(LED BUILTIN, HIGH);// turn the LED on (HIGH is the voltage level)delay(1000);// wait for a seconddigitalWrite(LED BUILTIN, LOW);// turn the LED off by making the voltage LOWdelay(1000);// wait for a second}

Useful Arduino Functions pinMode(pin, mode) - Sets the pin to be INPUT or OUTPUTdigitalRead(pin) - Returns HIGH or LOW depending on the voltage of thespecified pinanalogRead(pin) - Returns a value from 0 to 1023 representing the voltageof the specified pin between 0 and 5 VanalogWrite(pin, value) - Writes a value between 0 and 255 to the pindigitalWrite(pin, value) - Writes HIGH or LOW to the pinSerial.begin(speed) - Configures the serial output for the specified speed(9600 is typical)Serial.write(val) - Writes a value or string to the Serial monitor

More Components

Raspberry Pi Camera Module V2 1080p HD video at 30 frames/second720p HD video at 60 frames/second8 Megapixels for still photos (3280 x 2464)Fixed Focus LensConnected to Raspberry Pi with 15-pin ribbon dule-Megapixel/dp/B01ER2SKFS

PIR Motion Sensor Detector Module PIR: Passive Infrared Senses infrared radiation from objects Range is adjustable up to 7 meters Viewing area is approximately a 120 rared-Detector-Hc-sr501/dp/B013LA6MW0/ref sr 1 3?ie UTF8&qid 1484274011&sr 8-3&keywords pir sensor

PIR Motion Sensor Detector Module Time Delay Adjust Clockwise increases delaySensitivity Adjust Clockwise decreases rangePins Power: Should be between 5 and 20 V input Ground: Should be connected to ground Output: Will be 3.3 V if activated, 0 if notDiagram from Henry’s Bench

Sense HAT for Raspberry Pi Includes: 8 x 8 RGB LED matrix Five-button joystick Gyroscope Accelerometer Magnetometer Thermometer Barometric pressure HumidityHas been used on the International Space Station

Sense HAT BasicsInstall the Sense HAT package sudo apt-get install sense-hat Ensure that you unplug your Pi Attach your Sense HAT

Setting up the code and sending text to the HAT Create a Python file: nano helloWorld.py Create Sense HAT object:from sense hat import SenseHatsense SenseHat() Have text scroll across the Sense HATsense.show message("Hello world")

Further Information

Raspberry Pi vs. ArduinoRaspberry Pi Allows graphical user interfaceCan be directly connected toInternetMore powerful and more memoryCan be used with moreprogramming languagesArduino Low power consumptionCan directly read analog inputsRequires less hardware (monitor,mouse, etc.) to get startedNo operating system needs to beinstalled

Link to These Slidesseascf.seas.gwu.edu/workshops

Running a Basic Arduino Program 1. Open the Arduino Desktop IDE (install required) a. There is also an Arduino Web IDE (account required) 2. Connect the Arduino to the computer using a USB cable 3. Open example sketch from File Examples 01.Basics Blink 4. Select the board type from Tools Board 5. Select the port with the Arduino from .

Related Documents:

A. Models of Raspberry Pi used in the Experiments For our assessment, we had the following Raspberry Pi SBCs: two Raspberry Pi Zero W, two Raspberry Pi Zero 2 W, two Raspberry Pi 3 Model B, one Raspberry Pi 3 Model B , and one Raspberry Pi 4 Model B (8 GB of RAM). Some of their technical specifications are presented next:

Arduino compatible components. Personal computer running Arduino software Arduino software is free to download and use from: www.arduino.cc Arduino board Such as: Arduino Uno Freetronics Eleven Genuino Uno or any Arduino compatible board that has a standard Arduino UNO header l

Hence we given interesting top five easy to make Arduino projects with code and library link. Happy learning Arduino 1. Heart Rate Monitor AD8232 Interface Arduino 2. Fingerprint sensor-scanner with Arduino 3. Giving Voice Recognition Ability to Arduino 4. Soil Moisture Sensor and Arduino 5. How to Interface RFID with Arduino?

arduino-00 -win.zip Recommended Path c:\Program Files\ ( - version #) Step 3: Shortcut Icon Open c:\program files\arduino-00 Right Click Arduino.exe (send to Desktop (create shortcut)) \ ( - version #) Step 4: Plug In Your Arduino Plug your Arduino in: Using the included USB cable, plug your Arduino board into a free USB port. Wait for a box to .

The Raspberry Pi 2 which added more RAM was released in February 2015. Raspberry Pi 3 Model B released in February 2016, is bundled with on-board WiFi, Bluetooth and USB boot capabilities. As of January 2017, Raspberry Pi 3 Model B is the newest mainline Raspberry Pi. Raspberry Pi boards are priced between US 5-35.

1. Set up the Simulink support package for Raspberry Pi 2. Build a simple Simulink model for controlling pins on the Raspberry Pi 3. Generate, download and run code on the Raspberry Pi to blink an LED This is the first tutorial in a series on using MATLAB and Simulink to program a Raspberry Pi. In this tutorial Raspberry

Raspberry Pi 2B Raspberry Pi 3B Raspberry Pi 3B Raspberry Pi 4B If you have one of above-verified boards, please make sure that you: Follow this guide to setup your Raspberry Pi Check if the operating system on your verified board is ready, and, if not, follow this guide to set up the software on your Raspberry Pi

Alfredo López Austin, Universidad Nacional Autónoma de México (UNAM) 4:15 pm – 5:00 pm Questions and Answers from Today’s Panelists . Friday’s symposium presenters (order of appearance): Kevin B. Terraciano Kevin Terraciano is Professor of History, chair of the Latin American Studies Graduate Program, and interim director of the Latin American Institute. He specializes in Colonial .