Raspberry Pi LESSON 15: Analog Input on the Raspberry Pi Using the ADC0834

Поделиться
HTML-код
  • Опубликовано: 29 сен 2024
  • Announcing the Most Awesome Raspberry Pi Lessons of All Times! This time we RUMBLE!
    In this class series, we will be using the most excellent Sunfounder Ultimate Raspberry Pi kit, available here: (Affiliate Link)
    amzn.to/3tSk9Mo
    or for our UK friends, amzn.to/3I5d401
    In this lesson I will show how to do analog reads with the Raspberry Pi. This will be done using the ADC0834 Analog to Digital Converter Chip.
    If you want to grab those cool little straight jumper wires I am using to keep my breadboard builds neat and clean you can snag a box of them here:
    amzn.to/36NyfHq
    If you guys are interested in the oscilloscope I am using, you can pick one up here (affiliate link):
    amzn.to/3v13Mhl
    You guys get your hardware ordered so you can follow along at home!
    You will also need a Raspberry Pi. I suggest the Raspberry Pi 4. If you do not already have one, this is the most suitable gear I could find:
    amzn.to/3pBMfKm
    The Raspberry Pi's are sort of pricy right now, so you can look on ebay or elsewhere to see if there are any deals. You will need a SD card. If you do not already have one, this is a good one:
    amzn.to/3KcXTn2
    I like using a wireless keyboard and mouse to have fewer wires. You can certainly use your USB keyboard and mouse, but if you want a nice wireless one, this one works on the pi. We demonstrate this by using a button switch to control a LED.
    amzn.to/36Rv9Sk
    You guys can help me out over at Patreon, and that will help me keep my gear updated, and help me keep this quality content coming:
    / paulmcwhorter
    [Disclosure of Material Connection: I am a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to amazon.com. ]
    #VPYTHON
    #RESISTTHEMETAVERSE
    #RASPBERRYPI

