Professional Documents
Culture Documents
Activity report on
Submitted by
NAME USN NAME USN
Submitted to
Dr. Mohana Lakshmi J
Associate Professor
Department of Computer Science and Engineering
Malnad college of Engineering Hassan, Karnataka 573202,India
1)Write a RaspberryPi Pico compatible python code to record the temperature in a room,
display this value on a LED
Problem statement:-
Write a RaspberryPi Pico compatible python code to record the temperature in a room,
display this value on a LED
We will read the Temperature Sensor Value from Raspberry Pi Pico. The Raspberry Pi
Pico has internal Temperature Sensor connected to one of a few special pins
called ADCs or Analog-to-Digital Converters
We will connect an I2C OLED Display to the Raspberry Pi Pico & read the Temperature
Data from the Sensor. We will then display the temperature on OLED Screen
Circuit design:
Simulation using Wokwi
Wokwi is an online simulator that simulates several electronic
components. We also implement the code so that the project can
run successfully.
Step1:
Open wokwi platform and create a python file .py. Add the
required components
Step2:
There will be two windows, editor window and simulator
window. In the simulator window, we make connections of
the components as shown in circuit diagram
Step3:
According to the connections we have to implement the python
code in order to run the simulator.
Step4:
Code is written in such a way that the temperature will be displayed
on OLED screen
Results:
Code Implementation
from machine import Pin, I2C
from ssd1306 import SSD1306_I2C
import machine
import utime
sensor_temp = machine.ADC(4)
conversion_factor = 3.3 / (65535)
WIDTH = 128
HEIGHT = 64
while True:
reading = sensor_temp.read_u16() * conversion_factor
temperature = 27 - (reading - 0.706)/0.001721
print(temperature)
# Finally update the oled display so the image & text is displayed
oled.show()
run the Server sky mote and also the simulation control
EXECUTION
VideoLink
https://drive.google.com/drive/folders/1g0qwM0Cz8pyotqXwVP__Z9C
LrhbfdIOD