Raspberry Pi Linux LESSON 27: PWM Output on GPIO Pins from Python

  Рет қаралды 121,840

Paul McWhorter

Paul McWhorter

Күн бұрын

Пікірлер: 132
@thronabulax
@thronabulax 3 жыл бұрын
I learned more from your honest sense of humility than from the lesson content. You were not afraid to show your human fallacy. In the face of failure you did not become frustrated, you did not edit out the mistakes, but showed us the unvarnished approach to problem solving, “warts and all.” Found the problems and not only fixed them, but improved on them. The spirit of a true engineer. Bravo! It also shows that even folks who have ADHD, or difficulty spelling can be extremely intelligent and deserve our compassion, patience and admiration.
@masdi-2173
@masdi-2173 7 жыл бұрын
An almost 3 years old video, and still a great tutorial video.. Thanks sir! Awesome!
@alanproctor8324
@alanproctor8324 9 жыл бұрын
Just starting out with python and a raspberry pi and this is by far most helpful video I have watched yet, all the other, thankyou
@nigelworwood8530
@nigelworwood8530 5 жыл бұрын
I like the fact that you let us see you finding the problem. So often in other tutorials there is an edit and we do not learn the process. Okay the "sart" example - Remember the times it has happened to us. We tend to read what we think it is supposed to be. Does that make sense?
@ezeprojects5425
@ezeprojects5425 8 жыл бұрын
I have appreciated your videos so much, wish I had come across them in the beginning of my Pi adventure. I was a programmer for decades, was not an engineer like you, so have learned a thing or two about debugging outputs. The Python processor is telling you exactly which line the error is on, line 6. Sometimes, an error will be caused by a previous error, but this script is so small, the place to start and end is line 6. I, too, have stared at misspellings and not seen them, just keep looking. Sometimes I call a friend for a "second pair of eyes". Plz keep up the great work. Your students do not know just how lucky they are.
@jasoncherry5849
@jasoncherry5849 8 жыл бұрын
Your videos have helped me create and develop my capstone project for college. Thank you for the time and effort you have put into your tutorials.
@icarus7471
@icarus7471 7 жыл бұрын
Man I am just a 14 year old but I was able to understand each and everything . Your each and ever lesson was helpful . You are doing a great job with these lessons !!! These are , by far ,THE BEST TUTORIAL FOR UNDERSTANDING THE RASPBERRY PI !!!!!!!!!!!
@paulmcwhorter
@paulmcwhorter 7 жыл бұрын
Thank you for the kind words, and please share the videos with others. We need more people who know this stuff!
@icarus7471
@icarus7471 7 жыл бұрын
For sure!!
@norfazrinadzri4982
@norfazrinadzri4982 9 жыл бұрын
The Best tutorial for Pi. Never seen others make a tutorial clear like u sir.
@sst8872
@sst8872 4 жыл бұрын
Happy New Year Paul! I'm surprised to find myself watching your loooong~ video nonstop. You are truly marvelous, Grand Pa Paul. Take care of your health. Again Thank you!
@harleycruiser4331
@harleycruiser4331 4 жыл бұрын
I really enjoy your videos especially your diagnosis of a problem, and yes I like the BOOMs, I do that myself when it works.
@mintoo2cool
@mintoo2cool 4 жыл бұрын
thanks for these tutorials. there are helpful refreshers for guys like me who worked with 16bit microcontrollers in their college and never touched them again ... tip - you don't need to keep python as a superuser. you can add user 'pi' into the sudoer list (not recommended) or you create another user (like gpio) and add that user to the sudoer list and everytime you want to run programs that interact with gpio, you sudo su - '' to switch to that user and run your python programs without having to sudo each time.
@DodgyBrothersEngineering
@DodgyBrothersEngineering 7 жыл бұрын
First video of your I've watched and I going to go right ahead and give myself a pat on the back as I spotted all of the mistakes you made as you typed them. Considering I have never written a line of python in my life I thought I did pretty well understanding it. Thanks for making it so easy to follow, and sometimes it is good to include the bloopers because it helps with understanding how to diagnose the errors that happen in real life. Also I do know if there is a way to exit the program in a graceful manner since they is no exit out of the loop that I could see.
@Analyse_US
@Analyse_US 7 жыл бұрын
Thanks for not editing out the sart error. As a beginner coder, it's reassuring to see others make this type of simple coding errors..
@aleksandrjaworski7789
@aleksandrjaworski7789 9 жыл бұрын
Thank you for your tutorials! I had my first experiments with arduino thanks to your videos.
@seanli75
@seanli75 4 жыл бұрын
36:36 i am having trouble with the **(power of ) it keeps showing blank on my LED and yes i did hook things up right
@seanli75
@seanli75 4 жыл бұрын
can anyone help me?
@seanli75
@seanli75 4 жыл бұрын
okay so the problem is that when i input a number like 4 it doesn't even light up
@JohnWest4
@JohnWest4 3 жыл бұрын
4 Years hence and it's still great!
@ki-wonlee4
@ki-wonlee4 6 жыл бұрын
Thank you for your contribution in raspberry pi dummy world. I like your class. Also I love your BOOM!
@adamwalter2573
@adamwalter2573 3 жыл бұрын
Anything that works in background ? I mean keep values set in some sort on a buffer, so that once application exists, the state is still the same ?
@MarkBamford
@MarkBamford 3 жыл бұрын
Absolutely brilliant tutorial Paul. Thanks so much. Regards, Mark
@paulmcwhorter
@paulmcwhorter 3 жыл бұрын
Glad it was helpful!
@dwaynemartin9944
@dwaynemartin9944 5 жыл бұрын
Loved the video, love all your videos. This has helped me with my Pi foo a lot, and I really appreciarte your efforts.
@PirithiumX
@PirithiumX 8 жыл бұрын
Thank you very much for this contribution. I will be looking forward to more in the future. Great work.
@ReCoN12371
@ReCoN12371 8 жыл бұрын
Great tutorials!!! I"m learning so much and you make the learning easy and fun.
@alekrand85
@alekrand85 4 жыл бұрын
Im trying to use my pi to drive a set of mosfets for a HV flyback. In a half bridge configuration. Very similar to a zvs drive. Do u have any tips on how to go about this?
@jensemilhansen1602
@jensemilhansen1602 8 жыл бұрын
It turned on with 0 as input because 2^0 is 1 as you can see in the video too 35:55
@TheSuperSangan
@TheSuperSangan 8 жыл бұрын
is there a way to do a case in python? like have the leds light on when 1 or 2 are pressed then off when 3 or 4 are pressed?
@jokano6865
@jokano6865 5 жыл бұрын
The reason the "bright" variable at 32:30 didn't work as intended is because when you prompt the user with an input() fuction, python stores the input as a String data type. Because of this, you need to change the data type of "bright" from string to integer. The solution should look something like 2^(int(bright))
@swwewearwffv5099
@swwewearwffv5099 8 жыл бұрын
pulse width modulation right? not pulse width modification....
@NelsonGallo1
@NelsonGallo1 7 жыл бұрын
Is there another way to stop the program without the keyboard interruption? For example with another application py. That is, I want an application for me to illuminate the led in 50% and another to turn it off.
@darthenx2585
@darthenx2585 7 жыл бұрын
Question... if I am wanting to check if the pwm.start() has been initiated , how can I use that in an If statement?
@bmoviestgams
@bmoviestgams 9 жыл бұрын
Hello ! Can i use the raspberry in order to control 4 brushless motors at the same time ?(with python) or i will need a ServoHAT to do that ?
@marcvanelverdinghe50
@marcvanelverdinghe50 4 жыл бұрын
Even after all these years interesting enough to base a tobot project on!
@robbery30
@robbery30 3 жыл бұрын
What's the raspberry pi equivalent for Serial.begin(9600)?
@samsont81
@samsont81 9 жыл бұрын
can i control a brushless motor using this connected to Esc ?
@averycox1429
@averycox1429 5 жыл бұрын
Can you use a pie to control devices that are using devicenet?
@yugeshkc9026
@yugeshkc9026 4 жыл бұрын
How can we use PWM if the LED is powered by an external battery? I would be thankful for your response
@aynursunagatullin7029
@aynursunagatullin7029 4 жыл бұрын
Thank you Mr. McWhorter, very good!
@julianray6802
@julianray6802 5 жыл бұрын
Boom! These videos are such good fun for a newbie like me! Thank you Paul, and I like the booms(!) ;)
@smackledorfmcsween
@smackledorfmcsween 7 жыл бұрын
You can tell this guy was tired. when he made this. I'm subscribed due to the fact that he reminds me of my tael teacher Mr. Blair.
@prashantmeti7986
@prashantmeti7986 3 жыл бұрын
Can we control 24 v LED brightness sir
@debabrata2137
@debabrata2137 8 жыл бұрын
sir I have raspberry pi 3 B. i want to control a servo by taking the sensor data from a mobile. can you please help me?
@squeakycheex7771
@squeakycheex7771 Жыл бұрын
Thanks!
@paulmcwhorter
@paulmcwhorter Жыл бұрын
Thanks! REally appreciate that.
@ruchitpanchal2074
@ruchitpanchal2074 7 жыл бұрын
That Oscilloscope line can be made horizontal by turning a screw. It should be somewhere near the screen. The old Cathode Ray Oscilloscopes have the screw I'm not sure if the new Digital ones have a similar calibration feature. Enjoyed the Video and I'm learning a lot :) Thank You :):)
@gavares3
@gavares3 6 жыл бұрын
oh this guy is awesome. love your videos. please keep them coming through. my confidence went through the roof with this guys explanations.
@jokano6865
@jokano6865 5 жыл бұрын
absolutely amazing video, extremely clear. Thank you!!
@rodrigo7089
@rodrigo7089 5 жыл бұрын
Thank you very much Paul!. Great tutorial as always
@sawansaurabh6457
@sawansaurabh6457 8 жыл бұрын
hi paul, great video. I wanted to ask that in the final code, every time when you set the brightness, the code loops back and asks the user for another entry. So, how does it reach to the GPIO.cleanup() part cuz evrytime it'll just loop back asking for input.. ?
@quantummandavid
@quantummandavid 7 жыл бұрын
PWM = Pulse Width Modulation Thanks for posting
@flaviogjoni5747
@flaviogjoni5747 3 жыл бұрын
34:14 that smile made me happy too c:
@mohamadilham1384
@mohamadilham1384 6 жыл бұрын
Can i use multipe pin for another PWM?
@samarthmoudgalya8747
@samarthmoudgalya8747 7 жыл бұрын
I have a list of int say [1,0,1,0] . How do i send this data to the cro. pls help
@jimmykan7873
@jimmykan7873 7 жыл бұрын
Can use this to control the speed with l289n motor driver?
@arpit11rastogi
@arpit11rastogi 7 жыл бұрын
i m yet to try that
@k1ng401
@k1ng401 5 жыл бұрын
I know this is a late reply but yes you can. Just done it myself.
@timb1648
@timb1648 9 жыл бұрын
Great video... I was yelling at the screen with sart.
@alkhashtee
@alkhashtee 5 жыл бұрын
Ahahahah me too
@salioudiallo582
@salioudiallo582 5 жыл бұрын
@@alkhashtee HAHAHA me 3
@toasterbath1395
@toasterbath1395 5 жыл бұрын
Saliou Diallo hahahaha me *4* *😂*
@seanli75
@seanli75 4 жыл бұрын
@@toasterbath1395 me five
@seanli75
@seanli75 4 жыл бұрын
@@toasterbath1395 *hahaha me 5
@jalilabdul8986
@jalilabdul8986 7 жыл бұрын
Can we make an "inverting pwm output" on raspberrypi?
@abhishektyagi7513
@abhishektyagi7513 3 жыл бұрын
You can use the 'try and except' statements in python. That way, you can be sure that the cleanup happens even if there's a bug in the main code.
@mohammedal-alaw6249
@mohammedal-alaw6249 6 жыл бұрын
Using the Oscilloscope; What is the max. P.W.M. possible
@yunusemrecagatay2146
@yunusemrecagatay2146 5 жыл бұрын
How can i read pwm signal on raspberry Please help me
@MartinThong
@MartinThong 8 жыл бұрын
So what is the point of changing the frequency if it does not affect anything?
@joshdcunha8674
@joshdcunha8674 8 жыл бұрын
I think that for the LED the only thing that matters is the voltage it's receiving (which is controlled by changing the duty cycle). If you try changing the frequency with a Piezo element you get different sounds.
@charlesbrewer6552
@charlesbrewer6552 7 жыл бұрын
Hi Paul I really Appreciate your videos. Absolutlely great. I was thinking it might be good practice to puit a "clean-up" statement a the beginning of all my programs?
@stevec3h8
@stevec3h8 7 жыл бұрын
Paul, thanks for a great series! I appreciate your teaching style. I have a question related to the GPIO.cleanup() statement. I've noticed a couple of times when you've stopped a program in the middle and it doesn't get to execute the cleanup statement, the next time you run the program it gives a warning message. This is just a question because I'm new to Python and Pi, would it be a good practice to start your program with a GPIO.cleanup() statement so that every time you execute your program, you know you are starting with a clean slate? Again ... thanks for a great series and all the time you have put into this effort!
@farhinismail3978
@farhinismail3978 7 жыл бұрын
mr paul how about making a tutorial on making a database that i can take and send information. i really look forward to it because i enjoyed your lessons
@maffysdad
@maffysdad 9 жыл бұрын
Thank you, this has been a interesting video, somewhat more informative than some other tutorial videos in that it was all 'on the fly', and the image has the three images in one, the presenter, the pi, and the programming, makes it much more instructional, and yes, I was shouting at the screen, haha! But that's how we all learn isn't it eh? :-D
@kevintamez
@kevintamez 9 жыл бұрын
realy nice tuts, realy useful:)
@pin4586
@pin4586 8 жыл бұрын
Amazing tutorial !
@airbrushernst
@airbrushernst 9 жыл бұрын
Tnx for explaining! Isn't ((2**bright)-1) better? with input 1-7?
@Jockeponkenboy
@Jockeponkenboy 6 жыл бұрын
Why not just (bright * 10) and limit to 0-100.. and have the possibility between 1-10
@Bigboss-zn8pv
@Bigboss-zn8pv 6 жыл бұрын
Thank you so much, great video
@daesoolee1083
@daesoolee1083 6 жыл бұрын
Paul McWhorter is my incredible teacher hhh I love his teaching videos
@paulmcwhorter
@paulmcwhorter 6 жыл бұрын
Thank you for the kind words!
@AlanHeigl
@AlanHeigl 4 жыл бұрын
great lesson
@erygion
@erygion 5 жыл бұрын
Great lesson Mr. Mcwhorter, I learned a lot. What ever happened to doing our comments in the code like good boys and girls? (I know it would take longer...)
@nicole4422
@nicole4422 7 жыл бұрын
pow(int base, int exp) also works
@soundguydon
@soundguydon 8 жыл бұрын
PWM = Pulse Width Modulation. Also, I really like your vids, but just as a heads up, when you're using NANO, you can just hit ^X when you're done editing, and it'll ask you if you want to save it. You don't have to do ^O then ^X :)
@MohamadNaseer
@MohamadNaseer 8 жыл бұрын
good work sir....
@seanli75
@seanli75 4 жыл бұрын
33 33:30 you could just put GPIO.setwarnings(False) and it will not give you the error
@Popart-xh2fd
@Popart-xh2fd 8 жыл бұрын
One day Python will come with a Spell Checker...
@uprajsingh
@uprajsingh 5 жыл бұрын
with good IDE it does
@toasterbath1395
@toasterbath1395 5 жыл бұрын
upraj singh *IDLE*
@yuchaosys
@yuchaosys 7 жыл бұрын
great stuff!
@sampro454
@sampro454 7 жыл бұрын
36:07 When python doesn't let you get carried away.
@elhamkeshavarzarshadi
@elhamkeshavarzarshadi 5 жыл бұрын
you can use HIGH instead of 1 or TRUE and HIGH instead of 0 or LOW
@paulmcwhorter
@paulmcwhorter 5 жыл бұрын
Good points.
@mathiassimson4167
@mathiassimson4167 4 жыл бұрын
You can write # pinout in terminal and see GPIO and other information about your Raspberry PI.
@Popart-xh2fd
@Popart-xh2fd 8 жыл бұрын
Sart(re) is a philosopher and 2^7 is 128! :)
@raymondthomas5857
@raymondthomas5857 8 жыл бұрын
Popart 2015
@AranyaSen
@AranyaSen 9 жыл бұрын
Excellent video! Too many "boom"s for my liking though :P
@loulounet777
@loulounet777 8 жыл бұрын
You do know that all analog oscilloscopes have a trace rotation potentiometer...
@rasheedataliep5757
@rasheedataliep5757 3 жыл бұрын
thank you so much
@paulmcwhorter
@paulmcwhorter 3 жыл бұрын
No problem
@stefanooliveira
@stefanooliveira 3 жыл бұрын
Perfect!!!!
@calpardo
@calpardo 4 жыл бұрын
LIKED IT
@LetMeThinkItThrough
@LetMeThinkItThrough 5 жыл бұрын
^ is the sign for XOR thats is why it turned off, 2^2=0, hahah. It was amusing too watch the small "misses"
@oleynikdenis
@oleynikdenis 9 жыл бұрын
Boom )
@fanyinU
@fanyinU 6 жыл бұрын
when go over 128 haha
@seanli75
@seanli75 4 жыл бұрын
STOP with the DISLIKES AND LIKE IT!!!!!!!
@cren189
@cren189 7 жыл бұрын
if only my school wifi would not stop the video after one second
@RinksRides
@RinksRides 7 жыл бұрын
you could just as easily do su pi instead and be locked as super user... Subb'd & liked! don't you have an astig/rotate/brightness level adjustments on that o-scope?
@mgtowluau5651
@mgtowluau5651 9 жыл бұрын
ah ha dutycycycycycle = round((1-e^-bright)*100) bright is 0 to inf in practice bright = -ln(0.005) = 5.299 should yield 100 but higher values are safe for entry. The point of this being the use of e for math nerds and a scale from 0 to inf.
@ku567318
@ku567318 8 жыл бұрын
Paul, Love the videos. If I could offer one suggestion... Please use the term guys and "GIRLS." I'm trying to discover my my little girl's interest by watching your videos with her. Thanks. Ken
@paulmcwhorter
@paulmcwhorter 8 жыл бұрын
for me, "Guys" is synonymous with "people" or "folks". It is intended to be gender neutral. Just like our team is the "Space Cowboys", but a key leader is a girl.
@ku567318
@ku567318 8 жыл бұрын
Thanks Paul. My girl will love your comment.
@steve905
@steve905 5 жыл бұрын
Lesson is: Always read the error message carefully.
@franknarc
@franknarc 7 жыл бұрын
You have a Hummer, Mercedes, Jaguar, Nissan 350Z...But still, you want somebody to donate an Oscilloscope ?? BOOOOM !!!
@paulmcwhorter
@paulmcwhorter 7 жыл бұрын
I said cars I have "HAD" not "HAVE". When I was working as an electrical engineer I made lots of money. Then I retired and I teach school, so now I drive a little toyota pickup. So, I dont have cars like that any more.
@franknarc
@franknarc 7 жыл бұрын
But still it makes no difference, coz it wasn't only Hummer or only Mercedes or only Jaguar...you've had ALL THREE !!! BOOM !!! Hope you can make another series of videos "How to make lots of money (Electrical Engineers Edition)" and soon, it'll also be a HIT !! BOOOOOOOOM !!! :P
@paulmcwhorter
@paulmcwhorter 7 жыл бұрын
Actually being an electrical engineer is probably the most likely way for most people to become wealthy. Sports, rap, music, lottery . . . those are all dreams. But if you work hard, get an engineering degree and then work hard at your job, you can put do very well. That is one of the reasons I teach . . . I want the kids to see that there is a path that is real for them if they are willing to work.
@franknarc
@franknarc 7 жыл бұрын
Nah, if you are really ready to work hard, sports, rap, music,..anything can be lucrative... Wouldn't you agree that Eminem knows better vocabularies than Shakespeare ?? B)... But anyway...you re doing a great job !! Make some BOOOM !!! Only then it makes you PAUL MCWHORTER B) Else it sounds like somebody else :P
@dmkays
@dmkays 5 жыл бұрын
Cool Beans d;^}
@seanli75
@seanli75 4 жыл бұрын
can you stop saying BOOM?
@paulmcwhorter
@paulmcwhorter 4 жыл бұрын
No
@seanli75
@seanli75 4 жыл бұрын
@@paulmcwhorter why?
@cannabis7619
@cannabis7619 7 жыл бұрын
i grabbed my monitor and yell at it STAAAAAAAAAAAAAAART !!!!!!!! after that i stopped watching youtube sarted my pi.
@dvsmotions
@dvsmotions 8 жыл бұрын
hahahaha
How to treat Acne💉
00:31
ISSEI / いっせい
Рет қаралды 108 МЛН
VIP ACCESS
00:47
Natan por Aí
Рет қаралды 30 МЛН
Raspberry Pi LESSON 30: Control LEDs with Buttons on GPIO Pins
20:31
Paul McWhorter
Рет қаралды 57 М.
Is the Orange Pi Zero3 Better Than the Raspberry Pi?
16:46
Gary Explains
Рет қаралды 59 М.
Raspberry Pi GPIO - Getting Started with gpiozero
48:40
DroneBot Workshop
Рет қаралды 451 М.
Inside the V3 Nazi Super Gun
19:52
Blue Paw Print
Рет қаралды 2,4 МЛН
The BEST Mechanical Display You've EVER Seen!!!
13:51
Tin Foil Hat
Рет қаралды 572 М.
Using ChatGPT to write Raspberry Pi Python code
15:43
ExplainingComputers
Рет қаралды 109 М.
You’ve Never Seen WiFi Like This
20:43
Data Slayer
Рет қаралды 1,1 МЛН
Every Developer Needs a Raspberry Pi
27:27
Sam Meech-Ward
Рет қаралды 1,1 МЛН
Raspberry Pi LESSON 4 : Understanding and Using GPIO Pins
45:45
Paul McWhorter
Рет қаралды 62 М.