Modified Serial Plotter with Y-Axis control and Clear capability

** Note if you downloaded the SerialPlotter.txt file it has been updated to correct a problem where it was not re-setting the X-Axis.

I posted an article yesterday asking if anyone knew how to fix the Y-axis on the Arduino IDE Plotter and since nobody responded I had to assume that the answer was no. I needed to have a very small max to min as I was using an FC-22 gas detector with an Arduino Uno to try to locate a very small gas leak in my central heating boiler and, since the voltage swings were hard to see with the default -12 to +12 Y-Axis, being able to fix it at say +8 to +10 would be far more useful.

As there didn't seem to be a way of doing it currently I figured I would bite the bullet and see if I could modify the plotter code myself and since the instructions for rebuilding the Arduino IDE looked pretty straightforward I thought I would give it a go. I located the code that needed changing in the SerialPlotter.java file and altered it to get the Y range from a drop down combo box and while I was at it I added the ability to clear the graph and re-start it by sending a command. Sending on a line by itself, including the <> brackets, to the serial port will clear the graph and restart displaying data.

I am posting the modified code here for anyone who would like to have a bit more control over the plotter. Just rename the attached file from .txt to .java and overwrite the file SerialPlotter.java that is in the ~/Arduino/app/src/processing/app/ directory. Rebuild the IDE and you should be good to go. I have added the line //DCM to each section of code that I have added or altered so please feel free to tweak to suit your requirements.

If you are hesitant about building the IDE then don't be as it is astonishingly straightforward (well on a Mac it is, not sure about Windows/Linux). Just visit the https://www.arduino.cc/en/Main/Software page for the instructions on how to get the source code and how to build it. It's actually a lot of fun!

Oh, and also note that the changes I made work for me and the job I was trying to do (yes, tracked the leak down to a pipe joint thanks for asking). Your mileage may vary. If you find any bugs in the bits that I have added please feel free to let me know.

And finally, I'm not sure if this is the correct section in the forum to put this but none of the other sections looked any better. So if you are a moderator and you think it is in the wrong place please feel free to relocate.

SerialPlotter.txt (11.7 KB)

Thanks for posting this. I'm curious though why simply scaling the Y values to fit the default axis scale did not work for you.

I tried that and it just wasn't right. The actual voltage is 0.9 and I scaled it up to 9v but the plotter set the axis to -12 to +12 and since the plot variance was less than .1 volt maximum even scaled up to 1 volt it wasn't easy to see subtle differences in gas concentration. i can now set the axis range from 8 volt to 10 volt and the swing is very obvious.