rooster
Posts: 100
Joined: Thu Aug 02, 2012 8:09 pm

RPi oscilloscope

Fri Aug 17, 2012 3:19 pm

I have a number of things I am looking to do with the RPi, they all involve measuring external voltages.

These voltages may be 240 V or mV, static or time varying.

Any experts out there able to design a circuit that would take an external voltage, step it up/down to an appropriate level (maybe via a x10, x100 etc switch), pass through an AD converter to the GPIO? I'm sure I can write the software to make a nice oscilloscope trace out of the results.

R

User avatar
Burngate
Posts: 6372
Joined: Thu Sep 29, 2011 4:34 pm
Location: Berkshire UK Tralfamadore
Contact: Website

Re: RPi oscilloscope

Fri Aug 17, 2012 4:38 pm

What you are going to need pretty much depends on what you want to look at.

Peering over the table here, I can see a proper scope, that'll take a signal from 2mv upto 1000v, from DC upto 100MHz, and display it.
If you want to limit yourself to audio, say 10Hz to 20kHz, and look at between 10mv and 10v, it should be doable.
Analogue TV - upto 5MHz - gets more difficult

If you want to look at mains - 240v, 50Hz - my advice would be DON'T - not until you know more about what you're doing.
That can bite, and can fri your Pi

User avatar
redhawk
Posts: 3465
Joined: Sun Mar 04, 2012 2:13 pm
Location: ::1

Re: RPi oscilloscope

Fri Aug 17, 2012 4:51 pm

Timing is going to be a big issue the PI doesn't have an RT clock or timing chips so calculating the frequency would be problematic if not inaccurate.

Richard S.

Hugh Jarse
Posts: 46
Joined: Mon Mar 05, 2012 5:03 pm

Re: RPi oscilloscope

Tue Aug 21, 2012 3:55 pm

redhawk wrote:Timing is going to be a big issue the PI doesn't have an RT clock or timing chips so calculating the frequency would be problematic if not inaccurate.

Richard S.
I think this point is well made. To do this kind of application where you want the display to tell the truth about the outside world, you surely would not want to do frequency calculation anyway on a multitasking OS. This probably needs to be farmed out to some preprocessor/mcu circuit.

User avatar
DexOS
Posts: 876
Joined: Wed May 16, 2012 6:32 pm
Contact: Website

Re: RPi oscilloscope

Tue Aug 21, 2012 4:13 pm

Or you could use a bare metal OS on the PI, i have had very good results using bare metal.
If you can code a arduino bare metal, then you can code a pi.
Batteries not included, Some assembly required.

User avatar
TonyD
Posts: 451
Joined: Thu Sep 08, 2011 10:58 am
Location: Newcastle, UK
Contact: Website

Re: RPi oscilloscope

Tue Aug 21, 2012 8:02 pm

Are they any good wiki references or blogs showing how to "bare metal" program on the RPi?
Tony

tufty
Posts: 1456
Joined: Sun Sep 11, 2011 2:32 pm

Re: RPi oscilloscope

Wed Aug 22, 2012 6:19 am

Yes.

User avatar
DexOS
Posts: 876
Joined: Wed May 16, 2012 6:32 pm
Contact: Website

Re: RPi oscilloscope

Wed Aug 22, 2012 11:35 am

TonyD wrote:Are they any good wiki references or blogs showing how to "bare metal" program on the RPi?
Heres some of my tuts, using assembly macros to make a basic/arduino like language for bare metal coding.
http://www.dex-os.com/DexBasic/DexBasic.htm

Note: I have added lots more function and tuts, but i have not up loaded them yet.
Batteries not included, Some assembly required.

User avatar
TonyD
Posts: 451
Joined: Thu Sep 08, 2011 10:58 am
Location: Newcastle, UK
Contact: Website

Re: RPi oscilloscope

Wed Aug 22, 2012 2:58 pm

