Finished DIY portable Wi-Fi function generator (part 17)

Finally, it happened – the generator is (kind of) finished. It took a bit of time after the previous post to bring the device to its final state. Quite a lot was done from the last time – mostly it was firmware’s finishing touches. I had to make sure that everything, especially LCD interface, works and behaves as expected. Although there might be some bugs left, the device is fully useable and most importantly – it meets all my needs.


Links to all posts

This post is going to be more like a summary of the previous posts with some additional information. For more information on particular topics you can find in the links below:

  1. VCA822 Gain Amplifier Circuit
  2. LM7171 Offset Circuit
  3. Gain and Offset Control Filter Circuit
  4. Dual 5V Power Supply
  5. Dual 12V TPS65131 Power Supply
  6. Battery Charging Circuit with BQ24295
  7. Basic WEB Interface
  8. IPS Capacitive LCD on an ESP32
  9. IPS LCD, ESP32 with eSPI library and Touch screen
  10. Final PCB Design for the DIY Waveform Generator
  11. Custom Design PCBs and How To Get Them Manufactured
  12. Soldering the PCB
  13. AD9833 Library and Further Output Noise Reduction
  14. Arduino BQ24295 Battery Charger Library
  15. LCD GUI with LVGL on ESP-32
  16. 3D Printed Enclosure
  17. Finished DIY generator (this page)

Device’s specification

  • 3.5 inch IPS LCD with capacitive touch panel
  • 2200 mAh Li-Po battery
  • ESP-32 MCU
  • AD9833 for sine and triangle waveform generation (up to 25 MHz)
  • Square wave and PWM generated by the MCU (up to 5 MHz)
  • The device can be controlled through LCD or WEB interface
  • For WEB control, the device can connect to a Wi-Fi or it can create its own Wi-Fi Access Point
  • Output signal’s offset range: -8V … +8V
  • Output signal’s amplitude range: 0 … 9V (sine, triangle), 0 … 5.5V (square). PWM output: 3V.
  • Battery charging time: <2 hours
  • Working time (Wi-Fi on, output relay ON, maximum LCD brightness): around 6 hours
  • USB Type C port for charging, 2 SMA ports for signal output, 1 ON/OFF switch, LED charging indicator
  • Price: around 60 Euros (depends on where the parts are bought from)

Design (enclosure, connections, etc.)

The generator’s enclosure is 3D printed from black ABS plastic. The case is made as small as possible. It accommodates all needed electronics and a battery without wasting any unused space. So, whole device is smaller than majority of todays smartphones (although it is a lot thicker).

DIY signal generator Right side no connection

Apart from one switch to turn the device on or off, the generator does not have any physical buttons. All control is executed through the capacitive touch display.  

DIY signal generator Bottom side connectors

Looking to the sides of the device, you can see, that only top and bottom have some connectors. On the bottom side there is an USB Type-C charging port and a power switch. The USB port can be used only for charging, no data can be transmitted to or from the device with this connection. The ON/OFF switch is used to fully cut off the voltage going to power supply circuits, so the device does not have any low power idle state. It is either operating normally or it is totally powered down (except for a battery charging circuit, which is always on). Also, there is a small hole next to the USB connector. When device is charging, LED light can be seen trough it. When the device becomes fully charged, the LED is turned off.

DIY signal generator tom side SMA connectors

On the top you can find two SMA connectors. Those are used for signal’s output. The left SMA is used only for the PWM waveform, while the right one – for everything else. Because of their small size, SMA connectors were chosen instead of bulky BNC.

Local Interface

Diy Generator Main Screen With Text

LCD interface has two screens: “main” and “settings”. Main screen has all information and widgets for full control of generator’s main parameters. These parameters are: output signal’s frequency, amplitude, offset, duty (if applicable), waveform. It has keyboard which is used to type in needed values. Main screen also shows secondary information such as battery level, Wi-Fi icon with device’s IP address (if Wi-Fi is enabled). Finally, “main” screen allows user to switch output relay on or off.

How to change waveform?

If you want to change output signal’s waveform, you just need to press one of four buttons: SINE, TRI, SQ or PWM. All waveforms (except for PWM) have three main parameters: frequency, amplitude and offset. PWM instead of amplitude and offset has duty parameter. Also, when outputting PWM you have to use SMA port which is on the left. For any other waveform – the right one is used. Which SMA port needs to be used for a particular waveform is indicated by a small arrow symbol.

Diy Generator Main Screen Freq Type-in With Text

How to type in freq, ampl, offset, duty?

To type in one of the main parameters (frequency, amplitude, offset or duty) you need to press one of the corresponding buttons: Freq, Amp, Offs or Duty. When you press one of those (for example, Freq), the keyboard changes its keys to numeric. Also, instead of selected parameter’s value “—” is shown on the screen. Then you need to type in a value and press one of possible Unit keys (like “kHz”) to finish the type in. If you want to discard a value which is being typed in, you have to press a parameter key for the second time (for e.g. “Freq”). Then the device puts back old parameter’s value which was used before value change was initiated.

Diy Generator Main Screen PWM mode with text

How to turn on/off output relay?

Button “Output” turns on or off the output relay. Also, there is a virtual LED on the screen which indicates whether the output is turned on or off.

Settings screen

If you want to go to the settings screen, you simply have to press the ”…” button.

The “Settings” screen allows the user to setup a known Wi-Fi’s credentials, set-up your own Wi-Fi Access Point’s credentials, turn either connection (Wi-Fi or own AP) on/off, changing LCD’s brightness.

Diy Generator Settings Screen With Text

How to type in credentials?

