RPi 2/3, I2C, Analog Sensor jyheo0@gmail.com.

Slides:



Advertisements
Similar presentations
EMS1EP Lecture 8 Pulse Width Modulation (PWM)
Advertisements

ELECTRONIC SYSTEMS NESI NanoRacks Embedded System Integration Board HARDWARE Functional Design.
EXTERNAL COMMUNICATIONS DESIGNING AN EXTERNAL 3 BYTE INTERFACE Mark Neil - Microprocessor Course 1 External Memory & I/O.
SPI Serial Peripheral Interface. SPI Serial Peripheral Interface is communication between two devices, one bit at a time sequential one bit at time over.
ELECTRICAL. Circuits Outline Power Hub Microcontroller Sensor Inputs Motor Driver.
Introduction of Holtek HT-46 series MCU
Serial Communication Buses: I 2 C and SPI By Brody Dunn.
Travis Reed Todd Hummel Kwan-Truc. Concept USB 1.1 SPI b.
Technion-Israel Institute of Technology Electrical Engineering Department High Speed Digital Systems Laboratory Project subject: wireless biofeedback system.
7/10/2007 AIIT Summer Course - D# 1 Wireless Embedded Systems and Networking Lab Day 2: Part 1: Add your own external sensors Lab Assistant: Jaein Jeong.
HT46 A/D Type MCU Series Data Memory (Byte) Program Memory HT46R22 (OTP) HT46C22 (Mask) 2Kx Kx16 4Kx HT46R23 (OTP) HT46C23 (Mask) HT46R24.
Embedded Programming and Robotics
Digital I/O Connecting to the Outside World
ASPPRATECH.
Technion-Israel Institute of Technology Electrical Engineering Department High Speed Digital Systems Laboratory Project subject: wireless biofeedback system.
Team Members Jordan Bennett Kyle Schultz Min Jae Lee Kevin Yeh.
Project: sun tracker Idea: –Use two photodiodes to detect where the sun is –Control a motor to turn toward the sun –When sun is “half-way” between PD,
Image of Arduino. Arduino discussion Address issues with circuit walk-through – Electricity, Programming, Arduino Concepts Work on BeatTable (next week)
Baseboard Aavikkomursu 7.2. Aavikkomursu Micro- controller Extension port for programming microcontroller and sensor input Resistor RS485 interface chip.
Dean Brock, Rebecca Bruce and Susan Reiser, CCSC SE 2009 Using Arduino Material taken from Todbot blog Bionic Arduino Todbot blog Bionic ArduinoTodbot.
LSU 06/04/2007Expanding the BASIC Stamp1 Expanding the BASIC Stamp: Useful peripherals Programming Unit, Lecture 6.
Ballooning Bundle. What is a Microcontroller? Small computer with a processor core, memory and programmable input/output Continuously repeats software.
Basic Stamp Free Pins These pins can be used by the operator for digital Inputs and Outputs Used Pins 0.
Lecture 20: Communications Lecturers: Professor John Devlin Mr Robert Ross.
DEVICES AND COMMUNICATION BUSES FOR DEVICES NETWORK
Robotics Research Laboratory Louisiana State University.
ECE/CS-352: Embedded Microcontroller Systems The Silicon Laboratories C8051F020 Enhanced 8051 Part 4 Timer3, Temperature Sensor, AD0WINT.
Suleyman Demirel University CSS340 Microprocessor Systems – Lecture 2 ATMEGA328P ARCHITECTURE ANALOG INPUTS.
2010/2011 Lab Project. Lab Project Consist of Two Parts Demo Viva Total Marks Final Exam: 50% Test (2x) : 20% Lab Report: 10% Lab Test: 10% Lab Project:
©2008 R. Gupta, UCSD COSMOS Summer 2008 Peripheral Interfaces Rajesh K. Gupta Computer Science and Engineering University of California, San Diego.
INTERNET OF EVERYTHING SDU 2016 Week 4. Simple Digital and Analog Inputs  The Arduino’s ability to sense digital and analog inputs allows it to respond.
ECE 102 Engineering Computation Chapter 11 LabJack Photo Resistor & Mechanical Switch Interface Dr. Herbert G. Mayer, PSU Status 9/2/2015 For use at CCUT.
AAPT workshop W03 July 26, 2014 Saint Cloud State University, MN, USA
1. PIC ADC  PIC18F877 has 8 analog input channels i.e. port A pins(RA0 to RA5) and port E pins(RE1 and RE2). These pins are used as Analog input pins.
MICROCONTROLLER AND INTERFACING Presented by: Shefali Jethva ( ) Shivali Panchal ( ) Komal Soni ( ) Roll no. :- 14EC308.
Zilogic Systems 1 Device Interfacing with Python and ZIO Zilogic Systems.
Zilogic Systems 1 Device Interfacing with Python and ZIO Zilogic Systems.
USING TV REMOTE AS A CORDLESS MOUSE FOR THE COMPUTER
CORDLESS MOUSE FEATURES BY TV REMOTE USING PIC MICROCONTROLLER
Assist. Prof. Rassim Suliyev - SDU 2017
Prototyping with Microcontrollers and Sensors
Outline Analog to digital conversion (ADC) of NuMaker TRIO
Environment Temperature Monitor
Serial Communication Buses: I2C and SPI
Embedded Software Development with Python and the Raspberry Pi
Device Interfacing with Python and ZIO
Microcontroller basics
Serial Communication Protocols And Embedded IoT
Chapter 11: Inter-Integrated Circuit (I2C) Interface
Liquid Crystal Display Arduino
Interfacing of LCD with µP
ECB4042 ISDP Semester I SENSORS and interfacing
ADC, DAC, and Sensor Interfacing
Communication Lines Fundamentals.
How to avoid catching things on fire.
ARDUINO     What is an Arduino? Features 14 Digital I/O pins 6 Analogue inputs 6 PWM pins USB serial 16MHz Clock speed 32KB Flash memory 2KB SRAM.
Introduction to Microprocessors and Microcontrollers
Internet-of-Things (IoT)
Internet-of-Things (IoT)
University of Illinois, at Urbana-Champaign
Displays and I2C(IIC) communications
Digital Theremin with LED
PIC18F458 Analog-to-Digital
Arduino Board.
Преглед Начин функционисања Имплементације
Presentation of Robotics (3)
Passive Infrared Sensor
Maker Education Manipulator
I/O Experiments Assignment 1.
Robot and Crickit HAT © Copyright 2019 by Dr. Elizabeth I. Horvath and Dr. Eva A. Horvath 1.
Presentation transcript:

RPi 2/3, I2C, Analog Sensor jyheo0@gmail.com

I2C (I-squared-C) Serial computer bus invented by Philips Semiconductor Typically used for attaching lower-speed peripheral ICs to processors and microcontrollers A sample schematic with one master (a microcontroller), three slave nodes (an ADC, a DAC, and a microcontroller), and pull-up resistors Rp https://en.wikipedia.org/wiki/I%C2%B2C

ADC, DAC ADC - Analog to Digital Converter DAC - Digital to Analog Converter PCF8591t 3 ADC, 1 DAC value range: 0~255 YL-40 board with PCF8591t AOUT AIN0 AIN1 AIN2 AIN3 P4 P5 P6 Jumper P4 for AIN1: R6 thermister Jumper P5 to AIN0: R7 photocell Jumper P6 to AIN3: The single turn 10K ohm resistance Removing a jumper allows an input channel to be fed from one of the external pins, labelled accordingly. SCL SDA GND VCC

Enable I2C in RPi Enable I2C in raspi-config $ sudo raspi-config Interfacing Options 선택 > I2C 선택

Enable I2C in RPi Check if the I2C kernel module is loaded Test $ lsmod i2c-dev, i2c-bcm???? must be listed! Test $ i2cdetect -y 1

Wiring RPi and YL-40 YL-40 RPi SCL SCL1 SDA SDA1 GND VCC 3V3

Photocell on YL-40 $ python3 yl40.py 0 import smbus import time import sys bus = smbus.SMBus(1) address = 0x48 if len(sys.argv) == 2: i = int(sys.argv[1]) input_addr = 0x40 + i else: input_addr = 0x40 while True: bus.write_byte(address, input_addr) bus.read_byte(address) aread = bus.read_byte(address) print(aread) time.sleep(0.2) Photocell on YL-40 $ python3 yl40.py 0 # AIN0 0x40: photocell # AIN1 0x41: thermister # AIN3 0x43: registance https://github.com/jyheo/rpi2/blob/master/yl40.py

Temperature Sensor - LM35 Wiring LM35 1 to RPi 3V3 OUT to YL-40 AIN2 GND to RPi GND $ python3 yl40.py 2 https://github.com/jyheo/rpi2/blob/master/yl40.py

Vibration Sensor Wiring $ python3 yl40.py 2 One leg of Vibration Sensor to RPi 3V3 The other leg to YL-40 AIN2 $ python3 yl40.py 2 https://github.com/jyheo/rpi2/blob/master/yl40.py

IR Receiver Wiring $ python3 yl40.py 2 Longer leg of IR Sensor to RPi 3V3 The other leg to YL-40 AIN2 $ python3 yl40.py 2 IR Receiver can be used to detect motion https://github.com/jyheo/rpi2/blob/master/yl40.py

Analog OUT $ python3 yl40w.py 255 $ python3 yl40w.py 0 Turn on green LED of YL-40 $ python3 yl40w.py 0 Turn off the LED import smbus import time import sys bus = smbus.SMBus(1) address = 0x48 if len(sys.argv) == 2: v = int(sys.argv[1]) bus.write_byte_data(address, 0x40, v) else: print(‘sudo python yl40w.py 0~255’) https://github.com/jyheo/rpi2/blob/master/yl40w.py

Exercise Write a python program Motion detection LED To display temperature and light Motion detection LED Detect motion using IR receiver Once detecting motion, keep turning LED on for 3 seconds