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

  Переглядів 13,426

Paul McWhorter

Paul McWhorter

Рік тому

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

КОМЕНТАРІ: 79
@donaldhoudek2889
@donaldhoudek2889 Рік тому
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!!!
@markbooco1719
@markbooco1719 Рік тому
Hello Paul! Very good lesson. Thank you for all the hard work putting these lessons together.
@pralaymajumdar1206
@pralaymajumdar1206 Рік тому
Nothing to say... Just outstanding lesson.. U r real magic man🙏
@ShinesMonkey1
@ShinesMonkey1 7 місяців тому
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.
@opalprestonshirley1700
@opalprestonshirley1700 Рік тому
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 Рік тому
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.
@Leonilian
@Leonilian 10 місяців тому
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.
@arguedas02
@arguedas02 Рік тому
Blessings to you.. Great content, Paul! I do enjoy every single lesson …
@paulmcwhorter
@paulmcwhorter Рік тому
Great to hear!
@donaldhoudek2889
@donaldhoudek2889 Рік тому
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 !
@TheUnofficialMaker
@TheUnofficialMaker Рік тому
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!
@dphair3805
@dphair3805 6 місяців тому
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.
@brugierelaurent8696
@brugierelaurent8696 7 місяців тому
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!
@cbrombaugh
@cbrombaugh Рік тому
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?
@mmulisha1022
@mmulisha1022 Рік тому
I am legend. What a fun lesson. Ill submit the HW later today
@paulmcwhorter
@paulmcwhorter Рік тому
LEGEND!
@upperlip
@upperlip 3 місяці тому
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?
@jameslewellen150
@jameslewellen150 Рік тому
Why did you not use the + and - of the breadboard?
@davemessink6410
@davemessink6410 3 місяці тому
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?
@davidbundy5365
@davidbundy5365 Рік тому
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 Рік тому
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.
@georgebibyk1122
@georgebibyk1122 Рік тому
Do you have any tutorials using capacitance?
@thaoluc1810
@thaoluc1810 Рік тому
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
@alexandrebrittopereira8237
@alexandrebrittopereira8237 5 місяців тому
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?
@KarthikBhandary
@KarthikBhandary Рік тому
Hey paul are there any other ICs available other that ADC 0834 to use as a converter?
@warrenscorner
@warrenscorner Рік тому
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 Рік тому
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 Рік тому
Warren, I could not do it either!
@masonscott8029
@masonscott8029 10 місяців тому
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.
@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.
@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??
@farshidowrang2762
@farshidowrang2762 Рік тому
Takk!
@paulmcwhorter
@paulmcwhorter Рік тому
Really appreciate the support!
@arlo4051
@arlo4051 Рік тому
Homework done : ukposts.info/have/v-deo/iHyDnImRap2KyKc.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.
@captinkrazy6968
@captinkrazy6968 Місяць тому
i got this working. I just dont understand how you know where to put the pins bc they are not designated in the program.
@fabersoaks4975
@fabersoaks4975 Місяць тому
I dont have ADC0834 can use ADC0808CCN?
@keithlohmeyer
@keithlohmeyer Рік тому
Not finding the "reading analog signals" page on your TTB search. Can you provide a link to the page? Thanks
@paulmcwhorter
@paulmcwhorter Рік тому
toptechboy.com/reading-analog-signals-with-the-raspberry-pi-and-the-adc0834/
@waynel4344
@waynel4344 Рік тому
Look at that, we got the pi doing analogRead BOOM:)
@paulmcwhorter
@paulmcwhorter Рік тому
BOOM!
@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 11 місяців тому
Did you ever find an answer to this? Wondering this myself
@hankehly
@hankehly 6 місяців тому
Homework solution: ukposts.info/have/v-deo/q2mWYYGZeKl626M.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.
@paulmcwhorter
@paulmcwhorter 6 місяців тому
LEGEND!
@weakgrand
@weakgrand 11 місяців тому
The Raspberry Pi GPIO pins can only read/write at 3.3V. The ACD0834 outputs 5V. How does this not break the Raspberry Pi?
@rickbonari4493
@rickbonari4493 Рік тому
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. ukposts.info/have/v-deo/h2ZehWmWa69zunU.html
@fablapp
@fablapp 2 місяці тому
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!
@israelpurdum9470
@israelpurdum9470 Рік тому
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 Рік тому
I visited the Masai tribe in Kenya, and he as a Masai Warrior. Real privilege to meet such a noble man.
@israelpurdum9470
@israelpurdum9470 Рік тому
@@paulmcwhorter wow that is really cool
@captinkrazy6968
@captinkrazy6968 Рік тому
board and drawing has posative and negative rails backwords
@michaelschweizer2115
@michaelschweizer2115 Рік тому
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: ukposts.info/have/v-deo/iaSndq-lbXtosXk.html
@Ry3Bre4d
@Ry3Bre4d Рік тому
ukposts.info/have/v-deo/h2ZehWmWa69zunU.html I had the same question and decided to find out the answer. Not that I would doubt Paul or anything.
@weakgrand
@weakgrand 11 місяців тому
Did you ever find a solution to this?
@lorisrobots
@lorisrobots Рік тому
Thanks for reviewing my first hw video! I appreciate your feedback. Here is an updated version. Great lesson. ukposts.info/have/v-deo/j4Wfa4drom-immw.html
@daviddirac5942
@daviddirac5942 Рік тому
My highest reading is only 196, not 255. Is this an indication that something is wrong.
@DrDave327
@DrDave327 Рік тому
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 Рік тому
I checked the link, and the link does connect to the right kit on Amazon, so not sure what might have happened.
@DrDave327
@DrDave327 Рік тому
@@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.:)
@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: ukposts.info/have/v-deo/nJGZa6GMfYN7lI0.html
@mmulisha1022
@mmulisha1022 Рік тому
My homework... ukposts.info/have/v-deo/g4Cpg36whJCkkXk.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!
@paulmcwhorter
@paulmcwhorter Рік тому
Good work Chris.
@suelingsusu1339
@suelingsusu1339 Рік тому
👍👍👍👌👌👌👌👏👏👏👏🙏🙏🙏🙏🖖🖖🖖🖖🖖
@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.... ukposts.info/have/v-deo/j4R1d5CQiKGiq2g.html
@paulmcwhorter
@paulmcwhorter Рік тому
Excellent. Love your little wooden build tray.
@hammadahmed3409
@hammadahmed3409 8 місяців тому
Homework ukposts.info/have/v-deo/p36aiIuxjXp7yHk.htmlsi=WtoIsJUDaasDV8xa Controlling led digitally causes flickering and latency. Connecting led positive leg to potentiometer middle leg gives more natural dimming
@farshidowrang2762
@farshidowrang2762 Рік тому
Takk!
@paulmcwhorter
@paulmcwhorter Рік тому
Thanks! Really appeciate the support.
Raspberry Pi LESSON 16: Creating a Potentiometer Controlled Dimmable LED
22:04
Reading Analog Inputs | Raspberry Pi Pico Workshop: Chapter 2.6
8:46
Что будет с кроссовком?
00:35
Аришнев
Переглядів 2,3 млн
ЧТО ДЕЛАТЬ, ЕСЛИ НЕ ХВАТАЕТ ДЕНЕГ НА ВОССТАНОВЛЕНИЕ ТАЧКИ?
47:52
#369 Definitive Guide to Attaching Sensors to the Raspberry Pi (Tutorial)
13:22
⚙ Add Video Input To The Raspberry Pi - Tinkernut Workbench
6:24
Raspberry Pi LESSON 25: Using an LCD1602 LCD Display with I2C
29:12
Paul McWhorter
Переглядів 12 тис.
The experiment that revealed the atomic world: Brownian Motion
12:26
Steve Mould
Переглядів 2,2 млн
iPhone 15 Precision Finding | Find Your Friends | Apple
2:52
Subscribe for more!! #procreate #logoanimation #roblox
0:11
Animations by danny
Переглядів 3,8 млн
СМАРТФОНЫ HTC ВЕРНУЛИСЬ В 2024! Шок для Apple, Samsung и Xiaomi...
11:51
Thebox - о технике и гаджетах
Переглядів 34 тис.
All New Atlas | Boston Dynamics
0:40
Boston Dynamics
Переглядів 5 млн
Infrared Soldering Iron from Cigarette Lighter
0:58
ALABAYCHIC
Переглядів 1,9 млн