Using Raspberry Pi to read signal generated by a function generator

Thread Starter

John Manuel

Joined Jun 6, 2018
17
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.
 

Attachments

jaredwolff

Joined Jul 1, 2017
58
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.
I have found that without a logic analyzer for these types of situations, I'm completely lost. I suggest you go grab one, even a cheap one off of eBay if you don't have the budget for a Saelae (though I highly recommend them, they're awesome -- no affiliation) Alternatively, you can capture things on a standard scope but seeing the hexadecimal representation of the I2C transactions is gold.

Next best bet it to make sure that the supply matches of the Raspberry Pi. The Pi runs at 3.3V so the I2C pull-up resistors should be pulled up to 3.3V.

Next thing, do you have I2C pull-up resistors? Are they on that dev board. You're dead in the water without em. Typically built in pull-ups do not do a sufficient job. (4.7k recommended)

Also, along the same lines, read the documentation as to what the chip on the dev board should be addressed as. Looks like there are 3 address pins that control the 3LSB of the address. Again, easy to figure out if you're getting I2C NACKs on your logic analyzer output.

Once you ruled out the hardware, I would again reference the data being provided by the analyzer and figure out what commands are working and what aren't. Typically, these types of devices require some setup or even setting some bits in registers to enable the device or even a single ADC channel.

Hopefully that gets you off on the right foot.
 
Top