To type in credentials the user has to press either on SSID or Pass text area. Then, a keyboard shows up which allows you to type in needed information. It must be noted that the device saves newly typed information only when you turn on either Wi-Fi or AP. So, if, for example, you changed the SSID of the Wi-Fi while it was turned on, you will have to turn the Wi-Fi switch off and on again to save new settings.

Diy Generator Settings Screen Keyboard With Text

How to change brightness?

The device allows to change its screen brightness. To do that, you need to slide the slider knob to a desired position.

The generator also saves Wi-Fi (which Wi-Fi or AP or neither is turned on) and brightness statuses. It is done, when you close the settings screen by clicking on an “X” button on the top right corner.

Web Interface

The web interface is made to be similar to the LCD interface. The main difference – WEB interface does not have a “settings” screen. Also, it does not show the device’s IP address. Other than that, all other functions are executed the same as with the LCD interface.

Diy Generator final web interface

In the background, the Web interface works a bit differently than the LCD interface. Web interface polls data every ~ 2 seconds from the device while LCD interface’s values are updated instantly when they change. So, the Web interface might have some data update delay, but usually you do not notice any.


Because Web interface POSTs data to (and in such way receives from) the ESP, you could tell that by default the generator has its own web API which could be used to integrate it with other systems/devices and/or software. Every two seconds, the web interface gets data from the server by sending POST (or it can also be a GET) request to an url: /data. The server then returns JSON string with all data. For example, if the device is connected to the router and has an IP address of and you open such URL in your browser:, you will get back such JSON string:

{"wform":"sine", "freq":1000.000, "freqU":"kHz", "ampl":1.00, "amplU":"Vpp", "offset":0.00, "duty":50.00, "dutyU":"%", "out":0, "batt":78}

If you change some parameter in the web interface, it will POST that data to one of the URLs:

  • /output – sends to it 0 or 1 to turn on/off output relay
  • /waveform – to set output waveform. 0 for sine, 1 – triangle, 2 – square, 4 – PWM
  • /freq – sends frequency value with the used unit (Hz, kHz, MHz)
  • /ampl – sends amplitude value with the used unit
  • /offs – sends offset value
  • /duty – sends duty value with the unit

Hardware design

I won’t talk too much about the hardware used, as there is more information on the previous posts.

The ESP-32 was used as main MCU. It was chosen because it is quite cheap with all the features needed (like Wi-Fi, lots of flash, etc.). One of the drawbacks with this MCU can be a lack of available IO pins. In this project, all available pins (except for the input-only pins) were used.

DIY signal generator sandwitch interconnect between pcb, lcd and battery

For sine and triangle signals an AD9833 IC is used. It itself can generated signal with frequencies up to 25 MHz But I don’t have any possibility to see how “good” those high frequencies are. The AD9833 can’t change signals amplitude or offset, so additional circuits were used.

Diy_generator_final schematic analog

To change signal’s amplitude, a variable gain amplifier VCA822 was used. To change signal’s offset a regular op-amp was used (LM7171). Both amplifiers are controlled by a variable DC voltage. To change it digitally two additional active filters were used. PWM signal from the MCU is transmitted to filters inputs, and we get DC voltages from their outputs. By varying PWM’s duty, it is possible to change DC voltage value which is then used to control either amplifier gain or add offset to the signal.

All analog circuits are supplied with four voltages: +- 4V and +- 12 V. The lower voltages are used for VCA822 and higher voltages – for LM7171. Other (digital) circuits are supplied from a 3V power supply (LDL1117).

Diy generator final schematic power

Square wave and PWM goes directly from the MCU. The difference between the two is that PWM is directly outputted trough the dedicated SMA connector, while square wave is the same PWM with duty 50% and is fed through the amplitude and offset circuits.

DIY generator final schematic MCU

The device is battery operated. So, it has integrated battery charging circuit with a BQ24295. It does not only charge the battery, but it also powers up whole system.

DIY signal generator size metric

Finally, the device uses IPS LCD 3.5-inch screen with capacitive touch panel. It has great viewing angles that makes a huge difference from other cheap LCD screens used in most Arduino projects.

The enclosure is made from two parts which are glued together after inserting a battery and a PCB.

DIY signal generator sandwitch contruction from side


The ESP-32 runs Arduino based firmware. I am not going to comment on any parts of the code – there are lots of code lines, so everyone who wants to see how does the code look – you can find it on my GitHub. One thing to note – the code is not very “clean” as it was written just to work “good enough” ant not to be read by others 😀

The biggest library which was used within the project is the LVGL – graphics library. It allowed me to write a nice graphical interface as seen in the pictures. Also, for more information about this library, I have written a tutorial for LVGL.

Bugs, caveats, limitations

The device has one hardware related (in my opinion) bug. When I charge the battery (especially to fully charged state) while the device itself is turned off (obviously), after disconnecting the charging cable the device won’t power on. If I plug the cable back and then try to switch it on – the generator power on. After this procedure, I can disconnect the cable and device can be turned on/off indefinitely without any problems. I believe that the problem might be with the charger IC, but haven’t managed to confirm that. I will make an update here when I know what is the reason behind such behavior.

Output has some 5-10 mV high frequency (in 40 – 100 kHz range) noise which I haven’t managed to eliminate. To me, it is small enough to be ignored. For some, because of this noise amplitude, the device might not be very useful.


To sum up, it is a great little portable device which is more than enough for my personal use. The one downside of this generator is that it took more time to design and make than I initially anticipated.


Code, schematics, PCB files: GitHub

STL files for 3D printing the enclosure: Thingiverse


Subscribe to a newsletter!

Was this page helpful?