Arduino Uno R4 WiFi LESSON 11: Pulse Width Modulation (PWM) Simulation of Analog Voltages

แชร์
ฝัง
  • เผยแพร่เมื่อ 26 ธ.ค. 2024

ความคิดเห็น • 46

  • @larryb6759
    @larryb6759 8 หลายเดือนก่อน +9

    Pulse Width Modulation (PWM) is a technique used to encode analog information in a digital signal. It involves rapidly switching a digital output between on and off states at a fixed frequency. The ratio of time the signal is on (high) to the time it is off (low) within each period, known as the duty cycle, determines the average voltage or power delivered to a load. PWM is commonly used in controlling the speed of motors, regulating LED brightness, and generating analog signals from digital sources.

  • @peterwadham7965
    @peterwadham7965 8 หลายเดือนก่อน +1

    Great Lesson and nice scope, PWM allows the user to change the proportion of the time the signal is high compared to low, over a constant time interval to simulate an analog output

  • @alfredcalleja450
    @alfredcalleja450 8 หลายเดือนก่อน +1

    Hi Paul, thanks for another insightful tutorial. Even though I did your previous tutorial on PWM, I found this really reinforced my understanding of PWM and analogWrite, so I found this video really helpful and useful. Also, you really brought home to me the understanding that analogWrite is really pwmWrite and it only simulates an analog signal. Thanks again.

  • @jameslewellen150
    @jameslewellen150 8 หลายเดือนก่อน +1

    Nice video, in my previous homework I used the oscilloscope to show this. Have a nice day/night.

  • @MStoica
    @MStoica 8 หลายเดือนก่อน +1

    I can say your videos are great, without saying “your videos are great”: I’m watching despite the coffee remarks 😁 I would never put more coffee than milk in a coffee drink. Plus 2-3 kinds of syrup: always caramel and coconut, and sometimes also hazelnut - otherwise the drink doesn’t make any sense to me 😅

  • @jeraldgooch6438
    @jeraldgooch6438 8 หลายเดือนก่อน

    Not related to this video but…. I needed to edit a file on an RPi4. I found one of your old videos that covered how to use nano. Because of that video I was successful in what I needed. Just to remind you that your videos are valued as a tech library. Thanks.

  • @CasiboyCasiboy
    @CasiboyCasiboy 8 หลายเดือนก่อน +1

    hey Paul , i really love and enjoy your series of tutorial. In my opinion you are the best teacher there is out here, dynamic, make difficult concepts look casual , funny and have a lot knowledge. Could you do a series of tutorials on PCB design, I am sure you are pretty knowledgeable in this area of engineering. Thank you , God Bless you and your loved ones.

    • @paulmcwhorter
      @paulmcwhorter  8 หลายเดือนก่อน

      Thank you for the kind words. Probably wont be doing a PCB series as I do not have access to a way to get them made. Also, it is a tough topic as the software typically has so many different parameters, it is hard for a hobbiest to really master the topic.

    • @CasiboyCasiboy
      @CasiboyCasiboy 8 หลายเดือนก่อน

      PCBway offers manufacturing services at very affordable prices, often just a few dollars. Your ability to simplify complex concepts has always impressed me, so I understand if you prefer not to dive into this topic. However, if you're willing, I'd greatly appreciate a well-written explanation.

  • @frickinbill
    @frickinbill 8 หลายเดือนก่อน

    Great lesson! Ordered oscilloscope from your amazon link as its a very useful instrument.
    I agree with another comment regarding a basic course in how to utilize one as it can be very intimidating in regards to cost versus proper usage.

  • @FreidonNasrat
    @FreidonNasrat 8 หลายเดือนก่อน

    great lesson, I understood how to use PWM to perform analogWrite to digital.

  • @DrDave327
    @DrDave327 8 หลายเดือนก่อน

    Great review, Paul! Keep this great content coming!!

  • @larryplatzek9017
    @larryplatzek9017 8 หลายเดือนก่อน

    As usual this a great lesson and next week will be doing Analog reads, good!

  • @drthik1
    @drthik1 8 หลายเดือนก่อน

    Makes sense how the arduino uses pwm/timing/off-on to control output voltage. Used the oscilloscope to see the signal output. It would be nice to get a supplemental crash course lesson on using it though. I ordered one through your amazon link.

    • @paulmcwhorter
      @paulmcwhorter  8 หลายเดือนก่อน +3

      I am thinking about doing a general circuits class around the oscilliscope but just have not yet got it all laid out.

  • @mundocoolokudasai9478
    @mundocoolokudasai9478 9 หลายเดือนก่อน +2

    Excellent videos, dear teacher, you could make an example with Arduino to control a brushless motor for RC airplanes, using drivers because I always end up burning the drivers and mosfets, to control the gates of the mosfets, the motors are soon three-phase and we use them famous h-bridges, we would appreciate it, and for everything you have taught us, God bless you

  • @robertschuldenfrei2402
    @robertschuldenfrei2402 8 หลายเดือนก่อน

    There is no “making” assignment for this week. Rather, teacher Paul asked us to summarize Pulse Width Modulation (PWM) as explained in the video. The Arduino can only generate digital signals by way of two voltages, either zero volts or five volts. That can be made to correspond to a pseudo analog value of voltages between 0 - 5. It does this by dividing the signal into small segments of 1/256 or 0.01953 volts each. It then passes one of these integers on to the analogWrite() function. For example, if you sent 51 to the analogWrite() function it would output 1v. It does this by keeping the pulse voltage at 5 for 51/256 of the time and 0 for 205/256. The LED appears to be dimly lit all of the time, but it is dark most of the time in this example.
    Just for fun I asked ChatGPT: “What is Arduino PWM?” Of course, ChatGPT did not listen to today’s presentation, however its answer is quite good. Here is part of its answer:
    Arduino PWM (Pulse Width Modulation) refers to the technique used by Arduino microcontrollers to simulate analog output using digital signals. PWM allows you to control the average voltage level delivered to a load by rapidly switching a digital output pin on and off at varying intervals. By adjusting the duty cycle (the percentage of time the signal is on versus off within each cycle), you can effectively control the power delivered to devices like LEDs, motors, or other actuators.
    In an Arduino, PWM is commonly used for tasks such as dimming LEDs, controlling the speed of DC motors, or generating analog voltage levels for interfacing with analog components. Although Arduino boards are digital devices, PWM enables them to interface with analog components and perform analog-like tasks.
    Arduino boards have built-in PWM capabilities on certain pins, which are marked with a "~" symbol on the board. These pins are capable of producing PWM signals using the analogWrite() function in Arduino IDE. The function takes two arguments: the pin number and the desired duty cycle, which ranges from 0 (always off) to 255 (always on).

  • @anagramfive
    @anagramfive 7 หลายเดือนก่อน

    Homework: In this class we learned that Arduino has the hability to "simulate" analog outputs in order to have a range of 256 levels of voltage in the PWM (Pulse Widht Modulation) pins intead of the digital ouput of only 0 or 5 volts (Low & High). The special pins PWM are marked with the symbol "~" beside of the pin number. The Pulse Widht Modulation consists not in make a variation in the ouput voltage, but in making a kind of average voltage by letting out 5V for a fraction of 2ms. This way we have a 256 fractions of every 2ms to emulate an output between 0-5 Volts. In this case when the analogWrite in a PWM pin = 0, we have an output of 0V. all the time. In tha case of analogWrite in a PWM pin = 255, we have a constant output of 5V. In between if we have a value of 128, we have 1ms High and 1ms Low (simulating an output of 2.5V.), and so on all the range...

  • @Tron_Starfighter
    @Tron_Starfighter 7 หลายเดือนก่อน

    We can simulate an analog value using a digital device if we properly choose our ON and OFF time frames. The arduino function 'analogWrite' performs this function for us requiring us to only need to choose a "brightness" value; which in reality is setting the ON/OFF time frames. I suspect we could achieve the same result manually by using the function 'digitalWrite' and choosing sufficiently small 'delay' time values for ON and OFF.

  • @alfredvink
    @alfredvink 3 วันที่ผ่านมา

    Ok, so in this lesson we learned how to 'simulate' analog values with the Arduino. The Arduino can do this by using a technique called Pulse Width Modulation or PWM. As the Arduino can only output HIGH and LOW, or 5V and 0V the analog value is represented by the amount of time the signal stays HIGH within a certain period of time. The period for PWM is defined as 2 mSec. So if the signal stays HIGH for 1 mSec within this 2 mSec interval it is at 50% or 127 on a scale from 0 - 255. If the signal stays HIGH for 0.2 mSec it is at 10% or 26.
    By rapidly switches between 5V and 0V in this way, average voltages can be applied to the output.

    • @paulmcwhorter
      @paulmcwhorter  2 วันที่ผ่านมา +1

      Excellent summary

  • @ryanholt2509
    @ryanholt2509 6 หลายเดือนก่อน

    Great explaination!

  • @PhilipStanway
    @PhilipStanway 8 หลายเดือนก่อน

    The lesson explained how to get an output with only zero and five volts to simulate any other voltage. The output of zero and five volts is switched in a defined period on and off so the average of the voltage over that period is the desired output voltage. For the Arduino this only works on output with a "~" and use of the analog write function.

  • @taurus548
    @taurus548 8 หลายเดือนก่อน

    Great Lesson!

  • @mahanmotaghiraad1790
    @mahanmotaghiraad1790 4 หลายเดือนก่อน

    So I believe we should use 1k resistors even if we are using a low voltage as it is actually implementing 5 volts. right?

  • @fredvanderheyden6969
    @fredvanderheyden6969 8 หลายเดือนก่อน

    Hi Paul, I am a complete newbie, have been doing your tutorials in this series. Runing an Uno R3. All was going good till this session. I think I may have cooked two boards. I can't get past this message: "uploading error: exit status 1". Have tried reinstalling the IDE program, different cables to connect UNO, different Ports. Is there a way to test for u/s boards?

  • @patrickfox-roberts7528
    @patrickfox-roberts7528 8 หลายเดือนก่อน

    Thanks Paul.

  • @ArthurCammers
    @ArthurCammers 3 หลายเดือนก่อน

    With my Arduino Uno WIFI pin 12 (putative on PWM) behaves just like pin 11 (PWM) with output from analogWrite command.

  • @BerndRenzing
    @BerndRenzing 8 หลายเดือนก่อน

    Question:
    If I have an actor which supports v(max) 3V; could I use also PWM with 126 for this although the device gets 5 Volts for 1ms and then 0 Volts for the other ms.

    • @paulmcwhorter
      @paulmcwhorter  8 หลายเดือนก่อน

      Yes, you have to be cognizant of that PWM does produce a larger peak votage than the specified voltage, so you have to make sure that will not damage the component you are driving.

  • @J-WafflezZ
    @J-WafflezZ 7 หลายเดือนก่อน

    Question, if the analogWrite is just PWM and the average is taken from the 2ms, why cant we get the same result from a digitalWrite if we manually average a 126 having a digitalWrite of HIGH with a 1ms delay and then a digitalWrite of LOW with another 1ms delay?
    Im sure im missing something here, im just not quite sure what it is...
    [edit] For those who have the same questions. If you use a digitalWrite with 1ms delays in between the HIGH and LOW, you can actually mimic an analogWrite at 126, its just not as efficient.

  • @kenamosjr.bo_51
    @kenamosjr.bo_51 8 หลายเดือนก่อน

    I originally thought it would show up as the voltage value we wanted but remembered it only shows time/ frequency on scope as full voltage . The actual voltage needs read by meter and it will be the voltage we’re after. Been 45 yrs since high school electronics-Lol.

  • @chrisallen2894
    @chrisallen2894 5 หลายเดือนก่อน

    🙏

  • @RiteshKumar-vz5pz
    @RiteshKumar-vz5pz 8 หลายเดือนก่อน

    create a video, how to code esp32 and ram4m1 chip intependently without using any usb bridge, because when i program esp32 in arduino r4 wifi , the device goes always on ESP_Download mode, then we can't program ram4m1 chip then.
    please guide us how to access both chip independently

  • @dorixlopte6026
    @dorixlopte6026 5 หลายเดือนก่อน

    if you want a output of 2,5 v the arduino don´t understand 2,5v he can only produce 0v and 5v, so the arduino switch in the half of a period off and the other half on. The average is 2,5v.

  • @wallypelech6181
    @wallypelech6181 8 หลายเดือนก่อน

    😅 27:35

    • @wallypelech6181
      @wallypelech6181 8 หลายเดือนก่อน

      If I wanted to analogwrite 120 only on the 1st time through the loop, what would the waveform look like after the first 2ms?

  • @richardsstark9825
    @richardsstark9825 8 หลายเดือนก่อน

    my homework th-cam.com/video/3TOiPGM94Ak/w-d-xo.htmlsi=54MDc1G1MDxY8tfV
    In audio terms, the Arduino PWM pin generates a square wave of constant amplitude (peak to peak of approximately 5 volts) and constant frequency (wavelength of about 2 milliseconds, or 500Hz, corresponding to a musical note close to of B4). Modulating the pulse width by varying the analogWrite value in the code changes the average voltage as measured with a multimeter or LED brightness. This changes the timbre of the note without changing the frequency or amplitude.

  • @zrig1
    @zrig1 3 หลายเดือนก่อน

    Is it odd that I am following an Arduino tutorial to learn my ESP32 ...

  • @coolguyfilms6631
    @coolguyfilms6631 6 หลายเดือนก่อน +2

    Hey paul 👋
    Please adopt me so i can be paul jr.
    Xoxo

  • @scottwait3585
    @scottwait3585 8 หลายเดือนก่อน

    Thank you Paul