Easy programming for the DSO Quad

--DSO203

Moderators: violet, jessie, jpa

jpa
Elementary-2
Elementary-2
Posts: 215
Joined: Wed Nov 02, 2011 4:06 am
Are you a staff member of seeedstudio?: no
Which products/projects are your favorite?: DSO Quad

Re: Easy programming for the DSO Quad

Post by jpa » Thu Jan 03, 2013 3:50 am

c.wilt wrote:So I can send data with simple printf() but no read? Thats enough for data log but not control.
Kind of. Not yet Pawn bindings for the function. But maybe I'll find time to add it soon :)
c.wilt wrote: I took the sample voltmeter code and created a large number display to use like a DVM. The code is not pretty but I was amazed at how much more accurate readings are in pawn compared to the normal or alternative software.
Yeah after being calibrated it should be quite accurate. Maybe one day I'll bother porting the calibration stuff to main firmware. It's not complex, I don't understand how the main firmware calibration manages to suck so bad.
c.wilt wrote: I wonder what could be done with pawn if it was the main app. Use all the slots for pawn.
Flash is no-longer restricting, but the RAM size is. Pawn as a language is not very powerful, if there will be a more powerful version of DSO Quad one day I'd like to run Lua or Squirrel on it.

And because Pawn is interpreted, it'll always be limited to the simpler stuff. I couldn't imagine writing a complete oscilloscope app in pawn; it would simply be too slow.

c.wilt
Pre-kindergarten
Pre-kindergarten
Posts: 27
Joined: Thu Jul 19, 2012 9:05 pm
Are you a staff member of seeedstudio?: no
Which products/projects are your favorite?: DSO Quad

Re: Easy programming for the DSO Quad

Post by c.wilt » Thu Jan 03, 2013 4:26 am

jpa wrote:Kind of. Not yet Pawn bindings for the function. But maybe I'll find time to add it soon :)
That would be great. Let me know if you need beta tester.
jpa wrote:Yeah after being calibrated it should be quite accurate. Maybe one day I'll bother porting the calibration stuff to main firmware. It's not complex, I don't understand how the main firmware calibration manages to suck so bad.
The one thing I noticed is that I must calibrate on battery power. If I calibrate while powered by USB it is off. Maybe gabonator1 could use the same method for calibration in the alternate firmware.
jpa wrote: Flash is no-longer restricting, but the RAM size is. Pawn as a language is not very powerful, if there will be a more powerful version of DSO Quad one day I'd like to run Lua or Squirrel on it.

And because Pawn is interpreted, it'll always be limited to the simpler stuff. I couldn't imagine writing a complete oscilloscope app in pawn; it would simply be too slow.
What else could pawn do on the DSO?

c.wilt
Pre-kindergarten
Pre-kindergarten
Posts: 27
Joined: Thu Jul 19, 2012 9:05 pm
Are you a staff member of seeedstudio?: no
Which products/projects are your favorite?: DSO Quad

Re: Easy programming for the DSO Quad

Post by c.wilt » Fri Jan 04, 2013 12:34 am

I have decided to use pawn on the DSO to make a capacitor checker. Simple RC circuit timer. Use waveout to power and wave-in to measure voltage drop over time. I think it may also be possible to measure the internal resistance of the cap too.

jpa
Elementary-2
Elementary-2
Posts: 215
Joined: Wed Nov 02, 2011 4:06 am
Are you a staff member of seeedstudio?: no
Which products/projects are your favorite?: DSO Quad

Re: Easy programming for the DSO Quad

Post by jpa » Fri Jan 04, 2013 1:32 am

c.wilt wrote: The one thing I noticed is that I must calibrate on battery power. If I calibrate while powered by USB it is off.
Good to know! I haven't noticed that, but it makes sense as the 3.6V supply voltage is not regulated. It may be that the battery charge level also affects it a bit. But it shouldn't be very large effect because it is only the opamp supply voltage and not any reference voltage.
c.wilt wrote:I have decided to use pawn on the DSO to make a capacitor checker. Simple RC circuit timer. Use waveout to power and wave-in to measure voltage drop over time. I think it may also be possible to measure the internal resistance of the cap too.
Nice! Perhaps the 51 ohm internal resistor on the waveout is enough, so you don't need separate resistor for the RC timer?

c.wilt
Pre-kindergarten
Pre-kindergarten
Posts: 27
Joined: Thu Jul 19, 2012 9:05 pm
Are you a staff member of seeedstudio?: no
Which products/projects are your favorite?: DSO Quad

Re: Easy programming for the DSO Quad

Post by c.wilt » Fri Jan 04, 2013 2:12 am

jpa wrote:Good to know! I haven't noticed that, but it makes sense as the 3.6V supply voltage is not regulated. It may be that the battery charge level also affects it a bit. But it shouldn't be very large effect because it is only the opamp supply voltage and not any reference voltage.
I wonder if it could be used to improve accuracy more. Compare current voltage against that of when it was calibrated. Would need to test at various voltages to check for linearity but I think it could be an improvement to your already good calibration system.
jpa wrote:Nice! Perhaps the 51 ohm internal resistor on the waveout is enough, so you don't need separate resistor for the RC timer?
I doubt 51 ohms would work across a wide enough range but it will need to be considered in the calculations.

jpa
Elementary-2
Elementary-2
Posts: 215
Joined: Wed Nov 02, 2011 4:06 am
Are you a staff member of seeedstudio?: no
Which products/projects are your favorite?: DSO Quad

Re: Easy programming for the DSO Quad

Post by jpa » Fri Jan 04, 2013 3:05 am

