Oscilloscope tester like Hameg HZ60 - Page 1
Forum section: electronics / projects

author: cosenmarco
author_rank: Regular Contributor
timestamp: July 31, 2017, 05:16:27 pm
content: Hi,I recently acquired a Hameg 203-7 oscilloscope and in the service manual they recommend their Hameg HZ60 for testing and calibration.The service manual can be found on the internet. Here a few links:http://www.radiomuseum.org/r/hameg_scope_tester_hz_60.htmlhttp://www.sm5cbw.se/hameg/hmzub/hz60.pdfWhat I'm looking for is a simple project which matches (or exceeds) the specs of this little puppy for testing / calibrating my scope.The device itself is pretty rare to find and for what it is, also pretty expensive.I think this could be a nice small project to realize to learn a few things.As far as I understand the specs I'm looking for are:- Precision square wave both in frequency and in voltage for various frequencies- Voltage precision 1% (or better) for 2.5V, 250mV, 25mV adjustable through a trimmer- Frequency accuracy: as good as the crystal oscillator- Rise time: within 3ns (possibly within 1 ns) for the 25mV 50Ohm-terminated output- Budget within 80€ ~ 90$ for PCB + componentsAlso if I understand correctly this project would not contain fancy components as the Hameg is basically a crystal oscillator fed into a frequency divider fed into a buffer for the output. The various voltages are obtained using precision resistor-based voltage divider.Any advice on how to collect info and ideas for such a project would be very welcome.

author: IconicPCB
author_rank: Super Contributor
timestamp: July 31, 2017, 07:55:29 pm
content: The old analogue scopes need to have a number of specifications checked and adjusted over their operating life.time base and delayed time base if availableinput attenuator accuracy and bandwidthchannel amplifier gain and frequency responseThe equipment needed isa square wave signal source with stable precisely presettable or selectable periodan adjustable DC source and a voltmetera pulse generator of known high speed fall/rise time characteristics to match the bandwidth of the scopea leveled signal generator exceeding the bandwidth of the oscilloscopeterminating feed through impedance which matches the leveled signal generator output impedanceHZ60 box incorporates all functionalities bar the leveled source signal generator needed to check but not necessarily adjust/calibrate the scope

author: Ian.M
author_rank: Super Contributor
timestamp: July 31, 2017, 08:18:58 pm
content: I'm surprised Hameg didn't parallel up sections of the 74HC00 output driver for a lower output impedance. Maybe their custom divider chip couldn't drive the extra input capacitance hard enough to maintain the rise time required.The frequency selection and divider chain functionality could easily be handled by a small MCU. Then all you need to do is to copy the output stage and resistor network and provide a trimmable 5V supply to the output stage and a decoupled supply to the MCU.. Its probably also worth putting a trimmer in for one of the crystal's load caps so you can fine trim the frequency. You can probably squeeze the cost down to 50€.

author: tautech
author_rank: Super Contributor
timestamp: July 31, 2017, 09:59:07 pm
content: If you're a hobbyist all you need to know is that the waveforms are reasonably accurate and representative of the signal on the input. Precision accuracy is generally not required for general scope use.Most simple accuracy checks can be accomplished with just an AWG.IIRC in this vid Dave just checks the basic fundamentals of this Hameg and tweaks a few things to better align them.https://www.eevblog.com/2013/08/03/eevblog-502-19-hameg-analog-oscilloscope/Like any repair or accuracy check the PSU must be perfectly to spec and if it does need the PSU adjusting most other parameters just fall into spec.

author: cosenmarco
author_rank: Regular Contributor
timestamp: August 01, 2017, 06:52:32 am
content: Thanks for the repliesQuoteSeems very convenient but I think I don't want into programming and flashing this time. I might reconsider this.QuoteCan you please define AWG ?QuoteI've watched the video. Dave has plenty of precision equipment and I bet everything is super spot-on calibrated in his lab. I have just a couple of crappy DMMs and a non-calibrated (broken for now, I have to fix it) scope. So I want a reliable device which has intrinsically as much precision as possible (on spec or better) without much need for calibrating it.QuoteProbably you wanted to say "most other parameters just DON'T fall into spec"

author: cosenmarco
author_rank: Regular Contributor
timestamp: August 01, 2017, 07:19:38 am
content: To IconicPCB,QuoteCan you please elaborate on this? I thought the moment you check for something against a known reference and it's not matching, you adjust the corresponding trimmer in the scope and you make it matching. For me this sounds like a calibration.I agree that you don't get all you need from the Hameg HZ60 to perform a full calibration but many important areas can be calibrated using this device.

author: tautech
author_rank: Super Contributor
timestamp: August 01, 2017, 07:56:04 am
content: Quote from: cosenmarco on August 01, 2017, 06:52:32 amArbitrary Waveform Generator.I meant what I said, there's a good # of examples in instrument repair threads where when the PSU is adjusted to spec, the instrument falls into spec. That said, it is the first thing you check and ensure it is spot on, not just near enough, spot on.Really a DMM and a AWG can provide good enough reference sources for the hobbyist to check and adjust with some certainty that the instrument will most likely meet their needs. If you need better then send it to a Cal lab.

author: cosenmarco
author_rank: Regular Contributor
timestamp: August 01, 2017, 08:15:42 am
content: Thanks tautech,QuoteDefinitely. I was planning initially to buy an cheap AWG like FY3220S but then looking at the specs I see the rise time is ?100ns which brought me to the Hameg HZ60.Being that inexpensive (compared to cal. lab. equipment) and hard to find I though I could realize something myself also for learning purposes and... here I am.Maybe a bad idea though with the crappy equipment I have.I'll buy the AWG anyway but still I want to build this thing and make it open: I find it's a handy and neat device to have around.Maybe this is the wrong forum section? Could please a moderator move it to where it's more appropriate? Here probably it's more about a few ppm and not 1% tolerances

author: tautech
author_rank: Super Contributor
timestamp: August 01, 2017, 08:35:55 am
content: Quote from: cosenmarco on August 01, 2017, 08:15:42 amIMO you're over thinking theverificationandadjustmentrequirements of your scope AND that your scope has better capabilities than 1% accuracy in amplitude, it doesn't.Check the datasheet and service manual,+3% is the norm for scope amplitude accuracy.

author: IconicPCB
author_rank: Super Contributor
timestamp: August 01, 2017, 08:52:12 am
content: Quite so Tautech.Old analogue scope are like analogue meters... without the mirror backing its hard to judge the spot position against a graticule especially if the graticule is on a piece of plastic window in front of the scope screen.Modern digital scopes are generally 8 bits vertical resolution and i seem to recall early flash converters hanging somewhere near six bits.By all means make your "calibrator" but the scope is not a precision instrument.AWG == arbitrary waveform generator.. a synthesised signal generator.

author: cosenmarco
author_rank: Regular Contributor
timestamp: August 01, 2017, 09:22:14 am
content: By "Here probably it's more about a few ppm and not 1% tolerances" I was meaning the forum section.This post probably doesn't belong here: this is what I was saying.Any moderator who can move this?Btw. still I'd like to have a cheap but decent voltage reference within the project. I'll read the gazillion posts around the subject.

author: tautech
author_rank: Super Contributor
timestamp: August 01, 2017, 09:26:51 am
content: Quote from: cosenmarco on August 01, 2017, 09:22:14 amThey don't see all posts, the easiest way is to use the report post and ask nicely that the thread be shifted.

author: cosenmarco
author_rank: Regular Contributor
timestamp: August 01, 2017, 12:09:56 pm
content: Ok, the thread has been moved, thanks!Now... ideas?It would be useful for example to have the same test frequencies of 1-10-100 Hz 1-10-100 KHz and 1MHz of the Hameg but dividing a frequency by 10 is not straightforward like hooking a 74xx292 frequency divider...

author: Ian.M
author_rank: Super Contributor
timestamp: August 01, 2017, 12:54:37 pm
content: However its fairly trivial to set up a MCU with a PWM module that has at least an 8 bit period timer and a power of two prescaler to output the desired frequencies. e.g. start from a 16MHz crystal clock:Freq.PrescalerPeriod1MHz disabled 16...1MHz /4 4100KHz disabled 160...100KHz /16 1010KHz /8 200...10KHz /32 501KHz /64 250... above means there are a range of prescaler, period combos that give the same division ratio. Some MCU PWM modules have a fixed pre-prescaler limiting the available prescaler ratios. e.g. 8 bit PIC 'classic' PWM modules use Fosc/4 as the input clock. Note that unless the PWM module can do fractional input period duty cycles, ypou need the period to be even so you can get an accurate 50% duty cycle square wave.Once the PWM has been set up its 'fire and forget' and the program can idle till it sees an input switch change requesting a different frequency. At 10KHz and below, depending on PWM module prescaler limits, it may be preferable to use Output Compare if available, but that's probably going to need an ISR to service it unless it can also auto-reset the timer.Its well within the capabilities of an Arduino Uno PWM module so protoype it on a Uno then use a bare ATmega328P chip + a real 16MHz crystal (not the crappy ceramic resonator fitted to a genuine Uno) in the final buildAlternatively, if you've got a toolchain for 8 bit PICs, just about any with a PWM module can handle it, and I'm sure the same is true of most other small MCUs with PWM. Avoid ones that use PLL clock multiplication because of the increased jitter.Doing it in pure hard-wired logic would be a royal PITA. You could use 4x 74HC193 preloadable 4 bit counters to implement a 16 bit preloadable counter, feed it from a Pierce oscillator or a TCXO, and feed its output through a /2 flipflop to get a square wave, but implementing the different 16 bit preload input values required would be a PITA even if you used pullup resistors + a diode matrix.

