I am currently building a Multichannel analyzer featuring a Pi3. A requirement is very fast ADC acquisition. SPI and I2C are all too slow i.e. millisecond sample times. It seems the only converters that are fast enough (and 12-16 bit) are parallel data transfer. The Pi i/o seems to scatter its data bits randomly over its ports I can't seem to find a contiguous byte much less word. How can one use a "data bus" with the Pi, not using bus expansion shift registers (just another way of saying serial port) I need a minimum of 8 bits for a 2 byte read. Or have I hit a dead end? Thank You Todd

  • 1
    SPI too slow? A 100 ksps shouldn't be that hard on a Pi3. – joan Aug 4 '16 at 17:13
  • The UART will work at 1 Mbps, so using a parallel input shift register should net you 125 KB/s. – goldilocks Aug 4 '16 at 18:46
  • I would really like to get the sample acquired and read in 5 uS, 10 uS at the most (1 uS would be a dream). All of the ADC's I have found with SPI are much slower than that. The only ones faster in serial are some formats I'm really not familiar with. They seem to be for audio/video codecs. – Todd Coleman Aug 4 '16 at 19:10
  • 1 usecs would be a dream. If the sample size is 4 bits you might conceivably get 5 usecs, if it is 8 10 usecs, but you will only be able to do it using an existing bus that is implemented in hardware. There is no possibility of fabricating some kind of parallel interface in software working at that speed using the GPIOs, particularly within the context of a multi-tasking OS. – goldilocks Aug 4 '16 at 21:04
  • 1
    @goldilocks Actually pigpio can sample GPIO 0-31 at 1 MHz. I don't recommend it as it uses 25% of the CPU for the sampling (the default 5µs sampling rate has an overhead of about 6%). The problem with parallel data is clocking the data into the Pi. – joan Aug 4 '16 at 21:18

Todd, I've faced a similar issue, for ultrasound signal acquisition. Basically, you may want to explore the way the GPIOs of the Pi are mapped to its memory - but once it's done you just have to reorganize the bits and reconstruct your signal.

I would recommend this article as it describes quite well the way parallel ADCs are managed and mapped to memory, resulting in a 10Msps+ acquisition. And for the fun of it, you can interleave two ADCs, clocked by the Pi, and get up to 20Msps+.


Todd, you possibly should back up and rethink the problem. I have worked on a series of data collection systems that have looked at the spectra from NaI(Tl) and BGO. The resolution of these detectors is such that you are kidding yourself trying to look at a higher resolution than 8 bits. Our systems accumulates the data from the detector in a remote memory (like the internal memory in a microcontroller) and only transmits the data block serially once a second. That would be 256 channels with 16 bit wide data. Even if you could manage count rates of 1 million counts per second, unless they were all in a few channels (causing overflow of the 16 bit data) you could transmit your entire spectrum with only 4096 bits of data per second. That would be pretty simple for any Pi, or even any Arduino for that matter. If the update rate is not high enough, you could probably get away with sending the samples every quarter second. It complicates the hardware a bit, but if you are good enough to design an A/D converter and signal conditioning circuits that can handle a million counts a second plus solve the nonlinearity issues of the detectors at such a high count rate the addition of a microcontroller would be trivial.

  • Yes currently using, Bicron BC412. It may very well be that I am expecting unrealistic count rates but transmission is not the problem as I plan to keep the dataset in local ram as the Pi has plenty and process it after I gather it. As for resolution I have the bad(?) habit of gathering more than I can use and filtering it after I gather it because I can always throw it out. What would be a reasonable count rate? also the conversion time is almost more important to minimize the sag in the sample-hold. -continued- – Todd Coleman Aug 16 '16 at 11:59
  • -continued- I think that concerns me the most right now. Any advice would be appreciated as this is a diy Gamma-ray spectrometer. The "soundcard" version didn't make me happy (grin). – Todd Coleman Aug 16 '16 at 12:00

Take a look at USB FIFO chips, like UM245R. They allow you to sample 8 bits at a time at pretty high rates, and transfer that data via USB at very decent speeds (UM245R datasheet advertises data rates up to 1 MB/s). FTDI also provides drivers for Linux, including Raspberry Pi.

enter image description here

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.