I need to get measurements of voltage and current using two sensors connected through an MCP3008 ADC to the Raspberry Pi. I need to get the voltage and current waveforms simultaneously and compare them to find phase difference, etc. But since only one channel of the MCP3008 can be queried at once, I'll have to query both the sensors one after another.

How fast can I query them?

  • What is fast enough? – joan Mar 1 '16 at 14:13
  • Rephrased the question :) – Hassaan Mar 1 '16 at 14:38

The standard Pi Linux SPI driver can execute about 20 thousand transactions per second.

So to read two channels from a MCP3008 should take about 0.1 milliseconds.

  • Can you please provide a reference for that? I would like to use it in my project. – Hassaan Mar 1 '16 at 17:29
  • 1
    You won't find any official document which gives that information. The 20 k transactions per second with the standard Linux SPI driver is based on my own benchmarks. If you bypass the Linux SPI driver you can increase the performance 20 times. – joan Mar 1 '16 at 18:00
  • Is this the total amount of time required to read the two channels? Or is there some other delay that needs to be accounted for as well, like switching channels? – Hassaan Mar 3 '16 at 12:53
  • 1
    That will be the total time. However you must bear in mind that two separate SPI transactions may be split by a Linux interrupt which will (very rarely) throw your timings out. To get around that I think you can use an IOCTL to merge the transactions as far as the driver is concerned. – joan Mar 3 '16 at 12:59

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.