How to read the temperature sensor on the Raspberry Pi Pico

Поділитися
Вставка

КОМЕНТАРІ • 123

  • @TrapShooter68
    @TrapShooter68 4 роки тому +17

    I love to watch you work your way thru the errors until success. There are so many quotes abt learning more from failure than from success.

    • @avivarma6564
      @avivarma6564 4 роки тому

      It’s shows that there is truly a human behind the camera, I prefer it this way too!

  • @adamarzo559
    @adamarzo559 4 роки тому +2

    The Pico is about $5 in Australia. Wow! For such a complex board I can't believe how cheap it is. Definitely worth getting some of these for a few projects. Technology advancements like this are amazing. Great examples, thank you!!

  • @Keeping_IT_Simple
    @Keeping_IT_Simple 4 роки тому +1

    Fantastic Pico beginners guides - please keep on teaching us this new platform ....
    Too many channels would have edited out or skipped over the "mistakes" - the fact you leave them in proves what a great teacher you are as it is the mistakes that can teach you the most ....

  • @MattSimmonsSysAdmin
    @MattSimmonsSysAdmin 4 роки тому +4

    Your python has gotten much better in the last couple of days!

  • @fillempie1501
    @fillempie1501 4 роки тому +42

    It went wrong because the last row rows did not had a tab. It sticks in the loop and does not execute the last 2 lines.
    Python is tab sensitive.

    •  4 роки тому +4

      It was indentation - either spaces or a tab. In Python you can use either spaces or tabs but never mix them. Indentation is a very important part of Python's syntax - it marks blocks of code like {} in C or shell.

    • @deadly_dave
      @deadly_dave 4 роки тому +2

      I came here to say something similar.

    • @dripcode2600
      @dripcode2600 3 роки тому

      Oops! I just said the same thing above, before reading this. Great video!

  • @opalprestonshirley1700
    @opalprestonshirley1700 4 роки тому +3

    Pretty nice. Now all I need is a Pico. Thanks, Paul.

  • @tav9755
    @tav9755 4 роки тому

    You are lucky. You got one! In Germany it is sold out. Great that you jumped right onto this new toy and teach us how to use it.

  • @anupamvipul233
    @anupamvipul233 4 роки тому +2

    If can have a look at RTC part of it too

  • @mateus72483
    @mateus72483 3 роки тому

    I buied the pico on this weekend and the video help me understand how the internal sensor works! thank very much!

  • @gartmorn
    @gartmorn 4 роки тому

    I think this board will take off big time! It helps that its big brother is the pi! Another learning curve to negotiate with the python family of languages but it seems to be the way forward! Look forward to seeing what the community comes up with in the way of standalone projects.

  • @philipatkinson1532
    @philipatkinson1532 4 роки тому +3

    I too was wondering if you were working in fridge. Cool video! And, absolutely right, everything is better with cheese :)

  • @paulb36utube
    @paulb36utube 4 роки тому +2

    Love it.
    Temperature recording led lighting and button boxes are my thing.
    Very excited about this cheap board. Especially as I can get non clones from Australia.

  • @mikeoliver3254
    @mikeoliver3254 4 роки тому

    Man this pico looks powerful and micro python looks easy to work with I cannot wait to get one of these. I look forward to more videos on this thing even with the new language hiccups. Great video Paul, this is great new fun.

    • @learnelectronics
      @learnelectronics  4 роки тому +1

      Thanks Mike. How are you these days?

    • @mikeoliver3254
      @mikeoliver3254 4 роки тому

      @@learnelectronics oh man I’ve been spending less time on UA-cam and more time at the electronics bench. I’ve been working on a synthesizer using a as3340 and a few cd4000 series logic chips it’s been fun but frustrating, I keep ending up with inconsistent volume levels from different chips. I think I just need to get a bunch of op-amps and buffer all of the outputs from every chip so I can get the basic sounds working and then I have a bunch to learn about the different filters I’m going need down the road. Maybe one day I’ll have it functioning enough to get some boards made up, well that’s the hope.

  • @LightningHelix101
    @LightningHelix101 4 роки тому +4

    Wholesome content and a little muddling through it, so it looks like even I can do it. Mines coming in a few days:)

  • @thetedcor
    @thetedcor 4 роки тому

    i like your vids, i got my pico's last week but havent had time to play yet.

  • @stevetobias4890
    @stevetobias4890 4 роки тому +1

    Very cool, I have been thinking about investing in one of these boards.
    Thanks mate.

    • @jeanyluisa8483
      @jeanyluisa8483 4 роки тому

      I'm not trying to stop you from buying one, I bought one myself. But just in case you already own a Esp8266, Esp32, STM32 or so, you can use them with Thonny and Micropython too.

  • @carl7221
    @carl7221 3 роки тому

    Great video, just what I was looking for, thank you.

  • @devvrattoshniwal8971
    @devvrattoshniwal8971 2 роки тому

    How many readings per second is it capturing? And can that number be increased

  • @DIYwithBatteries
    @DIYwithBatteries 4 роки тому

    Your videos are always knowledgeable I like it Sir 👍

  • @robholbert8188
    @robholbert8188 4 роки тому

    Thanks Paul, appreciate the videos. Keep up the good work/content!!

  • @mattantonelli4273
    @mattantonelli4273 2 роки тому

    you are a genius i have learned so much to day

  • @Popsimath
    @Popsimath 4 роки тому +1

    I did this on, in F, and would like to see more beginner Pico videos soon. Possibly with different types of motors? or a Humidity sensor with an LCD readout? in Python.

  • @paulcabrelli1863
    @paulcabrelli1863 4 роки тому +1

    Great videos/.tutorials. I am enjoying these plus also learning a lot as well :)

  • @joshualittlefield1541
    @joshualittlefield1541 3 роки тому

    how do i do it in f?

  • @michaelpadovani9566
    @michaelpadovani9566 4 роки тому

    Great demonstration Paul. Anyone know if utime.sleep is blocking (like Arduino delay)?

  • @petersnyder1642
    @petersnyder1642 4 роки тому +2

    Thanks Paul.... any suggestions on where to find a ras pico. Amazon and Banggood seem sparse. Thanks

    • @AWriterWandering
      @AWriterWandering 4 роки тому +2

      I doubt you’re going to find it in stock anywhere right now. The demand is just so high that you’ll just have to wait and snatch one up from the next batch.

    • @garyhardman8369
      @garyhardman8369 4 роки тому +1

      Not sure where you are in the world.
      However, multiple sellers have them on EBAY UK.

    • @Biser10562
      @Biser10562 4 роки тому +2

      I picked up a few yesterday at Micro Center in Yonkers, NY. They were available for $2.00 US each - so I bought three.

  • @TheRealFrankWizza
    @TheRealFrankWizza 4 роки тому

    is it possible to read a camera from the usb?

  • @gadjetsvideo
    @gadjetsvideo 4 роки тому +3

    Thanks for the video, I had already tried this but found that the accuracy using the calculation supplied was terrible, about 4/5 degrees out. Did it feel like 14 Degrees C in your workshop? I would rather use an external DS18B20 but I don't think the onewire library is implemented yet?
    **Update **. I switched to Circuitpython as it has a onewire library and a Ds18x20 library.

  • @kencohagen4967
    @kencohagen4967 4 роки тому

    I want something I can build a guitar effects pedal switcher. Something I can program, then when you step,on a switch it will turn on and off a preselected set of pedals. Is that possible with these?

  • @Spentelectrons
    @Spentelectrons 4 роки тому

    Can you flip the board and solder the header to the other side?

    • @willsgrandad
      @willsgrandad 4 роки тому +3

      There is a button on the “top” side which you need to press sometimes. That would be underneath if you put the headers on the other way round. Looks like the best way is to print off the pin out reference sheet. Do agree it’s a big mistake printing labels on the “bottom” side.

    • @Spentelectrons
      @Spentelectrons 4 роки тому

      @@willsgrandad I don't do digital so I have no idea. Is that an issue? Can it be pulled from the board, the button pressed, and it programmed, and reinstalled?

  • @alheeley
    @alheeley 4 роки тому

    How to calibrate it? Mine reads 15.5 C in my study and I know the temperature is about 19 - 20

  • @aranyaakashmandal6548
    @aranyaakashmandal6548 2 роки тому

    Is this onboard temperature sensor good for measuring room temperature?

    • @learnelectronics
      @learnelectronics  2 роки тому

      Not particularly unless you take into account the heat of the chip

  • @deeptimaanbanerjee6330
    @deeptimaanbanerjee6330 2 роки тому

    Hey! Just a question, does this give us the room temperature? Because my room surely is at 30 C and it shows just 22 C.

  • @nbj77095
    @nbj77095 2 роки тому

    Have you ever tried to create a SPWM signal with the Pi Pico. I have this on an AMTEL328P but having difficulties bring it over to the Pi Pico. I'm not a firmware GURU rather a power electronic person. Need some help... Interested?

  • @dr.shoveler7794
    @dr.shoveler7794 Рік тому

    you had the print outside of the while true statement, so it never got to that portion of the code.

  • @MegaNursen
    @MegaNursen 3 роки тому

    Awesome vídeo!
    I was wondering if is possible to Connect an external thermistor. For measure an external temperature
    Thank you so much!

    • @learnelectronics
      @learnelectronics  3 роки тому +1

      Yes, absolutely

    • @MegaNursen
      @MegaNursen 3 роки тому

      @@learnelectronics could you upload a tutorial ? You would help me a lot! Thank you

  • @dripcode2600
    @dripcode2600 3 роки тому

    Great video! You code was correct at first, it was just missing "tabs" on the last 2 lines. Python requires "tabs" for scope (e.g. python saw the last 2 lines as not being in the while loop).

  • @garymetheringham4990
    @garymetheringham4990 4 роки тому

    tip! only main.py (your auto run on powerup sketch) and drivers need to be saved on pico, test sketches like this can be saved locally and still run on pico.

  • @gl0sek
    @gl0sek 4 роки тому +1

    Great video but I have one question. If our ADC is 12 bit why do we divide by 65536 and not 4096? I always thought that 12 bit means 2^12 so max "resolution" should be 4096. It looks more like a max value of a variable but that is just a guess.

    • @ExpectMichael
      @ExpectMichael 4 роки тому +2

      The pico library expands it to a full 16 bit value. This way future boards with higher ADC resolution will still be compatible with older code.

    • @gl0sek
      @gl0sek 4 роки тому +1

      @@ExpectMichael Oh ok I understand. Thank you for reply!

  • @oswaldjh
    @oswaldjh 4 роки тому +1

    Temperature reading of 14°C is about 57°F. Are you in an unheated space or did you just take the Pico out of the fridge?

  • @TheRealTombi
    @TheRealTombi 4 роки тому

    Due to the granularity of the readings, notice the repeated values where the Temps report the same each time. I would recommend a round up function to the nearest whole number. Not many applications require anything more than this anyway.

  • @UncleEngineer
    @UncleEngineer 4 роки тому

    Thank you, Paul. waiting next video

  • @stevefox3763
    @stevefox3763 4 роки тому

    Now if Raspberry Pi could shrink the Zero into that form factor while keeping the CSI connector, the 1Ghz processor and 512mb ram, it would have a load of us super excited, there is a whole community using the Zero for digital HD FPV in our RC Craft :)

  • @niklasnorrthon3125
    @niklasnorrthon3125 4 роки тому +4

    14 deg Celcius = 57 deg F. Doing this outdoor? :)

    • @bassblom
      @bassblom 4 роки тому

      he is a polar bear ;+)

    • @MS-ho9wq
      @MS-ho9wq 4 роки тому

      ikr, must've been freezing 'is bollocks off; my biggest takeaway from this video: this guy is a mad lad lol

    • @jeanyluisa8483
      @jeanyluisa8483 4 роки тому

      I just tried the same program on my pico. Mine shows about 3 deg Celsius too low.
      It's just a guess, but I can imagine the temperature is in the chip because its purpose usually is to measure the core temperature and protect the chip from overheating.
      As Pico users might be more interested in the ambient temperature, that weird factor is probably rather an estimation than a real calculation of the temperature outside the chip.

    • @drescherjm
      @drescherjm 4 роки тому +1

      I say not in his neighborhood. It's been at least a month since we have seen that high of a temp outside. I live within 50 miles / 80km of Paul. This morning I went for an inline skate and it was around -5C / 23F.

    • @niklasnorrthon3125
      @niklasnorrthon3125 4 роки тому +1

      @@drescherjm I had no idea where Paul lives. I live in Stockholm, Sweden. Here it's about -10C outside.
      The program in the video that shows the temp is listed in the "Get started with Micropython" book. I run the same program and got approximately the same temperatures.
      Guess the calibration is a bit off...

  • @mattantonelli4273
    @mattantonelli4273 2 роки тому

    great stuff man

  • @BeetleBeetleY
    @BeetleBeetleY 4 роки тому

    Hello! Why does the temp appear to be off? I'm assuming it was not actually 14°C in your shop - that's 57°F

  • @alistairgill5538
    @alistairgill5538 4 роки тому +1

    I can see why Python is popular as a programming language. Particularly, on German keyboard you have to do fancy gymnastics to get to curly brackets.

    • @sssxxxttt
      @sssxxxttt 4 роки тому

      I was so happy when usb keyboards were introduced. One can have an us for programming and an european keyboard for documenting/mail.

    • @alistairgill5538
      @alistairgill5538 4 роки тому +1

      @@sssxxxttt hmmm. I get mixed up if I try a different keyboard. Particularly y and z and all the signs/punctuation marks. They're all over the place on a German keyboard. Initially I had an English layout - I guess US actually - but eventually changed to the German one and learnt it.

    • @sssxxxttt
      @sssxxxttt 4 роки тому

      @@alistairgill5538 Agree, but I get that problem every time my employer issues me a new laptop. The keyboards are never the same. Admitted I don't get to immerse into programming as I once did, but it's obvious the symbols chosen are much more convenient on a us-layout.

  • @conradh7659
    @conradh7659 4 роки тому +1

    Great video Paul! Looks like the temperature is reading low (14C ?); I doubt you were in a room at that temperature, brrr! Is there a way to calibrate the temperature sensor?

  • @alistairgill5538
    @alistairgill5538 4 роки тому

    You mixed bits and bytes. The AD converter has a maximum value of 4096 - 1 because it has 12 bits.

    • @alistairgill5538
      @alistairgill5538 4 роки тому

      Sorry. I confused you pronunciation of "but" for byte.

    • @alistairgill5538
      @alistairgill5538 4 роки тому

      Sorry I confused your pronunciation of "but" for "byte"

  • @ivegotpetercriss
    @ivegotpetercriss 4 роки тому +1

    Did you and Ben Heck coordinate this??

    • @learnelectronics
      @learnelectronics  4 роки тому

      Never talked to him, I would love to work with though.

  • @bblod4896
    @bblod4896 4 роки тому

    I think it's very cool. How about putting an Ice cube on the sensor to check its calibration?
    Thanks Paul. Peace.

  • @salan3
    @salan3 4 роки тому

    Thank for this. Problem though Pico says it's 24C Thermometer says 17.5? Any idea?What I have typed (which hopefully is the same as yours but I am dyslexic!):import machine
    import utime
    sensor_temp = machine.ADC(4)
    conversion_factor = 3.3/(65535)
    while True:
    reading = sensor_temp.read_u16()*conversion_factor
    temperature = 27 - (reading-0.706)/0.001721
    print(temperature)
    utime.sleep(2)

    • @twistedsoul
      @twistedsoul 4 роки тому

      From my understanding it's giving you the internal CPU temperature, not an environmental reading unfortunately. The thermistor diode is inside the die.
      However his CPU was cold because of his environment, if he ran a tight loop for a while it would soon jump up

  • @michaelrobert4094
    @michaelrobert4094 3 роки тому

    temperature = 32.3 - (reading - 0.706) / 0.001721
    seems to match the temperature reading of my AstroAI multimeter.
    temprature can easily been displayed in Celsius and Fahrenheit like this:
    celsius = 32.3 - (reading - 0.706) / 0.001721
    fahrenheit = celsius * 1.8 + 32
    print("{} Celsius / {} Fahrenheit.".format(celsius, fahrenheit))

  • @jeanyluisa8483
    @jeanyluisa8483 4 роки тому +1

    Wow, another video with perfect python code just one day later. That looks like someones ego got a bit hurt he learned micropython all night long after Thonny didnt like C code the other day ;-)
    I like that "pretty simple" comment after the first two lines ;-) It's true, typing those 4 words is pretty simple, at least after finding out they are needed and what they are good for.
    The first time I looked at micropython, I entered all the import commands I found in the documetation into my boot.py. I thought this way I never need to remember and type them again ;-)

  • @robwebster7406
    @robwebster7406 4 роки тому +1

    Thank you for your great vids 👍 one question, when I skip the 5 to 7 seconds ads do you still get paid for them 🤔 keep up the great work 👍

    • @NewAgeDIY
      @NewAgeDIY 4 роки тому +1

      Get Prime. No ads.

    • @learnelectronics
      @learnelectronics  4 роки тому

      I honestly don't know. Don't worry about. Your skipping at most costs me 0.00001 cents. I can take it. Thanks for watching, and thinking of me.

  • @TOMTOM-nh3nl
    @TOMTOM-nh3nl 4 роки тому

    Thank You

  • @aprilliac
    @aprilliac 4 роки тому +1

    python whitespace will getcha

  • @amirb715
    @amirb715 4 роки тому

    yes please continue on :-)

  • @paulmacgiollacaoine8619
    @paulmacgiollacaoine8619 4 роки тому

    Nice video.
    Maybe it's my lack of imagination but without wifi, bluetooth. lora interface what use is the pico as an isolated device?
    I mean just printing the temperature to a screen doesn't seem exceptionally useful.
    Thanks :)

    • @learnelectronics
      @learnelectronics  4 роки тому +1

      You can take the temperature as an input, Have device process it and then activate other pins as an output either activating relays or other displays

    • @Biser10562
      @Biser10562 4 роки тому +1

      My first application is to replace the thermostat in a small under-counter refrigerator. The Pico is $2 and a two relay expansion board was $4 at Micro Center. Six dollars to replace a $16 dollar mechanical unit... (Excludes power supply - of which I have too many)

    • @paulmacgiollacaoine8619
      @paulmacgiollacaoine8619 4 роки тому

      @@Biser10562 nice, is there a relay expansion board for the pico?

  • @furrane
    @furrane 4 роки тому +1

    11:04 It was an indentation mistake : the last two lines ( "print(temperature)" and "utime.sleep(2)" ) were not indented and thus were out of the "While True" loop. And of course, since the "While True" loop is infinite, anything written after that is never going to execute.
    Also, I higly suggest you to take the habit of using TAB for indent and not a single space like you did. It might be wierd at first but trust me, in the long run it will save you a lot of headaches if you're serious about micropython/python =)

    • @learnelectronics
      @learnelectronics  4 роки тому

      Yep

    • @brucehanson4147
      @brucehanson4147 2 роки тому

      @@learnelectronics Also left 'sleep" out after utime
      Well presented and explained, easy to follow

  • @thebeststooge
    @thebeststooge 4 роки тому

    Tile: How to read the temperature sensor on the Raspberry Pi Pico
    Me: From left to right.

  • @wallaceshackleton1889
    @wallaceshackleton1889 4 роки тому

    Your working environment it 14C?
    You must be made of strong stuff indeed, perhaps there's a mistake somewhere with the temperature read out.
    HOWEVER, I enjoyed the video and learned something in the process, thanks.

    • @learnelectronics
      @learnelectronics  4 роки тому +2

      The window was open. I burnt up a rectifier and was venting the fumes.

  • @electroniquepassion
    @electroniquepassion 4 роки тому

    Merci 😉

  • @boi_doingthings
    @boi_doingthings 4 роки тому

    I thought the pico had a onboard temperature sensor.

  • @NewAgeDIY
    @NewAgeDIY 4 роки тому

    Paul, yes that’s cool. Now let’s work on a graph or dial.
    Lookout Nest!

  • @Jimwill01
    @Jimwill01 4 роки тому +1

    Adafruit seems to be out of them.
    Big github page of examples - github.com/raspberrypi/pico-examples

  • @TheBinarydeity
    @TheBinarydeity 4 роки тому

    why didn't they design the pico pins to be silkscreened? very amateur. Can you use vscode instead of thonny or is thonny required ide? also , you may want to semicolon the end of each line.

  • @davidkerr8030
    @davidkerr8030 4 роки тому

    Hi Paul, thanks very much for the videos on programming the Pico. When you have used it for a bit longer, maybe you could do a video on how it compares to the Arduino Nano in terms of performance, versatility, interfacing, ease of use etc? Seems that on paper, the Pico is way better.

  • @electronic7979
    @electronic7979 4 роки тому

    👏👏👏

  • @juliocosta5818
    @juliocosta5818 3 роки тому

    Whilst it does indeed change with ambient temperature, the actual reading obtained by this method is grossly inaccurate. Either the equation is incorrect, or some reference voltage or current needs to be correctly set. Surely it wasn't 14°C in your lab, and your heat gun would have been hotter than 20°C?!

  • @dusankreslin2898
    @dusankreslin2898 4 роки тому

    fahrenheit = (celsius * 1.8) + 32

  • @normcaissie5598
    @normcaissie5598 4 роки тому

    you live in a fridge?

  • @weerobot
    @weerobot 4 роки тому

    Makes Arduino look easy...lol

  • @OnlyKnowsGod
    @OnlyKnowsGod 4 роки тому

    The whole process of the programming the pico is in nessasary messy. They need a ide that allow for Arduino library use. And eases upload seamlessly. I don't think trying to beat Arduino on price will work without the ease that Arduino brings in seemless upload of programing with its massive library's and ide. Pico will need to bring more to the game then price. As if your programming in micropython for microcontroling then you could pick up an raspberry pi2 cheap and use that then buying a pico. Sorry I'm a microelectronic engineer and the block to using a microcontroller for electronic control shouldn't be blocked by very few library's and programs and a messy upload and programming method. I know I'm gonna get gait for this but it's true. Raspberry have spent too much time on the board and for got the pc side software interface.

    • @garymetheringham4990
      @garymetheringham4990 4 роки тому

      there is also a massive micropython library of sensor drivers, and it's a lot easier to add/alter the driver if its not quite how you like it. it can also be programmed in C ! and through arduino ide soon

    • @alistairgill5538
      @alistairgill5538 4 роки тому +1

      Have I understood it correctly that single step debugging is possible? That would make me consider a pico instead of the arduino. Of course it is possible to use the atmel IDE with the arduino but that is another level of complexity. For my purposes, the arduino and simplicity of the IDE is fine.

    • @garymetheringham4990
      @garymetheringham4990 4 роки тому +1

      @@alistairgill5538 I'm finding micropython Fairly easy to get to grips with after using arduino, definitely a lot easier to edit code, and of course you got the added advantage of the REPL so you can run commands directly,
      Think back to 8bit computers like the commodore 64, you use the editor window like typing in a program with line numbers and the REPL (output window) for direct commands (no line numbers) is the easiest way to explain how micropython works

    • @alistairgill5538
      @alistairgill5538 4 роки тому

      @@garymetheringham4990 I never used the commodore but Basic in DOS. (Thanks to Bill). So the idea of running immediate commands is familiar. That's a while ago! But a good debugger setting breakpoints and checking register and variable values is really important for debugging more complex algorithms.