Graph Arduino Sensor Data with Java and JFreeChart
HTML-код
- Опубликовано: 3 окт 2024
- Make a data logger with your Arduino! Using the built-in serial port of an Arduino, we are able to communicate with a Java program. In this demo, a simple graphical user interface is made to graph the level of light seen by a Cadmium Sulfide sensor. This program could easily be extended to send data from an Arduino to a web site. Check back for more videos on this topic.
This project's source code:
www.farrellf.co...
EDIT: Several of you asked about how to graph multiple sensors. I have a new video showing that, check it out here:
• Easy Arduino Data Logg...
That video also shows how to do histograms, fourier transforms and more.
This is more of a tutorial/reference video about making a UI with Java than anything else! Which is great!
Thanks for the feedback, glad you liked it.
This is even more powerful than programming with Arduino and Processing.
Many thanks. There is a real shortage of Arduino Java tutorials. If you have more ideas please do them.
I just successfully completed my first Java project by following your excellent tutorial. Your graph program is exactly what I needed for my Arduino heart monitor. I'm a 75 year old retired hardware engineer with minimal software skills an no previous exposure to Java or eclipse, so I needed every single detail in your video. I would have been lost if you had left out a single word. Fortunately for me, you produced the most complete, detailed, and professionally presented youtube video I've ever seen. I also like the way you take the time to respond to the comments. Thank you for this superb tutorial.
Glad you liked it. Thanks for the feedback!
This is the level of quality that all training videos should strive for. Thanks for the detailed tutorial, amazing work!
Good work! Saved me a lot of time having to read and sort through books in order to get a GUI up and running. BRAVO!
You are my hero!
He had long months trying to get the data, but, with the help of your video I made it in few minutes.
Greetings from Mexico.
+Miguel Vázquez Thanks for the feedback. I'm glad it helped.
Excellent video just what I needed to go from zero to having a running java app over the weekend. Thank for all your hard work.
What a delightful tutorial! VERY detailed!! Thank you for the EASY and in-depth Step-by-step instruction!
GREAT JOB Sir!
Thanks for the kind feedback!
Wow...I just gotta say, This Is A Fantastic Tutorial! Way "above and beyond". Keep up the great work.
I am not used to comment videos, but this is so great, that I have to express it. Thank you very much, Your video helped me a lot and is really useful.
Thanks for the kind feedback!
You are an excellent tutor for Java and Arduino. Excellent work !
I couldn't help but comment how good this was/is. I also started thinking about when exceptions were caught. I might suggest incrementing x (as in x++) in the try/catch block, but if you do it in the finally() portion, you guarantee the value of x to increment-even though there may be an exception.
I suggest this because if you have a series of, or frequent exceptions, you might want to ensure your 'seconds' time series still represented reality. It would just have 'blank' spots where there was no data. This way you could accurately count back & know when you had disconnects/exceptions.
I've always avoided graphing in Java, so being an arduino hobbyist and a crack Java programmer, this was just what I needed to motivate me to use SWT!
Excellent tutorial! You made it comprehensive, easy to understand, anyone can follow it. Thanks!
You're a very good teacher. I've learned a lot from your video. I'll be returning back as long as I haven't done it all. Thanks, great video. Very clear.
Finally, after searching for hours I found this. Thanks! This will help us in our study.
héroe!!! me acabas de salvar de un problema que traía en cómo leer el puerto serie al enviar datos del arduino a la PC, infinitas gracias
Best Tutorial Video I've Seen - Thankyou.
Excellent video. Very informative, clear, and thorough. Thanks for taking the time to create this video.
Finally, I could do it in NetBeans 8.2 on Linux and It works fine. Thanks a lot
really thank you !!!
l just learn so much . i have done some projects with arduino lonely ! l have studied the java last term and now based on your vid l have more confidence to build communication project between PC and arduino ! l think it is pretty cool ! thx again
Many thanks ,This is more help to lerning to program .
Hi, thanks for your tutorial. Easy way to get started with Java and microcontrollers. Thank you again
Very informative. Thank you for taking the time to start from scratch and develop a useful application.
Really thanks for informative java video , I truly understand real job of class and thread here .
This is more than a tutorial ....really awesome video...thanks for every step of instruction and video:)
Incredible video/tutorial ! Everything to the point from start to the end ! Thanks a lot sir ! Waiting for more java+arduino tutorials !
Thanks, I've managed to start serial communication now!
Thanks man, I think this tutorial will be my introduction to Java in general. Seems perfectly suited for my heart beat monitor, and tired of using processing.
Great video, your thoroughness is highly appreciated.
Excellent tutorial! If anyone is still watching this and wants to try it in 2020 with the newest versions you must set a baudrate on your SerialPort with .setBaudRate()
Excellent! Learned a lot and well explained, thank you. I am using this as a basis for one of my hobby projects.
Wow, this is a really amazing tutorial. You really nailed it and explain it well. A++
Thank you so much. Your tutorial is the best!!!
What a great video! I am new on Arduino and you helped me a lot.
Thanks dude.
Thank you for so great explanation of everything java related!
Thank you for your time and effort. Exactly what I was looking for
Awesome tutorial. Coming back to java after a long time of C and C++ programming and this is just what I needed for my new project. Only suggestion would be to use a better screen capture program.
Nice video men. Really help me a lot.
Excellent tutorial : It was very helpful and your explanation is really awesome.
We expect a lot more stuff like this !
Thanks for your interest for sharing with us.
A end the video was not very clear
Excellent video, very detailed, I'm sure if you done a series on Java, Arduino, ESP8266, Interfacing things it would be very popular.
amazing .... Thank you very much Sir
Great video. Thanks for taking the time to share your knowledge!
Thanks for your time, your video is worth ! :)
Love your all videos. Thanks for detailed explanation. Kindly, extend this video for multiple sensors and upload these graphs on server, using raspberry pi or windows.
Thanks for the feedback. I just posted a new video showing how to graph multiple sensors:
ruclips.net/video/lFZ26gD7OIE/видео.html
I plan to eventually make a video showing how to send sensor data to a web server like a Pi, but that might take a while.
Wowww, I'm not real programmer
Never though before, that we able plot some data from arduino.
But, I enjoyed the whole video
Very interesting
Thx You :)
I watched video many2 times to learn it, I followed step by step, & I get to Java build Path (13:50) - library & find 'add external jars' not executable (in grey mode)
Any sugestion?
Awesome!!! You are an excellent instructor. Thanks.
Glad you liked it!
Very Very nice.That is what I need. Thank you. Best tutorial.
That was really interesting thanks. It was like a Java/Arduino "Hello, world" example. My head is buzzing with ideas now. I had forgotten that you could use Java to communicate with the serial port. I've ordered an Arduino starter kit from Amazon and I am going to repeat your experiment to compare sunset/sunrise times with official times. JFreeChart is a cool API, though I think I will use JavaFX for the charting.
As another person has commented, if you have more Java/Arduino examples that leverage Java's powerful APIs it would be great to see them.
very nice sir !!!! everything explained so nicely
Very well explained. Valuable vid!
Excellent work!! Can't thank you enough!!
Thank you! This was extremely helpful.
Hey!! exactly what I am looking for .. owsome job
Really liked this! I appreciate you taking all this time to provide this instruction! Great detail level for someone that is not a programmer. I will be replicating this. Can't wait to give it a try!
Scott
Great Tutorial!! Congratulations and thank you!!
I learn Java, in video is tutorial how to create chart, that's really simple, thank. Static chart about 5 rows :)
Thank you so much..this is more helpful ,good job
Excellent tutorial
amazing video thank you so much
You are king! Thank you very much!
Excellent Thanks for sharing and for your time to do this
Thank you very much man! Cool video.
Thank you very much for this tutorial. You should really make some bucks out of these videos.
Good tutorial. Helped me alot!
Hi everyone! I just made another video related to this topic. In the new video I cover how to send data from your PC to the Arduino. It's a simple project that has the computer tell the Arduino the current time and date. The data is shown on a 16x2 LCD.
ruclips.net/video/5N30jHMhw9c/видео.html
+upgrdman i alrdy figure out how u read from arduino, is the serial monitor, but is there anyway to read the line with 2 data?
Yes, there is. He talks about it in this video starting at 28:15 for few secounds. But you should also somehow mark data that is sent to serial in arduino skech. Sensor1, Sensor2 and then the value. Then in Java you can identifay from what value comes from what sensor. But Im not sure how to do that.
hey @upgrdman i have tried your method and was able to successfully connect to my arduino but was not able to receive any data from the arduino .
this is the way you did it:
1) Scanner scanner = new Scanner(chosenPort.getInputStream());
and i would like to use this method but sadly i dont get any data.
but using the java.io library and the getInputStream method :
2) InputStream data = serialPort.getInputStream();
String data_scan = dataScan.nextLine();
//"Print data scan"
this was successful and was able to recive the data. but the way i got the data was in "char " and that is a nightmare to work with !.
while(true){
try {
System.out.print((char)data.read());
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
see the thing is i'm doing this for the RFID rc522 i wanna be able get the UID(unique id) of card every time a card is scanned.
if you can help my email id is johnpaulrodrigues83@gmail.com
nope fixed it ... it was the while loop condition .. i changed the while loop to run infinitely :
Scanner dataScan = new Scanner(serialPort.getInputStream());
String data_scan = dataScan.nextLine();
while (true){
System.out.println(data_scan);
}
but the data is definitely wierd.
Thank you very much. Very good job.
Excelente !!!
Great tutorial, thank you very much for sharing!
+Alexis Figueroa Thanks for the kind feedback. Glad the video helped.
Great Job sir... It help us very Much....
it was very good and helped me a lot
Many thanks.
thanks for this video helped me a lot only one thing i want to suggest that to use a screen recorder tool i hope it will make your video more effective
Thanks for the feedback. I use screen recording software in my newer videos.
Thank you
I got a lot of help from your video
Thanks, Great tutorial, but please use a screencast,
But even with that it's a really good job ;)
thanks for your great work
you really deserve it...
FANTISTIC ...THANKS FOR YOU HELP
Thanks very good job!
you are great! Thank you so much.
Great Video! But how to have 2-way communication between PC and sensor? For example, only when PC send msg ‘1’ then the sensor will reply with current light intensity; when PC send msg “2”, then the sensor will reply with current temperature.
ME AJUDOU BASTANTE OBRIGADO!
THIS WAS VERY HELPFUL, THANK YOU!
Found the code below. Thanks.
God bless you
nice ! good job !
I tried to follow your lesson but when I run it, there is an error. I don't what wrong. the message "Error: Unable to initialize main class SensorGraph
Caused by: java.lang.NoClassDefFoundError: org/jfree/data/xy/XYDataset"
This was a very useful video, thank you for posting this. The only problem that I have is that when I disconnect and the connect, the GUI freezes. It doesn't even give any errors or exceptions.
+LightFykki Hi. If I recall correctly, when connecting or disconnecting from the UART, the Arduino resets. You might need to delay for a few seconds before attempting to communicate.
Thaks! Great tutorial
thanks for your code :) very helpful....
Please create a tutorial on connecting Arduino to website and creating a real time graph for the data throws by the sensor. It will be a great help to us. Thank you so much. (Water Level Monitoring System)
Really nice video
thanks man it's very helpfull
keep up the good work
Great tutorial. Thanks...
I love you
oxnium I'm glad to help. Good luck with your class!
This video is wonderful! But how to add another sensor value into the graph if I separate the two sensor value by "," in serial print ?
awesome thank you..
Thanks so much Sir for this tutorial ✨✨ but I’m wondering if I can use it for easyPic with a sensor of temperature 🤔🤔🤔 ?
Excelente Vídeo !!
Thanks
Excelent video
Cool video!
+Aleksandr Gorbachev Thanks