author: 2N3055
author_rank: Super Contributor
timestamp: August 01, 2017, 03:10:12 pm
content: Take a look at this:http://leapsecond.com/pic/picdiv.htmCombine it with 10MHz TTL oscillator.For output use SINGLE gate from 74AC14, with power to the chip connected through 10-15 Ohm SMD resistors, decoupled BEFORE resistors. That will critically damp edge transitions and remove overshoot.. Edges will be in 1-2 ns range..Make signal selector for frequency, and setup output termination for amplitude.Idea is from here:http://www.antiqueradios.com/forums/viewtopic.php?f=8&t=293808&sid=a4cb015ad8faf1901bcc58a68a7036faLayout will be critical.Calibrate at DC and have fun..

author: cosenmarco
author_rank: Regular Contributor
timestamp: August 02, 2017, 09:34:02 am
content: Hey 2n3305 this is what I was looking for. That entire thread is very close to what I wanted to build in the first place. Thanks a lot!I will order some parts and start experimenting with the PIC and the 74AC14.I'll see where I get and I'll try to post progress for those who are interested but the original thread is very good.

author: 2N3055
author_rank: Super Contributor
timestamp: August 02, 2017, 10:04:03 am
content: Quote from: cosenmarco on August 02, 2017, 09:34:02 amGlad to help..I've been planning to make one for ages... As other said, you don't really need it so much nowadays, but for fun.. But other projects that pay the bills come first.. And you have to sleep sometimes... So never got around to do it. But I will order PICS now that you reminded me .. Maybe even make it this time .Take care,Sinisa

author: Ian.M
author_rank: Super Contributor
timestamp: August 02, 2017, 10:50:50 am
content: PICDIV cant do /10 for 1MHz from a 10MHz input as the PIC12F675 doesn't have a PWM module and shortest possible squarewave bit toggle loop takes 6 instruction cycles or 24 input clock cycles per full output cycle. As the maximum standard midrange PIC12/16 clock speed is 20MHz you cant simply crank up the input frequency enough to get 1MHz out.Also it doesn't seem to do /100 (required for 100KHz from 10MHz), and although it would be possible to add /100, there are only 25 instruction cycles to do it in, so you cant get a 50% duty cycle squarewave - the best you can do is 48% or 52% as 25 is not divisible by 2. Doubling the input to 20MHz solves the 50% duty cycle as its now /200 with 50 cycles to do it in.If you get aPIC16F683, all those problems go away as it has a PWM module which can be set up as I described in my earlier post. The fly in the ointment is: the built-in oscillator uses two I/O pins you are only left with three to encode the frequency, which means you need a multi-pole switch or a diode matrix, or need to use an external oscillator module to free up a pin if you want to reproduce the HZ60 functionality. If you use a PWM capble PIC (or AVR) with more pins, a single pole slide switch is sufficient (2 pole if you also want it to control power) or you can use a far more readily available DP6T rotary switch.However getting into PIC development is fairly expensive compared to AVRs as there is no dirt-cheap programmer that will run on a modern PC, (genuine PICkit 3 is $50 and the $15 clones can be fairly flaky) and the MPLAB X development environment is a big bloated mess that needs a high end PC to run smoothly. OTOH the minimum investment to get into AVRs and program your own bare chips is a $3 USBASP programmer or Arduino Nano clone running ArduinoISP, and you can use the lightweight Arduino IDE and the AVR-GCC toolchain it installs. If you choose to use anATmega328Pwith a 16MHz crystal its even easier as that's the MCU on an Arduino Uno.

author: David Hess
author_rank: Super Contributor
timestamp: August 02, 2017, 11:19:36 am
content: It is very difficult to get a clean edge directly out of CMOS logic without a lot of fiddling as that antiqueradios link shows. The best result there is pretty poor; it does not have any overshoot but the leading edge is bent indicating poor frequency response from the poor decoupling which was used to remove the overshoot. Serious designs use a series diode or transistor cascode to disconnect the pulse output which is then pulled to ground through a parallel RF termination resistor so the clean edge is exactly terminated into 50 ohms with a minimum of capacitance.The Heathkit IG-4505 had a simple design shown below using the transistor cascode method. Note the parallel termination resistor at the end of the cable where the oscilloscope connects; this was their version of a feedthrough termination and was part of the cable.

author: med6753
author_rank: Super Contributor
timestamp: August 02, 2017, 11:35:37 am
content: Quote from: David Hess on August 02, 2017, 11:19:36 amDavid's idea is a good one. Heathkit also sold the IG-4244 Oscilloscope Calibrator. (See picture). It does have a square wave output with a rise time of 1ns. I used mine to check the accuracy of my Tek 2465 and it was spot on. They occasionally show up on E-bay but they are pretty rare.

author: David Hess
author_rank: Super Contributor
timestamp: August 02, 2017, 12:21:41 pm
content: Here is the schematic for the IG-4244. The major difference in the pulse output is that it includes the series disconnect diode as well. The resistor shown at the BNC is the shunt termination resistor on the pulse generator. This design assumes that a feedthrough termination is used on the oscilloscope end of the cable.The oldest design I know of like this is theTektronix 106pulse generator.

author: 2N3055
author_rank: Super Contributor
timestamp: August 02, 2017, 12:44:49 pm
content: Quote from: David Hess on August 02, 2017, 11:19:36 amGood points..Edges on IG-4505 are specified at < 4ns , HZ with 74HC is < 3ns, and with 74AC you get <2ns..Adding two resistors on 74AC and careful layout is not more complicated than careful layout of transistor version.Output on IG-4505 doesn't look like a cascode, but as a differential shaper, that can make nice clean square wave.. So can 74AC....As for 74Ac version, from images posted on that forum, I can't say if what looks like slow edges originate from pulse generator (in which case it was overdamped), it is not clear how the scope was terminated (1MOhm, 50 Ohm) , or even if it is a 20MHz scope.... It doesn't say... I'm not able to recognize what scope it is from the graticule...Regards,Sinisa

author: med6753
author_rank: Super Contributor
timestamp: August 02, 2017, 02:06:47 pm
content: Quote from: David Hess on August 02, 2017, 12:21:41 pmCorrect. The kit included a RG-58 coax where you assembled a 50 ohm feed thru termination at the scope end of the cable. But if your scope has 50 ohm inputs, as my 2465 does, you can use any RG-58 patch cable.

author: David Hess
author_rank: Super Contributor
timestamp: August 02, 2017, 04:36:49 pm
content: Quote from: 2N3055 on August 02, 2017, 12:44:49 pmBut it is not creating a pulse edge suitable for calibration. See below.QuoteThe two Heathkit designs use the same configuration of output transistors but drawn differently. They are both differential stages with an emitter follower driving a cascode into cutoff; I am used to calling that "emitter switching". ECL works the same way but buffers the output with another emitter follower. Replace the driving emitter follower with the output from the 74AC and it too can produce a clean output. Or drive that series diode or two series diodes on the output with the 74AC. Or combine all of these things.QuoteI marked the problems on the first photograph below taken from the forum. That double edge is just wrong and is the exact sort of thing that a good reference level pulse generator should reveal instead of cause. The roughly 200 nanosecond second edge can probably be ignored but I doubt it is from the oscilloscope and it looks a lot like saturation from the 74AC logic; maybe it is the channel of the conducting transistor heating up? The oscilloscope had to be 50 ohm terminated for that measurement and the bandwidth is irrelevant because the two discontinuities should not be there at any bandwidth.The second photograph is the output from my PG506 taken with a 14 GHz bandwidth. Ignore the jitter; that is deliberate as part of the test I was running. The slight slope along the top finishes in about 600 picoseconds and has nothing to do with the pulse generator; it is dribble up from the coaxial patch cable which neatly shows why faster reference level pulse generators use a pulse head directly attached to the oscilloscope input. In any event, that dribble up wouldn't even been observable on a 100 MHz or even 200 MHz oscilloscope.The third photograph is the schematic for the PG506 output circuit.The fourth photograph is the schematic from the NBS (National Bureau of Standards which is now NIST) output circuit.For simplicity, I would just take the output from the 74AC logic without that resistive decoupling mess and run it through the diode (or two diodes) into the parallel termination. Ideally the diode is a microwave schottky diode but the base-emitter junction of a small signal RF transistor or a small signal schottky diode would also be suitable.

