element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Members
    Members
    • Benefits of Membership
    • Achievement Levels
    • Members Area
    • Personal Blogs
    • Feedback and Support
    • What's New on element14
  • Learn
    Learn
    • Learning Center
    • eBooks
    • STEM Academy
    • Webinars, Training and Events
    • More
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • More
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • More
  • Products
    Products
    • Arduino
    • Dev Tools
    • Manufacturers
    • Raspberry Pi
    • RoadTests & Reviews
    • Avnet Boards Community
    • More
  • Store
    Store
    • Visit Your Store
    • Choose Another Store
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
DIY Test Equipment
  • Challenges & Projects
  • Project14
  • DIY Test Equipment
  • More
  • Cancel
DIY Test Equipment
Blog Arduino oscilloscope - DIY entry device
  • Blog
  • Forum
  • Documents
  • Events
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
DIY Test Equipment requires membership for participation - click to join
Blog Post Actions
  • Subscribe by email
  • More
  • Cancel
  • Share
  • Subscribe by email
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: idanre1
  • Date Created: 21 Aug 2017 5:46 PM Date Created
  • Views 1306 views
  • Likes 18 likes
  • Comments 28 comments
  • diytestequipch
  • arduino_projects
  • test and measurement
  • arduino_classic
  • osciloscope
  • arduino
  • diytestinstruch
Related
Recommended

Arduino oscilloscope - DIY entry device

idanre1
idanre1
21 Aug 2017

  • The Software
  • The Hardware
  • The probe - Try 1 (not that good, please review try 2)
  • The probe - Try 2
  • Summary
  • Proof of work

 

The big problem with being a maker newbie, is that you have to have equipment.

When I started, I bought soldering kit and a multimerter - things that don't cost allot and are very needful to start your first steps.

But I believe the most important test equipment one need is oscilloscope, but it also very expensive.

So there is a conflict...

Many times you need to debug a circuits because things can go wrong (we all know that...) and you need a scope to figure out what's the problem.

Consider you still in the noob phase, you don't want to spend hundreds of $$$'s just for buying a simple scope

 

If you could just have a simple cheap one that is good enough for very simple circuits you wouldn't think twice

 

Now, let's define what is a simple circuit.

For me it has two major parameters

1. Low bandwidth

2. Low voltage, let's say 0-5Volt and if you insist 0-15Volt

 

I have searched the internet and found many of them, some are better then others, some are complicated to build than others.

I put my eyes on Girinoscope www.instructables.com/id/Girino-Fast-Arduino-Oscilloscope/

This scope is using aruino uno (I built my with arduino nano) and reaching 150Ksps with 5V voltage swing.

The problems with the tutorial are:

  1. Its explaining allot of the software and a general knowledge on how a scope trigger works, but:
    1. The info not that well explained to a noob that just want to build it.
    2. There isn't even a simple connections diagram.
    3. You need to deep dive the Atmel documentation to really understand what the tutorial explains.
  2. The provided code needs to have patches to work in max BW (Currently 150kbps).
  3. The GUI provided by 3rd party only visualizing the sample but can't save it for future use.
    1. GUI link: https://github.com/Chatanga/Girinoscope

The Software

The instructables describes how to configure arduino's CSR and you get a pretty good feeling what is happening, but only if you have some knowledge in VLSI and logic design (Muxes, Flipflops, PADs, etc...)

I have tweaked the SW a little bit to support higher sampling rates (code improvements to save MIPS)

I also put the GUI in the same github for ease of access, Also with script to run it from arm CPU (RPI, db410c)

https://github.com/idanre1/Girinoscope2_0

  • main path contains the arduino code
  • capture_exe - perl program to acquire samples that can be saved to a disk (not just watching on the screen)
    • excel can be used to manipulate data and show graphs
  • scope
    • contains the GUI
  • db_src
    • source code for test suites in db410c.
    • RPI can be also used with minor changes.

 

The Hardware

All you need is an arduino + some resisters and capacitors.

For simple testing purposes I used 555 timer with output swing from 0-5v, calculated the expected frequency and tried to match expectations with result samples.

 

{gallery} My Gallery Title

Full circuit: Arduino ADC connected to LM358N as input probe. ne555 as the test circuit. ne555 is supplied with 7v rail to rail so the output will be about 5v.

