Connect with us

Using Raspberry Pi to read signal generated by a function generator

Discussion in 'Microcontrollers, Programming and IoT' started by John Manuel, Jun 25, 2018.

Scroll to continue with content
  1. John Manuel

    John Manuel

    20
    0
    Jun 7, 2018
    I am trying to work with the signals generated by a function generator using Raspberry Pi. Since Raspberry Pi does not have an inbuilt ADC, I used pcf8591. Now, I do not know how to feed the signal generated by the function generator into the input pins of pcf8591. Please help.
     
  2. kellys_eye

    kellys_eye

    4,275
    1,147
    Jun 25, 2010
    Have you looked at the datasheet for the device?

    It's a simple matter of applying it to the analog input pin(s) !!! Just make sure the ground connections of both circuits are commoned together and power them accordingly.

    Or look at this website:

    http://henrysbench.capnfatz.com/hen...duino-tutorial-1-a-simple-analog-measurement/

    As for the BNC part, the signal goes through the centre 'core' and the screen of the cable is connected to ground.
     
  3. John Manuel

    John Manuel

    20
    0
    Jun 7, 2018
    I am using a Raspberry Pi 3 Model B to read the signal generated by a function generator. I have used PCF8591 fitted in YL-40 PCB as the ADC. I have used python for establishing the I2C communication between the Rpi and PCF8591. But, I am getting undesirable values when I run the setup.

    The connection between the Rpi and PCF8591 are as follows-
    (Rpi) (PCF8591)
    Pin 1 -> VCC
    Pin 3 -> SDA
    Pin 5 -> SCL
    Pin6 -> GND

    The generated wave was: Frequency = 1KHz; Amplitude = 1 Vpp; DC offset = 0

    A picture of the python code I used, the output when the function generator is not connected, the output when the function generator is attached and the connection between the ADC and the function generator is attached below.
     

    Attached Files:

  4. kellys_eye

    kellys_eye

    4,275
    1,147
    Jun 25, 2010
    In what way are they 'undesirable'?

    What are you 'expecting' to see?

    The values you get will correspond to the instantaneous value of the waveform at the time when the sample is taken i.e. if you sample it at the peak of the waveform you will 'consistently' measure the peak amplitude but if your samples are taken 'at random' you will see values that could be from anywhere on the waveform cycle.

    Equally, if you are sampling at a too low frequency (sample rate) you won't see enough values to reconstitute the original signal - if that's your intention.

    Are you looking to measure peak, average or frequency values? etc?
     
  5. Alec_t

    Alec_t

    2,950
    803
    Jul 7, 2015
    Make sure that the function generator signals are within the allowed input range of the ADC module. You may need a DC offset. Check the datasheets/specs of both the generator and the module.
     
  6. John Manuel

    John Manuel

    20
    0
    Jun 7, 2018
    I wanted to measure the frequency
     
  7. kellys_eye

    kellys_eye

    4,275
    1,147
    Jun 25, 2010
    You will need a peak detector and a timer interrupt to do that.

    Currently all you are doing is taking repeated measurement of the amplitude of the signal - which tells you nothing!
     
  8. Alec_t

    Alec_t

    2,950
    803
    Jul 7, 2015
    .... or a zero-crossing detector instead of the peak detector, if the waveform is bipolar.
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-