Menu

No PPMout signal

Bugs
Anonymous
2020-08-24
2020-08-26
  • Anonymous

    Anonymous - 2020-08-24

    Hi, first of all thanks a lot for your work.
    I'm trying to use PPMin and PPMout to record the data emitted by a remote control while transmitting.

    Step by step I managed to record the data by transmitting it to a computer. However, when I wanted to compare the input and output signal with an oscilloscope I realized that the output signal did not match the input signal at all.

    So I decided to just try this code to compare the 2 signal :

    #include <PPMIn.h>
    #include <PPMOut.h>
    #include <Timer1.h>
    
    #define CHANNELS 6
    
    uint16_t g_valuesIn[CHANNELS];                  
    uint8_t  g_workIn[PPMIN_WORK_SIZE(CHANNELS)]; 
    
    uint16_t g_valuesOut[CHANNELS];                   
    uint8_t  g_workOut[PPMOUT_WORK_SIZE(CHANNELS)];  
    
    rc::PPMIn g_PPMIn(g_valuesIn, g_workIn, CHANNELS);
    rc::PPMOut g_PPMOut(CHANNELS, g_valuesOut, g_workOut, CHANNELS);
    
    void setup()
    {
      rc::Timer1::init();
    
      pinMode(8, INPUT);
    
      PCMSK0 = (1 << PCINT0);
      PCICR = (1 << PCIE0);
    
      g_PPMIn.setTimeout(1000);
      g_PPMIn.start();
    
      g_PPMOut.setPulseLength(448);   
      g_PPMOut.setPauseLength(10448); 
      g_PPMOut.start(10);
    }
    
    void loop()
    {
      g_PPMIn.update();
    
      if (g_PPMIn.isStable())
      {
      }
      else if (g_PPMIn.isLost())
      {
      }
    
      for (uint8_t i = 0;  i < CHANNELS; ++i)
      {
        g_valuesOut[i] = g_valuesIn[i];
      }
      g_PPMOut.update();
    
      delay(50);
    }
    
    static uint8_t lastB = 0;
    
    ISR(PCINT0_vect)
    {
      uint8_t newB = PINB;
    
      if ((lastB & (1 << 0)) != (newB & (1 << 0)))
      {
        g_PPMIn.pinChanged(newB & (1 << 0));
      }
    
      lastB = newB;
    }
    

    I checked the values g_valuesIn and g_valuesOut are the same before and after g_PPMOut.update().

    You can find attached a picture of the signal on the oscilloscope the input signal is in yellow and the output in blue. You can see that neither the amplitude nor the pulse duration corresponds.

    Could you please help me with this problem?

     
  • dvdouden

    dvdouden - 2020-08-24

    that's odd. The ppm generator code is pretty robust, or at least it's supposed to be.
    You are using a Atmega328 based Arduino? (i.e. an Uno or Nano)
    There's not much I can do about the amplitude, it's a digital output pin so it's either VCC or GND. The input voltage depends on whatever your receiver outputs, that may be 3.3V. If you need a lower output voltage then you could use a voltage divider made out of a few resistors.

     
    • Anonymous

      Anonymous - 2020-08-25

      Yes I am using a Atmega328 on a arduino Uno.

       

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.