author: 2N3055
author_rank: Super Contributor
timestamp: August 02, 2017, 05:13:42 pm
content: Quote from: David Hess on August 02, 2017, 04:36:49 pmDavid,Thanks for an explanation and details.. I understand better now what you want to say. That dual-slope on the edge is what is bothering you.. I would think it has to do with saturation characteristics of mosfets in output stage as they approach power rails voltage, or something like that.. Interesting, I might take a look at it ...Also diode idea is good, I might try that too, with a transistor for now.. Thanks.I will definitely build one now, out of curiosity...Best regards,Sinisa

author: David Hess
author_rank: Super Contributor
timestamp: August 02, 2017, 05:24:57 pm
content: I just noticed that the second part of that dual slope is on both edges so it cannot be heating of the MOSFET channel because one of those pulses is at ground where no current is flowing unless it is leakage which seems really unlikely into 50 ohms. The leading edge problem is still there though. Maybe there *is* something wrong with his oscilloscope.

author: Ian.M
author_rank: Super Contributor
timestamp: August 02, 2017, 06:02:31 pm
content: Here's PIC code (in XC8 C) for HZ60 style calibrator signals:Code:/**************************************************************************** Oscilloscope Calibrator Timing Generator ****************************************************************************** Description: Produces true squarewaves on GP2 at frequencies 10^N Hz ** between 1KHz & 1MHz + DC level from 16MHz crystal input. ** The frequency is set by a binary number on pins ** <GP3><GP1><GP0>, 0 is 1MHz, 1 is 100KHz etc. decreasing ** to DC (Vcc). Out of range gives 0V out. ** FileName: calibrator.c ** Version: 0.2 - incomplete HZ60 emulation ** Dependencies: See INCLUDES section ** Processor:PIC12F683 (can port to other midrange devices with CCP) ** Hardware:16MHz crystal on OSC1 & OSC2, or ext. 16MHz clock reqd. ** Complier: Microchip XC8 ** Author:Ian.M ** Licence: "THE BEER-WARE LICENSE" (Revision 42) ****************************************************************************//** -------------------------------------------------------------------------* "THE BEER-WARE LICENSE" (Revision 42):* "Ian.M" <https://www.eevblog.com/forum/profile/?u=104739> wrote this file.* As long as you retain this notice you can do whatever you want with this* stuff. If we meet some day, and you think this stuff is worth it, you* can buy me a beer in return. Ian.M* --------------------------------------------------------------------------*//********** CONFIG **********/// PIC12F683 Configuration Bit Settings#pragma config FOSC = HS // Oscillator Selection bits// (HS oscillator: High-speed crystal/resonator on RA4/OSC2/CLKOUT and RA5/OSC1/CLKIN)#pragma config WDTE = OFF // Watchdog Timer Enable bit (WDT disabled)#pragma config PWRTE = ON // Power-up Timer Enable bit (PWRT enabled)//#pragma config MCLRE = ON // MCLR Pin Function Select bit (MCLR pin function is MCLR)#pragma config MCLRE = OFF // MCLR Pin Function Select bit// (MCLR pin function is digital input, MCLR internally tied to VDD)#pragma config CP = OFF // Code Protection bit// (Program memory code protection is disabled)#pragma config CPD = OFF // Data Code Protection bit// (Data memory code protection is disabled)#pragma config BOREN = ON // Brown Out Detect (BOR enabled)#pragma config IESO = OFF // Internal External Switchover bit// (Internal External Switchover mode is disabled)#pragma config FCMEN = OFF // Fail-Safe Clock Monitor Enabled bit//(Fail-Safe Clock Monitor is disabled)/********** INCLUDES **********/#include <xc.h>#include <stdint.h>/********** DEFINES **********/typedef struct { uint8_t Pre; uint8_t Period; uint8_t Duty;} freq_t;typedef enum{ F_1MHz, F_100KHz, F_10KHz, F_1KHz, F_DC, N_Modes} mode_t;/********** GLOBALS **********/const freq_t freqs[]={ // Frequency table// Freq Fosc divisor// ---- ------------{0, 3, 2}, // 1MHz /16{0, 39, 20}, // 100KHz /160{1, 99, 50}, // 10KHz /1600{2, 249, 125}, // 1KHz /16K{0, 127, 255} // DC by duty cycle >100%};/********** CODE **********/void main(void){// variablesmode_t mode=F_DC, oldmode=N_Modes;// setupGPIO=0;TRISIO=0b111011; // All inputs except GP2/CCP1ANSEL=0; // All digital inputsCMCON0bits.CM=0b111; //Comparator disabledCCP1CONbits.DC1B=0b00; // No fractional duty cycle bitsdo{ // main loop//Read mode from port, skipping bit 2mode=(GPIObits.GP3<<2)|(GPIO&0b11);// Set new modeif(mode!=oldmode){if(mode<N_Modes){// Disable PWM, set output low, stop timer.CCP1CONbits.CCP1M=0b0000; // OffGPIObits.GP2=0;T2CONbits.TMR2ON=0;// Load frequency dataT2CONbits.T2CKPS=freqs.Pre;PR2=freqs.Period;CCPR1L=freqs.Duty;// Restart timer and PWMTMR2=0xFF; // so it rolls to 0 ASAP for PWM restartCCP1CONbits.CCP1M=0b1100; // PWM, active highT2CONbits.TMR2ON=1;// Done.oldmode=mode;}else{// Disable PWM, set output low.CCP1CONbits.CCP1M=0b0000; // OffGPIObits.GP2=0;}}}while(1); // End main loop}Tested under MPLAB 8 SIM - I don't have a PIC12F683 and a good enough scope handy to test it in real life.It currently only covers the range 1KHz - 1MHzEnjoy!See calibrator2.c attached to reply #34 below for improved version that adds frequencies down to 1Hz.

author: 2N3055
author_rank: Super Contributor
timestamp: August 02, 2017, 06:24:31 pm
content: Quote from: Ian.M on August 02, 2017, 06:02:31 pmWow! that is good work Ian ! Nice!!This is starting to be productive... We might even settle on a design that works nicely..Regards,Sinisa

