- How to Adjust X and Y Axis Scale in Arduino Serial Plotter (No Extra Software Needed)Posted 1 week ago
- Elettronici Entusiasti: Inspiring Makers at Maker Faire Rome 2024Posted 1 week ago
- makeITcircular 2024 content launched – Part of Maker Faire Rome 2024Posted 3 months ago
- Application For Maker Faire Rome 2024: Deadline June 20thPosted 4 months ago
- Building a 3D Digital Clock with ArduinoPosted 9 months ago
- Creating a controller for Minecraft with realistic body movements using ArduinoPosted 10 months ago
- Snowflake with ArduinoPosted 10 months ago
- Holographic Christmas TreePosted 10 months ago
- Segstick: Build Your Own Self-Balancing Vehicle in Just 2 Days with ArduinoPosted 11 months ago
- ZSWatch: An Open-Source Smartwatch Project Based on the Zephyr Operating SystemPosted 11 months ago
How to Adjust X and Y Axis Scale in Arduino Serial Plotter (No Extra Software Needed)
The Serial Plotter in Arduino is an excellent tool for quickly visualizing serial data. However, it has a limitation that can frustrate many users: it’s not immediately obvious how to adjust the X and Y axis scales, especially the X axis. In this article, I will guide you step by step on how to solve this issue without the need for additional software like Python or Processing.
Why Adjusting the Scale Is Important
In the latest version of the Arduino IDE (from version 2 onwards), the X-axis has a moving scale that only shows 50 data points, while the Y-axis is dynamic, adapting to the minimum and maximum values of the last 50 points. This can make data interpretation difficult, especially if you’re monitoring a stable signal such as a sine wave.
You can try this code to experience the visualization challenges:
float t; float y; void setup() { Serial.begin(115200); } void loop() { t = micros() / 1.0e6; y = sin(2PIt); Serial.println(y); }
Steps to Modify the Axis Scales
1. Stabilize the Y-Axis
To keep the Y-axis constant, you can add horizontal lines near the desired minimum and maximum values. Here’s how to do it:
- Define Horizontal Lines in the Code: In your Arduino sketch, add the following lines to set Y-axis limits:
Serial.print("1.1, ");
Serial.print("-1.1, ");
This will keep the Y-axis constant between -1.1 and 1.1, making it easier to visualize the signal.
float t; float y; void setup() { Serial.begin(115200); } void loop() { t = micros() / 1.0e6; y = sin(2PIt); Serial.print("1.1, "); Serial.print("-1.1, "); Serial.println(y); }
2. Increase the X-Axis Scale
To modify the X-axis scale and display more than 50 data points, you need to edit a JavaScript file within the Arduino IDE. Here’s how to proceed:
a. Locate the JavaScript File
- Access the Program Files: Go to the folder where the Arduino IDE is installed.
- Navigate the Path: Follow this path:
Resources > App > Lib > Backend > Resources > Arduino Serial Plotter Web App > Static > JS
[C:\Program Files\Arduino IDE\resources\app\lib\backend\resources\arduino-serial-plotter-webapp\static\js].- If the path doesn’t match, search the IDE folder using the keyword “plotter”.
b. Edit the main.35ae02cb.chunk.js
File
- Create a Backup Copy: Copy the file
main.35ae02cb.chunk.js
to the desktop for safety. - Open the File in a Text Editor: Use an editor like WordPad or VS Code.
- Find the Line to Edit: Search for
useState)(50)
. - Modify the Value: Change
50
to the desired number of data points. For example, to increase it to 3000:useState(3000)
- Save and Overwrite the Original File: Save the changes and copy the modified file back to the original folder, replacing the existing file. You may need to grant the necessary permissions.
3. Verify the Changes
- Reopen the Serial Plotter: After saving the changes, open the Arduino Serial Plotter again.
- Check the New Scale: The X-axis should now display up to 3000 data points.
4. Be Aware of Limits
It’s important to note that there is a limit to the X-axis size, depending on the amount of data you’re sending. If you set a value too high, you might find that the plotter can’t display all the points. For example, setting the X-axis to 5000 may cause the plotter to stop between 3000 and 4000 points due to data overload.
Conclusion
Adjusting the axis scales in the Arduino Serial Plotter can significantly improve your data visualization experience. By following the steps outlined above, you can stabilize the Y-axis and increase the X-axis scale, making it easier to analyze your signals. If you prefer a more advanced solution, consider using Python for an even more customized visualization.
Happy working on your Arduino projects!