ESP WiFi Oscilloscope and Network Volt Meter

Electronics and Programming tutorials and projects

ESP WiFi Oscilloscope and Network Volt Meter

esp wifi oscilloscope esp8266 esp32

Today I’m going to introduce my new esp based projects which is “ESP WiFi Oscilloscope and Volt Meter” firmware with Chain Network feature. This projects are based on the “ESP32 WebApp Builder” and “ESP8266 WebApp Builder” projects which is a base source code with the chain network feature.

These projects are available in the following links:

ESP32 Network WiFi Oscilloscope and Volt Meter Arduino Source Code – Rev 1.2

ESP8266/NodeMCU WiFi Oscilloscope+Network Volt Meter Arduino Source Code – Rev 1.2

There are the following files in this project:

  1. ESP32WebApp.ino or ESP8266WebApp.ino (Main handler file)
  2. AC.h (Configuration header file)
  3. AC.ino (Configuration handler file)
  4. functions.ino (System functions)
  5. rootPage (UI handler file)
  6. user_global.h – Project global variables and definitions file.
  7. user_init.ino – Project initial script file.
  8. user_loop.ino – This file has a “userLoop()” function which calls repeatedly (like arduino “loop()” function).
  9. user_settings.ino – Project settings file.
  10. user_main.ino – Oscilloscope handler script.
  11. user_sub.ino – Network volt meter handler script.
  12. user_global.ino – This file has a “userGlobal()” function which calls at the same time in all of the devices in the network. This function will be called when the app sends a command to the network (after userMain and userSub).
  13. Webapp.h – This file contains the WiFi Oscilloscope WebApp’s script.
  14. Manual PDF file

Uploading the ESP WiFi Oscilloscope project

First open one of the files with Arduino program, then set the settings as the following image (Board, CPU and Flash Frequency).

Then put the ESP module on the “download mode” and upload the program.

After upload, run the program in “normal mode”.

Then in case you are using “DO IT ESP32 DEVKIT V1” or “ESP8266MOD”, the blue LED on the board would be turned on and you’ll be able to see the module’s hot spot SSID via the WiFi networks in your PC or smart phone.

The default SSID is “WiCardOSC” and the default password is “12345678”. Connect and go to http://192.168.4.1 with a web browser.

ESP WiFi Oscilloscope Input Pins

The GPIO 33 pin of ESP32 module and ADC pin of ESP8266 is the default analog input and the default digital input pin is GPIO 05.

The input range of analog signal for the ADC pin is between 0-3.3V (or 0-1V for the ESP8266).

With the suggested circuit, the input signal voltage can be vary between 0-12V.

The input of digital signal should be 0V (LOW) or 3.3V (HIGH). If your digital “High” voltage may be up to 5V, you can use the suggested circuit in the manual file as the voltage divider.

The ESP WiFi Oscilloscope Web Application

The ESP WiFi oscilloscope project has a nice and responsive web application which is placed in the root page address (192.168.4.1 by default and can be set to 192.168.5.1 or you can use the router’s DHCP IP).

If you are going to use the network feature, you can select the target device for the oscilloscope.

The screen resolution is 12288×4096 pixels. By click on the screen you can download the Graph file in .png format and the zoomed result would be like this:

wifi oscilloscope graph

There are 4 toggle buttons under the scope screen:

  1. HOLD: Holds the capturing.
  2. LIGHT: Toggles between the light and dark theme.
  3. DIGITAL: Toggles between “Digital” channel and the “Analog” channel.
    wifi oscilloscope digital graph
  4. SINGLE: Enables and disables the “Single Shot” mode. That means the screen will be updated only once.

And 8 push buttons under the scope screen:

  1. CLEAR: Clears the screen and re-captures the signal.
  2. RESET: Clears the screen and capturing mode (Falling/Raising).
  3. FREQ+: Increases the sampling frequency.
  4. FREQ-: Decreases the sampling frequency.
  5. ZOOM+: Zooms In the analog signal to 4X from Zero
  6. ZOOM-: Zooms out the analog signal to the original.
  7. RAISING: Sets the capturing mode to the “Raising mode”. That means the screen will be cleared and the scope stops sampling. Then if the analog signal voltage increases or the digital signal state changes from LOW to HIGH, the sampling will start.
  8. FALLING: Sets the capturing mode to the “Falling mode”. That means the screen will be cleared and the scope stops sampling. Then if the analog signal voltage decreases or the digital signal state changes from HIGH to LOW, the sampling will start.

The ESP WiFi Oscilloscope responsive WebApp

This web application is also compatible with cell phone and mobile device browsers:

mobile web application oscilloscope

The menus

The Web Application is divided to 3 menus. The menus can be selected by click on the menu button.