author: Ian.M
author_rank: Super Contributor
timestamp: August 02, 2017, 06:57:32 pm
content: Its still got three possible mode numbers left, (assuming you don't actually need 0V DC out with it powered up). I could write some output compare code to extend it for 100Hz, 10Hz and 1Hz, for better HZ60 compatibility, or if there's demand for it implement other signals - I need at least 20us between edges, but they will be cycle accurate with a resolution of up to 250ns.Making it work with other crystal frequencies is a little tricky - it MUST be N*4MHz to support 1MHz out so you are S.O.L. if you want to run it off a 10MHz GPSDO, unless you use a XOR + delay to frequency double to 20MHz.

author: David Hess
author_rank: Super Contributor
timestamp: August 02, 2017, 07:13:26 pm
content: Here are a couple of photographs from my PG506 and 100 MHz 2232 showing what I would expect.The first one duplicates the conditions of the photograph from the antiqueradios forum. There is something at the corner of the fast edge but nothing like that dual slope.The second one shows the detail of the edge. The oscilloscope's transient response is a little better than +2%, -2%, and 4% peak-to-peak which is within the 2232 specification of +6%, -6%, and 6% peak-to-peak. Rise time appears to be exactly 3.5 nanoseconds which is no surprise for a 100 MHz bandwidth.Neither photograph shows any linear discontinuities which indicate problems like slew rate limiting, saturation, cutoff, or thermal effects. The important thing to note is that the slope discontinuity in the photograph from the antiqueradios forum would completely mask what the transient response of even a 100 MHz oscilloscope should look like.

author: 2N3055
author_rank: Super Contributor
timestamp: August 02, 2017, 07:18:00 pm
content: Ian,running it off good 16MHz quartz or TCXO is more than enough for the purpose..I was also thinking about ATmega328P with similar code..It would be easier to implement UI.. Few LEDS, few buttons..Regards,Sinisa

author: 2N3055
author_rank: Super Contributor
timestamp: August 02, 2017, 07:29:18 pm
content: David,that looks real good.. I will investigate further in next few days......Thanks for the effort and knowledge...Regards,Sinisa

author: Ian.M
author_rank: Super Contributor
timestamp: August 02, 2017, 07:40:25 pm
content: As I said *way* up thread, more pins makes the UI easier no matter whether its PIC or AVR based, though for real cheap-skates I could easily implement a resistor ladder (or weighted resistors and a BCD switch) to an ADC input for mode selection to save pins. OTOH, as all the frequency generation is handled by hardware in the background, on a more powerful MCU, there's no reason why it couldn't handle a rich UI - anything up to a graphic LCD + touchscreen in the foreground superloop.I'd have to do some actual hardware experimentation to verify the timings if I ported it to an ATmega328P. The algorithm would be pretty much the same - the only differences would be the const freqs[] array contents and the code to stuff the registers to set up each PWM frequency.

author: David Hess
author_rank: Super Contributor
timestamp: August 02, 2017, 08:29:25 pm
content: Quote from: 2N3055 on August 02, 2017, 05:13:42 pmThinking about it, I like your idea better. Maybe it explains both problems.It is not something I have looked at in detail because I have never bothered using saturated output transistors in designs like these. I either used a diode to disconnect the output which is then pulled to ground by the termination resistor or a current output into a shunt resistance. The practical limit for the diode disconnect design is better than 250 picoseconds and good for calibration up to 1 GHz.Analog switches can work well for generating a clean and calibrated adjustable peak-to-peak output signal from a precision DC reference but are too slow and have too much capacitance for a precision fast edge. Older designs use a precision resistor and calibrated currents which are easy to switch using diodes and bipolar transistors even at high voltages.

author: Ian.M
author_rank: Super Contributor
timestamp: August 03, 2017, 02:08:51 am
content: Now the PIC12F683 can do all the frequencies the Hameg HZ60 can (1MHz to 1Hz + DC). All it will need is a 16MHz crystal+ load caps, decoupled supply, an 8 position switch for frequency selection, and whatever the consensus is for the best output stage and precision attenuator.Code tested under MPLAB 8 SIM for all the frequencies.Suggested octal encoded switch:Grayhill 94HBB08T+Knobfrom Mouser. Tie common to Vss and add 10K pullups to Vdd on all the PIC's frequency control pins. N.B: make sure the switch is in position 0 (all open) for PIC ICSP.

author: cosenmarco
author_rank: Regular Contributor
timestamp: August 03, 2017, 07:10:11 am
content: Wow the PIC design is really starting to take shape.Ian.M thanks for pointing out the limitations of the PICDIV and the complexity associated with PIC programming. I did a PIC project many years ago and it was quite hard.I think I will settle to PIC12F683. I don't really need to have exact UI of the Hameg and I think I have 3 GPIO pins free for frequency selection which I will implement using 3 dip switches which will set the bits directly: no need for fancy pancy rotary switches and diode matrixes or (worse) touchscreen crap.David Hess and 2N3055: Great stuff! I'd like to hear about the experiments.

author: Ian.M
author_rank: Super Contributor
timestamp: August 03, 2017, 01:55:11 pm
content: Yes, the project does seem to be coming together nicely.We do need some input here from the fast pulse, short risetime gurus, for the most cost effective way of producing the buffered output, without 'select on test' parts, as I for one don't have a good enough scope to do that selection. I think we'll need the PCB layout for that section as well as some of the factors involved are not obvious to many of us. Unless there is a *CLEAR* case to reject them, I suggest aiming for the same output options and amplitude trimmability as the HZ60.DIP switches do seem a little clumsy for the UI, but I suppose they aren't a bad choice if you want to make it as a cheap as possible bare board OSHW project. Use a 4 switch one with 3 for selection and the 4th for power and silk screen the frequency table next to it on the PCB. For power, I'm thinking 9V PP3 and linear regulator to keep it as cheap as possible while still being able to run to about 90% 0f its 0.8V/cell EOL - it isn't worth putting the effort into designing a low enough noise switching regulator or single sell boost converter. It would be nice to put together a community project good enough to send to Dave.On the UI side of things, if there's a spare inverter I could mod the code to use two three position slide switches or center off toggle switches, to select the frequencies from a 3x3 grid which might be a bit more intuitive than DIP switches. Use DPDT-CO switches and the center position of the grid can be power off, or if you stick to SPST-CO switches, I could re-work the code to add a 0.1Hz option, or any other pulse pattern suggested. I do feel its worth retaining the Hameg Hz60's look and feel and to that end, I could also use a SP10T rotary switch with 8 2.2K resistor wired between 9 of its positions as a potential divider feeding an ADC input for frequency selection. If I add a ultra low power regulator with a /SHUTDOWN pin, the same switch's 10th position can be power off - simply put a 3.3Meg pullup to +Batt on /SHUTDOWN to turn the regulator on, and when the switch is in the OFF position, it sinks a few uA through the ADC input (via a 1K series resistor) and the PIC's upper input protection diode into the Vcc rail to hold it off. 100K from Vdd to 0V will keep the rail low enough for it to stay in shutdown. To actually get it to turn off, in the first place, the PIC would make the ADC pin an output and drive it low periodically, between polling the ADC for the switch setting. That arrangement with a regulator that has 1uA standby current would use 23% of the alkeline PP3 battery capacity during its 5 year shelf life*. If the regulator has 5uA standby current it will use 48% of the battery capacity - still acceptable. Add a micropower comparator and a few resistors and I can add low battery detection, and make the PIC blink the power LED if there isn't enough headroom to maintain the 5V rail. HZ60 style auto-power-off is a little trickier without going up in pin count and leaving the PIC powered in sleep mode.Its easy to get auto-power-off wrong: EPE and Silicon Chip magazines seem to manage it at least annually judging by the number of their project articles that have a part 2 or 3 errata that's basically ripping out the auto-power-off or dumbing it down to a long time constant RC network!I can also help with porting to other PICs - tell me what you've got with an (E)CCP/10 bit PWM module and I can probably churn out a version to suit pretty quickly. An AVR/Arduino port would be a *MUCH* bigger project for me as I'm not familiar with the AVR OC/PWM modules to anywhere near the same extent I know the PIC ones, and don't have a cycle-accurate AVR simulator to verify the timing on.*ENERGIZER 522 (9V PP3 Alkaline): Capacity typ. 700mAH to 6.0V @10mA CC load. Shelf life is nominally 5 years to 80% capacity remaining.

author: HighVoltage
author_rank: Super Contributor
timestamp: August 03, 2017, 03:16:57 pm
content: I still have my original Hameg HZ 60-2 from a long time ago, bought it brand new.Growing up in Germany, one had to have a Hameg scope and an HZ60.These days, I am using my Keysight 33522B Generator to calibrate old analog scopes.If it helps the project, I could take measurements of what this HZ 60-2 is capable of, on a modern scope.

author: Ian.M
author_rank: Super Contributor
timestamp: August 03, 2017, 03:56:15 pm
content: That would be nice, especially an A-B comparison between it and the Keysight 33522 set for the same nominal output. Also, if you are willing to open the HZ-60, some good closeup photos of both sides of the board would be a big help with the output stage layout for the DIY version - copying Hameg's output stage layout and circuit should give closely comparable specs.

author: David Hess
author_rank: Super Contributor
timestamp: August 03, 2017, 04:37:59 pm
content: Quote from: Ian.M on August 03, 2017, 03:56:15 pmYou can find schematics of the Hameg HZ-60 online or at least enough of them to see what they were doing.All three outputs come from resistor dividers driven by a single 74HC00 logic gate powered by some type of discrete low dropout regulator which I assume is trimmed for an exact output voltage. That can provide enough accuracy for limited vertical calibration but is not suitable for transient response testing on anything faster than about 20 MHz.In theory the same output stage can be used for high bandwidth transient response testing and vertical calibration up to maybe 5 volts but in practice I have always seen them implemented as separate outputs which is just easier. A full capability calibrator needs to support outputs up to at least 20 volts peak-to-peak (4 divisions at 5V/div) which is incompatible with edges fast enough for 100 MHz bandwidth testing.

author: HighVoltage
author_rank: Super Contributor
timestamp: August 03, 2017, 04:57:40 pm
content: Here are some pictures of the HZ60 inside

author: David Hess
author_rank: Super Contributor
timestamp: August 03, 2017, 05:36:14 pm
content: That Hameg custom divider IC is hilarious.The 4060 is part of a timing circuit which powers the instrument for about 3 minutes when the power button is pressed and then shuts it off.

author: Ian.M
author_rank: Super Contributor
timestamp: August 03, 2017, 05:54:23 pm
content: @HighVoltage,So its single sided with the only proper ground plane round the board edges. One could reproduce that output stage with copper foil tape on matrix board and get almost identical results.As you couldn't easily photo the track side, its fortunate that the RadiomuseumHZ-60 pagehas the top-view PCB layout. Rotated 180 deg, it looks like it matches your board photo #2. Its interesting to see the how the 50R terminator has been removed from the board and wired direct to the BNC socket to reduce inductance.Can you check the 74HC00 supply voltage and the DC out 2.5V level to 3 d.p.s please?I suspect a +/- 0.5V adjustment range for an adjustable LDO will be plenty, and the PIC will be happy enough over the same supply range.We've nearly got enough info to build a PIC based functional clone . . .Quote from: David Hess on August 03, 2017, 05:36:14 pmHow else would you do it back in 1985 or '86 without a board full of logic? I don't think you could fit a 5 decade divider chain in a contemporary PAL. ASICs were very much the thing.QuoteYes that bit seems like either it was an afterthought or they couldn't fit another two decades into the ASIC. Otherwise it would have been a no-brainer to expand it to 0.1Hz (the switch is already 12 way stopped to 8 way) and put the power hold on logic in the ASIC so all it needs is an external level shifter and pass transistor.

author: cosenmarco
author_rank: Regular Contributor
timestamp: August 03, 2017, 08:30:03 pm
content: Hey @HighVoltage vielen Dank for the close ups. The measurements on the voltage rails would be very much appreciated.David Hess:QuoteFor sure this project doesn't aim at being a full fledged calibrator. For me it would be a handy device with close to no setup to whack into the scope and check roughly its calibration status and to check probe compensation when changing probes. I'm talking about low-end analog scopes.@Ian.M: auto power off would be a nice little touch. I still have to think about the best way to implement the UI in a way that allows minimal setup and makes economy of PIC pins...I don't know if anybody spotted yet the TL431-based adjustable voltage reference. Looking at the resistance divider for the 2.5V output, the output of the 74HC00 should be at (2.5Vpp*650Ohm)/500Ohm = 3.25Vpp which is compatible with the 74HC00 datasheet for recommeded operation and also makes sense to power with 4xAA batteries. This is though not good for PIC operation at 16Mhz so the replication of the Hameg's output stage is not an option with PIC driven oscillator.

author: cosenmarco
author_rank: Regular Contributor
timestamp: August 03, 2017, 09:02:54 pm
content: So, speaking of pin economy, in the PIC12F683 we have 8 pins total.- 2 are for power supply (VDD, VSS)- 2 are for crystal oscillator (ORC1, OSC2)- 1 is for the output (CCP1)This leaves 3 pins for UI. Enough to build all 8 frequency combinations but we would need 2 other pins:- 1 pin to turn the device on (INTx)- 1 pin to drive the other parts of the circuit on (voltage reference and output stage)Am I missing something?If the output stage uses the 74AC14 we could use one of the spare inverters to build ahttps://en.wikipedia.org/wiki/Pierce_oscillatorand provide external clock to the PIC effectively gaining one pin (would cross -talk in the 74AC14 actually be a problem?) but still 1 pin would be missing.The alternative suggested by Ian.M is to drive an ADC pin (ANx) with a resistor ladder and some sort of rotary / linear switch to represent different UI settings. This would free up 2 pins.

author: Ian.M
author_rank: Super Contributor
timestamp: August 03, 2017, 10:07:33 pm
content: Quote from: cosenmarco on August 03, 2017, 08:30:03 pmNot a problem. If you need to run the output buffer at about 3.3V, make sure the regulator's feedback input is ground referenced, then simply use 2 silicon diodes after the adjustable regulator to drop the output voltage and take the feedback from the 3.3V rail. The PIC can be powered by a minimum of 4.5V, probably somewhere between there and 5V. The logic level mismatch can be easily handled with a potential divider with a few pF of capacitance across the upper resistor, tweaked to be slightly underdamped for best risetime.Alternatively, just use a PIC that's rated for 3.3V operation at 16MHz. A 14 pin PIC16F1823 would be a good candidate and the extra I/O pins could simplify frequency selection, or if we are sticking to shoehorning it into to an 8 pin PIC then use a PIC12F1822. We could also use the Reference Clock Module, routed through the Data Signal Modulator (as its default output is on OSC2) to concurrently output a 1MHz reference clock - or any other binary divisor of the crystal frequency down to /128.I could probably also tweak the PIC12F683 code to run with an 8MHz crystal and still output 1MHz. I'd need to change all the PR2 constants (integer divide by 2), and add code to right shift the duty cycles before loading CCPR1L and dump the original LSB into CCP1CONbits.DC1B1.Quote from: cosenmarco on August 03, 2017, 09:02:54 pmYou can get cute and read a digital I/O pin as High/Low/Floating - it needs a small cap (few tens of pF) at the pin to hold the state + a series resistor to the moving contact of a SPDT center off switch. The strategy is to read the pin, then briefly make it an output and pulse it to the opposite state - if it stays there long enough, the input is floating. If it is floating, make it an output until you poll it again to avoid floating pins increasing power consumption. Two pins would give nine possible combos. Together with freeing up GP4/OSC2, that would give you the extra input (only) pin - GP3 and output pin you need. I really wouldn't recommend stealing gates from the output buffer for a Pierce oscillator, as there's far too much risk of crosstalk. A Pierce oscillator spends too much time in the linear region so there would almost certainly be intermodulation due to the supply and ground impedance, leading to Fosc ripple on the top and bottom of the squarewave and if you are unlucky with the gate delays a possible glitch on the rising or falling edge. It would be much safer to use a separate TCXO module which would also improve the uncalibrated frequency accuracy.And yes, using the ADC input for mode selection is fairly trivial - After adding ADC setup code to the initialisation section, in the main loop simply rip out the line that that sets mode from the GPIO port:Code:mode=(GPIObits.GP3<<2)|(GPIO&0b11);replacing it with code that triggers the ADC and waits for the result, then shifts the whole result left one bit adds 0x0080 to it for rounding, then throws away the low byte to get a three bit result in the high byte to stuff into mode directly compatible with the rest of the existing code. (or you could even shift it two bits to keep a 4 bit result and add the intermediate 500KHz, 50KHz, 5KHz, 500Hz, 50Hz and 5Hz frequencies). The minimum hardware is a 1P7T rotary switch (possibly 1P8T if we want to get cute with using it for power as well) and seven equal resistors in a potential divider chain between Vdd and Vss.On the subject of UIs, 6 LEDs arranged on the sides of a 3x3 grid can be charliplexed with only 3 I/O pins to indicate any one of nine states (without getting into blinking etc.) and the control could be a simple pushbutton to cycle through them or two, one for each side. You'd need a PIC16 to have enough pins but it could be a lot cheaper than a decent quality rotary switch. You can do 12 LEDs with 4 I/O pins which would allow an individual LED for each mode.

author: 2N3055
author_rank: Super Contributor
timestamp: August 03, 2017, 10:13:56 pm
content: You can't use 74AC14 for anything except that one gate for output.. You can inject all kinds of crap into output.I think single gate logic would be perfect here, but I want to replicate previous results before going further..

author: David Hess
author_rank: Super Contributor
timestamp: August 03, 2017, 11:56:56 pm
content: Quote from: Ian.M on August 03, 2017, 05:54:23 pmI suspect they either already had that IC in production or someone else had it and marked it for Hameg. Of course Tektronix was making low volume ICs for their own use and so maybe Hameg was doing the same.Did Hameg make an oscilloscope with selectable frequencies for its probe calibrator output?QuoteThe Hameg counter IC only provides one output at a time. The switch controls various logic inputs to the counter IC to select which output is selected.Quote from: 2N3055 on August 03, 2017, 10:13:56 pmI would probably try to use the CMOS output from the PIC itself.

author: Ian.M
author_rank: Super Contributor
timestamp: August 04, 2017, 12:41:53 am
content: There was an interesting thread on fast rise time logic gates for scope calibration a few years back:https://www.eevblog.com/forum/testgear/fast-rise-time-2ns-or-1ns-signal-generator/TheSN74LVC1G04 single inverterwas suggested and one of the members was getting sub-ns rise-times.TheSN74LVC1G17 Schmitt input buffer/drivermight also be worth a look - depending on the risetime of its input from the PIC's CCP pin, it *may* do better.Both SN74LVC1G series gates have 5.5V tolerant inputs even when their Vcc is reduced and are suitable for logic level down-conversion so the amplitude can easily be trimmed with a variable regulator.

author: David Hess
author_rank: Super Contributor
timestamp: August 04, 2017, 04:08:01 am
content: I was looking at doing this before I got a PG506. One of the designs I considered used a tristate LVC or similar CMOS gate to drive an RF transistor cascode (1) and schottky diode as shown in those schematics I posted. The collector of the RF transistor drives the diode and 50 ohm parallel termination at the output BNC. 10 milliamps of collector current then gives a 0.5V open circuit output and 0.25 volts into a 50 termination but 4, 8, or 20 milliamps could be used also for 0.2/0.1, 0.4/0.2, and 1.0/0.5 volts. Higher voltages would require more current and parallel CMOS gates.The gain of the transistor produces a faster edge than the gate can produce by itself and the configuration makes for a cleaner edge.The problem here is that it requires a second supply voltage higher or lower than ground or Vcc.(1) Something like a SOT-223 packaged BFG31 or BFG97 or SOT-89 packaged BFQ149 or BFQ19 but there are lots of options.

author: morecat_lab
author_rank: Newbie
timestamp: August 04, 2017, 07:55:57 am
content: Hi,I built a very simple oscilloscope tester based on Arduion, which you might be interest.https://github.com/kuwatay/simpleDDSTwo channel sin wave (software DDS) with phase adjustment.--> This function is useful for the test of XY.Two channel square wave (hardware timer, 8MHz to 1Hz)Two channel square wave (software-based, sync with sin wave)It even has OLED and rotary encoder for user interface.-Yoshi

author: cosenmarco
author_rank: Regular Contributor
timestamp: August 04, 2017, 12:47:06 pm
content: Hi morecat_lab, thanks for posting. It looks really nice. It seems the ATMega8, for example, has comparable characteristics with the PICs in terms of Timer+PWM operation for the generation of the scaled clock signal. Also the price is comparable.I think we should stick to a specific deviceand I don't want to start a discussion PIC vs AVR because there's already enough.So I'm going to choose PIC because I have a programmer, I already did a PIC project and we have already a working program thanks to Ian.M which does what we need.So I'd like to fix some points that will let us choose the best PIC device for the job:- Voltage source: 4XAA batteries. The PIC has to turn on / off all other devices (adjustable voltage reference and output stage) due to sleep mode.- Clock 8Mhz crystal-controlled (so we don't necessarily need a LF PIC variant)- 16 bit Timer with PWM- 14 pinsDoes it make sense? Did I forget something?

author: David Hess
author_rank: Super Contributor
timestamp: August 04, 2017, 01:57:36 pm
content: Quote from: morecat_lab on August 04, 2017, 07:55:57 amThat is pretty cool. Tektronix liked to specify horizontal bandwidth by both the -3dB point and the point where the phase mismatch became 2 degrees. To measure the later, you could set the phase adjustment to -2 degrees and then increase the frequency until the diagonal line is straight.Commonly the 2 degree point happened at 35 or 50 kHz. Some oscilloscopes had an option available for "phase correction" which could extend this to 1 or 2 MHz depending on the -3dB bandwidth of the horizontal amplifier.If you wanted higher XY bandwidth, then you needed sampling oscilloscope, digital storage oscilloscope, or an unusual oscilloscope like a 7104.

author: Ian.M
author_rank: Super Contributor
timestamp: August 04, 2017, 02:10:25 pm
content: Quote from: cosenmarco on August 04, 2017, 12:47:06 pmYou wont find that combo in the 'classic' midrange family, and the code is set up for one odd-numbered 16 bit timer for output compare, + one even numbered (not Timer 0) 8 bit timer with period register for the PWM. Those features come with the plain (E)CCP modules that do max. 10 bit PWM not the 16 bit dedicated PWM modules found in many newer devices. I'd need to completely rewrite the code to support the newer 16 bit PWM modules, but I don't have any PIC16F1xxx parts in stock and don't trust the simulator's 16 bit PWM support. If we do go 3.3V with a PIC16(L)F1xxx part, choosing one with a CCP or ECCP module rather than a 16 bit PWM module will minimise the code changes required.I think the easy option is to keep things much as they are, run the PIC at between 4.5V and 5.5V for faster output transitions and use the level translation capable gates I linked to for the output stage, running from an adjustable rail to set the amplitude.In another thread:Quote from: tggzzz on July 08, 2017, 12:29:48 pmSN74LVC1G14 Single Schmitt-Trigger InverterThat could do pretty well for the output stage. Run the 74LVC1G14 gates near 5V Vdd for speed, and rework the HZ-60's attenuator chain to look like a 50R load and have 50R output impedance. That could give you 2.5V, 0.25V and 0.05V unloaded or 1.25V, 0.125V and 25mV into 50R. Drop the 74LVC1G14 supply by about a volt by switching in a different resistor in the regulator feedback network, and you could also get 2.0V, 0.20V and 0.04V unloaded or 1.0V, 0.10V and 20mV into 50R from the same three BNC sockets.

author: electrolust
author_rank: Unknown
timestamp: August 04, 2017, 06:42:41 pm
content: Quote from: cosenmarco on July 31, 2017, 05:16:27 pmHow abouthttp://www.ebay.com/itm/CALIBRATION-AND-TESTING-DEVICE-FOR-TEKTRONIX-AND-ALL-QUALITY-OSCILLOSCOPES-/132283680426?Half the precision (2%), double your budget ($200), and 10x the rise time (30nS). Regardless of not hitting your target specs, it's probably a reasonable calibrator for your scope, and at just 2x your budget (but completely packaged and tested) it's a bargain. IIRC he used to be asking more on the order of $400.

author: 2N3055
author_rank: Super Contributor
timestamp: August 04, 2017, 10:19:08 pm
content: Quote from: Ian.M on August 04, 2017, 02:10:25 pmFunny, I ordered few today, to experiment..In meantime I have to figure out original AC problem David mentioned.. Probably I will use LVC version anyway, but it made me curious...Regards,Sinisa

author: David Hess
author_rank: Super Contributor
timestamp: August 04, 2017, 10:43:51 pm
content: Quote from: 2N3055 on August 04, 2017, 10:19:08 pmWhich AC problem is that? Controlling ground and supply pin bounce to produce a clean output?If you are replicating the original Hameg design with resistive dividers to produce different output voltages, then that is going to make very fast clean edges somewhere between difficult to impossible. I would settle for clean at the expense of speed so it can be used to check probe and divider compensation and then add a special fixed level output with the fastest possible edge.One thing to consider here is actually verifying that a fast edge is clean. For that either a high bandwidth oscilloscope that you trust or a sampling oscilloscope is required. The designs I suggested have the best chance of achieving a fast clean edge without undo hardship.

author: 2N3055
author_rank: Super Contributor
timestamp: August 04, 2017, 11:17:40 pm
content: Quote from: David Hess on August 04, 2017, 10:43:51 pmDual slope on the edge that you noticed.. Out of curiosity, i would like to understand why is there.As I said, to try one chip inexpensive solution, I already ordered few 74LVC14 single gates... They are fast, SOT23, minimal parasitics...I agree with you, clean, well defined edge, is more important than speed...I like your proposal for bipolar cascode and fast small signal schottky diode cutoff into single 50 terminator right on the BNC.I'm studying schematics you showed....

author: David Hess
author_rank: Super Contributor
timestamp: August 05, 2017, 03:48:19 am
content: Quote from: 2N3055 on August 04, 2017, 11:17:40 pmI like the MOSFET drain-source saturation explanation.QuoteLVC/ALVC was one of the candidates I considered. I do not remember what 5 volt logic I considered. I looked specifically for tristate outputs which can be configured to operate as N or P channel open drain outputs like the 74LVC125.QuoteFor checking compensation and vertical calibration, a surprisingly slow edge speed and low fidelity can be tolerated so that part of the design is trivial. Some precision pulse generators with linear (class AB) outputs are more than fast enough.High fidelity fast edges are a whole different matter requiring careful layout and special parts. The fast edge outputs on the PG506 have the termination resistors built into the BNC connectors.QuoteThe problem is that it will require more than a 3 volts. It might just be possible on 5 volts but higher would be better.Below are a photographs of the construction of the PG506 fast outputs to show what can work and the full schematic. Tektronix managed it with air wired through hole parts so I think a surface mount implementation can do better. Those little resistors are 1/8 watt carbon composition which have low parasitics except of course for their lead length. Some of the complexity is to make up for the non-ideal construction.Things to take special note of are how the BNC connector attaches to the printed circuit board almost forming a coplanar waveguide and the high performance 50 ohm termination which is built into the end of the BNC connector in the form of a disk. A simple design will use a 50 ohm transmission line to the BNC and a 50 ohm termination probably made from a pair of 100 ohm resistors.

author: cosenmarco
author_rank: Regular Contributor
timestamp: August 05, 2017, 05:37:44 pm
content: @electrolust: I thought about getting myself one. Seems a nice device. Rise time is <= 30ns and fall time <= 50ns. Functionality would be harder to replicate than the Hameg for my pet project.So, just to clarify how I intend to use the PIC, I created a block diagram which will show the different components and the voltages involved.If I understand correctly the Schmitt Triggers like the buffers / inverters we were considering (eg. SN74LVC1G17) and can accept input up to 6V independently of the supply voltage. This doesn't hold true for the 74AC14. Would a resistor divider be a possible solution to bring the input in the range 0->Vcc (3Vpp from max 6.4Vpp)?

author: Ian.M
author_rank: Super Contributor
timestamp: August 05, 2017, 07:45:53 pm
content: A resistor divider should work, to get down from 5V logic to ~3.3V but you may need to fiddle with a 'gimmick' cap across the upper arm to compensate for the 74AC14 input capacitance to speed it up. The problem is trimming the gimmick cap - a x10 probe gives you about 15pF||10Meg, most of the 15pF being stray capacitance to the probe body shield, which will swamp the input capacitance you are trying to trim for. To do it right you really need a 2pF input capacitance active probe.

author: David Hess
author_rank: Super Contributor
timestamp: August 05, 2017, 08:43:33 pm
content: The 74AC14 has Schmitt trigger inputs so compensation should not be required at the input for a fast output edge. But it does not hurt and the capacitor value can be calculated from the divider ratio and datasheet specification for input capacitance plus an estimate for circuit capacitance. Leave a spot for the capacitor in the layout if you think it may be necessary.If you want to find out, test it with the resistive divider and just watch the output edge to see if it matters. There is no need to probe the 74AC14 input.

author: David Hess
author_rank: Super Contributor
timestamp: August 06, 2017, 06:00:15 pm
content: Here is an MTS529 portable oscilloscope tester that I have. It uses an ECL output stage to generate a 300mV edge into 50 ohms with a roughly 350 picosecond rise and fall . It lacks the pulse fidelity of the PG506 fast rise and fall outputs (1) but is good enough to test bandwidth and verify proper operation of an oscilloscope up to 500 MHz.The construction shows the problem. An attempt was made to maintain a 50 ohm environment but the layout is marginal and the loop area of that connection to the BNC connector spoils the potential performance.As shown on my 2232, the response looks very good ... too good and better than the performance of my slightly slower PG506. The reason for this was that the transient response of this particular 2232 was calibrated against this MTS529 because at the time it was the best source that I had and I never recalibrated it against the PG506 when I acquired it later.(1) You will have to take my word for this for now as I do not have any photographs of its pulse response but it displays a typical "peaked" response with some ringing. It is not terrible but it is not as clean as the PG506.

author: cosenmarco
author_rank: Regular Contributor
timestamp: August 16, 2017, 08:52:33 pm
content: Hi, I worked on a preliminary version of the schematic.To-the-point feedback would be much appreciated.

author: Ian.M
author_rank: Super Contributor
timestamp: August 16, 2017, 10:12:04 pm
content: I can see a few issues:* you've got a 100K + 330K potential divider across the +6V rail and Gnd so that's a permanent 14uA drain and the resulting Thévenin equivalent resistance of 77K is way out of spec for input impedance for correct PIC ADC operation, so at the minimum you need a 0.1uF cap at the SENSE ADC pin to lower the source impedance To reduce the power down (Sleep) quiescent current, you may prefer to scale the divider resistors up into the Megs or 10s of Megs range and add a micropower OPAMP to buffer it for the ADC.* the 4.5V tap on the battery will be a PITA. Ditch it, use a low current 5V micropower LDO to power the PIC off the 6V rail (with the full expectation the 5V will droop before the battery is dead), ditch the Battery/DC switch and use the switch contact on the DC jack to isolate the battery instead.* You need to ground all unused inputs of the 74AC14 so they don't toggle due to capacitive coupling inside the chip and glitch the output edge.* If you ever need ON and Error LEDs lit simultaneously they'll need seperate anode resistors rather than a shared cathode resistor.* As the PIC and the 74AC14 are running at different Vdd voltages, you'll need a series resistor in the Signal line to limit current into its input protection diodes to no more than 10% of the permitted maximum with a small capacitor across it (say 50pF) so you still get fast edges.

author: cosenmarco
author_rank: Regular Contributor
timestamp: August 17, 2017, 06:47:47 am
content: QuoteYeah, I wanted to avoid quiescent current aside the PIC and the regulator and this is a mistake.QuoteI wanted to use the comparator against the internal reference voltage of 1.024V to sense the battery voltage using the resistor divider which should give me a bit less than 1.024V when rail is at ~4VQuoteIf I do a divider with 3.3M / 1.2M it will consume 1.44µA. I think if I use the hysteresis of the comparator there is no need for another external opamp, right?QuoteMy thinking was (1) to avoid regulator drop when PIC was off and (2) be able to use as much battery life as possible. What would cause my PITA with this setup? Also the switch may be handy if I know I will store the device for very long time completely cutting the battery line.Quotewill do! thanks.QuoteI don't need simultaneously green and red.QuoteYeah it slipped off, thanks for bringing it up: I'll fix it.Thanks Ian.M for the feedback: it's great to have another pair of eyes. At work (I'm software engineer) we do mandatorily code reviews and this practice is alone improving a lot the quality of our code and consequently the quality of the product.

author: cosenmarco
author_rank: Regular Contributor
timestamp: August 19, 2017, 03:21:05 pm
content: New version of the schematic with most of the problems addressed.

author: StillTrying
author_rank: Super Contributor
timestamp: August 19, 2017, 06:45:00 pm
content: Here's my about £0.02's worth.The regulator's OP and FB connections to the voltage setting resistors are wrong.IfI'm reading the data sheet right, the current into the SD pin isn't good at about 30uA while SD.1.4uA though the sense resistors might not be enough with changes in the PIC's comparator's input current, - can't find it on the PIC's data sheet.You could just use the regulator's Error output as a dead battery warning.Simulating the output resistor network, I get the VCC to the 74AC14 to be 3.47V, I'd be tempted to use a proper on-off SW and power the PIC from the 3.47V as well because of the number of problems it solves. Or use one ON-OFF-ON SW.If the 10K between the PIC and 74AC14, stays I think 10pF across it would be enough to keep the switching edges fast without putting spikes on the 74's VCC.

author: cosenmarco
author_rank: Regular Contributor
timestamp: August 20, 2017, 03:05:34 pm
content: StillTrying: thanks a lot.QuoteThanks for spotting. Should be fixed now.Quote30µA minimum at 2.4V. We're feeding in 5V so it might be more... too much. Do you have any suggestion? I'm thinking about adding a MOSFET based switch like suggested inhttps://electronics.stackexchange.com/a/208942to switch the output circuitry (regulator and 74ac14). This has also the positive effect that I can increase the current going through the SENSE divider addressing your concerns around the comparator's input. The datasheet says "A maximum source impedance of 10 kOhm is recommended for the analog sources" so I will have a divider with 33K and 12K giving a Thevenin equivalent Rs of 8.8K which should be within spec. This sucks 144µA but then only when the system is ON.QuoteNope... quoting datasheet: "The Compactor produces a logic low output whenever the TS2951/A output falls of regulation by more than around 5%" which is for me too much. I still want to detect that fact in the PIC to maybe make the red led flash.QuoteI would loose an important feature: auto shut-down which I think is a very nice feature to have. And the switch is there anyway in case one wants to completely isolate the battery.QuoteYeah it might be a bit ugly to let current flowing through PIC and 74's Vcc. I think a proper resistor divider on the PIC's output should solve this.

author: StillTrying
author_rank: Super Contributor
timestamp: August 20, 2017, 07:24:28 pm
content: The power switching looks OK to me.Are you sure you can't now get the PIC onto the 3.47V VCC line.Some decoupling is need on the PICs power, 100n very near the PIC plus 10 to 100uF.A couple of uF is probably needed between the power switch FET and the regulator.The 20k and 33k divider doesn't work very well when the PIC's voltage gets down to about 3.5V, the divider's output berely reaches the 74's high switching point. If you want it to still work with the PIC's voltage down to about 3V (which will be below the 74's VCC) you'll probably have to replace the 2 resistor divider with something like this.Edit: I was thinking of something like this for the On/Off, don't spend any time on it if you're happy with your powering methods.

author: Ian.M
author_rank: Super Contributor
timestamp: August 20, 2017, 10:21:25 pm
content: Personally, I'd stick to the 10K series resistor with parallel pF speedup cap for the level shifting. If carefully controlled protection diode current is really an issue, add a fast small signal Schottky clamp to the adjustable Vdd rail. However, as when the input is high, the 74AC14 output is low, you'll also need a load on the adjustable Vdd rail to prevent it rising. The regulator's divider chain may be sufficient, but check that you meet the regulator's specs for minimum load current with the max possible clamping current flowing into its output.

author: StillTrying
author_rank: Super Contributor
timestamp: August 21, 2017, 12:33:21 am
content: Quote from: Ian.M on August 20, 2017, 10:21:25 pmYes, just a straight 10k plus a 10 to 20pF seem like the simplest solution that works down to 3V at the PIC, and when the PIC is at 5V the 10 to 20pF doesn't cause spikes above the 74's 3.47V VCC.I'm assuming the PIC output is about 25R and 15ns and the 74 input about 4pF.

author: cosenmarco
author_rank: Regular Contributor
timestamp: August 21, 2017, 07:11:41 am
content: Hey StillTrying,QuoteYes, I was thinking myself about something like that and I like it.I'll come up with something this evening or during the day if I get the time.Thanks a million.

author: cosenmarco
author_rank: Regular Contributor
timestamp: August 21, 2017, 08:00:42 pm
content: Here we go!. I hope it has some sense.The SHUTDOWN PIC output should be set to high during normal operation. When it goes low it makes the FET switch turn everything off resulting in the PIC committing suicide.The button, when everything is ON, if pressed would put some higher-than-vdd voltage on the PIC SW input but current is limited to, I think, ~500µA so it should be fine.EDIT: I added some de-bouncing caps to the button.

author: cosenmarco
author_rank: Regular Contributor
timestamp: October 30, 2017, 08:52:00 am
content: Hi there,I breadboaded the power supply stage. Here a couple of pictures about how the TS2951 is doing.The regulated voltage stability is quite OK. I put a load here of 330Ohm.There was some noise on the VDD (if I remember correctly around the 2mVpp) but I think it was coming from the power supply and various RF sources.I'll see with the actual batteries whether the output cleans up.Next step PIC programming and testing. I'll keep posted as soon as I make some progress.

author: cosenmarco
author_rank: Regular Contributor
timestamp: November 05, 2017, 09:05:07 am
content: I pushed the project to Github:https://github.com/cosenmarco/scopetesterThe code is not yet complete: It misses the signaling logic for the LED and the battery sensing as well as the auto-shutdown feature.I would appreciate any type of review.I simulated so far the code with the MPLAB X simulator and I cannot get it to switch pins RC2 and RC3 to high... Am I missing something?

author: Ian.M
author_rank: Super Contributor
timestamp: November 05, 2017, 09:26:43 am
content: I don't see any initialisation code to disable analog mode for inputs. Without it analog capable port pins will always read as 0. You aren't using the comparator or ADC so adding:Code:ANSELA=0;ANSELB=0;ANSELC=0;should do the trick.For any pin you need to use analog mode on (e.g. battery sensing by potential divider), set the corresponding ANSELx SFR bit to 1.Also, to avoid issues with theRMW effect, you should define the output pins as:Code:#define LED_GRN LATAbits.LATA0#define LED_RED LATAbits.LATA1//....#define SHUTDOWN LATCbits.LATC0//....#define OUT LATCbits.LATC5and similarly for any other output pins.

author: Leo Bodnar
author_rank: Frequent Contributor
timestamp: November 05, 2017, 06:11:16 pm
content: If you, guys, are still researching Steve Swift's MTS529 its schematic isavailable here. Steve has been working on a much faster version - up until a few days before he, sadly, passed away.He named MTS529 after his daughter's initials and birthday...Leo

author: StillTrying
author_rank: Super Contributor
timestamp: November 05, 2017, 08:03:13 pm
content: Quote from: cosenmarco on November 05, 2017, 09:05:07 amI only had a quick look...Did you watch the count of TMR1 in the simulation.CCP1M<3:0>: ECCP1 Mode Select bits0010 = Compare mode: toggle output on matchdoesn't say anything about reseting TMR1 to 0 for the next timed toggle.

author: cosenmarco
author_rank: Regular Contributor
timestamp: November 06, 2017, 02:09:18 pm
content: QuoteThat's exactly what I figured out yesterday and I guess also why Ian.M used PWM in his code. If I have to reset the Timer1 registers in the ISR routine, then the thing will be too slow to have a correct 1MHz output.What can I say? No errors, no learning, no fun !!I'll try PWM out when I get some time.

author: cosenmarco
author_rank: Regular Contributor
timestamp: December 05, 2017, 09:11:57 am
content: Hi, I updated the code in Github to a version which behaves correctly according to the simulator.I also started programming and debugging but I cannot get it working: what I get is the following:1) Programming and verifying goes fine according to pk2cmd using my PICKIT2 on Linux. Remember device is PIC16F1823.2) After applying VDD at 3.3V I connected the scope probe to the 8MHz quartz and I see a noisy 2Vpp square wave oscillating at ~ 2Hz (not MHz)3) also pin 12 presents a similar signal all other pins are either at VSS or at VDDI've tried 3 different devices so far with the same results.I suspected the compiler (MPLAB IDE with XC8) but opening the .hex in the MPLAB IPE shows the correct config word flags.Is there a good, free disassembly tool I could use to check the .hex more in deep (preferably linux)?Any suggestions on how to go further?

