尊敬的 微信汇率:1円 ≈ 0.046239 元 支付宝汇率:1円 ≈ 0.04633元 [退出登录]
SlideShare a Scribd company logo
Sri Ramakrishna Institute Of Technology
(An Autonomous Institution)
Introduction to Raspberry Pi
Mr.A.P.Roger Rozario
Assistant Professor (Sr.Gr)
Department of EEE
SRIT
6/14/2024 1
Sri Ramakrishna Institute Of Technology
(An Autonomous Institution)
ON BOARD TEMPERTAURE SENSOR
6/14/2024 RPI PICO – MICRO PYTHON 2
Sri Ramakrishna Institute Of Technology
(An Autonomous Institution)
Temperature Sensor
6/14/2024 RPI PICO – MICRO PYTHON 3
Sri Ramakrishna Institute Of Technology
(An Autonomous Institution)
Temperature Sensor
6/14/2024 RPI PICO – MICRO PYTHON 4
import machine
import utime
sensor_temp = machine.ADC(4)
conversion_factor = 3.3 / (65535)
while True:
reading = sensor_temp.read_u16() * conversion_factor
temperature = 27- (reading 0.706)/0.001721
print(temperature)
utime(2)
Sri Ramakrishna Institute Of Technology
(An Autonomous Institution)
TEMPERATURE LCD I2C
6/14/2024 RPI PICO – MICRO PYTHON 5
from pico_i2c_lcd import i2c Lcd
from machine import i2C,Pin
import time
sensor_temp = machine.ADC(4)
conversion_factor = 3.3 / (65535)
i2c = I2C(id=0, scl=Pin(1), sda=Pin(0),freq=100000)
lcd=I2cLcd (i2c, 0x27, 216)
while True:
reading = sensor_temp.read_u16()*conversion_factor
temperature = 27- (reading 0.706)/0.001721
print(temperature)
lcd.move_to(0,0)
lcd.putstr("Temp: ")
lcd.move_to(6,0)
lcd.putstrstr(str(temperature)+“C")
time.sleep(1)
lcd.clear()
Sri Ramakrishna Institute Of Technology
(An Autonomous Institution)
RGB LED
6/14/2024 RPI PICO – MICRO PYTHON 6
Sri Ramakrishna Institute Of Technology
(An Autonomous Institution)
RGB LED
6/14/2024 RPI PICO – MICRO PYTHON 7
Sri Ramakrishna Institute Of Technology
(An Autonomous Institution)
RGB LED – toggle
6/14/2024 RPI PICO – MICRO PYTHON 8
from machine import Pin
import utime
led_r = Pin(16, Pin.OUT)
led_g = Pin(17, Pin.OUT)
led_b = Pin(15, Pin.OUT)
#Clear Common Anode RGB LED
led_r.value(1)
led_g.value(1)
led_b.value(1)
while True:
led_r.toggle()
utime.sleep(1)
led_r.toggle()
led_g.toggle()
utime.sleep(1)
led_g.toggle()
led_b.toggle()
utime.sleep(1)
led_b.toggle()
utime.sleep(1)
Sri Ramakrishna Institute Of Technology
(An Autonomous Institution)
7 Segment Display
6/14/2024 RPI PICO – MICRO PYTHON 9
Sri Ramakrishna Institute Of Technology
(An Autonomous Institution)
7 Segment Display
6/14/2024 RPI PICO – MICRO PYTHON 10
Sri Ramakrishna Institute Of Technology
(An Autonomous Institution)
7 Segment Display
6/14/2024 RPI PICO – MICRO PYTHON 11
from machine import Pin
import utime
pins = [
Pin(16, Pin.OUT), #middle
Pin(17,Pin.OUT), #top left
Pin(18,Pin.OUT), #top
Pin (19, Pin.OUT), #top right
Pin(13,Pin.OUT),#bottom right
Pin(14, Pin.OUT), #bottom
Pin(15,Pin.OUT), #bottom left:
Pin(12, Pin.OUT) #dot
#common anode 7 segment
chars = [
[1, 0, 0, 0, 0, 0, 0, 0], #0
[1, 1, 1, 0, 0, 1, 1, 1], #1
[0, 1, 0, 0, 1, 0, 0, 0], #2
[0, 1, 0, 0, 0, 0, 1, 0],#3
[0, 0, 1, 0, 0, 1, 1, 0], #4
[0, 0, 0, 1, 0, 0, 1, 0],#5
[0, 0, 0, 1, 0, 0, 0, 0],#6
[1, 1, 0, 0, 0, 1, 1, 1),#7
[0, 0, 0, 0, 0, 0, 0, 0],#8
[0, 0, 0, 0, 0, 0, 1, 1]#9
]
def clear():
for i in pins:
i.value(1)
clear()
while True:
for i in range (len(chars)):
for j in range(len(pins)):
pins[j].value(chars [i][j])
utime sleep(1)
Sri Ramakrishna Institute Of Technology
(An Autonomous Institution)
Ultrasonic Sensor
6/14/2024 RPI PICO – MICRO PYTHON 12
Sri Ramakrishna Institute Of Technology
(An Autonomous Institution)
Ultrasonic Sensor
6/14/2024 RPI PICO – MICRO PYTHON 13
Sri Ramakrishna Institute Of Technology
(An Autonomous Institution)
Ultrasonic Sensor
6/14/2024 RPI PICO – MICRO PYTHON 14
from machine import Pin,Timer
import utime
timer = Timer()
trigger Pin(14, Pin.OUT)
echo = Pin(15, Pin. IN)
led = Pin(16, Pin.OUT)
distance = 0
def get_distance (timer):
global distance
trigger.high()
utime.sleep(0.00001)
trigger.low()
while echo.value() == 0:
start=utime.ticks_us()
while echo.value() ==1:
stop = utime.ticks_us()
duration = stop – start
distance = (duration 0.0343) / 2
print("Distance: ", distance,"cm")
return distance
timer.init(freq=1,mode=Timer.PERIODIC,callback=get_distance)
while True:
if distance < 5:
led.value (1)
else:
led.value(0)
Sri Ramakrishna Institute Of Technology
(An Autonomous Institution)
Infrared Sensor
6/14/2024 RPI PICO – MICRO PYTHON 15
Sri Ramakrishna Institute Of Technology
(An Autonomous Institution)
Infrared Sensor
6/14/2024 RPI PICO – MICRO PYTHON 16
Sri Ramakrishna Institute Of Technology
(An Autonomous Institution)
Infrared Sensor
6/14/2024 RPI PICO – MICRO PYTHON 17
from machine import Pin
import utime
led Pin(16, Pin.OUT)
sensor = Pin (15,Pin.IN)
while True:
print (sensor.value())
if sensor.value()==1:
led.value (0)
else:
led.value (1)
Sri Ramakrishna Institute Of Technology
(An Autonomous Institution)
STEPPER MOTOR
6/14/2024 RPI PICO – MICRO PYTHON 18
Sri Ramakrishna Institute Of Technology
(An Autonomous Institution)
STEPPER MOTOR
6/14/2024 RPI PICO – MICRO PYTHON 19
Sri Ramakrishna Institute Of Technology
(An Autonomous Institution)
STEPPER MOTOR
6/14/2024 RPI PICO – MICRO PYTHON 20
from machine import Pin
import utime
pins = [
Pin (15, Pin.OUT), #IN1
Pin (14, Pin.OUT), #IN2
Pin(16,Pin.OUT), #IN3
Pin (17,Pin.OUT), #IN4
]
full_step_sequence = [
[1,0,0,0],
[0,1,0,0],
[0,0,1,0],
[0,0,0,1]
]
while True:
for step in full_step_sequence:
for i in range (len(pins)):
pins[i].value(step[i])
utime.sleep(0.001)
Sri Ramakrishna Institute Of Technology
(An Autonomous Institution)
DC Motor
6/14/2024 RPI PICO – MICRO PYTHON 21
Sri Ramakrishna Institute Of Technology
(An Autonomous Institution)
DC Motor
6/14/2024 RPI PICO – MICRO PYTHON 22
from machine import Pin
import utime
ini Pin(15, Pin.OUT)
in2 Pin(14, Pin.OUT)
while True:
in1.value(0)
n2.value(0)
utime.sleep(1)
in1.value(0)
in2.value(1)
|
utime.sleep(1)
in1.value(1)
in2.value()
utime.sleep(1)
in1value(1)
in2.value(1)
utime.sleep(1)

More Related Content

Similar to rpi PICO micro python - SENSORS interfacing

Iot car parking system
Iot car parking systemIot car parking system
Iot car parking system
SandeepMaurya88
 
IRJET - Lie Detector using MATLAB, Arduino and Biomedical Sensors
IRJET -  	  Lie Detector using MATLAB, Arduino and Biomedical SensorsIRJET -  	  Lie Detector using MATLAB, Arduino and Biomedical Sensors
IRJET - Lie Detector using MATLAB, Arduino and Biomedical Sensors
IRJET Journal
 
IPT CHENNAI:INPLANT TRAINING IN MATLAB/EMBEDDED SYSTEMS/ROBOTICS
IPT CHENNAI:INPLANT TRAINING IN MATLAB/EMBEDDED SYSTEMS/ROBOTICSIPT CHENNAI:INPLANT TRAINING IN MATLAB/EMBEDDED SYSTEMS/ROBOTICS
IPT CHENNAI:INPLANT TRAINING IN MATLAB/EMBEDDED SYSTEMS/ROBOTICS
ASHOKKUMAR RAMAR
 
INPLANT TRAINING:INPLANT TRAINING FOR ENGINEERING STUDENTS-CSE/IT/ECE/EEE
INPLANT TRAINING:INPLANT TRAINING FOR ENGINEERING STUDENTS-CSE/IT/ECE/EEEINPLANT TRAINING:INPLANT TRAINING FOR ENGINEERING STUDENTS-CSE/IT/ECE/EEE
INPLANT TRAINING:INPLANT TRAINING FOR ENGINEERING STUDENTS-CSE/IT/ECE/EEE
ASHOKKUMAR RAMAR
 
INPLANT TRAINING FOR COMPUTER SCIENCE ENGINEERING&IT STUDENTS INPLANT TRAINING
INPLANT TRAINING FOR COMPUTER SCIENCE ENGINEERING&IT STUDENTS INPLANT TRAININGINPLANT TRAINING FOR COMPUTER SCIENCE ENGINEERING&IT STUDENTS INPLANT TRAINING
INPLANT TRAINING FOR COMPUTER SCIENCE ENGINEERING&IT STUDENTS INPLANT TRAINING
ASHOKKUMAR RAMAR
 
INPLANT TRAINING MECHANICAL ENGINEERING-MECHATRONICS INPLANT TRAINING
INPLANT TRAINING MECHANICAL ENGINEERING-MECHATRONICS INPLANT TRAININGINPLANT TRAINING MECHANICAL ENGINEERING-MECHATRONICS INPLANT TRAINING
INPLANT TRAINING MECHANICAL ENGINEERING-MECHATRONICS INPLANT TRAINING
ASHOKKUMAR RAMAR
 
IPT:INPLANT TRAINING(IPT) FOR CSE STUDENTS/IT STUDENTS,
IPT:INPLANT TRAINING(IPT) FOR CSE STUDENTS/IT STUDENTS,IPT:INPLANT TRAINING(IPT) FOR CSE STUDENTS/IT STUDENTS,
IPT:INPLANT TRAINING(IPT) FOR CSE STUDENTS/IT STUDENTS,
ASHOKKUMAR RAMAR
 
INPLANT TRAINING FOR EEE STUDENTS/ELECTRICAL STUDENTS INPLANT TRAINING
INPLANT TRAINING FOR EEE STUDENTS/ELECTRICAL STUDENTS INPLANT TRAININGINPLANT TRAINING FOR EEE STUDENTS/ELECTRICAL STUDENTS INPLANT TRAINING
INPLANT TRAINING FOR EEE STUDENTS/ELECTRICAL STUDENTS INPLANT TRAINING
ASHOKKUMAR RAMAR
 
Plc & scada Training Report
Plc & scada Training ReportPlc & scada Training Report
Plc & scada Training Report
Lakshminarayan Solanki
 
Java programming: Elementary programming
Java programming: Elementary programmingJava programming: Elementary programming
Java programming: Elementary programming
Karwan Mustafa Kareem
 
Implementation of Automatic Door Opening System with Entry Counter for Univer...
Implementation of Automatic Door Opening System with Entry Counter for Univer...Implementation of Automatic Door Opening System with Entry Counter for Univer...
Implementation of Automatic Door Opening System with Entry Counter for Univer...
ijtsrd
 
obstacle avoiding robot project
obstacle avoiding robot projectobstacle avoiding robot project
obstacle avoiding robot project
Aisha Naeem
 
IRJET- Line following and Obstacle avoiding Bluetooth Controlled Surveillance...
IRJET- Line following and Obstacle avoiding Bluetooth Controlled Surveillance...IRJET- Line following and Obstacle avoiding Bluetooth Controlled Surveillance...
IRJET- Line following and Obstacle avoiding Bluetooth Controlled Surveillance...
IRJET Journal
 
FINAL CORRECT Report
FINAL CORRECT ReportFINAL CORRECT Report
FINAL CORRECT Report
RK Saini
 
Codemania101: The Present, Past and Future of Asynchronous Programming in Python
Codemania101: The Present, Past and Future of Asynchronous Programming in PythonCodemania101: The Present, Past and Future of Asynchronous Programming in Python
Codemania101: The Present, Past and Future of Asynchronous Programming in Python
Yothin Muangsommuk
 
An internet of things-based touchless parking system using ESP32-CAM
An internet of things-based touchless parking system using  ESP32-CAMAn internet of things-based touchless parking system using  ESP32-CAM
An internet of things-based touchless parking system using ESP32-CAM
International Journal of Reconfigurable and Embedded Systems
 
A Proportional-Integral-Derivative Control Scheme of Mobile Robotic platforms...
A Proportional-Integral-Derivative Control Scheme of Mobile Robotic platforms...A Proportional-Integral-Derivative Control Scheme of Mobile Robotic platforms...
A Proportional-Integral-Derivative Control Scheme of Mobile Robotic platforms...
IOSR Journals
 
Obstacle avoiding Robot
Obstacle avoiding RobotObstacle avoiding Robot
Obstacle avoiding Robot
Rasheed Khan
 
Arduino radar system
Arduino radar systemArduino radar system
Arduino radar system
delhi technological university
 
Scottish Ruby Conference 2010 Arduino, Ruby RAD
Scottish Ruby Conference 2010 Arduino, Ruby RADScottish Ruby Conference 2010 Arduino, Ruby RAD
Scottish Ruby Conference 2010 Arduino, Ruby RAD
lostcaggy
 

Similar to rpi PICO micro python - SENSORS interfacing (20)

Iot car parking system
Iot car parking systemIot car parking system
Iot car parking system
 
IRJET - Lie Detector using MATLAB, Arduino and Biomedical Sensors
IRJET -  	  Lie Detector using MATLAB, Arduino and Biomedical SensorsIRJET -  	  Lie Detector using MATLAB, Arduino and Biomedical Sensors
IRJET - Lie Detector using MATLAB, Arduino and Biomedical Sensors
 
IPT CHENNAI:INPLANT TRAINING IN MATLAB/EMBEDDED SYSTEMS/ROBOTICS
IPT CHENNAI:INPLANT TRAINING IN MATLAB/EMBEDDED SYSTEMS/ROBOTICSIPT CHENNAI:INPLANT TRAINING IN MATLAB/EMBEDDED SYSTEMS/ROBOTICS
IPT CHENNAI:INPLANT TRAINING IN MATLAB/EMBEDDED SYSTEMS/ROBOTICS
 
INPLANT TRAINING:INPLANT TRAINING FOR ENGINEERING STUDENTS-CSE/IT/ECE/EEE
INPLANT TRAINING:INPLANT TRAINING FOR ENGINEERING STUDENTS-CSE/IT/ECE/EEEINPLANT TRAINING:INPLANT TRAINING FOR ENGINEERING STUDENTS-CSE/IT/ECE/EEE
INPLANT TRAINING:INPLANT TRAINING FOR ENGINEERING STUDENTS-CSE/IT/ECE/EEE
 
INPLANT TRAINING FOR COMPUTER SCIENCE ENGINEERING&IT STUDENTS INPLANT TRAINING
INPLANT TRAINING FOR COMPUTER SCIENCE ENGINEERING&IT STUDENTS INPLANT TRAININGINPLANT TRAINING FOR COMPUTER SCIENCE ENGINEERING&IT STUDENTS INPLANT TRAINING
INPLANT TRAINING FOR COMPUTER SCIENCE ENGINEERING&IT STUDENTS INPLANT TRAINING
 
INPLANT TRAINING MECHANICAL ENGINEERING-MECHATRONICS INPLANT TRAINING
INPLANT TRAINING MECHANICAL ENGINEERING-MECHATRONICS INPLANT TRAININGINPLANT TRAINING MECHANICAL ENGINEERING-MECHATRONICS INPLANT TRAINING
INPLANT TRAINING MECHANICAL ENGINEERING-MECHATRONICS INPLANT TRAINING
 
IPT:INPLANT TRAINING(IPT) FOR CSE STUDENTS/IT STUDENTS,
IPT:INPLANT TRAINING(IPT) FOR CSE STUDENTS/IT STUDENTS,IPT:INPLANT TRAINING(IPT) FOR CSE STUDENTS/IT STUDENTS,
IPT:INPLANT TRAINING(IPT) FOR CSE STUDENTS/IT STUDENTS,
 
INPLANT TRAINING FOR EEE STUDENTS/ELECTRICAL STUDENTS INPLANT TRAINING
INPLANT TRAINING FOR EEE STUDENTS/ELECTRICAL STUDENTS INPLANT TRAININGINPLANT TRAINING FOR EEE STUDENTS/ELECTRICAL STUDENTS INPLANT TRAINING
INPLANT TRAINING FOR EEE STUDENTS/ELECTRICAL STUDENTS INPLANT TRAINING
 
Plc & scada Training Report
Plc & scada Training ReportPlc & scada Training Report
Plc & scada Training Report
 
Java programming: Elementary programming
Java programming: Elementary programmingJava programming: Elementary programming
Java programming: Elementary programming
 
Implementation of Automatic Door Opening System with Entry Counter for Univer...
Implementation of Automatic Door Opening System with Entry Counter for Univer...Implementation of Automatic Door Opening System with Entry Counter for Univer...
Implementation of Automatic Door Opening System with Entry Counter for Univer...
 
obstacle avoiding robot project
obstacle avoiding robot projectobstacle avoiding robot project
obstacle avoiding robot project
 
IRJET- Line following and Obstacle avoiding Bluetooth Controlled Surveillance...
IRJET- Line following and Obstacle avoiding Bluetooth Controlled Surveillance...IRJET- Line following and Obstacle avoiding Bluetooth Controlled Surveillance...
IRJET- Line following and Obstacle avoiding Bluetooth Controlled Surveillance...
 
FINAL CORRECT Report
FINAL CORRECT ReportFINAL CORRECT Report
FINAL CORRECT Report
 
Codemania101: The Present, Past and Future of Asynchronous Programming in Python
Codemania101: The Present, Past and Future of Asynchronous Programming in PythonCodemania101: The Present, Past and Future of Asynchronous Programming in Python
Codemania101: The Present, Past and Future of Asynchronous Programming in Python
 
An internet of things-based touchless parking system using ESP32-CAM
An internet of things-based touchless parking system using  ESP32-CAMAn internet of things-based touchless parking system using  ESP32-CAM
An internet of things-based touchless parking system using ESP32-CAM
 
A Proportional-Integral-Derivative Control Scheme of Mobile Robotic platforms...
A Proportional-Integral-Derivative Control Scheme of Mobile Robotic platforms...A Proportional-Integral-Derivative Control Scheme of Mobile Robotic platforms...
A Proportional-Integral-Derivative Control Scheme of Mobile Robotic platforms...
 
Obstacle avoiding Robot
Obstacle avoiding RobotObstacle avoiding Robot
Obstacle avoiding Robot
 
Arduino radar system
Arduino radar systemArduino radar system
Arduino radar system
 
Scottish Ruby Conference 2010 Arduino, Ruby RAD
Scottish Ruby Conference 2010 Arduino, Ruby RADScottish Ruby Conference 2010 Arduino, Ruby RAD
Scottish Ruby Conference 2010 Arduino, Ruby RAD
 

More from Dr. Roger Rozario A P

EM-2 LAB MANUAL induction motors and alternators
EM-2 LAB MANUAL induction motors and alternatorsEM-2 LAB MANUAL induction motors and alternators
EM-2 LAB MANUAL induction motors and alternators
Dr. Roger Rozario A P
 
20EE012 electrical machines -1 lab manual
20EE012 electrical machines -1 lab manual20EE012 electrical machines -1 lab manual
20EE012 electrical machines -1 lab manual
Dr. Roger Rozario A P
 
Performance Analysis of Induction Motors
Performance Analysis of Induction MotorsPerformance Analysis of Induction Motors
Performance Analysis of Induction Motors
Dr. Roger Rozario A P
 
AC Machines Alternators and Induction Motors
AC Machines Alternators and Induction MotorsAC Machines Alternators and Induction Motors
AC Machines Alternators and Induction Motors
Dr. Roger Rozario A P
 
Transformers design and coooling methods
Transformers design and coooling methodsTransformers design and coooling methods
Transformers design and coooling methods
Dr. Roger Rozario A P
 
Induction Motors design procedure and construction
Induction Motors design procedure and constructionInduction Motors design procedure and construction
Induction Motors design procedure and construction
Dr. Roger Rozario A P
 
Polarity Test Sumpners test back to back test
Polarity Test Sumpners test back to back testPolarity Test Sumpners test back to back test
Polarity Test Sumpners test back to back test
Dr. Roger Rozario A P
 
Electromechanical Energy Conversion Notes
Electromechanical Energy Conversion NotesElectromechanical Energy Conversion Notes
Electromechanical Energy Conversion Notes
Dr. Roger Rozario A P
 
Unit 1 consderations and limitations in design
Unit  1 consderations and limitations in design Unit  1 consderations and limitations in design
Unit 1 consderations and limitations in design
Dr. Roger Rozario A P
 

More from Dr. Roger Rozario A P (10)

EM-2 LAB MANUAL induction motors and alternators
EM-2 LAB MANUAL induction motors and alternatorsEM-2 LAB MANUAL induction motors and alternators
EM-2 LAB MANUAL induction motors and alternators
 
20EE012 electrical machines -1 lab manual
20EE012 electrical machines -1 lab manual20EE012 electrical machines -1 lab manual
20EE012 electrical machines -1 lab manual
 
Performance Analysis of Induction Motors
Performance Analysis of Induction MotorsPerformance Analysis of Induction Motors
Performance Analysis of Induction Motors
 
AC Machines Alternators and Induction Motors
AC Machines Alternators and Induction MotorsAC Machines Alternators and Induction Motors
AC Machines Alternators and Induction Motors
 
Transformers design and coooling methods
Transformers design and coooling methodsTransformers design and coooling methods
Transformers design and coooling methods
 
Induction Motors design procedure and construction
Induction Motors design procedure and constructionInduction Motors design procedure and construction
Induction Motors design procedure and construction
 
Polarity Test Sumpners test back to back test
Polarity Test Sumpners test back to back testPolarity Test Sumpners test back to back test
Polarity Test Sumpners test back to back test
 
Electromechanical Energy Conversion Notes
Electromechanical Energy Conversion NotesElectromechanical Energy Conversion Notes
Electromechanical Energy Conversion Notes
 
Unit 1 consderations and limitations in design
Unit  1 consderations and limitations in design Unit  1 consderations and limitations in design
Unit 1 consderations and limitations in design
 
Ism 11
Ism 11Ism 11
Ism 11
 

Recently uploaded

Asymmetrical Repulsion Magnet Motor Ratio 6-7.pdf
Asymmetrical Repulsion Magnet Motor Ratio 6-7.pdfAsymmetrical Repulsion Magnet Motor Ratio 6-7.pdf
Asymmetrical Repulsion Magnet Motor Ratio 6-7.pdf
felixwold
 
FUNDAMENTALS OF MECHANICAL ENGINEERING.pdf
FUNDAMENTALS OF MECHANICAL ENGINEERING.pdfFUNDAMENTALS OF MECHANICAL ENGINEERING.pdf
FUNDAMENTALS OF MECHANICAL ENGINEERING.pdf
EMERSON EDUARDO RODRIGUES
 
TENDERS and Contracts basic syllabus for engineering
TENDERS and Contracts basic syllabus for engineeringTENDERS and Contracts basic syllabus for engineering
TENDERS and Contracts basic syllabus for engineering
SnehalChavan75
 
一比一原版(uoft毕业证书)加拿大多伦多大学毕业证如何办理
一比一原版(uoft毕业证书)加拿大多伦多大学毕业证如何办理一比一原版(uoft毕业证书)加拿大多伦多大学毕业证如何办理
一比一原版(uoft毕业证书)加拿大多伦多大学毕业证如何办理
sydezfe
 
BBOC407 Module 1.pptx Biology for Engineers
BBOC407  Module 1.pptx Biology for EngineersBBOC407  Module 1.pptx Biology for Engineers
BBOC407 Module 1.pptx Biology for Engineers
sathishkumars808912
 
Literature review for prompt engineering of ChatGPT.pptx
Literature review for prompt engineering of ChatGPT.pptxLiterature review for prompt engineering of ChatGPT.pptx
Literature review for prompt engineering of ChatGPT.pptx
LokerXu2
 
DELTA V MES EMERSON EDUARDO RODRIGUES ENGINEER
DELTA V MES EMERSON EDUARDO RODRIGUES ENGINEERDELTA V MES EMERSON EDUARDO RODRIGUES ENGINEER
DELTA V MES EMERSON EDUARDO RODRIGUES ENGINEER
EMERSON EDUARDO RODRIGUES
 
Technological Innovation Management And Entrepreneurship-1.pdf
Technological Innovation Management And Entrepreneurship-1.pdfTechnological Innovation Management And Entrepreneurship-1.pdf
Technological Innovation Management And Entrepreneurship-1.pdf
tanujaharish2
 
Data Communication and Computer Networks Management System Project Report.pdf
Data Communication and Computer Networks Management System Project Report.pdfData Communication and Computer Networks Management System Project Report.pdf
Data Communication and Computer Networks Management System Project Report.pdf
Kamal Acharya
 
Call Girls Goa (india) ☎️ +91-7426014248 Goa Call Girl
Call Girls Goa (india) ☎️ +91-7426014248 Goa Call GirlCall Girls Goa (india) ☎️ +91-7426014248 Goa Call Girl
Call Girls Goa (india) ☎️ +91-7426014248 Goa Call Girl
sapna sharmap11
 
INTRODUCTION TO ARTIFICIAL INTELLIGENCE BASIC
INTRODUCTION TO ARTIFICIAL INTELLIGENCE BASICINTRODUCTION TO ARTIFICIAL INTELLIGENCE BASIC
INTRODUCTION TO ARTIFICIAL INTELLIGENCE BASIC
GOKULKANNANMMECLECTC
 
🔥LiploCk Call Girls Pune 💯Call Us 🔝 7014168258 🔝💃Independent Pune Escorts Ser...
🔥LiploCk Call Girls Pune 💯Call Us 🔝 7014168258 🔝💃Independent Pune Escorts Ser...🔥LiploCk Call Girls Pune 💯Call Us 🔝 7014168258 🔝💃Independent Pune Escorts Ser...
🔥LiploCk Call Girls Pune 💯Call Us 🔝 7014168258 🔝💃Independent Pune Escorts Ser...
adhaniomprakash
 
Call Girls Chennai +91-8824825030 Vip Call Girls Chennai
Call Girls Chennai +91-8824825030 Vip Call Girls ChennaiCall Girls Chennai +91-8824825030 Vip Call Girls Chennai
Call Girls Chennai +91-8824825030 Vip Call Girls Chennai
paraasingh12 #V08
 
Covid Management System Project Report.pdf
Covid Management System Project Report.pdfCovid Management System Project Report.pdf
Covid Management System Project Report.pdf
Kamal Acharya
 
comptia-security-sy0-701-exam-objectives-(5-0).pdf
comptia-security-sy0-701-exam-objectives-(5-0).pdfcomptia-security-sy0-701-exam-objectives-(5-0).pdf
comptia-security-sy0-701-exam-objectives-(5-0).pdf
foxlyon
 
Call Girls Madurai 8824825030 Escort In Madurai service 24X7
Call Girls Madurai 8824825030 Escort In Madurai service 24X7Call Girls Madurai 8824825030 Escort In Madurai service 24X7
Call Girls Madurai 8824825030 Escort In Madurai service 24X7
Poonam Singh
 
Particle Swarm Optimization–Long Short-Term Memory based Channel Estimation w...
Particle Swarm Optimization–Long Short-Term Memory based Channel Estimation w...Particle Swarm Optimization–Long Short-Term Memory based Channel Estimation w...
Particle Swarm Optimization–Long Short-Term Memory based Channel Estimation w...
IJCNCJournal
 
🔥Young College Call Girls Chandigarh 💯Call Us 🔝 7737669865 🔝💃Independent Chan...
🔥Young College Call Girls Chandigarh 💯Call Us 🔝 7737669865 🔝💃Independent Chan...🔥Young College Call Girls Chandigarh 💯Call Us 🔝 7737669865 🔝💃Independent Chan...
🔥Young College Call Girls Chandigarh 💯Call Us 🔝 7737669865 🔝💃Independent Chan...
sonamrawat5631
 
❣Unsatisfied Bhabhi Call Girls Surat 💯Call Us 🔝 7014168258 🔝💃Independent Sura...
❣Unsatisfied Bhabhi Call Girls Surat 💯Call Us 🔝 7014168258 🔝💃Independent Sura...❣Unsatisfied Bhabhi Call Girls Surat 💯Call Us 🔝 7014168258 🔝💃Independent Sura...
❣Unsatisfied Bhabhi Call Girls Surat 💯Call Us 🔝 7014168258 🔝💃Independent Sura...
hotchicksescort
 
AN INTRODUCTION OF AI & SEARCHING TECHIQUES
AN INTRODUCTION OF AI & SEARCHING TECHIQUESAN INTRODUCTION OF AI & SEARCHING TECHIQUES
AN INTRODUCTION OF AI & SEARCHING TECHIQUES
drshikhapandey2022
 

Recently uploaded (20)

Asymmetrical Repulsion Magnet Motor Ratio 6-7.pdf
Asymmetrical Repulsion Magnet Motor Ratio 6-7.pdfAsymmetrical Repulsion Magnet Motor Ratio 6-7.pdf
Asymmetrical Repulsion Magnet Motor Ratio 6-7.pdf
 
FUNDAMENTALS OF MECHANICAL ENGINEERING.pdf
FUNDAMENTALS OF MECHANICAL ENGINEERING.pdfFUNDAMENTALS OF MECHANICAL ENGINEERING.pdf
FUNDAMENTALS OF MECHANICAL ENGINEERING.pdf
 
TENDERS and Contracts basic syllabus for engineering
TENDERS and Contracts basic syllabus for engineeringTENDERS and Contracts basic syllabus for engineering
TENDERS and Contracts basic syllabus for engineering
 
一比一原版(uoft毕业证书)加拿大多伦多大学毕业证如何办理
一比一原版(uoft毕业证书)加拿大多伦多大学毕业证如何办理一比一原版(uoft毕业证书)加拿大多伦多大学毕业证如何办理
一比一原版(uoft毕业证书)加拿大多伦多大学毕业证如何办理
 
BBOC407 Module 1.pptx Biology for Engineers
BBOC407  Module 1.pptx Biology for EngineersBBOC407  Module 1.pptx Biology for Engineers
BBOC407 Module 1.pptx Biology for Engineers
 
Literature review for prompt engineering of ChatGPT.pptx
Literature review for prompt engineering of ChatGPT.pptxLiterature review for prompt engineering of ChatGPT.pptx
Literature review for prompt engineering of ChatGPT.pptx
 
DELTA V MES EMERSON EDUARDO RODRIGUES ENGINEER
DELTA V MES EMERSON EDUARDO RODRIGUES ENGINEERDELTA V MES EMERSON EDUARDO RODRIGUES ENGINEER
DELTA V MES EMERSON EDUARDO RODRIGUES ENGINEER
 
Technological Innovation Management And Entrepreneurship-1.pdf
Technological Innovation Management And Entrepreneurship-1.pdfTechnological Innovation Management And Entrepreneurship-1.pdf
Technological Innovation Management And Entrepreneurship-1.pdf
 
Data Communication and Computer Networks Management System Project Report.pdf
Data Communication and Computer Networks Management System Project Report.pdfData Communication and Computer Networks Management System Project Report.pdf
Data Communication and Computer Networks Management System Project Report.pdf
 
Call Girls Goa (india) ☎️ +91-7426014248 Goa Call Girl
Call Girls Goa (india) ☎️ +91-7426014248 Goa Call GirlCall Girls Goa (india) ☎️ +91-7426014248 Goa Call Girl
Call Girls Goa (india) ☎️ +91-7426014248 Goa Call Girl
 
INTRODUCTION TO ARTIFICIAL INTELLIGENCE BASIC
INTRODUCTION TO ARTIFICIAL INTELLIGENCE BASICINTRODUCTION TO ARTIFICIAL INTELLIGENCE BASIC
INTRODUCTION TO ARTIFICIAL INTELLIGENCE BASIC
 
🔥LiploCk Call Girls Pune 💯Call Us 🔝 7014168258 🔝💃Independent Pune Escorts Ser...
🔥LiploCk Call Girls Pune 💯Call Us 🔝 7014168258 🔝💃Independent Pune Escorts Ser...🔥LiploCk Call Girls Pune 💯Call Us 🔝 7014168258 🔝💃Independent Pune Escorts Ser...
🔥LiploCk Call Girls Pune 💯Call Us 🔝 7014168258 🔝💃Independent Pune Escorts Ser...
 
Call Girls Chennai +91-8824825030 Vip Call Girls Chennai
Call Girls Chennai +91-8824825030 Vip Call Girls ChennaiCall Girls Chennai +91-8824825030 Vip Call Girls Chennai
Call Girls Chennai +91-8824825030 Vip Call Girls Chennai
 
Covid Management System Project Report.pdf
Covid Management System Project Report.pdfCovid Management System Project Report.pdf
Covid Management System Project Report.pdf
 
comptia-security-sy0-701-exam-objectives-(5-0).pdf
comptia-security-sy0-701-exam-objectives-(5-0).pdfcomptia-security-sy0-701-exam-objectives-(5-0).pdf
comptia-security-sy0-701-exam-objectives-(5-0).pdf
 
Call Girls Madurai 8824825030 Escort In Madurai service 24X7
Call Girls Madurai 8824825030 Escort In Madurai service 24X7Call Girls Madurai 8824825030 Escort In Madurai service 24X7
Call Girls Madurai 8824825030 Escort In Madurai service 24X7
 
Particle Swarm Optimization–Long Short-Term Memory based Channel Estimation w...
Particle Swarm Optimization–Long Short-Term Memory based Channel Estimation w...Particle Swarm Optimization–Long Short-Term Memory based Channel Estimation w...
Particle Swarm Optimization–Long Short-Term Memory based Channel Estimation w...
 
🔥Young College Call Girls Chandigarh 💯Call Us 🔝 7737669865 🔝💃Independent Chan...
🔥Young College Call Girls Chandigarh 💯Call Us 🔝 7737669865 🔝💃Independent Chan...🔥Young College Call Girls Chandigarh 💯Call Us 🔝 7737669865 🔝💃Independent Chan...
🔥Young College Call Girls Chandigarh 💯Call Us 🔝 7737669865 🔝💃Independent Chan...
 
❣Unsatisfied Bhabhi Call Girls Surat 💯Call Us 🔝 7014168258 🔝💃Independent Sura...
❣Unsatisfied Bhabhi Call Girls Surat 💯Call Us 🔝 7014168258 🔝💃Independent Sura...❣Unsatisfied Bhabhi Call Girls Surat 💯Call Us 🔝 7014168258 🔝💃Independent Sura...
❣Unsatisfied Bhabhi Call Girls Surat 💯Call Us 🔝 7014168258 🔝💃Independent Sura...
 
AN INTRODUCTION OF AI & SEARCHING TECHIQUES
AN INTRODUCTION OF AI & SEARCHING TECHIQUESAN INTRODUCTION OF AI & SEARCHING TECHIQUES
AN INTRODUCTION OF AI & SEARCHING TECHIQUES
 

rpi PICO micro python - SENSORS interfacing

  • 1. Sri Ramakrishna Institute Of Technology (An Autonomous Institution) Introduction to Raspberry Pi Mr.A.P.Roger Rozario Assistant Professor (Sr.Gr) Department of EEE SRIT 6/14/2024 1
  • 2. Sri Ramakrishna Institute Of Technology (An Autonomous Institution) ON BOARD TEMPERTAURE SENSOR 6/14/2024 RPI PICO – MICRO PYTHON 2
  • 3. Sri Ramakrishna Institute Of Technology (An Autonomous Institution) Temperature Sensor 6/14/2024 RPI PICO – MICRO PYTHON 3
  • 4. Sri Ramakrishna Institute Of Technology (An Autonomous Institution) Temperature Sensor 6/14/2024 RPI PICO – MICRO PYTHON 4 import machine import utime sensor_temp = machine.ADC(4) conversion_factor = 3.3 / (65535) while True: reading = sensor_temp.read_u16() * conversion_factor temperature = 27- (reading 0.706)/0.001721 print(temperature) utime(2)
  • 5. Sri Ramakrishna Institute Of Technology (An Autonomous Institution) TEMPERATURE LCD I2C 6/14/2024 RPI PICO – MICRO PYTHON 5 from pico_i2c_lcd import i2c Lcd from machine import i2C,Pin import time sensor_temp = machine.ADC(4) conversion_factor = 3.3 / (65535) i2c = I2C(id=0, scl=Pin(1), sda=Pin(0),freq=100000) lcd=I2cLcd (i2c, 0x27, 216) while True: reading = sensor_temp.read_u16()*conversion_factor temperature = 27- (reading 0.706)/0.001721 print(temperature) lcd.move_to(0,0) lcd.putstr("Temp: ") lcd.move_to(6,0) lcd.putstrstr(str(temperature)+“C") time.sleep(1) lcd.clear()
  • 6. Sri Ramakrishna Institute Of Technology (An Autonomous Institution) RGB LED 6/14/2024 RPI PICO – MICRO PYTHON 6
  • 7. Sri Ramakrishna Institute Of Technology (An Autonomous Institution) RGB LED 6/14/2024 RPI PICO – MICRO PYTHON 7
  • 8. Sri Ramakrishna Institute Of Technology (An Autonomous Institution) RGB LED – toggle 6/14/2024 RPI PICO – MICRO PYTHON 8 from machine import Pin import utime led_r = Pin(16, Pin.OUT) led_g = Pin(17, Pin.OUT) led_b = Pin(15, Pin.OUT) #Clear Common Anode RGB LED led_r.value(1) led_g.value(1) led_b.value(1) while True: led_r.toggle() utime.sleep(1) led_r.toggle() led_g.toggle() utime.sleep(1) led_g.toggle() led_b.toggle() utime.sleep(1) led_b.toggle() utime.sleep(1)
  • 9. Sri Ramakrishna Institute Of Technology (An Autonomous Institution) 7 Segment Display 6/14/2024 RPI PICO – MICRO PYTHON 9
  • 10. Sri Ramakrishna Institute Of Technology (An Autonomous Institution) 7 Segment Display 6/14/2024 RPI PICO – MICRO PYTHON 10
  • 11. Sri Ramakrishna Institute Of Technology (An Autonomous Institution) 7 Segment Display 6/14/2024 RPI PICO – MICRO PYTHON 11 from machine import Pin import utime pins = [ Pin(16, Pin.OUT), #middle Pin(17,Pin.OUT), #top left Pin(18,Pin.OUT), #top Pin (19, Pin.OUT), #top right Pin(13,Pin.OUT),#bottom right Pin(14, Pin.OUT), #bottom Pin(15,Pin.OUT), #bottom left: Pin(12, Pin.OUT) #dot #common anode 7 segment chars = [ [1, 0, 0, 0, 0, 0, 0, 0], #0 [1, 1, 1, 0, 0, 1, 1, 1], #1 [0, 1, 0, 0, 1, 0, 0, 0], #2 [0, 1, 0, 0, 0, 0, 1, 0],#3 [0, 0, 1, 0, 0, 1, 1, 0], #4 [0, 0, 0, 1, 0, 0, 1, 0],#5 [0, 0, 0, 1, 0, 0, 0, 0],#6 [1, 1, 0, 0, 0, 1, 1, 1),#7 [0, 0, 0, 0, 0, 0, 0, 0],#8 [0, 0, 0, 0, 0, 0, 1, 1]#9 ] def clear(): for i in pins: i.value(1) clear() while True: for i in range (len(chars)): for j in range(len(pins)): pins[j].value(chars [i][j]) utime sleep(1)
  • 12. Sri Ramakrishna Institute Of Technology (An Autonomous Institution) Ultrasonic Sensor 6/14/2024 RPI PICO – MICRO PYTHON 12
  • 13. Sri Ramakrishna Institute Of Technology (An Autonomous Institution) Ultrasonic Sensor 6/14/2024 RPI PICO – MICRO PYTHON 13
  • 14. Sri Ramakrishna Institute Of Technology (An Autonomous Institution) Ultrasonic Sensor 6/14/2024 RPI PICO – MICRO PYTHON 14 from machine import Pin,Timer import utime timer = Timer() trigger Pin(14, Pin.OUT) echo = Pin(15, Pin. IN) led = Pin(16, Pin.OUT) distance = 0 def get_distance (timer): global distance trigger.high() utime.sleep(0.00001) trigger.low() while echo.value() == 0: start=utime.ticks_us() while echo.value() ==1: stop = utime.ticks_us() duration = stop – start distance = (duration 0.0343) / 2 print("Distance: ", distance,"cm") return distance timer.init(freq=1,mode=Timer.PERIODIC,callback=get_distance) while True: if distance < 5: led.value (1) else: led.value(0)
  • 15. Sri Ramakrishna Institute Of Technology (An Autonomous Institution) Infrared Sensor 6/14/2024 RPI PICO – MICRO PYTHON 15
  • 16. Sri Ramakrishna Institute Of Technology (An Autonomous Institution) Infrared Sensor 6/14/2024 RPI PICO – MICRO PYTHON 16
  • 17. Sri Ramakrishna Institute Of Technology (An Autonomous Institution) Infrared Sensor 6/14/2024 RPI PICO – MICRO PYTHON 17 from machine import Pin import utime led Pin(16, Pin.OUT) sensor = Pin (15,Pin.IN) while True: print (sensor.value()) if sensor.value()==1: led.value (0) else: led.value (1)
  • 18. Sri Ramakrishna Institute Of Technology (An Autonomous Institution) STEPPER MOTOR 6/14/2024 RPI PICO – MICRO PYTHON 18
  • 19. Sri Ramakrishna Institute Of Technology (An Autonomous Institution) STEPPER MOTOR 6/14/2024 RPI PICO – MICRO PYTHON 19
  • 20. Sri Ramakrishna Institute Of Technology (An Autonomous Institution) STEPPER MOTOR 6/14/2024 RPI PICO – MICRO PYTHON 20 from machine import Pin import utime pins = [ Pin (15, Pin.OUT), #IN1 Pin (14, Pin.OUT), #IN2 Pin(16,Pin.OUT), #IN3 Pin (17,Pin.OUT), #IN4 ] full_step_sequence = [ [1,0,0,0], [0,1,0,0], [0,0,1,0], [0,0,0,1] ] while True: for step in full_step_sequence: for i in range (len(pins)): pins[i].value(step[i]) utime.sleep(0.001)
  • 21. Sri Ramakrishna Institute Of Technology (An Autonomous Institution) DC Motor 6/14/2024 RPI PICO – MICRO PYTHON 21
  • 22. Sri Ramakrishna Institute Of Technology (An Autonomous Institution) DC Motor 6/14/2024 RPI PICO – MICRO PYTHON 22 from machine import Pin import utime ini Pin(15, Pin.OUT) in2 Pin(14, Pin.OUT) while True: in1.value(0) n2.value(0) utime.sleep(1) in1.value(0) in2.value(1) | utime.sleep(1) in1.value(1) in2.value() utime.sleep(1) in1value(1) in2.value(1) utime.sleep(1)
  翻译: