How To Create A PWM Signal Using The Arduino Uno - For Beginners

  Рет қаралды 20,853

Hamed Adefuwa

Hamed Adefuwa

Күн бұрын

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
@moaisl.3357
@moaisl.3357 Жыл бұрын
0.7 volt is the voltage drop across output transistor. That is why you do not have 5v at output.
@nigelsheridan6229
@nigelsheridan6229 2 жыл бұрын
Thanks Hamed for the video
@aftalavera
@aftalavera Жыл бұрын
Thanks for sharing!
@crazysvt03
@crazysvt03 9 ай бұрын
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
@DaveFer
@DaveFer Жыл бұрын
Hey, thanks, my friend. So just by doing an analogWrite(i) to a digital PWM pin ... it converts it to PWM? Neato! :)
@nibzlegend99
@nibzlegend99 Жыл бұрын
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?
@garavel28
@garavel28 2 ай бұрын
Hello Sir, can I ask you a question via email about the MPPT algorithm that I am trying to make using Arduino Mega 2560?
@HamedAdefuwa
@HamedAdefuwa 2 жыл бұрын
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
@mahmoudsamy1992
@mahmoudsamy1992 4 ай бұрын
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,
@0124akash
@0124akash 6 ай бұрын
Sir, can i get two different frequencies at the same time from single Arduino UNO board ? 20Khz and 50Hz square wave.
@markdaniel8740
@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< micros()) // checks if current time has passed time to toggle { 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< micros()) { fiftysig==!fiftysig; fiftyhz=micros()+20000; millis()+20 can also be used digitalWrite(9,fiftysig); }
@mickadams4471
@mickadams4471 2 жыл бұрын
Hi Hamed, hope everything is OK. Haven’t seen a video for a while mate.
@HamedAdefuwa
@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
@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.
How PWM works | Controlling a DC motor with a homemade circuit
10:01
How to create very fast square pulses with Arduino ( up to 4 MHz with Arduino NANO, UNO, & MEGA2560
18:03
ТАМАЕВ УНИЧТОЖИЛ CLS ВЕНГАЛБИ! Конфликт с Ахмедом?!
25:37
🤔Какой Орган самый длинный ? #shorts
00:42
تجربة أغرب توصيلة شحن ضد القطع تماما
00:56
صدام العزي
Рет қаралды 58 МЛН
100❤️
00:19
MY💝No War🤝
Рет қаралды 23 МЛН
Duty cycle, frequency and pulse width--an explanation
8:53
Justin Miller
Рет қаралды 459 М.
Arduino Basics 102: Control Structures, Variables, Interrupts
7:38
Arduino Basics Change your PWM Frequency
7:35
learnelectronics
Рет қаралды 87 М.
How to Control a 12V Motor with Arduino: Easy Wiring & Code Examples
44:13
I Melted Wood With Friction
8:44
The Action Lab
Рет қаралды 837 М.
Arduino To ESP32: How to Get Started!
9:26
Robonyx
Рет қаралды 257 М.
Arduino PWM Frequency Tweaked to 1kHz
17:00
Julian Ilett
Рет қаралды 15 М.
ТАМАЕВ УНИЧТОЖИЛ CLS ВЕНГАЛБИ! Конфликт с Ахмедом?!
25:37