Skip to content
Jesús Capistrán
  • About me
  • Blog
  • Courses
  • Publications
  • Log In
  • Toggle website search
Menu Close
Search this website

Simulación de celdas solares SCAPS-1D

  • Home
  • Courses
  • Course
  • Simulación de celdas solares SCAPS-1D

Simulación de celdas solares SCAPS-1D

Curriculum

  • 1 Section
  • 7 Lessons
  • 1 Week
Expand all sectionsCollapse all sections
  • SCAPS-1D: FASnI3 perovskite
    Simulación basada en artículo científico publicado en marzo de 2020
    7
    • 3.1
      Lección 1: Revisión de literatura
    • 3.2
      Lección 2: Diseño de celda solar
    • 3.3
      Lección 3: Construcción de celda solar
    • 3.4
      Lección 4: Simulación de celda solar en iluminación
    • 3.5
      Leccion 5: Simulación de celda solar en obscuridad
    • 3.6
      Lección 6: Obtención de curva JV light + dark
    • 3.7
      Leccion 7: Variación de Rs mediante proceso batch

Temperature Data Logger with Raspberry Pi Pico

Print Friendly, PDF & Email

Objective

  • Save the data into the Raspberry Pi Pico
  • Plot the saved data using Jupyter Notebook and Matplotlib

Reading the temperature data from the Raspberry Pi Pico is great however in the science world we will require to save the data to analyze it. Imagine you will place a temperature sensor inside a chemical reactor. With this data, you can analyze the behavior of the process and predict what is happening.

Temperature Data Logger for Solar Cell fabrication

There are two interesting places where I can use this data logger

  1. To know the temperature inside the chemical bath deposition. In the first stage we can track the chemical deposition temperature profile and after the analysis we could start controlling the chemical reaction by programming the temperature profile. Remeber that in some chemical deposition (metal chalcogenides) the reaction start just after passing a critical temperature point.
  2. Track and controll the crystallation process of the metal chalcogenides. After the chemical deposition of some metal chalcogenides thin films. For example we will require to anneal them in air or nitrogen atmosphere. Here we usually do no track the heating process. Therefore the temperature datalogger will help to get that data. However, in this application we will require additional components because the crystallization required from 300-400 ºC . That means we need a temperature sensor which supports almost 450 ºC. (J or K Thermocouples).

Temperature Data Logger with Raspberry Pi Pico

For this application, we are going to read the internal temperature sensor of our Raspberry Pi Pico and write the information on the same board. This example will show you the power of the Raspberry for measuring external physical properties like temperature (using sensors) and saving it for future analysis. In the following picture, you can see the basic connection.

  • This example is based on the following Circuit Python tutorial, Data Logger: https://learn.adafruit.com/getting-started-with-raspberry-pi-pico-circuitpython/data-logger
Raspberry Pi Pico is measuring the internal temperature sensor and writing in its own memory (limited)

Materials

  • Raspberry Pi Pico
  • Breadboard
  • Male to male jumper wire

The circuit

  • The jumper wire connects the Pin1 to Pin8 in other words we will connect GP0 to GND
We only need a jumper wire connected from GP0 to GND for the Data Logger application and save data in the internal memory.

The code

With the following codes (files), you will be able to save the temperature in the Pico board when the jumper wire is connected to the ground. If the jumper is not connected the PICO board won’t save the data.

File 01: boot.py

This code tells the Pico Board to look at the star if the GP0 (Pin1) is connected to GND. If it is true boot.py makes the board writeable on its own filesystem.

"""
boot.py file for Pico data logging example. If pin GP0 is connected to GND when
the pico starts up, make the filesystem writeable by CircuitPython.
"""
import board
import digitalio
import storage

write_pin = digitalio.DigitalInOut(board.GP0)
write_pin.direction = digitalio.Direction.INPUT
write_pin.pull = digitalio.Pull.UP

"""
If write pin is connected to ground on start-up, CircuitPython 
can write to CIRCUITPY filesystem.
"""

if not write_pin.value:
    storage.remount("/", readonly=False)

File 02: code.py

This is the same code found on the page of Adafruit Circuit Python here we are reproducing and testing it. Just copy and paste it into the code.py

  • It will only work when you disconnect the Pico Board from your computer, connect GP0 to GND and connect againg the board to 5V (computer or an adaptar).
  • Inmediatly you will see a blinking led indicating this program is working, internally you will find a temperature.txt file with the temperature data.

IMPORTANT: You need to disconnect the jumper wire before disconnecting the board from the energy source (USB or battery charger). This way you won’t corrupt the Pico Board system.

"""
Data logging example for Pico. Logs the temperature to a file on the Pico.
https://learn.adafruit.com/getting-started-with-raspberry-pi-pico-circuitpython/data-logger
"""
import time
import board
import digitalio
import microcontroller
led = digitalio.DigitalInOut(board.LED)
led.switch_to_output()
try:
    with open("/temperature.txt", "a") as datalog:
        while True: # When Datalogger is working This is the working Cycle
            temp = microcontroller.cpu.temperature
            datalog.write('{0:f}\n'.format(temp))
            datalog.flush()
            led.value = not led.value
            time.sleep(1)
except OSError as e:  # Typically when the filesystem isn't writeable...
    delay = 0.5  # ...blink the LED every half second.
    if e.args[0] == 28:  # If the filesystem is full...
        delay = 0.25  # ...blink the LED faster!
    while True:  # When Datalogger is not working This is the working Cycle
        temp = microcontroller.cpu.temperature
        temp = round(temp,2)
        print(f"T = {temp} ºC")
        led.value = True
        time.sleep(0.5)
        led.value = False
        time.sleep(0.5)
"""
Data logging example for Pico. Logs the temperature to a file on the Pico.
https://learn.adafruit.com/getting-started-with-raspberry-pi-pico-circuitpython/data-logger
"""
import time
import board
import digitalio
import microcontroller

led = digitalio.DigitalInOut(board.LED)
led.switch_to_output()

try:
    with open("/temperature.txt", "a") as datalog:
        while True: # When Datalogger is working This is the working Cycle
            temp = microcontroller.cpu.temperature
            datalog.write('{0:f}\n'.format(temp))
            datalog.flush()
            led.value = not led.value
            time.sleep(1)
            
except OSError as e:  # Typically when the filesystem isn't writeable...
    delay = 0.5  # ...blink the LED every half second.
    if e.args[0] == 28:  # If the filesystem is full...
        delay = 0.25  # ...blink the LED faster!
    while True:  # When Datalogger is not working This is the working Cycle
        temp = microcontroller.cpu.temperature
        temp = round(temp,2)
        print(f"T = {temp} ºC")
        led.value = True
        time.sleep(0.5)
        led.value = False
        time.sleep(0.5)

Real evidence – Video

If you want to see the data logged first click play to the video then in the next section you will be able to download the temperature.txt file.

Pico Board after measuring and logging the temperature: ∆t = 1 sec

The logged Data

This time I will provide you with the data I was able to measure with the internal temperature sensor of the Pico Board. If you want to save a day measuring temperature, then just download the following .txt file. This file has a measure of temperature during a whole day starting a 10 PM.

temperature_b_plotDownload

Data Analysis using Jupyter Notebook and Python 3

Leave a Reply Cancel reply

You must be logged in to post a comment.

Continue with Facebook
Continue with Google
  • About me
  • Blog
  • Courses
  • Publications
  • Log In
©Copyright 2025 - All thoughts and opinions are my own and do not reflect those of my institution.
  • About me
  • Blog
  • Courses
  • Publications
  • Log In
 

Loading Comments...
 

You must be logged in to post a comment.

    Modal title

    Main Content