Reverse Engineering USB Protocols On A Function Generator

When working with test equipment such as oscilloscopes and function generators, it can be useful to take a screen capture. Historically this was done with Polaroid cameras that were bolted in place, but these days it can be done over a simple USB connection. [Majenko] didn’t like the Windows-only software that shipped with their Tenma 72-14110 function generator, however, and set about reverse engineering the USB protocol to create their own.

The hack was pulled off by running the original software in a Windows VM, while running Wireshark in the host Linux OS to capture the USB traffic. Once enough data had been captured, [Majenko] set about figuring out how the function generator formatted the screen data when sending it to the PC. Based on the fact that the data changed in length depending on what was on the display, it was surmised that the data was not raw, but compressed somehow. A hunch suggested it was probably some form of Run-Length Encoding, and this proved to be correct. With a little more digging and experimentation, [Majenko] was able to put together some code that netted a clear image from the device.

It’s a useful guide for reverse engineering image data, one that could prove useful if you’re tackling a similar problem on other hardware. We’ve seen some great reverse engineering efforts over the years, on everything from old video hardware to the Sega Saturn. If you’ve been diving deep into the secrets of software or hardware yourself, be sure to drop us a line.

Upgrading A Classic Function Generator

If you need an oscilloscope, function generator, or other piece of kit for your electronics workbench, there are plenty of modern options. Dropping $4,000 for a modern oscilloscope is nice if you have the money, but if you’d rather put it to better use there are great options that don’t cost a fortune. There are some addons that can turn a smartphone into an oscilloscope but one of the best values out there are older pieces of equipment from the 80s that still work great. You can even upgrade them with some more modern features too, like [NFM] did with this vintage function generator.

This function generator is an HP3325A and it is several decades old, so some work was needed just to restore it to original working condition. The cooling fan and capacitors all needed to be replaced, as well as a few other odds and ends. From there [NFM] set about adding one of the two optional upgrades available for this device, the high voltage output. This allows the function generator to output 40 volts peak-to-peak at 40 milliamps. While he did have an original version from HP, he actually had a self-made design produced that matches the function of the original.

Even if you don’t have this specific function generator, this guide goes into great details about the functioning of older equipment like this. Most of the parts are replaceable and upgrades aren’t completely out of the question like some modern equipment, and with the right care and maintenance these pieces of equipment could last for decades longer.

Continue reading “Upgrading A Classic Function Generator”

Review: Unnamed Chinese DDS Function Generator

Best forgotten: my awful 2018 function generator.
Best forgotten: my awful 2018 function generator.

A lifetime of amassing random pieces of test equipment has left me with a gap in my armoury, namely that I don’t possess a low frequency function generator. This could easily be addressed, but for two things. I have a love for exploring the cheaper end of exported electronics and my need for a function generator is less than my desire to spend significant cash. I’ve tried to balance these competing forces in the past by picking up an astoundingly cheap instrument; that time I ended up with a lemon, but will lightning strike twice in the same spot? I spent £10 ($13) on a different cheap function generator and set off to find out. Continue reading “Review: Unnamed Chinese DDS Function Generator”

You Don’t Need That Bulky CRT Oscilloscope Anymore

While it might be nice to use a $4,000 oscilloscope in a lab at a university or well-funded corporate environment, a good portion of us won’t have access to that kind of equipment in our own home shops. There are a few ways of getting a working oscilloscope without breaking the bank, though. One option is to find old CRT-based unit for maybe $50 on craigslist which might still have 60% of its original 1970s-era equipment still operational. A more reliable, and similarly-priced, way of getting an oscilloscope is to just convert a device you already have.

The EspoTek Labrador is an open-source way of converting a Raspberry Pi, Android device, or even a regular run-of-the-mill computer into a working oscilloscope. It’s a small USB device with about a two square inch PCB footprint that includes some other features as well like a signal generator and logic analyzer. It’s based on an ATxmega which is your standard Arduino-style AVR microcontroller but geared for low power usage. It looks as though it is pretty simple to use as well, and the only requirements are that you can install the software needed for the device on whatever computing platform you decide to use.

While the Labrador is available for sale at their website, it is definitely a bonus when companies offer products like this but also release the hardware and software as open source. That’s certainly a good way to get our attention, at least. You can build your own if you’d like, but if you’d rather save the time you have pre-built options. And it doesn’t hurt that most of the reviews of this product seem to be very favorable (although we haven’t tried one out ourselves). If you’d prefer an option without a company backing it, though, we have you covered there too.

