Reading PWM Receiver Signal Using Arduino with Interrupt - Part 2

Поделиться
HTML-код
  • Опубликовано: 3 окт 2024

Комментарии • 49

  • @KirtikSoni
    @KirtikSoni 7 лет назад +3

    Superb Tutorial! The code is no nonsense and clean, Does the job wonderfully.. Thankyou so much

  • @joaoefrem
    @joaoefrem 8 месяцев назад

    Hi Kamran, So how can I implement the Failsafe after switch off the Receiver, possible implement this?

  • @pache11
    @pache11 7 лет назад +1

    I would like to have a more versatile PWM decoder to decode both the Duration and Frequency of PWM signals from 1 to 100kHz. Could you please show how that would be accomplished if capable using arduino. Thanks for your great work!

  • @1ozzyabroad
    @1ozzyabroad 7 лет назад +1

    Excellent series of videos, very clear and concise!!
    Do you know how to use these inputs to switch an output pin on a UNO, to switch an LED array on and off based on the pulse width? Say,

  • @_duta_
    @_duta_ 8 месяцев назад

    Does this work with a nano?

  • @eletronicaparaohooby
    @eletronicaparaohooby 7 лет назад

    Hi karan
    Very good, your tutorial!
    helped me a lot.
    Let me ask you 3 questions?
    The first, is it possible to use the other interrupt ports?
    I have the atmega 328p -AU, and in the datasheet informs that it has 23 interrupt ports.
    I changed the code, added more variables to store the timer values ​​and port, for exemple B00010000
    But the interruption occurs only in pins 12,13,14 and 15.
    For example, in the datasheet it says that pin 1 is also interrupt, but it does not work.
    I'll need to use 3 ports to read 3 channels from my receiver,
    But then I'll need to use two PWM ports for this.
    I wanted to use an interrupt port that did not have the PWM function.
    In my case I need the 6 PWM ports.
    Do you know how?
    The other question is, the pulsein command would help me solve this problem.
    But the problem is that when the signal is missing, it takes too long.
    But the advantage of pulsein is that you can use any port to read PPM signal.
    Do you know how the pulse in command works?
    Or just how to do a PWM via software?
    Thanks!

  • @tomscietvirs2379
    @tomscietvirs2379 4 года назад

    Hello!
    is it possible to control the speed of stepper motor (Nema17)?
    WITH this code?
    writing down the required code?
    I tried everything, but I didn't get it.

  • @varaprasaderapu65
    @varaprasaderapu65 6 лет назад

    It was nice video ..excellent very useful.

  • @safugam
    @safugam 8 лет назад

    You great , thank you , please dont stop

  • @hots2215
    @hots2215 4 года назад

    It`s absolutly stunning how well you teach me...
    but the code I write by my own does not show anything on serial monitor
    plz fix the download link of the code cuz it does not working now!
    thanks

  • @christophborst5536
    @christophborst5536 9 лет назад +2

    Very good post, thanks a lot :-)

  • @sesya222777
    @sesya222777 8 лет назад

    OMG, thank you, it helps a lot

  • @thegreatestmoo
    @thegreatestmoo 8 лет назад

    How would you use PCINT13-8 for this?

    • @kamranahmad6808
      @kamranahmad6808  8 лет назад

      PCINT15-8 are registered with interrupt enabler PCIE1 therefore you first need to run
      PCICR |= (1 PCINT15 can be used as interrupt pins but they are managed by PCMSK1 register, to enable each pin use
      PCMSK1 |= (1

    • @thegreatestmoo
      @thegreatestmoo 8 лет назад

      actually switched over to a MEGA board and I'm using
      PCICR |= (1

    • @kamranahmad6808
      @kamranahmad6808  8 лет назад

      That mistake is very common, PCINT16 has input register PINK not PIND. Using PINK & B00000001 should work.
      Depending on what you want the micro controller to do, try to avoid using digitalRead as it has many overheads and takes long to compute.

    • @thegreatestmoo
      @thegreatestmoo 8 лет назад

      Thanks for the help! I'm wondering if you can help me fix another issue kind of related to this. I'm using this code you showed in the videos to read my RC receiver's 6 channels. Now I'm using the built in Servo library to actually control my servos, and they have a really bad jitter problem. The servos glitch a couple degrees every few seconds, I think the arduino library is not very good. I have no idea where to even begin to write my own servo control code.

  • @jonasnebuka
    @jonasnebuka 4 года назад

    Nice Video, explained very well! Thanks

  • @frajomethippara9952
    @frajomethippara9952 7 лет назад

    very good tutorial... can you tell me the difference between ppm on and off in rx settings on tx

    • @KirtikSoni
      @KirtikSoni 7 лет назад

      Do you have a flysky fsi6? If yes, then you need ia6b receiver to use ppm option. the stock receiver cannot work with ppm. More on interfacing ppm here www.instructables.com/id/Reading-RC-Receiver-PPM-Signal-Using-Arduino/

  • @ChaotiCity
    @ChaotiCity 8 лет назад

    thank, can you show how to use attachInterrupt this function to do the same thing

  • @fotoamgamgfoto3695
    @fotoamgamgfoto3695 8 лет назад

    something is not working good for my Leonardo pro micro for input[0] I get 6724
    and for toher channels I get around:
    input[1] 13884
    input[2] 11528
    input[3] 12192
    just by touching the analog pins by hand!

    • @kamranahmad6808
      @kamranahmad6808  8 лет назад

      If the pins are open, they are likely to generate noise. Make sure they are connected to source if needed otherwise ground them or disable their interrupt.

  • @BasilHerb
    @BasilHerb 4 года назад

    Hi! Would it be possible to reupload the Link for the Final Code? I tried to copy it on the go and I think I almost did it, but its not quite working and I'm quite confused as to what I did wrong. Having the Final code would be a great help, thanks!

  • @rudramutalik5704
    @rudramutalik5704 6 лет назад

    How would you add more than 8 channels?

  • @tpobrienjr
    @tpobrienjr 8 лет назад

    Thank you. This is a good, clear explanation and demonstration.

  • @OCross19
    @OCross19 7 лет назад +1

    a question... Is it possible to read 5 PWM signals on arduino uno?

  • @rudramutalik5704
    @rudramutalik5704 6 лет назад

    your final code link does not work, but good tutorial!!

  • @chefseg
    @chefseg 2 года назад

    curious if this is possible on an ESP32S?

    • @chefseg
      @chefseg 2 года назад

      got it to work on the ESP32S with a different method but using the same logic, thank you!

  • @ChrisPavey85
    @ChrisPavey85 8 лет назад

    Quick question on the timer array. You've declared an array of 4 timers but then used timers 0 > 4. Why does this not throw an error?

    • @kamranahmad6808
      @kamranahmad6808  8 лет назад +1

      +Chris Pavey Sorry, I fixed it but the video probably got cut in post so it wasn't mentioned. The final code is actually using 5 timers which is correct. I'm trying to annotate that error but it wouldn't let me...

  • @alphalimit8
    @alphalimit8 6 лет назад

    its not working on my teensy..

  • @TechBaumgartner
    @TechBaumgartner 6 лет назад

    Wonderful Tutorial! Thank you!

  • @aldskanser7880
    @aldskanser7880 7 лет назад

    Stunning!!
    Really good.
    Thanks!

  • @devsoft1989
    @devsoft1989 5 лет назад

    Your idea create.but i use attachInterrupt instead. Thank you.

  • @niloysarkar8993
    @niloysarkar8993 8 лет назад

    I follow the same procedure but the channel which I have selected as last always giving wrong values. But the other channels are working fine. Do you have any idea about this?

    • @kamranahmad6808
      @kamranahmad6808  8 лет назад

      +Niloy Sarkar I would check if the board supports interrupt at that pin. Also verify that you are allocating correct variables. Finally could be a broken connection.

    • @fotoamgamgfoto3695
      @fotoamgamgfoto3695 8 лет назад

      how to choos which pin for which channel? I have a Leonardo Pro Micro and want to hook my receiver as joystick, the joystick library is working now I need to know what pins are good and how to set them up for receiver inputs (4-5 channels enough for me)
      According to documentation:
      Micro, Leonardo, other 32u4-based, Digital Pins Usable For Interrupts: 0, 1, 2, 3, 7
      But on the board pin numbers start from 2..10 then 14 15 16, no other pins like pin 1 or pin 0
      media.apcmag.com/wp-content/uploads/sites/20/2014/01/apcnews2012apc-arduino-foot-switch-project-thumb_mainImage2.jpg2.jpg
      upd: oh I found it the RX0 and TX1 are used for it:
      External Interrupts: 0(RX), 1(TX), 2, 3 and 7. These pins can be configured to trigger an interrupt on a low value, a rising or falling edge, or a change in value. See the attachInterrupt() function for details.
      Serial: 0 (RX) and 1 (TX). Used to receive (RX) and transmit (TX) TTL serial data using the ATmega32U4 hardware serial capability. Note that on the Micro, the Serial class refers to USB (CDC) communication; for TTL serial on pins 0 and 1, use the Serial1 class.
      So far I could get:
      docs.google.com/document/d/1ew2NMjswf7mPXAz_kwTeJL5NdgQKJrjOKzxiGQrffEU/edit?usp=sharing

    • @kamranahmad6808
      @kamranahmad6808  8 лет назад

      You code seems good to me, in order to choose the pins you want to use, you need to cross reference PCINT0 -> PCINT3 from data sheet to arduino pinout. Then when you plug the pins in, they should read. If you think interrupts are not working correctly, try running one interrupt at a time to see if they all work on their own.

  • @joelcielto1803
    @joelcielto1803 9 лет назад

    Thanks man helped alot

  • @rendyzuliawan1662
    @rendyzuliawan1662 8 лет назад

    hi,,how to controll brushless motor with this project ??

    • @callumwhite6434
      @callumwhite6434 8 лет назад

      hi. you should write a program to get the values (input[0-3]) and convert them into PWM signals if you are using an ESC. I would use the servo library. search controlling a brushless motor with Arduino. and i would use the Map function in Arduino. Hope this helps

  • @varaprasaderapu65
    @varaprasaderapu65 6 лет назад

    Bro its working on Mega board but it's not showing the values well.. I'm just getting 0 - 0 -0- 0

    • @varaprasaderapu65
      @varaprasaderapu65 6 лет назад

      In Uno Board serial print of" interrupt" is also not responding. I'm giving to the pulses signal to the 8,9,10,11 pins but not responding. Can you please mention reason for that.

    • @TheSnow520lee
      @TheSnow520lee 6 лет назад

      same here... all 0-0-0-0