atmos:researchmeetingnotes:researchmeetingnotes:home:lizcardoza
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
atmos:researchmeetingnotes:researchmeetingnotes:home:lizcardoza [2025/06/17 20:57] – [Carbon Dioxide Balloon-borne Observations] mwitherspoon | atmos:researchmeetingnotes:researchmeetingnotes:home:lizcardoza [2025/07/15 14:31] (current) – [Carbon Dioxide Balloon-borne Observations] mwitherspoon | ||
---|---|---|---|
Line 77: | Line 77: | ||
* To test if the raspberry pi is detecting any sensors in terminal: sudo i2cdetect -y 1 (It will be a diagram with dashes and numbers should show for each sensor: if you have 3 sensors three different values should be present) | * To test if the raspberry pi is detecting any sensors in terminal: sudo i2cdetect -y 1 (It will be a diagram with dashes and numbers should show for each sensor: if you have 3 sensors three different values should be present) | ||
- | import time | + | Presenation |
- | import csv | + | |
- | import board | + | |
- | import busio | + | |
- | import adafruit_mcp9808 | + | |
- | + | ||
- | # Set up I2C and sensor | + | |
- | i2c = busio.I2C(board.SCL, board.SDA) | + | |
- | mcp = adafruit_mcp9808.MCP9808(i2c) | + | |
- | + | ||
- | csv_filename = " | + | |
- | + | ||
- | # Write header if file is new | + | |
- | try: | + | |
- | with open(csv_filename, | + | |
- | writer = csv.writer(csvfile) | + | |
- | writer.writerow([" | + | |
- | except FileExistsError: | + | |
- | pass | + | |
- | + | ||
- | print(" | + | |
- | + | ||
- | try: | + | |
- | while True: | + | |
- | temperature = mcp.temperature | + | |
- | timestamp = time.strftime(" | + | |
- | + | ||
- | print(f" | + | |
- | + | ||
- | with open(csv_filename, | + | |
- | writer = csv.writer(csvfile) | + | |
- | writer.writerow([timestamp, | + | |
- | + | ||
- | time.sleep(5) | + | |
- | except KeyboardInterrupt: | + | |
- | print(" | + | |
===== History ==== | ===== History ==== | ||
* Liz Cardoza worked on project during 2024 Summer REU, see [[http:// | * Liz Cardoza worked on project during 2024 Summer REU, see [[http:// | ||
+ | * Michael Witherspoon 2025 Summer REU |
atmos/researchmeetingnotes/researchmeetingnotes/home/lizcardoza.1750193840.txt.gz · Last modified: 2025/06/17 20:57 by mwitherspoon