I would like to send a random binary data sequence to a rpi GPIO at a particular frequency and then read the data stream off a scope. Is there a way of implementing this through python?

  • what are you using for sending the data to the RPi? – jsotola Nov 13 '19 at 0:01
  • I want to write code to send the random data stream to a GPIO to read off on a scope. The binary data will later be used to encode a signal through various modulation schemes. The data stream is generated from the pi and transmitted out through a GPIO. – Ric Turner Nov 13 '19 at 0:08
  • Hi @Ric Turner, Welcome and let me see. You can poll or interrupt a input mode GPIO pin for your signal and log the reading results to a text file, together with time stamps, and display them as a scope like wave form. You can also use the scope' "single trigger mode" to display the waveform within a time period. You can also use a cheapie, US$300 scope to display the Fast Fourier Transform of the components of your random signals. – tlfong01 Nov 13 '19 at 0:15
  • I am a little bit confused. Do you mean you wish to use an output mode GPIO pin to send a random sequence of high low signals, which will be read by an input mode GPIO pin? If what you wish is only to display the signal waveform, you can directly output the signal to a scope, say, cheapie US$100 digital storage oscilloscope. – tlfong01 Nov 13 '19 at 0:21
  • Yes, I'd like to output the random sequence of HIGHs and LOWs from a GPIO pin set as an output. I'd like to clock the data out at a particular frequency. I've looked online but most examples include using SPI or I2C. I do not wish to use a master and slave setup with stop, start or acknowledge bits. The end result would be to see the data stream from a digital oscilloscope and to be able to identify the bit period that corresponds with the frequency that the data is sent out at. – Ric Turner Nov 13 '19 at 0:30

This assume you are sending the random data stream from the Pi.

pigpio waves will do what you want as long as you do not need better than 1 µs resolution.

For Python see wave_add_generic.

Perhaps have a look at the morse code example to get an idea of the sort of code you will need to write.

If you just want to view a random data stream sent to the Pi use piscope.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.