# Hobby function generators

I am a physicist with a limited knowledge of electronic. I usually study my problems extensively on Internet before asking for a help. This means that here I will present both the questions and probable solutions and I would like you to confirm or correct what I wrote.

I would like to obtain a relatively cheap hobby signal generator up to cca. 10MHz. I have two requirements:

1. It must give floating signal.
2. It must be possible to ground the output within the aperture and still get a signal with no DC component.

Ad 1: This condition can be fulfilled only if power and the signal generator are galvanically separated, which can be achieved by using a transformer. Therefore any signal generator that is DC powered (or has external DC power source) is out of the question.

Ad 2: The reasonable way to fulfill this condition is that the signal generator uses transformer with two secondary windings, e.g. 12V-0V-12V. When the common wire of secondary windings is grounded, it is possible to get true negative and positive voltages.

It seems that practically all cheap signal generators use DC power source (which automatically rules them out due to condition 1). One notably exception is model FY3200S. However, according to this video, signal generator FY3200 does not possess truly floated output (for 110V line voltage, 50V and 100 uA on the floating ground!). Fortunately, the secondary stage requires -12V, 5V, and +12V inputs, which probably means it should be able to make signals without DC component (condition 2).

Author of the video suggests that the problem is that the device uses less appropriate switch mode power supply instead of better linear power supply and suggests replacing power supply. [I suspect that the less convinient switch mode power supply is used in order that the device could be used on both 220V and 110V power lines.] However, no information on the design of the linear power supply or the benefit of replacing power supply are provided.

Since linear power supply should not be to hard to make, it seems to me that the best option would indeed be to replace original power supply with something like that:

I could easily and cheaply produce something like that and also add a switch at the connection between the common wire of the secondary windings and the ground. And using second stage from FY3200S (as well as its box) I would avoid dealing with much more complex electronics of function generating.

Does this seem to be a good idea? Would this at least reduce stray currents if not completely eliminating them? Is the power supply above appropriate for the application?

• Comments are not for extended discussion; this conversation has been moved to chat. Any conclusions reached should be edited back into the question and/or any answer(s). Sep 15, 2019 at 11:52
• @marcelm I don't know exactly. The autor of the video warned that original stray current (current between real ground and ground of the output) of 100 uA could destroy other electronic devices. Would using linear power supply reduce that and for how much? This is why I am anxious to find out about your solution - the design of your linear power supply and how much was the stray current reduced. Sep 15, 2019 at 12:50
• I don't see why you couldn't have use a function generator with a DC power input. Just use a galvanically isolated DC supply to run it. Almost any modern "wall wart" would suffice, perhaps with aid of a common-mode choke to reduce the AC coupling to mains ground. Sep 15, 2019 at 20:58
• @Pygmalion You added "up to cca. 10MHz" to your question; You might want to check the update to my answer. Could be disappointing, depending on your expectations... Sep 15, 2019 at 22:12
• @marcelm I am aware that square and triangle waves consist of higher harmonics, so I expect my signal generator to be useful primarily for sine waves at last frequency decade. Sep 16, 2019 at 5:23

I actually own a FY3200S signal generator. When I bought it, I was already aware of the questionable quality of the switching power supply inside it, and the reported high earth leakage currents. For this reason, I replaced the built-in switch-mode power supply by a simple regulated linear power supply (a fairly common mod for these units). If you want to go this route, note that you'll need to provide +12V, -12V, and +5V.

I managed to find the original switch-mode PSU for the signal generator, so I hooked it back up, and took several measurements with both the original switcher and the new linear supply. I probably should have done that when I built the linear supply, but hey ¯\_(ツ)_/¯

# Power supply design

The linear power supply is very straightforward:

simulate this circuit – Schematic created using CircuitLab

