Raspberry Pi Pico W LESSON 21: Temperature and Humidity Measurements with Toggle Switch

  Рет қаралды 6,160

Paul McWhorter

Paul McWhorter

Күн бұрын

Пікірлер
@siegfriedsader4124
@siegfriedsader4124 Жыл бұрын
My sensor DHT11 is from AZ-Delivery. It works only with myPin=Pin(dataPin,Pin.OUT,Pin.PULL_UP) instead of PULL_DOWN. But the original sensor works also fine with this change. Greets from Germany.
@ItchyCinderBlock
@ItchyCinderBlock Жыл бұрын
Boy I struggled so much with this and became convinced my device was broken. Mine also works with pull up but not pull down. I wonder why.
@charlotteswift
@charlotteswift Жыл бұрын
Hi Paul & Guys You might find this helpful. Rather than having to put chr(176) to get the degree symbol, you can type Alt + 0176 using the numeric keyboard in Word, WordPad, Notepad etc and cut and paste it into your program. When we get onto displaying it on the LCD1602 in a couple of lessons time, you won't be able to display the degree symbol without jumping through loads of hoops. I've just realised that you can do Alt + 0176 in Thonny as well. Silly me! I don't think it works if you're using a RPi which was why I got confused.
@keithlohmeyer
@keithlohmeyer Жыл бұрын
Nice tips! Thanks. The character LCD has some special characters available but they don't follow ascii notation. A close approximation of the degree symbol is at chr(223) and can be put in an F string as display_text = f'Temp = {tempC}{chr(223)}C'
@charlotteswift
@charlotteswift Жыл бұрын
@@keithlohmeyer Supposedly different LCDs behave differently. When I did Alt + 223 in WordPad, I got what looked like the German symbol for double s. I can't remember what it's called.
@keithlohmeyer
@keithlohmeyer Жыл бұрын
@@charlotteswift Yes that is the ascii notation. I did a test on the 1602 and you get a little square with a hole at the top of the character space sending the chr(223)
@keithlohmeyer
@keithlohmeyer Жыл бұрын
I created a video showing a couple of ways to get a degree sign on the 1602 LCD. kzbin.info/www/bejne/laOwhZxoeMhgesU
@briankelly4095
@briankelly4095 Жыл бұрын
Nice tip. I never would have considered typing the alt-code straight into Thonny. Thanks.
@peterhartshauser5176
@peterhartshauser5176 Жыл бұрын
I absolutely love those Pico W lessons. Thank you Paul!
@cbrombaugh
@cbrombaugh Жыл бұрын
I AM LEGEND. I had a little trouble getting the logic right, but found that "if, elif, else" was my friend on this problem. Thanks for another most-excellent lesson Paul.
@qzorn4440
@qzorn4440 Жыл бұрын
I look forward to the Raspberry Pi Pico W lessons. This Temp/Humidity can monitor a project box if it is running too hot. 😎 Thank you.
@ErlankBru
@ErlankBru 2 ай бұрын
Not sure if the DHT22 (the loose one with 4 pins) needs some additional line of code here (it worked in the previous lesson), but I came upon the weirdest thing. The TIMEDOUT error refers to the "sensor.measure()" line and line 1... coincidentally or per accident I realized that if I type "sensor.measure()" incorrectly (such as "sensor.measurement()", click on play to get the error and then correct it and press play once more, then I don't get the error and the program works, BUT only while the cursor stays where it is.. when I place the cursor somewhere else and press the run button, I get the error until I repeat my steps mentioned. *UPDATE: Sorry, I totally forgot to add "time.sleep(2)" right after I created the sensor at "sensor=DHT22(myPin)" so now my DHT22 works great. I do have the DHT11, but my challenge was to get the DHT22 going🙂
@iampad545
@iampad545 Жыл бұрын
Paul, any chance you'll be covering the pi pico PIO assembly programming?
@AviSchwartz1
@AviSchwartz1 7 ай бұрын
I am running into couple of issues: 1. If I am using Pin.OUT on the sensor I am getting ETIMEDOUT error no matter if I am using PULL_DOWN or PULL_UP. I need to set the sensor pin to IN for it to work correctly. 2. Too fast a polling and I run into another ETIMEDOUT error. Looking at the DHT11 data sheet they do not recommend polling more than once a second. If I use a 1 second delay then the switch detection is a hit or miss unless I press it down for more than a second. I know this is a much more advanced topic but I'd say that instead of polling we need to use an interrupt so that the button press reading will not be affected by the 1 second delay in the loop.
@Ed-fv9rl
@Ed-fv9rl Жыл бұрын
Thanks Paul! The Lesson was excellent. but my setup kept bombing out. I had to add delays and execute the temp reading first and then deal with the toggle switch. I wonder if using separate processors would help. In any case, I was able to work the lesson...Onto 22... I do not feel like a legend : (
@robakers6127
@robakers6127 Жыл бұрын
This was another great class.... thank you
@scottwait3585
@scottwait3585 Жыл бұрын
Thanks Paul, this is a really good class!
@paulmcwhorter
@paulmcwhorter Жыл бұрын
Glad you like it!
@40and42
@40and42 7 ай бұрын
Hi Paul, may I ask You if You can record some videos regarding LORA + raspberry communication? I can't find good videos about this topic :(
@mattkojetin8198
@mattkojetin8198 Жыл бұрын
I’m not having good luck with micropython programming the picow from my macbook. I have no trouble with circuitpython. Is there some trick? It looks like the serial interface is not connected to the USB port.
@lorisrobots
@lorisrobots Жыл бұрын
I do all my programming from my macbook pro. I use Thonny and have only some minor issues with it. Sometimes just need to restart Thonny to get it to work well. Its free software so I try not to get upset it doesn't run perfectly. What have you tried so far?
@Ducerobot
@Ducerobot Жыл бұрын
Will this work with the regular pico.
@paulmcwhorter
@paulmcwhorter Жыл бұрын
Yes.
@peterbush3972
@peterbush3972 Жыл бұрын
I AM LEGEND. Got homework done and working
@paulmcwhorter
@paulmcwhorter Жыл бұрын
LEGEND!
@luke752010
@luke752010 Жыл бұрын
Besides measuring temperature and humidity, is it also possible to measure air pollution?
@TheTechRancher
@TheTechRancher Жыл бұрын
I don't know. But with some math you can do Heat Index.
@agoktugaydin
@agoktugaydin Жыл бұрын
at 21:25 that ant on the breadboard was me. i was trying to find the right pin to wire
@brucemilyko8549
@brucemilyko8549 Жыл бұрын
I am legend °F-°C. Ifi the formatting problem by making tempC a float and rounding tempF to one decimal place. I had to do that as for some temperatures tempF had 3 digits after the decimal place.
@hoellenstein
@hoellenstein 6 ай бұрын
Could work it out. Didnt switch to Fahrenheit but to Kelvin 😜
@320mb
@320mb 2 ай бұрын
I am Legend... Extra Homework was to add functionality to the Button, Well I added 2 more Buttons and set the Code to show Celsius on the First, Fahrenheit on the 2nd and Humidity on the 3rd button...It took a few hours to work out the Loop Logic... I'll make a Video and edit this post with a link.
@arnoldschmucker9977
@arnoldschmucker9977 Жыл бұрын
I did it! kzbin.info/www/bejne/Zou4aZZugJqXrJI Sorry about the mistakes in the Lesson 20 video. I momently got led astray by other videos, but under Mr. McWhorter's superb tutelage I was able to correct the mistakes.
@paulmcwhorter
@paulmcwhorter Жыл бұрын
LEGEND!
@320mb
@320mb 2 ай бұрын
I almost had it, the Temps were toggling back and forth on their own.... I had the IF statements wrong.... So, if anyone has issues with the Temp doing the Toggle... I went thru 3 buttons before i realized the buttons were bad, button number 4 was the Charm.... So it all works now.....
@captainprototype187
@captainprototype187 Жыл бұрын
I really dont like python. I will do these on arduino. But for now Im making my brushless motor using a fidget spinner. Gonna be real cool.
@keithlohmeyer
@keithlohmeyer Жыл бұрын
As the commercial says... Try it You'll like it I come from the Arduino world and thought much the same. Both have their benefits.
@roomanhaider
@roomanhaider Жыл бұрын
hi you are very amazing
@todd3c
@todd3c 11 ай бұрын
!!!!!!!!!! IF using the DHT11 from the kit, CHANGE my DHT22 to DHT11 (Had a dht22 in junk box that I used) from machine import Pin import utime as time from dht import DHT22 dataPin =16 # setup the DHT11 myPin=Pin(dataPin, Pin.OUT, Pin.PULL_DOWN) sensor = DHT22(myPin) time.sleep(1) # Wait 1 second AFTER setting up the sensor otherwise you'll get a data error butPin=14 # Button setup myButton = Pin(butPin, Pin.IN,Pin.PULL_UP) toggle = 3 butLastState = 1 while True: try: if myButton.value() == 0 and butLastState: # Button PRESSED if toggle ==3: toggle = 0 else: toggle = toggle +1 butLastState = 0 elif myButton.value() ==1: # Button released get ready for next press butLastState = 1 sensor.measure() temp=sensor.temperature() tempf = temp*9/5+32 hum=sensor.humidity() if toggle == 0: print(' ','Temp = ',str(temp)+chr(176)+"C",end=' ') elif toggle == 1 : print(' ','Temp = ',str(tempf)+chr(176)+"F",end=' ') else: print(' ','Humidity = ',str(hum)+"%",end=' ') time.sleep(1) except KeyboardInterrupt: break except: print("Data error from sensor")
@Wythaneye
@Wythaneye Жыл бұрын
Better late than never, my homework for lessons #20 and #21: kzbin.info/www/bejne/jJrHpqt9rdeChck
@paulmcwhorter
@paulmcwhorter Жыл бұрын
LEGEND!
@TheTechRancher
@TheTechRancher Жыл бұрын
My Homework Link: kzbin.info/www/bejne/b4S7c4Cjr5abqK8 I like being able to propagate and keep it from scrolling. I'm using cheap push buttons and I have the hardest time keeping them in my breadboard. It's time to upgrade!
@jimworden9021
@jimworden9021 10 ай бұрын
Homework for lesson 21. Same basic code as lesson 20 with the addition of a calculation for Kelvin and a little bit of formatting for the print. kzbin.info/www/bejne/a5qloY19bc14ms0
@paulmcwhorter
@paulmcwhorter 10 ай бұрын
LEGEND!
@karliskide2460
@karliskide2460 Жыл бұрын
Thank you for an amazing lesson! Here is my homework assignment for this one: kzbin.info/www/bejne/qYebdJ-VpbySq7M
@paulmcwhorter
@paulmcwhorter Жыл бұрын
LEGEND!
@snowman58able
@snowman58able Жыл бұрын
My solution to the homework. kzbin.info/www/bejne/m3-zhJxrjcpqqac
@paulmcwhorter
@paulmcwhorter Жыл бұрын
LEGEND!
@keithlohmeyer
@keithlohmeyer Жыл бұрын
Homework complete kzbin.info/www/bejne/Z6vXaJajfZKrfM0 Thanks Paul for another great lesson.
@paulmcwhorter
@paulmcwhorter Жыл бұрын
LEGEND!
@320mb
@320mb 2 ай бұрын
This is the Homework I did, I used 3 buttons to display the Info from the Sensor.... kzbin.info/www/bejne/ZpSopoaim9hsick
@paulmcwhorter
@paulmcwhorter 2 ай бұрын
LEGEND!
@VeryUsMumblings
@VeryUsMumblings Жыл бұрын
I am Legend. Her's my homework: kzbin.info/www/bejne/bn-ce35vht-HetU Thanks for another excellent lesson.
@paulmcwhorter
@paulmcwhorter Жыл бұрын
LEGEND!
Raspberry Pi Pico W LESSON 22: Using an LCD Display with the Pico W
28:11
СИНИЙ ИНЕЙ УЖЕ ВЫШЕЛ!❄️
01:01
DO$HIK
Рет қаралды 3,3 МЛН
When you have a very capricious child 😂😘👍
00:16
Like Asiya
Рет қаралды 18 МЛН
How to treat Acne💉
00:31
ISSEI / いっせい
Рет қаралды 108 МЛН
This tiny computer changes EVERYTHING
15:57
Jeff Geerling
Рет қаралды 887 М.
Pico W Episode 1: Setting Up the Raspberry Pi Pico W
12:48
Lori Pfahler
Рет қаралды 16 М.
Can you crack this beautiful equation? - University exam question
18:39
Hardware interrupts
27:36
Ben Eater
Рет қаралды 605 М.
Raspberry Pi as Fast As Possible
5:23
Techquickie
Рет қаралды 1,9 МЛН
When Did Raspberry Pi become the villain?
21:54
Jeff Geerling
Рет қаралды 1,8 МЛН
СИНИЙ ИНЕЙ УЖЕ ВЫШЕЛ!❄️
01:01
DO$HIK
Рет қаралды 3,3 МЛН