c.wilt wrote: I wonder if it could be used to improve accuracy more. Compare current voltage against that of when it was calibrated. Would need to test at various voltages to check for linearity but I think it could be an improvement to your already good calibration system.
Indeed. Or maybe we are lucky and the behaviour is somehow predictable between units; then it could just be compensated without calibrating each device separately.
c.wilt wrote: I doubt 51 ohms would work across a wide enough range but it will need to be considered in the calculations.
Based on rough calculations, it would have some chance of working for capacitances 100nF and higher.

Not sure if ESR measurement will be possible without external FET; theoretically one could pull the waveout low, but the difference in voltage will be very small. The AC mode at 50mV range could work here.

c.wilt
Pre-kindergarten
Pre-kindergarten
Posts: 27
Joined: Thu Jul 19, 2012 9:05 pm
Are you a staff member of seeedstudio?: no
Which products/projects are your favorite?: DSO Quad

Re: Easy programming for the DSO Quad

Post by c.wilt » Fri Jan 04, 2013 6:13 am

jpa wrote:Indeed. Or maybe we are lucky and the behaviour is somehow predictable between units; then it could just be compensated without calibrating each device separately.
Entirely possible. Only way to know it to test.
jpa wrote:Based on rough calculations, it would have some chance of working for capacitances 100nF and higher.
I don't see it. 51 ohm, and 100nf cap with a 2.5v source has a rise time of 0.0164ms to reach 2.4v. That will require a very fast counter.
jpa wrote:Not sure if ESR measurement will be possible without external FET; theoretically one could pull the waveout low, but the difference in voltage will be very small. The AC mode at 50mV range could work here.
I was thinking along the lines of something like this.
May not be possible but I thought it would be worth a look.

jpa
Elementary-2
Elementary-2
Posts: 215
Joined: Wed Nov 02, 2011 4:06 am
Are you a staff member of seeedstudio?: no
Which products/projects are your favorite?: DSO Quad

Re: Easy programming for the DSO Quad

Post by jpa » Fri Jan 04, 2013 5:00 pm

c.wilt wrote: I don't see it. 51 ohm, and 100nf cap with a 2.5v source has a rise time of 0.0164ms to reach 2.4v. That will require a very fast counter.
You have hardware that is able to capture 1180 samples in that time. So I was thinking something like this:

1) Set waveout to output square wave @ 10Hz.

2) Set wavein to capture @ 72MHz in free-running mode (DC 500mV) and start the capture synchronously. This means the capture will start when waveout starts a new period.

The result will be a decaying waveform like this: http://en.wikipedia.org/wiki/File:Serie ... oltage.svg

Then you could fit the exponential function to the captured data and compute the capacitance from that.

You will have to adjust the sample rate for higher capacitances though. Because the usable sample buffer is only about 3500 samples, it will only store 50 microseconds @ 72MHz.

c.wilt
Pre-kindergarten
Pre-kindergarten
Posts: 27
Joined: Thu Jul 19, 2012 9:05 pm
Are you a staff member of seeedstudio?: no
Which products/projects are your favorite?: DSO Quad

Re: Easy programming for the DSO Quad

Post by c.wilt » Fri Jan 04, 2013 11:33 pm

jpa wrote: You have hardware that is able to capture 1180 samples in that time. So I was thinking something like this:

1) Set waveout to output square wave @ 10Hz.

2) Set wavein to capture @ 72MHz in free-running mode (DC 500mV) and start the capture synchronously. This means the capture will start when waveout starts a new period.

The result will be a decaying waveform like this: http://en.wikipedia.org/wiki/File:Serie ... oltage.svg

Then you could fit the exponential function to the captured data and compute the capacitance from that.

You will have to adjust the sample rate for higher capacitances though. Because the usable sample buffer is only about 3500 samples, it will only store 50 microseconds @ 72MHz.
I was just going to do a simple RC circuit. Your method will work and not require external parts. I will switch gears and duplicate with my test equipment first and then reproduce in pawn.

JackTheVendicator
Pre-kindergarten
Pre-kindergarten
Posts: 42
Joined: Tue Oct 11, 2011 6:12 am
Are you a staff member of seeedstudio?: no
Which products/projects are your favorite?: DSO Quad

Re: Easy programming for the DSO Quad

Post by JackTheVendicator » Sat Jan 05, 2013 10:14 pm

jpa wrote:
c.wilt wrote: I don't see it. 51 ohm, and 100nf cap with a 2.5v source has a rise time of 0.0164ms to reach 2.4v. That will require a very fast counter.
You have hardware that is able to capture 1180 samples in that time. So I was thinking something like this:

1) Set waveout to output square wave @ 10Hz.

2) Set wavein to capture @ 72MHz in free-running mode (DC 500mV) and start the capture synchronously. This means the capture will start when waveout starts a new period.

The result will be a decaying waveform like this: http://en.wikipedia.org/wiki/File:Serie ... oltage.svg

Then you could fit the exponential function to the captured data and compute the capacitance from that.

You will have to adjust the sample rate for higher capacitances though. Because the usable sample buffer is only about 3500 samples, it will only store 50 microseconds @ 72MHz.
Since we have a lot to FPGA logic to spare, the FPGA could even catch the preset point in your project with something like this

Code: Select all

-- Start some counter somewhere

sig_preset_reached <= '1' when ADC_sample > PRESET else '0';

preset_capture: process(sig_preset_reached)
begin
  if rising_edge(sig_preset_reached) then
    -- stop counter and output count
end process;
The first part (combinatorial) can easily run in less than a ns, and the counter can be connected to the main sampling clock.

Post Reply