author: StillTrying
author_rank: Super Contributor
timestamp: December 05, 2017, 12:58:56 pm
content: Could it be the scope probe stopping the XTAL, try probing though a 4k to 10k.Switch to the internal 16MHz HFINTOSC RC oscillator, for now.Put a 0.5s LED flash as the very first thing in main(), and get that working 1st even if you have to fiddle with I/O values right there.In main.c I couldn't find any obvious errors in Config1, Config2 or the RA4/OSC2 and RA5/OSC1 settings.

author: cosenmarco
author_rank: Regular Contributor
timestamp: December 08, 2017, 06:47:29 pm
content: It was definitely the Quartz. With the internal oscillator works a treat.I was using one of those cheapie quartz sold on eBay as a kit with the capacitors. I thought it was going to work out of the box.I have no clue about the datasheets so it won't be easy to design the oscillator backed by formulas but only by trial and error.I will play with the caps values and put a trimmer on the output of OSC1 and, as StillTrying suggested, probe through a resistor so that the interference of the probe input capacitance is reduced.Any other suggestion?

author: Leo Bodnar
author_rank: Frequent Contributor
timestamp: December 08, 2017, 06:56:47 pm
content: Quote from: cosenmarco on December 08, 2017, 06:47:29 pmUse XO.Or at least VSOP.Leo