DB410c as tester: I use the 1.8v digital GPIOs on the dragonboard to the arduino ADC. I sometimes using level shifer txs0108e to provide arduino with 5v from DB410c

Girinoscope schematic: From girinoscope intructables it is very hard to tell what to connect where. You need to deep dive the arduino code to understand what to do. This simple schematic can help allot

555 Timer: I use this circuit to see if the calculated frequency of the 555 timer will match what I sample using arduino.

GUI: Acquiring sample from the girinoscope GUI

 

The probe - Try 1 (not that good, please review try 2)

If I want to cross more than 5 volts I actually need to create a probe.

Special thanks to jc2048 and DAB for helping me navigating the world of opamps (there are thousand of them, and you gotta choose )

I have tried a simple simulation with the MCP6024

Basically I made a 1/4 voltage divider for being able to insert arduino more than 5V.

This is the simulation results:

WAY BETTER THAN LM358N! (See photo gallery for old opamp result)

Vin is square wave 20V@15KHz

You can see output is 4.98V (fair enough for basic scope)

Only thing that worries me is rise and fall time on the max acquired BW (15KHz)

 

Questions:

  1. Maybe I need a higher BW op-amp?
    1. Does adding some passive component to the feedback loop will help?
  2. Do I need to add to Vout of the opamp some reverse protection diode to save arduino from human fault?
  3. Why V_rise is slower than V_fall?

 

The probe - Try 2

  • Red circuit is is Differential amplifier
    • Vout=(R3/R1)*(V+-V-)
      • R1=R2 and R3=R4
    • How to reach that formula: http://www.electronics-tutorials.ws/opamp/opamp_5.html
    • C2 is for remove ringing. Real circuit have capacity in the wires, might need to be adjusted.
  • Orange Circuit is voltage offset
    • Since the opamp is 5V we need to offset for half meaning 2.5v
    • By adding 2.5V to to red circuit V+ we get -2.5v:2.5v input only by supplying 5v and GND to the opamp supply.
      • That I understood but could find proper analysis why??? (TODO - find a link to article)
  • Power supply
    • C2,C3 are for noise cancellation of the power supply (power supply decoupling)
  • U2,U3 are only 1:10 multiplier to work on low voltages.
    • http://www.electronics-tutorials.ws/opamp/opamp_3.html
  • C1 - power supply filtering
    • Remove some of the noise coming from the 5V and give a cleaner pseudo ground to work with.
  • R11
    • Isolates any capacitance on the output a little from the op-amp
  • R14
    • Input pit of GND that is connected to GND of the circut
    • Resistor is there to prevent high current from flowing when grounds are uneaven.

 

Probe schematic

Simulation result

I put square wave of 20v out of 25v.

You can see the output is from 0.5v-4.5v.

T_fall is about 4u_sec which is pretty reasonable. less than 1/7 of the square wave low voltage time...

 

Pad schematic from atmel datasheet:

 

 

I think the next step is to order this opamp

This would probably not happen during this competition period (shipping takes a while where I live)

 

Summary

Hope every noob will find this article:

  1. with full details how to built it
  2. Step by step explainable
  3. Have enough analysis details for understanding without inner assumptions not said.

 

I want to have a special thanks to jc2048 for helping me allot trying to build the probe.

 

Proof of work

The following video shows db410c (similar to RPI) generating square wave using one of its GPIOs in 1.8v

Then a level shifter which is design to between-chips communication is used to amplify the signal to 5v www.ti.com/lit/ds/symlink/txs0108e.pdf

The signal is captured by girinoscope and The specified item was not found. for a reference.

I demonstrates trigger modes and sampling of the square wave by both scopes using girinoscope GUI.

You don't have permission to edit metadata of this video.
Edit media
x
Upload Preview

 

The following video shows the probe detailed in this thread with 1:10 attenuation

Currently the opamp is the only one I have got LM358n which is manufactured around 30 years old, I have extracted it from an old circuit I have.

The opamp output is very noizy, I hope a newer opamp will do a better job (I put this video for proof of work of the probe)

Again caputes of both scopes are provided for a reference.

You don't have permission to edit metadata of this video.
Edit media
x
Upload Preview

 

 

 