The LEDs aid debugging, and help ensure the rails are in regulation under no-load conditions. At the time I made this, I took measurements for the current requirements, but I forgot the results and can't find my notes on this project. The transformers are capable of 133mA (+12V and -12V each) and 425mA (+5V) respectively. I remember my design having not much headroom, so maybe these numbers help you.

The power supply circuit in your question looks acceptable to me (though I haven't run the numbers). It's similar, except it uses a single transformer and derives the +5V from the +12V rail. I would expect it to work just fine, just ensure the transformer can deliver enough current to power both the +12V and +5V on one leg. Research how to size the transformer and capacitors; there should be plenty of information out there on that subject. These answers may be a good starting point.

The implementation is messier than the schematic, because I had to make do with whatever parts I had laying around. In particular, the 5V rail is powered by two transformers that are paralleled after their bridges, and I had to use capacitors in series (with balancing resistors) on the ±12V rails to get the appropriate voltage rating (the rectified transformer output is like 24VDC to ground under no-load conditions).

# Test setup notes

Please note that my test setup is probably terrible. None of my mains outlets have safety ground (I know ☹...), so my earth reference for these measurements was a wire hooked up to the central heating pipes (which are metal and grounded at the central heater). Also, there were longish wires all over the place picking up noise, etc...

Waveforms were captured using a Rigol DS1104Z; multimeter measurements were performed using an EEVBlog 121GW (I tried my Fluke 17B+ first, but it's terrible at measuring >500Hz AC).

For the tests, I only tested channel 1 of the FY3200S. Its output was set to a 10Vpp 1kHz sine wave. I also performed all tests with a 10Vpp 1kHz square wave, but that didn't yield any new information so those results have been omitted. I also used a 0V DC signal for the PSU noise measurements.

# Measurements

In the results below, I'll always have the original switch-mode PSU at the left, and the replacement linear PSU at the right.

# Waveform

First a capture of the test waveform. Looks clean, no difference between PSUs.

# PSU switching noise

With the signal generator set to generate a 0V DC "signal", this is a capture of the signal (50mV/div, 5µs/div). The left image shows switching ripple at some 37kHz, which is absent on the right image:

A close-up of the switching ripple (50mV/div, 50ns/div). The left image shows the switching ripple. The right image just appeared to have random noise (which sometimes the scope would trigger on, sometimes not):

# Waveform measurements

The multimeter measured the sine wave as 3.515VAC RMS (works out for 10Vpp), at 999.9Hz.

The square wave measured 4.933VAC RMS (close enough), at 999.9Hz.

There was no significant difference between the two PSUs.

# DC offsets

DC offset in the signal was measured with the multimeter in DC mode. Results:

            |  switching PSU |  linear PSU
------------+----------------+-------------
sine wave |        17.9 mV |     20.7 mV
square wave |        19.1 mV |     23.8 mV



There's a small difference in favour of the switching PSU. I suspect this might be caused by asymmetry in the 7812/7912 linear regulators I used for the linear PSU, but I didn't investigate further.

# Earth leakage voltage

This is the heart of the question, and the most common reason to replace the PSU in these signal generators. It was measured by hooking up the oscilloscope or multimeter between my earth reference (central heating pipes) and the ground of the signal generator. The signal generator output signal itself (10Vpp 1kHz sine) was left unconnected.

Clearly, the linear PSU still has earth leakage due to capacitive coupling in the transformers and perhaps wiring, but it looks better than the switching PSU (both image 50V/div, 5ms/div):

Multimeter measurements confirm that the open-circuit ground-to-earth voltage is indeed lower for the linear PSU (39VAC RMS) than the switching PSU (92VAC RMS):

# Earth leakage current

But the real difference is in the earth leakage current; at 5.5µA, I'm slightly disappointed in the linear PSU performance here, but it's two orders of magnitude better than the switching PSU at 334µA!

# Conclusion of sorts

So yeah. These things come with a crappy power supply. I have little faith in its safety, and ~0.3mA leakage current can ruin your day on sensitive circuits. And from what I've read online, some specimens exhibit >1mA leakage current.

However, replacing the PSU with a linear power supply can improve this a lot, and it can be a fun little project. I used linear power supplies for every rail (which also makes it easy to get rid of switching ripple), but I've heard of others using DC-DC converters to derive the necessary rails from a single external 12VDC or 5VDC power supply.

If you want to go this route, also consider what you'd like to do with the USB port, which is not isolated.

In the end, with my replacement linear PSU, the results look acceptable. No switching ripple, 5µA leakage current, 30VAC open-circuit earth-to-ground (which is still something to be careful with). It's not perfect, but for < $100 it's okay at the hobby level. # Signal quality at higher frequencies In your latest edit, you added "... up to cca. 10MHz." Beware that these cheap signal generators are not great at higher frequencies. If you need, say, good square waves at 10MHz, you'll probably have to spend more money. I added some captures of the FY3200S 10Vpp square wave at 10kHz, 1MHz, 6MHz, and 10MHz: I'm not even sure what's going on at 10MHz. Perhaps the synthesizer frequency isn't evenly divisible by 10MHz, so not all square pulses are of equal length, leading to the ghosting you can see there. Sine waves are easier, so they look considerably better, but at the higher frequencies they also show some small distortions. • I like this solution and I think I will follow your example. Your power supply looks a bit complicated and perhaps expensive - why three transformers? Could you share its circuit scheme? Sep 15, 2019 at 14:15 • I have not a lot lying around, so I will buy most components. Maybe it would be easier if you consider the circuit I showed in my question and eventually advice for possible changes - perhaps bigger power of the transformer, a separate transformer for +5V line... Sep 15, 2019 at 15:18 • BTW, Reroute also advises using Y capacitor. You might include it in your setup if you hadn't done that already, and maybe stray currents would be even smaller. Sep 15, 2019 at 15:26 • @Pygmalion Y-caps are not necessary for EMI in mains-frequency transformers. They might bring down the leakage a little bit if wired to earth, but my FY3200S is wired with a reversible 2-pin plug so I have no earth and no guarantee which terminal will be neutral. So I'll skip on the Y-cap :) Sep 15, 2019 at 17:28 • @Pygmalion I updated the answer with a bit of feedback on the circuit! (btw, those print transformers I had were like €3 each, so besides using what I had it wasn't terribly expensive; but if I were buying appropriate parts I would certainly have done it different) Sep 15, 2019 at 21:12 As low-tech as it sounds, I recommend using two lithium 9V blocks. It's simple, cheap, portable, has no mains nor buck converter artifacts. And it can sit on your shelf for years and just works when you need it – anywhere. Another way to achieve isolation is to use an ordinary function generator, and put the isolation transformer at the output. Over narrow frequency ranges, transformers are easy to build. As the frequency range gets larger, it gets harder to make a signal isolation transformer. Linear supplies also make a lot of high frequency noise because of the harmonics of the mains frequencies that are generated in the power rectifiers. These harmonics are typically present and measurable in systems up to about 20MHz. They are often visible in product EMI reports for both linear supplies and switchers. The harmonics are reduced by using power rectifiers with faster switching speeds. The faster rectifiers store less charge. The mechanism for creating the high frequencies is that the rectifier current snaps off quickly after the stored charge in the diode is depleted by the reverse current. The reverse current flows for a short time when the diode turns off. This rapid change in diode current during turn-off can generate even higher frequencies. For example, specialized diodes that snap off quickly are used to generate microwave signals. They are called Step Recovery Diodes. These high frequencies will pass through small capacitances that bridge the isolation barrier. In audio systems this can lead to a buzzing noise that can be hard to get rid of. For your original Assertions, AD1, Galvanic isolation is the norm, Lets say your powering it off a DC output plug-pack, that will have a mains transformer inside the part that sticks in the plug followed by a rectifier and a capacitor, As long as your DC source is not ground referenced like a computer power supply then the DC voltage is able to float within reason (generally +-500V from mains ground max, unless otherwise stated) AD2, For low complexity, then yes you can use that arrangement to rectify a positive and negative supply rail. There are many ways it can be done with switch-modes as well, but Unless you want more info on that I'll leave it to transformers. Now that I have cleared up that a DC supply can be galvanically isolated from mains voltage, I should cover the next part, your comment about the FY3200S, This is a side effect of being isolated from mains, switchmode supplies just like linear ones can be built to be isolated, The issue is, the thing connecting the 2 sides, e.g. the transformer itself, be it a 60Hz transformer for a linear supply, or a higher frequency transformer for a switchmode, It has a little bit of capacitance between the 2 windings, this capacitance generally ends up leaving about half mains voltage at a very low current super-imposed on the isolated sides "ground", This is what I can see from skimming that video link, linear supplies have the same issue. I should also point out he says "100uA" not 50mA, 50mA would be lethal to anyone. And just for completeness, the schematic you used shows mains ground linked to output ground for this reason, but would defeat your wish for galvanic isolation, The real solution is connect your reference wire before you connect your signal The lazy approach to reducing it is generally a 100K or 1 Mega-ohm resistor between output ground and mains ground, this way the amplitude of the superimposed mains is lower, while still being able to be pulled away from that point if needed. • As I pointed in my question, I would adapt the original circuit by adding a switch at the connection between the common wire of the secondary windings and the ground, so I could choose floating or grounded. I also learned from the discussion to my question that merely replacing switching to linear power supply the problem of stray voltage and current at reference would not be eliminated. But could it be reduced, say, from 100 uA, which is dangerous to electronics, to some safer value, perhaps 1 uA? Sep 15, 2019 at 12:46 • 100uA is still not dangerous to most devices, most IC's these days have ESD diodes between there inputs and there supply rails that can easily shunt multiple mA. Yes a mosfet gate cound be potentially damaged, but the common practice is to put a pullup/pulldown on a mosfet gate, which would shunt that current. As to replacing your power supply, that will not change much, What you can do is fit a "Y" capacitor like in this link, to divide down its amplitude, like the resistor option. electronics.stackexchange.com/questions/268597/… Sep 15, 2019 at 13:29 • If I understand you right, using Y capacitor would mitigate the problem. If this is so, could you include that into your answer: it might be the most interesting part of your answer. As for using linear power supply, you can see from the answer by marcelm that this can be also helpful (almost two orders of magnitude smaller currents). Sep 15, 2019 at 14:25 • I can confirm that after making experiment with linear power supply, your claims are in principle true. The same problem exists with both switch and linear power supplies. However, the effect with linear power supply is somewhat smaller, the voltage dropped from about 90V to about 35V, while current dropped from 35uA to 4uA. I am not sure if the effect was worth building the linear power supply, but at least it was fun. And it cost me only dozen bucks or so. May 21, 2020 at 19:57 • The difference would be in the isolation voltage rating of the transformer you used. Resulting in a bit less capacitance combined with many switchmodes deliberatly have a capacitor across the isolation barrier to reduce emi all this adds up to weaker coupling. So less total power delivered May 22, 2020 at 2:13 Sometimes brute force has its attractions. There exists a class of transformers called isolation transformers. They are intended to do exactly what you want by completely isolating the unit from the power mains. If you go to Digi-key and use their search function, you can find a 50 VA 120/240 to 120 VAC isolation transformer for less than$20.

• If I understand the problem right, the leakage currents are due to 220 p-p voltage oscillation on the primary winding of the 220V to 12V transformer. Therefore I don't understand why would isolation transformer help - if you put it between power line and voltage transformer - you would still have 220 p-p voltage oscillation on the primary winding. Unless there exists isolation transformer 220V to 12V. Sep 15, 2019 at 14:40