A Function Generator In Its Purest Form

If you have a modern function generator on your bench it is quite likely to contain a direct-digital synthesis circuit that creates arbitrary waveforms using a microprocessor controlled DAC. If you have a cheap function generator it’s likely to contain a one-chip solution that generates approximations to sine and triangle waveforms through modifying a square wave with a set of filters.

These methods both produce adequate waveforms for most of your function generator needs, but they are both far from perfect for the purist. Both methods introduce some distortion, and to address this [michal777] has produced a generator that takes the process back to basics with all stages implemented using building block ICs and transistors. The circuit follows the same square-wave-modifying path as the cheaper integrated devices, but with significant attention paid to the design to ensure that it does as good a job as possible. It also makes for a fascinating dive into function generator design.

The generator hardware has been neatly fitted onto a PCB with a riser for a set of front panel controls. He shares a few pictures of previous designs. We particularly like one that appears to have been fitted into a redundant cooking pot.

We’ve brought you a few function generators over the years. If you’ve got one of the cheaper examples, we’ve even covered how you might improve it a little.

Arduino Powered Portable Function Generator

It’s probably not much of a stretch to say that many of us have taken on a project or two that were little more than thinly veiled excuses to add a new tool or piece of gear to our arsenal. There’s something to be said for a bench full of button-festooned test equipment blinking away, it’s like bling for nerds. But just like getting your name written out in diamonds, it can get expensive quick.

Luckily, the hacker has enough technology at their disposal these days that DIY test equipment can help fill your bench without emptying your wallet. [Faransky] has created a very impressive Arduino function generator that doesn’t skimp on the features. Capable of generating sine, triangle, and square waves up to 10MHz with its all-digital circuitry, it’s a piece of gear that’s well worth the $30 USD or so it should cost to build your own version.

For those worrying that [Faransky] is relying on the PWM functionality of the Arduino Nano to generate waveforms, have no fear. At the heart of the device is a AD9833 waveform generator; with the Arduino, rotary encoder, and 16×2 LCD providing an interface to control it over SPI.

Unfortunately, the AD9833 doesn’t have a way to control amplitude, something which is pretty important in a function generator. So [Faransky] uses a X9C104P 100KOhm 8-bit digital potentiometer as a voltage divider on the chip’s output.

To wrap up the build, he added a 2000mAh 3.7V Li-Ion battery and TP4056 charger, with a DC-DC boost converter to get 5V for the Arduino. Though if you wanted to create a benchtop version of this device, you could delete those components in favor of a 5V AC/DC adapter.

We’ve seen our fair share of DIY function generators, ranging from minimalist builds to hardware that could pass for a commercial offering. We’ve even seen some cheap turn-key function generators, though the usual warnings about getting what you pay for apply.

Continue reading “Arduino Powered Portable Function Generator”

Review: FG-100 DDS Function Generator

I don’t have a signal generator, or more specifically I don’t have a low frequency signal generator or a function generator. Recently this fact collided with my innocent pleasure in buying cheap stuff of sometimes questionable quality. A quick search of your favourite e-commerce site and vendor of voice-controlled internet appliances turned up an FG-100 low frequency 1Hz to 500kHz DDS function generator for only £15 ($21), what was not to like? I was sold, so placed my order and eagerly awaited the instrument’s arrival.

The missing function generator is a gap in the array of electronic test instruments on my bench, and it’s one that maybe isn’t as common a device as it once might have been. My RF needs are served by a venerable Advance signal generator from the 1960s, a lucky find years ago in the back room of Stewart of Reading, but at the bottom end of the spectrum my capabilities are meagre. So why do I need another bench tool?

It’s worth explaining what these devices are, and what their capabilities should be. In simple terms they create a variety of waveforms at a frequency and amplitude defined by their user. In general something described as a signal generator will only produce one waveform such as a sine or a square wave, while a function generator will produce a variety such as sine, square, and sawtooth waves. More accomplished function generators will also allow the production of arbitrary waveforms defined by the user. It is important that these instruments have some level of calibration both in terms of their frequency and the amplitude of their output. It is normal for the output to range from a small fraction of a volt to several volts. How would the FG-100 meet these requirements? Onward to my review of this curiously inexpensive offering.

Continue reading “Review: FG-100 DDS Function Generator”