Regards

Idan

Anonymous

Top Comments

  • DAB
    DAB over 4 years ago in reply to idanre1 +5

    That is why I suggested it.

     

    Even if you do not use their devices, they provide an excellent overview on what you need to consider for good instrumentation.

     

    DAB

  • idanre1
    idanre1 over 4 years ago in reply to jc2048 +3

    Hi

    Since I only did analog in the university and in my day job I am doing digital I still considering myself as noob

     

    I think I will order your suggested opamp. But I am not sure I will get it in time for…

  • DAB
    DAB over 4 years ago in reply to idanre1 +2

    Go check the free ebook that Analog Devices is giving away on instrumentation amplifiers.

     

    I am sure you can get some good ideas.

     

    You could do a couple of very good posts just hooking some off the shelf Opamps…

Parents
  • jc2048
    jc2048 over 4 years ago

    Are you intending this to run from the +5V Arduino supply? If so, the op-amps need to run on 5V [a lot of older ones didn't]. The outputs need to get to the rails [old bipolar op-amps mostly didn't], otherwise you'll restrict the range of the ADC input that you can use. You'll also probably want the inputs to work to the rails too (I said probably because we don't know the circuit yet) [again a lot of older bipolar op-amps were poor at this - doesn't mean they were bad op-amps, just inappropriate for what you want here]. If the scope is going to be fairly precise, you don't want the input bias currents and the current and voltage offsets to be too large, though that isn't too much of an issue here [traditionally, FET and CMOS op-amps were good for low bias currents but often poor for offsets - but that has changed a lot in the last decade or two - better automation means they can be trimmed at manufacture]. You also need enough bandwidth from the op-amp so that it can work properly over the range of frequencies you will be looking at with the scope. The quick measure of bandwidth is the GBWP (gain-bandwidth product) - that's the frequency where the gain of the op-amp falls to unity; it needs to be much higher than the highest frequency you are working with (how much higher will depend on the circuit configurations you use, but a GBWP of 5-10MHz is the right sort of area for 100kHz of bandwidth at the scope input as long as you're not asking for too much gain from the amplifier).

    Presumably, you don't want to be paying $20 for it either.

     

    That will reduce the number of possible contenders quite considerably. If you also throw in the requirement that it be a conventional package rather than surface mount (to make your prototypng easier) then you're probably down to just a few devices from each manufacturer (they'll all have something that will do this because they're agressively competing with each other for your chip business.)

     

    Here's one possible contender. If you download the datasheet and look through it you'll see how it's specced and you should be able to locate most of what I've just gone through amongst the tables.

     

    MCP6024 - Amplifiers and Linear - Linear Op Amps

     

    Other manufacturers you could look at include TI (Texas Instrumenats), AD (Analog Devices), ON Semiconductor (don't know what the ON stands for!), and LT (Linear Technology).

     

    What do you want to do next?

     

    Either you could try doing something for yourself or we could give you a circuit to experiment with. If you've already done some op-amp circuits, you might want to try piecing something together for yourself as a learning exercise (and for the challenge), if not you might prefer to have an example circuit with an explanation to get you started and give you something to play with.

    • Cancel
    • Up +2 Down
    • Reply
    • More
    • Cancel
  • idanre1
    idanre1 over 4 years ago in reply to jc2048

    Hi Jon

    Thanks for the detailed reply.

    It helps allot.

     

    Power supply:

    I can run it from the arduino power and I can also do it from outside fr higher voltages.

    As you mentioned, the old BJTs are not rail to rail, I actually encountered this issue

    I have tried to make a probe from lm538n, and I got clipping (on both edges) when I used 5v power supply, and allot of noise. here is the capture:

     

    This is what I actually wants from the probe:

    1. Big R_IN for sensing the signal without changing it more than needed.
    2. Bigger than 5v
      1. I want to be able to do 1/5, 1/10 division in some way. so I could sample 15v as input signal without tempering the arduino
      2. Does it means I need a specific slew rate requirement?
    3. GBWP
      1. Well, I do remember that one from school
      2. If I plan to do division (as I mention in #2), does it means I can have smaller GBWP since I need less than unity?
    4. Breadboard pins as you mention can also help

     

    Also I will have a look on the datasheet you provided and try to come with other thoughts

     

    You talked about "input bias currents and the current and voltage offsets", could you pleas elaborate more? I am not actually following you.

     

    About experiments:

    I had in mind doing Peter's power bench supply circuit.

    I guess I could use other designs as well.

    Actually I am very interested entering this world of building circuits from op-amps but couldn't find a tutorial with nice learning curve.

     

    Thanks

    Idan

    • Cancel
    • Up +2 Down
    • Reply
    • More
    • Cancel
  • jc2048
    jc2048 over 4 years ago in reply to idanre1

    Sorry about that, I thought you were a "maker newbie" still in the "noob phase".

     

    The resources DAB pointed you at would be a good refresher of what you did in your degree. (DAB's much better at this support/mentoring stuff than I am - he quickly spotted what you needed.) There's lots of material on manufacturers websites - it's very worth while reading through their application notes. It's often much better than you'd find in a textbook.

     

    Gain of a tenth is no problem - look at a differential amplifier configuration if you want to offset at the same time.

     

    I think the slew rate largely derives from the same internal compensation capacitor that gets to define the GBWP, so the two tend to go hand in hand. But yes, calculate what you need and check it against the figures in the datasheet.

     

    For best accuracy you want to be working where there's a good amount of open-loop gain, so though you could relax the GBWP spec a bit, in practice I think I'd still go for for a few MHz. If you look at a datasheet, it will normally give you a plot of the open-loop gain against frequency.

     

    The bias current is the current in or out of the input terminal. For a bipolar device it's mostly the base current with a bit of leakage from any protection devices, for a FET input it's largely just the leakage of the protection. You can get some op-amps with very low input currents, down in the 2 or 3fA area, if you fancy building yourself an electrometer.

     

    The offsets are the difference between the two inputs. Although the inputs match very well when fabricated on a single chip because the transistors are (obviously) all made in the same conditions and have very similar properties, there will still be small differences. For what you're doing here it won't matter much - particularly for a 'scope where everyone is used to adjusting the Y offset by hand - but if you were looking at more precise instrumentation, like the kind of thing a couple of the professionals here are evidently doing in their day jobs, it would play a real part in the design, so you want to get used to looking at the figures and comparing with other devices you know/ have used.

    • Cancel
    • Up +1 Down
    • Reply
    • More
    • Cancel
Comment
  • jc2048
    jc2048 over 4 years ago in reply to idanre1

    Sorry about that, I thought you were a "maker newbie" still in the "noob phase".

     

    The resources DAB pointed you at would be a good refresher of what you did in your degree. (DAB's much better at this support/mentoring stuff than I am - he quickly spotted what you needed.) There's lots of material on manufacturers websites - it's very worth while reading through their application notes. It's often much better than you'd find in a textbook.

     

    Gain of a tenth is no problem - look at a differential amplifier configuration if you want to offset at the same time.

     

    I think the slew rate largely derives from the same internal compensation capacitor that gets to define the GBWP, so the two tend to go hand in hand. But yes, calculate what you need and check it against the figures in the datasheet.

     

    For best accuracy you want to be working where there's a good amount of open-loop gain, so though you could relax the GBWP spec a bit, in practice I think I'd still go for for a few MHz. If you look at a datasheet, it will normally give you a plot of the open-loop gain against frequency.

     

    The bias current is the current in or out of the input terminal. For a bipolar device it's mostly the base current with a bit of leakage from any protection devices, for a FET input it's largely just the leakage of the protection. You can get some op-amps with very low input currents, down in the 2 or 3fA area, if you fancy building yourself an electrometer.

     

    The offsets are the difference between the two inputs. Although the inputs match very well when fabricated on a single chip because the transistors are (obviously) all made in the same conditions and have very similar properties, there will still be small differences. For what you're doing here it won't matter much - particularly for a 'scope where everyone is used to adjusting the Y offset by hand - but if you were looking at more precise instrumentation, like the kind of thing a couple of the professionals here are evidently doing in their day jobs, it would play a real part in the design, so you want to get used to looking at the figures and comparing with other devices you know/ have used.

    • Cancel
    • Up +1 Down
    • Reply
    • More
    • Cancel
Children
  • idanre1
    idanre1 over 4 years ago in reply to jc2048

    Hi

    Since I only did analog in the university and in my day job I am doing digital I still considering myself as noob

     

    I think I will order your suggested opamp. But I am not sure I will get it in time for this competition.

    I might open a different blog when getting it.

     

    Regards

    Idan

    • Cancel
    • Up +3 Down
    • Reply
    • More
    • Cancel
  • jc2048
    jc2048 over 4 years ago in reply to idanre1

    Yes, everyone is at first, but having done your course you should be able to make sense of datasheets and application notes, which a beginner couldn't be expected to do, so it makes sense to direct you to that material rather than explain things in lots of detail.

     

    One other thing, 'rail-to-rail' is a marketing term and even though such op-amps are very good, they still fall fractionally short of the rails (often by a few tens of mV) - it's also very dependent on how the output is loaded (light load will get you closer). The figures are all in the datasheet. I'm assuming that won't matter to you, for what this is, but if it does then you'd need to run the op-amp on supplies that exceed the 0-5V of the Arduino.

     

    If you're digitising, then in theory you need to be sure you don't have any energy at the input above half the sampling rate or you'll get aliasing when you reconstruct the waveform from the samples. So, depending on the kind of signals you want to look at, you might want a filter there. It gets complicated quickly, though, because a filter will start to change the phase below the cut-off, particularly if the cut-off is steep. Anyway, something else for you to read up on.

     

    At the stage you're at, simulating some of this stuff would be a useful thing to do. Microchip have a model for that part - I tried it quickly and it worked ok in TINA-TI.

    • Cancel
    • Up +2 Down
    • Reply
    • More
    • Cancel
  • idanre1
    idanre1 over 4 years ago in reply to jc2048

    Hi Jon

    Simulating the circuit might be a great idea.

    I downloaded TINA TI from the official website and I have version 9.3.150.328

    I followed the instructions on how to import a spice model and when I tried to compile the model I got an error:

     

    Have a clue whats wrong? you mentioned you got it worked like a charm.

     

    How to simulate the load

    I need to have a behavioral model of the load.

    Do you have a hint how to simulate the PAD of the ADC pin in the arduino? (A0 pin)

     

    Thanks!

    Idan

    • Cancel
    • Up +1 Down
    • Reply
    • More
    • Cancel
  • jc2048
    jc2048 over 4 years ago in reply to idanre1

    You don't need to be compiling anything.

     

    Make a copy of the .txt file and change the extension on the copy to .lib.

     

    Open the New Macro Wizard from the Tools menu.

     

    Enter the Macro name and select 'From file' and point it at the .lib

     

     

    click 'Next>'

     

    You should see this

     

     

    If you want you could accept that shape, but I prefer a traditional symbol so

     

    select 'Load shape from library'

    untick 'Show suggested shapes only'

    use the down arrow to the right of the symbol displayed to drop the list down, move down to <Amplifier5G> and select it.

     

    You'll then have this

     

     

    click 'Next>'

     

    You'll then get this screen for doing the pin assignments. For some reason it manages the output pin for itself but not the others.

     

     

    You then drag the unconnected pins which are flashing to the pins you want them attached to on the symbol.

     

    You can tell which pin numbers go where from the netlist shown in the window underneath.

     

    click 'Next>' again

     

    That will then bring up save dialog box and you can save it wherever you want.

     

    Finally you'll get this message box and can insert a single instance onto the circuit diagram.

     

     

    From then on you can insert additional devices using 'Insert Macro' from the 'Insert' menu.

     

    Unfortunately, that standard symbol is upside down, so I mirror then rotate right twice to get the + supply pin at the top. If you're good with software, you might want to try reworking the symbol.

     

    And this is what it looks like on the circuit

    • Cancel
    • Up +1 Down
    • Reply
    • More
    • Cancel
  • jc2048
    jc2048 over 4 years ago in reply to idanre1

    Do you have a hint how to simulate the PAD of the ADC pin in the arduino? (A0 pin)

    Figure 24-8 in the Atmel datasheet for the processor gives an equivalent circuit for the input circuitry if you really want to model it.

    • Cancel
    • Up +1 Down
    • Reply
    • More
    • Cancel
Element14

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2022 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • Facebook
  • Twitter
  • linkedin
  • YouTube