author: cosenmarco
author_rank: Regular Contributor
timestamp: March 28, 2018, 06:22:51 pm
content: After a few encouraging experiments I went ahead and created the PCB design in KiCAD.Then I ordered the PCB by Elecrow. Here I must say that they were extremely nice and professional and honestly for the money (12€ for 14 PCBs including shipping) I wouldn't have expected the quality of service and the quality of product that I got. Definitely thumbs upI made a couple of minor mistakes: the indicator led pinout is wrong and the holes for the on/off button are too smallOne can see in the pictures that the rise time and fall time are in line with the bandwidth of the scope (HM407-2 40 MHz) and there is no over / undershootUnfortunately I have no faster scope. I can send a board to somebody who volunteers to test it to its limits and send me back pictures and data.

author: StillTrying
author_rank: Super Contributor
timestamp: April 02, 2018, 10:36:34 pm
content: The edges look very clean @ 40MHz.I've not tried that 74AC14 anti-ringing method, turning VCC right down to 2V works!

author: HighVoltage
author_rank: Super Contributor
timestamp: April 03, 2018, 12:08:52 pm
content: If you want to send to me, I can check it on my 6GHz Keysight 6000x scope.I can also test the original HAMEG HZ60 at the same time and you have a nice comparison.Send me a PM, if you are interested.