“Oscilloscope” refers to the WiFi Oscilloscope page, “Volt-Meter” refers to the Network Volt Meter page and “Settings” refers to the settings page.

The Network Volt Meter

In the “Volt-Meter” page, there are 16 channel rows of the volt meters result. That means you can add up to 16 devices to the chain network and see the values.

network wifi volt meter esp8266 esp32

In the above picture, only two devices (CH0 and CH1) are connected to the network.

The “Volt Meter’s Network Channel” can be set in the settings menu.

  • The maximum value is 12VDC.

The Settings menu

The web application’s settings menu has been divided to 5 parts:

  1. Modem Configuration
    In this section you can see the available access points, the connection status, the device MAC address and the DHCP IP.
    Also in this section you can set the SSID and password of the modem’s access point.
  2. Device Hotspot Configuration
    In this section you can set your module’s hotspot SSID and password.
    The secure link is a string which will be added at the end of your module’s IP address. For example if you set it “123”, the IP address of the WebApp of your module will be 192.168.4.1/123 instead 192.168.4.1
    The even means the default IP is 192.168.4.1, the Odd means the default IP is 192.168.5.1
    Hidden HotSpot will set the HotSpot hidden.
    Temporary HotSpot will disable the HotSpot right after the module is connected to the modem or joined to the network (For the last device in the network).
  3. System Configuration
    In this section, you can set the device’s network volt meter channel.
    The channel number must be between 0-15 and the devices can’t have the same channel.
  4. Local Network Configuration
  5. Local Network Map
    In this section, the attached devices in the chain network will be shown.
    For the master, it starts with master’s SSID, then the second ESP device, until the last one, but for the last device, the sort is vice versa.
    With typing the target device SSID in the target text-box, the oscilloscope will show the target device signal.
  • ESP32 can transfer the oscilloscope data of the other modules in the network, but esp8266 can transfer only just its own data.
  • You can directly access to the settings menu with http://ip#settings link (e.g. 192.168.4.1#settings).

Programming Manual

In the ESP WiFi Oscilloscope project files, use the pre-defined functions in the files which start with “user”.

Add your start-up script to the “userInit()” function in user_init.ino file. No need to do wifi or server configuration. This configuration already have done in the firmware system files (e.g. systemInit() and setup()).

The “userLoop()” function (user_loop.ino) calls repeatedly (like arduino “loop()” function), If your program needs to execute a statement repeatedly (e.g. reading a sensor’s data), insert your script in this function.

The “webapp.h” file is the root page’s script. You can customize sWebApp variable in that file if you’re going to make changes in the Web UI.

Also you can customize the “userGetSettings()” function (user_settings.ino), for adding more settings to the firmware. The WebApp execute this function when you click on the Settings menu.

After you click on the SAVE button of the user-defined settings, the “userSetSettings()” functions will be called.

  • The settings will not be shared in the network and each device has its own settings.

The “userMainInit()” in the “user_main.ino” file, calls once and only just in the network starter when you click on the “Oscilloscope”menu (or initially after loading the root page). You can initiate the uiAppData in this function.

The “userMain()” in the “user_main.ino” file, calls intervally or by clicking on the “Oscilloscope” menu elements. The WebApp will send the uiAppData to this function and then it can be transferred in the chain network.

The “userSubInit()” in the “user_sub.ino” file, calls once and only just in the network starter when you click on the “Volt-Meter” menu.

The “userSub()” in the “user_sub.ino” file, calls intervally or by clicking on the menu elements. The WebApp will send the uiAppData to this function and then it can be transferred in the chain network.

  • Only if you call “globalCmdEnable();” function at the end of “userMainInit()”, “userMain()”, “userSubInit()” and “userSub()”, the uiAppData will transferred in the chain network.
  • The “networkStarterCheck()” bool functions says whether the module is the network starter or not.

The “userGlobal()” function in the “user_global.ino” file calls at the same time in all of the devices in the chain network after the “CMD delay” time.

  • If you are going to use this function, set the menu’s interval time to 0.
  • This function always will be called after setting the “globalCmdEnable()”.
  • It’s recommended to use a bool variable when you are going to use this function after a change in an element occurs.

In the AC.h file, if you remove “#define LOG_ENABLE”, the logs will not be shown and the log memory would be released.

In the user_global.h file, you can set the default digital channel by the following “define” variable:

#define   DIGITAL_CH_PIN            5

And you can set the analog raising and falling detection threshold value by the following variables:

#define   ADC_R_THR                 20

#define   ADC_F_THR                 20

  • If you have not enough programming and electronics knowledge, do not make changes in the system files.

These projects are available in the following:

 

Leave a Reply

Your email address will not be published. Required fields are marked *

two × 1 =