Комментарии • 85

  • @donaldhoudek2889
    @donaldhoudek2889 2 года назад +16

    Hi Paul, It could be a little confusing to the new comers when they see that you reversed the V+ and GND jumpers.

    • @batticha462
      @batticha462 Год назад

      There is no need to do that !

  • @davemessink6410
    @davemessink6410 8 месяцев назад

    Thank you for all the great videos! In this video you sort of hand wave over why the ADC0834 is safe at 5v. I've googled this and cannot find a clear answer why this is safe. My main concern is that I often use a debugger and if I set a breakpoint when the gpio input is high it reads 5v (I tested this but disconnected the DIO lead first). I'm wondering if it's considered safe due to a data stream of highs and lows -- where hitting a breakpoint when it's high might fry my PI v4. Any thoughts?

  • @Leonilian
    @Leonilian Год назад +4

    Hi Paul, not sure if you still read the commens from these older videos, but I do have some feedback. This video, unlike the others so far, seems be more of a "do what I say" video instead of "here's why we're doing this". Why did we setup the circuit like that? What are the reasonings behind the actions we perform? This video doesn't feel like it teaches the reasoning behind the actions, more like it's just saying "go here, do this, because I said so." It would have been nice to go over the schematic and give information as to why we wire it up like we do, or briefly go over the library and explain how it works and the logic behind it. Also, the library is set to use the GPIO 17, 18, and 27, so saying that it doesn't need arguments when running ADC0834.setup() is a bit of a misnomer if someone were to wire it up without using those exact GPIO pins in the future, and could cause undue stress if the person doesn't know to look in the library to see why it isn't working. This series has been good about explaining the reasons why we do things, but this video is a bit of a letdown in that regard, sadly.

  • @upperlip
    @upperlip 8 месяцев назад +1

    Thanks again for the great lesson!
    I have 2 issues:
    1) the reading of the potentiometer is not constant. It gives a value, followed by some zero's, then a value again... Is the simple solution to switch ground and 5V on the potentiometer?
    2) when I turn the meter to te left, the value increases and the other way around
    What do I do wrong?

  • @donaldhoudek2889
    @donaldhoudek2889 2 года назад +4

    I forgot to finish my original post...
    I am at 73 years young, attended DeVry Tech when it was an Electronics Trade school during the 60's in Chicago, and still love electronics projects. Your videos make these projects so easy to try and SUCCESSFULLY complete. Keep up the GREAT lessons!!!

  • @jameslewellen150
    @jameslewellen150 2 года назад +4

    Why did you not use the + and - of the breadboard?

  • @warrenscorner
    @warrenscorner 2 года назад +3

    Ahhhh! I couldn’t do it! I could not make the red rail the ground and the blue one 5V. My OCD over powered my ADD.

    • @paulmcwhorter
      @paulmcwhorter  2 года назад +1

      Warren, I was surprised that that bothered a lot of people, not just you. In my mind, the label means nothing. The ground rail is the rail I connect to ground. I do wish the board was symmetric, like the top and bottom rows on the board were power, and the second to top and second to bottom were ground. I dont like that the top row is not always power rail, depending on orientation, so I ignore the labels. I guess one could argue it is poor engineering practice to ignore labels. Thanks for the comment.

    • @anitacunningham7831
      @anitacunningham7831 2 года назад +1

      Warren, I could not do it either!

  • @fablapp
    @fablapp 7 месяцев назад

    the extension board design is far from being perfect actually. Maybe the problem is that I do not have the exact hardware (sorry to be me, yes your life probably is going to be easier), but it is not possible to fit it well with the ventilator installed (using the original one)... adding that I am using the new RPI5 I have pretty much to rewrite the code... everything seems to have changed!

  • @ukerodriguezmartin3835
    @ukerodriguezmartin3835 3 месяца назад

    Hi teacher.. first of all thanks for our excellent work it is very encouraging and inspiring for me.. I just wnted to point out that on the physical bread board you have used what is suposed to be used as a positive line all along aas the nevative one the opposite way... positive as ground and ground as positive.. and I believe that particularly for noobies it can lead to mistakes..
    It is just an opinion..ones again thanks for all you nice work!

  • @tamerghaly4592
    @tamerghaly4592 Год назад

    Dear sir
    I got really confused after watching this video
    You have made a great jump and I couldn’t follow
    I have been so patient throughout the last 14 videos but suddenly I got lost
    Please help me out
    Where to start
    I even went to the playlists you have made and decided to start over from the arduino videos you made 8 years ago to get everything from the very beginning
    I hope that will work
    I’m a 45 year old pharmacist and trying to learn something
    But I have no clue about electricity or programming
    So I want to learn from the very beginning and without any great jumps
    So is it going to be good for me to pause the raspberry pi videos now and start fresh again with those older videos??

  • @captinkrazy6968
    @captinkrazy6968 6 месяцев назад

    i got this working. I just dont understand how you know where to put the pins bc they are not designated in the program.

  • @TheUnofficialMaker
    @TheUnofficialMaker 2 года назад +1

    Excellent as always, btw there is a young eng. named Mark Rober that just started Crunch Labs and is making monthly kits for kids 8-12 to learn and also does a video on how to assemble the kits and the principles behind it. HIs new lab is over the top!

  • @fabersoaks4975
    @fabersoaks4975 6 месяцев назад

    I dont have ADC0834 can use ADC0808CCN?

  • @opalprestonshirley1700
    @opalprestonshirley1700 2 года назад +2

    Enjoyed this lesson. Seeing those numbers from the pot change is as much fun as seeing the red led come on. It's funny how you get older it's the simple things that satisfy. God Bless and have a great birthday.

    • @seanbethell6736
      @seanbethell6736 2 года назад

      I was going to ask the same question, 5v = positive "+" and ground is negative "-", this is very confusing for those that have the same basic training.

  • @S-PRODUCTION1
    @S-PRODUCTION1 23 дня назад

    the best teacher

  • @hankehly
    @hankehly 11 месяцев назад

    Homework solution: ruclips.net/video/s9e-KbAsIzo/видео.html
    I was inspired to learn what is happening in the ADC0834 library (how the code interfaces with the hardware, the protocol, etc.) and after watching another homework solution video by @keithlohmeyer ended up coding it myself (borrowing from others). There's a link in my solution video description. I added a link to this video at the bottom.

  • @weakgrand
    @weakgrand Год назад

    The Raspberry Pi GPIO pins can only read/write at 3.3V. The ACD0834 outputs 5V. How does this not break the Raspberry Pi?

  • @masonscott8029
    @masonscott8029 Год назад

    Question for you Paul, and In reading the comments it looks like others have this same question as well. the library for the ADC that did all the hard stuff for us, but I'm curious to understand how the library works! Do you have a video or anything explaining this or something similar? specific question that come to mind right off the bat are: why did you choose delays of 0.000002 (500kHz) ? on the datasheet for the 0834 it sais the max clock frequency is 400 kHz so I'm confused. also, this raises the question of how accurate exactly is the time.sleep() function? 2 microseconds seems pretty darn good, although I guess the arduino has a delayMicroseconds function or something. Also, do you have to account for the time it takes to set the GPIOs high or low in addition to your delays? I would love. can you pick any clock speed? what exactly are the ODD/SIGN , start bit, select bit? I have so many questions! If you had a more advanced video to cover this that would be insane because I can hardly find anyone who has a video explaining how to decipher this serial protocol stuff.

  • @alexandrebrittopereira8237
    @alexandrebrittopereira8237 10 месяцев назад

    Hi Paul! Although my breadboard has the numbering growing from left to right like shown in your video, positive and negative rows are ordered differently. Should I connect the wires the same way you did, or should I consider that positive and negative are in a different row and stick to that?

  • @LowProFile1803
    @LowProFile1803 Год назад

    I couldn't get the program to run. I was getting "setup has no attribute". After a lot of tinkering, I ended up removing the last block of code in the library (from "if __name ... to the end of the file) and it worked. Not quite sure what are the side effects of that and the reasoning behind this if statement and the loop function. If you're stuck with the same problem that could help. I would have love to get an explanation of the libraries code. Thanks for the great content Paul, I am having a blast!

  • @hammadahmed3409
    @hammadahmed3409 Год назад

    Homework ruclips.net/video/oNiTUzVDJgE/видео.htmlsi=WtoIsJUDaasDV8xa
    Controlling led digitally causes flickering and latency. Connecting led positive leg to potentiometer middle leg gives more natural dimming

  • @billgregg
    @billgregg Год назад

    Just did the easiest thing I could think of. Let's see if we did it the same in your next video...
    Thanks for the lessons. I really wish videos like these had more information about why these chips like ADC0834 are wired they way they are. I can parrot just fine, but WHY is it wired the way it is. What is going on here? Probably too much for a lesson like this, but I would like to find videos explaining what's happening with all the pins I'm hooking up to the RPi.
    My homework: ruclips.net/video/dah7kUFMJ3Y/видео.html

  • @lorisrobots
    @lorisrobots 2 года назад

    Thanks for reviewing my first hw video! I appreciate your feedback. Here is an updated version. Great lesson. ruclips.net/video/WUn7Q4k9q98/видео.html

  • @dphair3805
    @dphair3805 11 месяцев назад

    Had a few issues as my software is newer, Raspian / Linux 11 is Bullseye and Python is ver 3.9. Thanks to comments and your tip how to configure Thonny were very helpful.

  • @thaoluc1810
    @thaoluc1810 2 года назад

    Hi Paul, your video is great. I have a problem about i2c communication standard of Rasberry 3b+ as follows: When I use sudo i2cdetect -y 1 command to check i2c connections all connections show up from 08 09 0a... to 77 although I don't connect to any i2c devices. Is it really that big of a deal for me?!

  • @PlausibleIdea
    @PlausibleIdea Год назад

    Paul - can you explain the ADC interface and how it functions? I was successful however I do not understand the interface and how the PI reads from the ADC0834

  • @ShinesMonkey1
    @ShinesMonkey1 Год назад

    Hi Paul! Just a tip I learned while playing around with various DIP ICs with the tiny little fragile legs mounted onto breadboards; sometimes they can grab on pretty tight and don’t wanna come out. If you don’t have an IC puller, just run a small piece of insulated wire through the breadboard trough underneath the IC, come back up and make a loop and pull straight upward. If you pull slowly and carefully this usually keeps the legs from bending at all for me. Again, great lesson Paul.

  • @arlo4051
    @arlo4051 2 года назад

    Homework done : ruclips.net/video/PLRhSZ3gYgs/видео.html I didn't think it would be difficult but the ChangeDutyCycle gave me a headache with "no attribute found" Arduino was definitely easier with analog. Apologies for the shaky video.

  • @cbrombaugh
    @cbrombaugh 2 года назад

    I AM LEGEND! Thanks for showing us the workaround for Raspberry Pi omitting analog inputs, Paul. Is it normal for the RPi to work with 5v inputs?

  • @jaythompson5102
    @jaythompson5102 Год назад

    I had some issues with this lesson due to the components. The expansion board requires quite a push into my breadboard, I was not able to get a value until I actually pressed the board quite hard into it to sink those connections down properly. Just thought I'd mention that to anyone having similar struggles, the pins have to be completely sunk into the breadboard so that you cannot see any metal or very little exposed.

  • @arguedas02
    @arguedas02 2 года назад +1

    Blessings to you.. Great content, Paul! I do enjoy every single lesson …

  • @daviddirac5942
    @daviddirac5942 Год назад

    My highest reading is only 196, not 255. Is this an indication that something is wrong.

  • @KarthikBhandary
    @KarthikBhandary Год назад

    Hey paul are there any other ICs available other that ADC 0834 to use as a converter?

  • @trevorblanchard923
    @trevorblanchard923 3 месяца назад

    I am a legend.

  • @markbooco1719
    @markbooco1719 Год назад

    Hello Paul! Very good lesson. Thank you for all the hard work putting these lessons together.

  • @captinkrazy6968
    @captinkrazy6968 Год назад

    board and drawing has posative and negative rails backwords

  • @davidschnider1297
    @davidschnider1297 Год назад

    well that was FUN... what a pleasure to be using the Thonny Development Environment... a comment: My version of Thonny only permitted python 3.8 or higher.. looking in /usr/lib/python3.8 I found it to be EMPTY.. looked inside /usr/lib/python3.9 and voila.. lots of files.... so, I put my copy of ADC0834 in python3.9.. and BOOM... it worked! here is my a link to my solution.... ruclips.net/video/WTDCZYQkqJ4/видео.html

    • @paulmcwhorter
      @paulmcwhorter  Год назад

      Excellent. Love your little wooden build tray.

  • @suelingsusu1339
    @suelingsusu1339 2 года назад

    👍👍👍👌👌👌👌👏👏👏👏🙏🙏🙏🙏🖖🖖🖖🖖🖖

  • @pralaymajumdar1206
    @pralaymajumdar1206 2 года назад

    Nothing to say... Just outstanding lesson.. U r real magic man🙏

  • @georgebibyk1122
    @georgebibyk1122 Год назад

    Do you have any tutorials using capacitance?

  • @davidbundy5365
    @davidbundy5365 2 года назад

    Hi Paul, I just received The Sunfounder kit, which is exceptional value and has all that's required, compared with the $100s I've spent on my Arduino for much less. I'm now eagerly waiting for the jumper wires which are 840 compared with kits I've been buying for same price with about 40 jumpers and poor length and color selection. Thank you.

    • @paulmcwhorter
      @paulmcwhorter  2 года назад

      The sunfounder kit is a great value. I think it is going to keep up busy for a couple of years. Hope you can also follow along in the Fusion 360 lessons. At some point I would like to 3D print enclosures for our Raspberry Pi projects.

  • @keithlohmeyer
    @keithlohmeyer 2 года назад

    Not finding the "reading analog signals" page on your TTB search. Can you provide a link to the page?
    Thanks

    • @paulmcwhorter
      @paulmcwhorter  2 года назад

      toptechboy.com/reading-analog-signals-with-the-raspberry-pi-and-the-adc0834/

  • @mmulisha1022
    @mmulisha1022 Год назад

    My homework... ruclips.net/video/KPxOHyMZs0E/видео.html noticed after watching lesson 16 i did make 1 mistake, didnt stop the pwm in my end routine. But I'll call it a win either way. Next homework is going to be a doozy! Getting started now!

  • @neilcampbell6026
    @neilcampbell6026 Год назад

    Question. If the Raspberry Pi is a 3.3 volt device, why doesn't it fry when the output pin of the ADC0834 connects to it?

    • @weakgrand
      @weakgrand Год назад

      Did you ever find an answer to this? Wondering this myself

  • @DrDave327
    @DrDave327 2 года назад

    Am I “that one guy” who got the wrong kit? I ordered through Paul’s link, and my book with the kit reads: “SuperKit V3.0 for RaspberryPi”. My kit didn’t have the RGB buttons, and now doesn’t have the ADC0834 chip. Lol, so I ordered another kit. Anybody else get V3.0?

    • @paulmcwhorter
      @paulmcwhorter  2 года назад

      I checked the link, and the link does connect to the right kit on Amazon, so not sure what might have happened.

    • @DrDave327
      @DrDave327 2 года назад

      @@paulmcwhorter Looking closer, it appears Amazon sent the wrong kit. No problem. The bright side: I will have extra electronic goodies, once the correct kit arrives.:)

  • @michaelschweizer2115
    @michaelschweizer2115 2 года назад

    Hello Paul!
    Another great lesson. But when I saw that the ADC0834 was connected to 5V, I wondered: can this harm the Raspberry Pi? In the previous lessons we only connected 3.3V to the inputs. So I installed a voltage divider. Maybe it's overkill since the pulses are very short? In the video you said that they work together perfectly. So I'm still not sure when to be cautious.
    Video is here: ruclips.net/video/QtvByn6E7PE/видео.html

    • @Ry3Bre4d
      @Ry3Bre4d Год назад

      ruclips.net/video/O6-Q3_4yBYA/видео.html
      I had the same question and decided to find out the answer. Not that I would doubt Paul or anything.

    • @weakgrand
      @weakgrand Год назад

      Did you ever find a solution to this?

  • @farshidowrang2762
    @farshidowrang2762 Год назад

    Takk!

  • @rickbonari4493
    @rickbonari4493 2 года назад

    The outputs on the adc0834 are 5 volts. Why are we connecting them directly to raspberry pi input? Why is this ok to do? I looked on the internet and there is nothing I have seen that says this is ok even though the pulses coming from adc0834 are narrow. Does anyone have solid evidence that this is a good practice?

    • @aman-sood
      @aman-sood Год назад

      Yeah.. for the same reason I connected my MCP3008 (since I don't have an ADC0834) to 3.3V instead of 5V. Would hate to fry my pi

    • @Ry3Bre4d
      @Ry3Bre4d Год назад

      The analog to digital converter chip just sends binary to the pi and also gets 3.3v from one of the GPIO pins. The 5 volts is just the maximum voltage in which to apply the maximum analog value. In this case, 1023. Check out this video of me testing this.
      ruclips.net/video/O6-Q3_4yBYA/видео.html

  • @israelpurdum9470
    @israelpurdum9470 2 года назад

    Hey Paul I have been studying your Arduino tutorials and They are very good I think but I have a very random question (I mean no offense by this),who is the other person in your profile picture?

    • @paulmcwhorter
      @paulmcwhorter  2 года назад

      I visited the Masai tribe in Kenya, and he as a Masai Warrior. Real privilege to meet such a noble man.

    • @israelpurdum9470
      @israelpurdum9470 2 года назад

      @@paulmcwhorter wow that is really cool

  • @mmulisha1022
    @mmulisha1022 Год назад

    I am legend. What a fun lesson. Ill submit the HW later today

  • @waynel4344
    @waynel4344 2 года назад

    Look at that, we got the pi doing analogRead BOOM:)

  • @farshidowrang2762
    @farshidowrang2762 Год назад

    Takk!