Thanks DexOS, I'll check them out
Tony

Hugh Jarse
Posts: 46
Joined: Mon Mar 05, 2012 5:03 pm

Re: RPi oscilloscope

Wed Aug 22, 2012 4:58 pm

DexOS wrote: Heres some of my tuts, using assembly macros to make a basic/arduino like language for bare metal coding.
http://www.dex-os.com/DexBasic/DexBasic.htm
Interesting project. Made me think about doing this for Forth for some reason :-)

User avatar
DexOS
Posts: 876
Joined: Wed May 16, 2012 6:32 pm
Contact: Website

Re: RPi oscilloscope

Wed Aug 22, 2012 5:54 pm

TonyD wrote:Thanks DexOS, I'll check them out
Your welcome TonyD
Hugh Jarse wrote:
DexOS wrote: Heres some of my tuts, using assembly macros to make a basic/arduino like language for bare metal coding.
http://www.dex-os.com/DexBasic/DexBasic.htm
Interesting project. Made me think about doing this for Forth for some reason :-)
Yes, i am Forth fan too, in the x86 ver of my OS there was a "retroforth" started http://retroforth.org/
Batteries not included, Some assembly required.

techpaul
Posts: 1512
Joined: Sat Jul 14, 2012 6:40 pm
Location: Reading, UK
Contact: Website

Re: RPi oscilloscope

Wed Aug 22, 2012 9:56 pm

rooster wrote:I have a number of things I am looking to do with the RPi, they all involve measuring external voltages.

These voltages may be 240 V or mV, static or time varying.

Any experts out there able to design a circuit that would take an external voltage, step it up/down to an appropriate level (maybe via a x10, x100 etc switch), pass through an AD converter to the GPIO? I'm sure I can write the software to make a nice oscilloscope trace out of the results.

R
Why bother there are plenty of cheap scopes out there with USB interfaces, that would be cheaper than the parts for a one off.

Some even have linux software so should be portable
Just another techie on the net - For GPIO boards see http:///www.facebook.com/pcservicesreading
or http://www.pcserviceselectronics.co.uk/pi/

pihead
Posts: 12
Joined: Sun Aug 26, 2012 1:22 am

Re: RPi oscilloscope

Sun Aug 26, 2012 1:52 am

I've considered making a RPi scope/spectrum analyser as well. I haven't yet confirmed the details, but my approach would be to use DMA for A/D input, and the GPU to do the FFT for spectrum analysis. If it requires bare-metal coding that doesn't scare me, I haven't done it with ARM but have done it for several microprocessors in the past.

I might attempt to code an A/D DMA device driver under Linux first, just to see what I can extract, and to give a base on which to test FFT code. If the driver can't provide clean enough data (can't keep up), then I will move it to bare metal.

Anybody done a DMA-driven A/D input yet?

8-bit should be sufficient for my purposes. Anything higher cuts the maximum input rate.

From what I have read so far, the sampling rate might reach something like 100 Ms/s.

Am I in the right universe?

techpaul
Posts: 1512
Joined: Sat Jul 14, 2012 6:40 pm
Location: Reading, UK
Contact: Website

Re: RPi oscilloscope

Thu Aug 30, 2012 9:37 am

You will need to make an external A/D converter and front end to a FIFO to then try and DMA it in using parallel, SPi or similar as there are no A/D inputs on Pi
Just another techie on the net - For GPIO boards see http:///www.facebook.com/pcservicesreading
or http://www.pcserviceselectronics.co.uk/pi/

User avatar
williamhbell
Posts: 291
Joined: Mon Dec 26, 2011 5:13 pm
Contact: Website Twitter

Re: RPi oscilloscope

Wed Dec 26, 2012 2:26 pm

Hi,

You could use a FPGA flash-adc circuit connected to a SPI line. The FPGA would need to be clocked externally though.

Regards,

Will

Return to “Automation, sensing and robotics”