jslawless / POPSICL

POPSICL - Probing Over the Physics' Institutions Systematic Cooling Liability
3 stars 0 forks source link

Interface RPi to DHT20 #3

Closed lawrenceleejr closed 1 year ago

lawrenceleejr commented 1 year ago

An example written in MicroPython (which would be a fine alternative to CircuitPython) is here:

https://github.com/flrrth/pico-dht20

lawrenceleejr commented 1 year ago

If you want to use this, I would add this other repo as a submodule in this repo. (Good time to learn about submodules. :D)

lawrenceleejr commented 1 year ago

Dylan agreed to take the lead on the Circuit/Micro/Whatever Python interface for the DHT20. Jacob agreed to take the lead on the physical connections of the DHT20 to the board.

Use this ticket as a log of anything you figure out.

dmontello commented 1 year ago

Found out some hardware info. The DHT20 has 4 pins, these are there functions. 1st Pin: VCC (Power) 2nd Pin: DATA 3rd Pin: NULL (Don't connect anything to it) 4th Pin: GND (Ground)

From what I've found people typically connect a 10k ohm resistor between the 1st and second pin. Then we would connect the 1st pin of DHT20 to pin 36 of the Raspberry Pi Pico (3v3 power). Then could use pin 38 on the pico for pin 4 on DHT20 for GND. Still not sure what to use for the data pin. I saw a website for the pico that used pin 4 which is a GPIO and can do I2C SDA and SPI SCK. Not really sure what that all means but I think we'd use the I2C SDA (serial data) functionality.

Website I found for DHT20 and Raspberry Pi Pico

image

lawrenceleejr commented 1 year ago

Take a look at the repo linked in the description. This has a little more on the pinout. Note that your link is for the DHT22. I believe the DHT20 does not require the resistor but you can look at the data sheet for it for the manufacturer recommendation.

Jmgou commented 1 year ago

I uploaded the MicroPython UF2 file to Raspberry Pi Pico W so that we can program it with micropython: rp2-pico-w-20230201-unstable-v1.19.1-850-gfe2a8332f.zip

Jmgou commented 1 year ago

I tested it out using Thonny to make an LED blink. Pico_LED_blink.zip

Jmgou commented 1 year ago

And here is the pico reading output from the DHT20 sensor. I copied the necessary files from the github repository @lawrenceleejr found to the pico board. 20230202_153323 Then I just ran the example code from the readme file. 20230202_153312 20230202_153328

lawrenceleejr commented 1 year ago

GREAT!! So it's all hooked up right. Maybe it's all ready to be laid out in the stick and soldered up and glued down. Want to plan a physical layout and such and post here?

dmontello commented 1 year ago

Started working on adding wifi functionality. Biggest challenge is eduroam is WPA2-Enterprise security, which so far I haven't found support for it in the network library

lawrenceleejr commented 1 year ago

You should use the ut-open network and separately register the MAC address with the UT network (you can ask @Jmgou how to do that). You'll want to choose a system of hostnames that works. Probably a name with an index like popsicl-01 where the index is different for each unit we end up having, and we can write down the hostname on each of the sticks. Design a naming system that is smart and scalable.

Jmgou commented 1 year ago

Was looking at the wifi code. I uploaded a .py file that will return the pico w's MAC address to github. For example, the MAC address of the pico I have connected to my laptop is:

image_2023-02-10_122246877

Jmgou commented 1 year ago

I sourced the code from this document here:

connecting-to-the-internet-with-pico-w.pdf

Jmgou commented 1 year ago

Houston, we have wifi. The code above is just a test seeing if the pico could access the contents of the URL shown in the script.

image_2023-02-10_124559456

dmontello commented 1 year ago

I consolidated the files for MAC address finding and connecting to wifi and the temp/humidity sensor all onto one file under my branch

Jmgou commented 1 year ago

All right, we have the first prototype constructed and it works:

20230217_155633 20230217_155733