author: Ian.M
author_rank: Super Contributor
timestamp: April 03, 2018, 06:06:58 pm
content: After you've got some test results, (and put together a documentation package in PDF format), as successful collaborative EEVblog forum projects of general interest aren't that common, it would be nice to send one to Dave for Mailbag.

author: TechieTX
author_rank: Contributor
timestamp: April 03, 2018, 11:21:55 pm
content: Quote from: cosenmarco on December 08, 2017, 06:47:29 pmI'm still learning the Microchip parts, but with OTHER microcontroller oscillator circuits you want the variable cap on the input of the buffer, not the output. The playing I've done pretty well nails a 22pf on the output, with variable freq/stability by using around a 5-25pf variable on the input of the buffer. I haven't found a really good breakdown on what that PIC oscillator section looks like.A 1meg to 10meg scope probe shouldn't have much effect on the oscillator.EDIT: and you'll need to add your KiCadcache.liblibrary for that project to the github, Marco. Opening your schematic with a vanilla KiCad install gets the screenshot below. The PCB loads fine, it's only the schematic that's wonky due to the missing symbols.

author: David Hess
author_rank: Super Contributor
timestamp: April 04, 2018, 12:29:39 am
content: Quote from: TechieTX on April 03, 2018, 11:21:55 pmA x10 high impedance passive oscilloscope probe usually has about 10 to 15 picofarads of tip capacitance. A x1 probe will have about 5 times that.What I have done in the past where this was a problem is to add a JFET source follower to buffer the signal to the oscilloscope probe tip. This can reduce the probe capacitance to a fraction of a picofarad.

