How To Create A PWM Signal Using The Arduino Uno - For Beginners
In this video we’ll be creating a PWM signal from an Arduino using some simple code.
Elegoo UNO: amzn.to/3qRV2sH
Arduino IDE: www.arduino.cc/en/software
All Code
Simple Program Changing Duty Cycle: github.com/hadefuwa/my-arduin...
Creating Custom Duty Cycles: github.com/hadefuwa/my-arduin...
Incrementing Duty Cycle: github.com/hadefuwa/my-arduin...
Decrementing Duty Cycle: github.com/hadefuwa/my-arduin...
Control From PC: github.com/hadefuwa/my-arduin...
Timestamps
0:00 Intro
1:00 PWM Pins
1:45 Simple Program Changing Duty Cycle
4:35 Creating Custom Duty Cycles
7:55 Incrementing Duty Cycle
10:10 Decrementing Duty Cycle
11:20 Lights Out
11:50 Control From PC (Serial Monitor)
_____________
Hi, I'm Hamed, an Electrical & Electronics Engineering Student in Leeds, UK. At the time of recording this video I am half way through my third and final year at university.
Visit my website at www.hamed.engineer
If you have any questions you can email me at hamed@hamed.engineer or just comment below.
Stuff You May Have Seen In My Videos
The Oscilloscope I Use (From Banggood): www.banggood.com/custlink/vvD...
Alternative Oscilloscope £220: amzn.to/32JhxXx
Elegoo Arduino Most Complete Kit £50: amzn.to/3EKfdMZ
Elegoo Arduino Basic Kit £15: amzn.to/3mSEpL4
Soldering Iron Station £28: amzn.to/3eONT5y
Handheld Oscilloscope £50: amzn.to/3HvJRvy
Handheld Oscilloscope £100: amzn.to/3ENljMG
DIY Function Generator £9.99: amzn.to/3JCQrCg
Lavolta Power Supply £60: amzn.to/3mMvwmb
Eventek Power Supply £60: amzn.to/3HxP9q3
Elegoo Breadboard Accessories £15: amzn.to/3JD55Jy
You Can Also Find The Above For Cheaper On Banggood/Aliexpress
Пікірлер: 14
0.7 volt is the voltage drop across output transistor. That is why you do not have 5v at output.
Thanks for sharing!
Thanks Hamed for the video
Hey if you wanted to use this to control a 3 port mac valve with a input being an interrupt signal that drops duty cycle to zero would you be doing similar code
Hey, thanks, my friend. So just by doing an analogWrite(i) to a digital PWM pin ... it converts it to PWM? Neato! :)
I want to be able to change pwm with input using a switch , when it goes high , duty cycle becomes 50%. How can I do that?
All Code Simple Program Changing Duty Cycle: github.com/hadefuwa/my-arduino-projects/blob/main/Simple%20Program%20Changing%20Duty%20Cycle Creating Custom Duty Cycles: github.com/hadefuwa/my-arduino-projects/blob/main/Creating%20Custom%20Duty%20Cycles Incrementing Duty Cycle: github.com/hadefuwa/my-arduino-projects/blob/main/Incrementing%20Duty%20Cycle Decrementing Duty Cycle: github.com/hadefuwa/my-arduino-projects/blob/main/Decrementing%20Duty%20Cycle Control From PC: github.com/hadefuwa/my-arduino-projects/blob/main/Control%20Arduino%20From%20PC
Hello Sir, can I ask you a question via email about the MPPT algorithm that I am trying to make using Arduino Mega 2560?
Sir, can i get two different frequencies at the same time from single Arduino UNO board ? 20Khz and 50Hz square wave.
@markdaniel8740
2 ай бұрын
You can use millis() or micros(). unsigned long twentykhz =0; unsigned long fiftyhz=0; int twentysig= HIGH; int fiftysig= HIGH; void setup() { pinMode(3,OUTPUT); pinMode(9,OUTPUT); } void loop() if (twentykhz { twentysig==!twentysig; // toggles output value twentykhz = micros ()+25; // set next toggle time 25 microseconds into future digitalWrite (3,twentysig); } This will make output high for 25 microseconds then off for 25. 20khz = 50 microseconds/ cycle. if (fiftyhz { fiftysig==!fiftysig; fiftyhz=micros()+20000; millis()+20 can also be used digitalWrite(9,fiftysig); }
Is there any way to make the PWM is shifted ??: I need to make 2 PWM with variable duty cycle which are controlled by means of potentiometer, The PWM frequency should be 30 khz. I have done all of that but I can't do it with the following challenge. I need those 2 PWM to be shifted from each other half cycle. And running simultaneously with each other. This is my code: #define PWM_1 9 #define PWM_2 10 #define POT A0 void setup() { TCCR1B = TCCR1B & B11111000 | B00000001; pinMode(PWM_1, OUTPUT); pinMode(PWM_2, OUTPUT); pinMode(POT, INPUT); } void loop() { long dutyCycle = map(analogRead(POT), 0, 1023, 0, 255); analogWrite(PWM_1, dutyCycle); analogWrite(PWM_2, dutyCycle); } I am using Arduino nano ATmega328 As you see, and when I run it on an oscilloscope simulation,
Hi Hamed, hope everything is OK. Haven’t seen a video for a while mate.
@HamedAdefuwa
2 жыл бұрын
❤️ appreciate the concern Mick. I'm very well thanks just beyond overwhelmed with university work. 2 months left 😮💨. I'm hoping to get the boring writing and technical stuff out the way and then start documenting me creating the solar charge controller. Too much to do, to little time sadly. I hope you're well?
@mickadams4471
2 жыл бұрын
Ah, good to hear from you mate. Not easy juggling uni with family. As long as you’re OK. I know how you feel, I haven’t touched a circuit or scope for a couple of months due to work.