author: Ian.M
author_rank: Super Contributor
timestamp: April 04, 2018, 06:06:27 am
content: Put a'gimmick' capacitorin the 1pF to 2pF range in series with the tip of your x10 probe and probe with the other lead of the gimmick cap to the osc out pin. That trades off an order of magnitude less signal level for an order of magnitude less loading. Above 10KHz, the 10Meg input resistance shunting the typically 15pF tip capacitance of the x10 probe is negligible, so with the scope AC coupled, you can even rough calibrate the assembly to approx x100 on a low impedance known signal source by trimming the gimmick cap.Avoid probing the osc in pin as that's usually higher impedance and more sensitive to loading. Also use a minimum length sprung ground connection to minimise noise injection.If the oscillator is so sensitive that it is significantly disturbed (other than a little frequency pulling) by the couple of extra pF introduced by touching it with the gimmick cap, its too close to the edge for a real-world application as a little board contamination or even temperature variation could also kill it, so its time to redesign with a tighter layout and a bit more drive margin.

author: cosenmarco
author_rank: Regular Contributor
timestamp: April 05, 2018, 11:09:09 am
content: Ian.MQuoteAbsolutely. I need to solve a few small issues, maybe spin a Rev2 with additional trimmers and package it nicely so that it doesn't seem crapI also would like to try to fit the 4 batteries (AAA) within the PCB area: should be possible but not with the battery holders available on e-bay because they are too big. I would need something as small as metal clips maybe directly soldered on the PCB... Ideas?The size is dictated by some boxes I currently have available. Maybe I can redesign using a larger box but I like the form factor and portability it has nowadays.By the way, for the batteroo fans, the output voltage starts decreasing when the battery voltage goes below ~3.6V. The LED turns red at ~3.8V. This means 0.95V per cell and a usage of I think more than 90% of the capacity.TechieTXQuoteI didn't have the issue with the clock not starting up anymore and that's basically why I wend forward with the PCB. Adding trimming to fine tune the frequency is an attractive feature but this project is oriented at calibrating analog scopes with relatively low bandwidth (the output can max 1MHz) so I don't know if we have real need for fine tuning the frequency.QuoteInterestingly enough I had the very same issueI think it was due to moving the project from a MacOS based PC to my normal Linux based (the laptop was broken at the time when I started). I removed the offending libraries from the project and now should show up fine. Let me know if there's still issues and I'll try to fix them.