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.

Комментарии • 295

  • @JimmiJohnJunnior
    @JimmiJohnJunnior 8 лет назад +21

    This is more of a tutorial/reference video about making a UI with Java than anything else! Which is great!

    • @upgrdman
      @upgrdman  8 лет назад +4

      Thanks for the feedback, glad you liked it.

  • @HitAndMissLab
    @HitAndMissLab 9 лет назад +28

    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.

  • @itisonlyadream
    @itisonlyadream 7 лет назад

    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.

    • @upgrdman
      @upgrdman  7 лет назад

      Glad you liked it. Thanks for the feedback!

  • @paveltrostianko9705
    @paveltrostianko9705 3 года назад +1

    This is the level of quality that all training videos should strive for. Thanks for the detailed tutorial, amazing work!

  • @jeffreymelanson9230
    @jeffreymelanson9230 6 лет назад +3

    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!

  • @vacm1700
    @vacm1700 9 лет назад

    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.

    • @upgrdman
      @upgrdman  9 лет назад

      +Miguel Vázquez Thanks for the feedback. I'm glad it helped.

  • @hughclarkson4425
    @hughclarkson4425 7 лет назад +1

    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.

  • @doylemaleche9937
    @doylemaleche9937 6 лет назад +1

    What a delightful tutorial! VERY detailed!! Thank you for the EASY and in-depth Step-by-step instruction!
    GREAT JOB Sir!

    • @upgrdman
      @upgrdman  6 лет назад

      Thanks for the kind feedback!

  • @devilshand6696
    @devilshand6696 9 лет назад +2

    Wow...I just gotta say, This Is A Fantastic Tutorial! Way "above and beyond". Keep up the great work.

  • @janjiratko6714
    @janjiratko6714 6 лет назад +1

    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.

    • @upgrdman
      @upgrdman  6 лет назад

      Thanks for the kind feedback!

  • @khanqaiserster
    @khanqaiserster 6 лет назад +1

    You are an excellent tutor for Java and Arduino. Excellent work !

  • @pattrainor7096
    @pattrainor7096 7 лет назад +1

    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!

  • @caioporai
    @caioporai 6 лет назад +1

    Excellent tutorial! You made it comprehensive, easy to understand, anyone can follow it. Thanks!

  •  9 лет назад +3

    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.

  • @melvsuy
    @melvsuy 7 лет назад +1

    Finally, after searching for hours I found this. Thanks! This will help us in our study.

  • @betoflores551
    @betoflores551 6 лет назад +1

    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

  • @cjkelly9101
    @cjkelly9101 6 лет назад +1

    Best Tutorial Video I've Seen - Thankyou.

  • @abdietabrizi1723
    @abdietabrizi1723 5 лет назад +1

    Excellent video. Very informative, clear, and thorough. Thanks for taking the time to create this video.

  • @pgorellana
    @pgorellana 5 лет назад +1

    Finally, I could do it in NetBeans 8.2 on Linux and It works fine. Thanks a lot

  • @chenamee9584
    @chenamee9584 7 лет назад +1

    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

  • @dalwinci
    @dalwinci 4 года назад +1

    Many thanks ,This is more help to lerning to program .

  • @fvgm
    @fvgm 7 лет назад +1

    Hi, thanks for your tutorial. Easy way to get started with Java and microcontrollers. Thank you again

  • @agwri
    @agwri 5 лет назад +1

    Very informative. Thank you for taking the time to start from scratch and develop a useful application.

  • @rz1359
    @rz1359 7 лет назад +1

    Really thanks for informative java video , I truly understand real job of class and thread here .

  • @poojasonegar2761
    @poojasonegar2761 7 лет назад +1

    This is more than a tutorial ....really awesome video...thanks for every step of instruction and video:)

  • @zachfotis
    @zachfotis 6 лет назад +1

    Incredible video/tutorial ! Everything to the point from start to the end ! Thanks a lot sir ! Waiting for more java+arduino tutorials !

  • @krisztiangyarmati2144
    @krisztiangyarmati2144 6 лет назад +1

    Thanks, I've managed to start serial communication now!

  • @FrequencyBender
    @FrequencyBender 7 лет назад

    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.

  • @oliverheaviside9355
    @oliverheaviside9355 9 лет назад +1

    Great video, your thoroughness is highly appreciated.

  • @Rishab12312
    @Rishab12312 4 года назад

    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()

  • @brianbrookes7521
    @brianbrookes7521 5 лет назад +1

    Excellent! Learned a lot and well explained, thank you. I am using this as a basis for one of my hobby projects.

  • @scimathfun
    @scimathfun 3 года назад +1

    Wow, this is a really amazing tutorial. You really nailed it and explain it well. A++

  • @MrRaulcarricajo
    @MrRaulcarricajo 7 лет назад +4

    Thank you so much. Your tutorial is the best!!!

  • @altugkaya3045
    @altugkaya3045 9 лет назад +1

    What a great video! I am new on Arduino and you helped me a lot.
    Thanks dude.

  • @leonidpiliptsevich5329
    @leonidpiliptsevich5329 9 лет назад +4

    Thank you for so great explanation of everything java related!

  • @ohmedarick1
    @ohmedarick1 6 лет назад +1

    Thank you for your time and effort. Exactly what I was looking for

  • @egleo7057
    @egleo7057 7 лет назад +1

    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.

  • @thearturo1909
    @thearturo1909 4 года назад +1

    Nice video men. Really help me a lot.

  • @kirityrapuru
    @kirityrapuru 9 лет назад

    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

  • @scooter144
    @scooter144 9 лет назад

    Excellent video, very detailed, I'm sure if you done a series on Java, Arduino, ESP8266, Interfacing things it would be very popular.

  • @pietmatsobane6790
    @pietmatsobane6790 4 года назад +1

    amazing .... Thank you very much Sir

  • @joesmith1922
    @joesmith1922 8 лет назад

    Great video. Thanks for taking the time to share your knowledge!

  • @diegoosorio3491
    @diegoosorio3491 9 лет назад +3

    Thanks for your time, your video is worth ! :)

  • @roxenhs6407
    @roxenhs6407 8 лет назад

    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.

    • @upgrdman
      @upgrdman  8 лет назад

      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.

  • @TheJavaSync
    @TheJavaSync 3 года назад +1

    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 :)

    • @TheJavaSync
      @TheJavaSync 3 года назад

      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?

  • @JohnDoe-pq8yw
    @JohnDoe-pq8yw 8 лет назад +1

    Awesome!!! You are an excellent instructor. Thanks.

    • @upgrdman
      @upgrdman  8 лет назад

      Glad you liked it!

  • @edmundasmilieska9266
    @edmundasmilieska9266 5 лет назад +1

    Very Very nice.That is what I need. Thank you. Best tutorial.

  • @r.d.machinery3749
    @r.d.machinery3749 5 лет назад +1

    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.

  • @amitgoel6830
    @amitgoel6830 6 лет назад +1

    very nice sir !!!! everything explained so nicely

  • @WasabiHapper
    @WasabiHapper 7 лет назад +1

    Very well explained. Valuable vid!

  • @hoatolagbe1
    @hoatolagbe1 7 лет назад +1

    Excellent work!! Can't thank you enough!!

  • @xlitomagicalx
    @xlitomagicalx 6 лет назад +1

    Thank you! This was extremely helpful.

  • @4Kkonkan
    @4Kkonkan 6 лет назад +1

    Hey!! exactly what I am looking for .. owsome job

  • @scottgilsdorf2938
    @scottgilsdorf2938 8 лет назад

    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

  • @DjanilsonMartins
    @DjanilsonMartins 8 лет назад +1

    Great Tutorial!! Congratulations and thank you!!

  • @Rosi2001
    @Rosi2001 7 лет назад

    I learn Java, in video is tutorial how to create chart, that's really simple, thank. Static chart about 5 rows :)

  • @sandeepahs419
    @sandeepahs419 7 лет назад +1

    Thank you so much..this is more helpful ,good job

  • @amarenpdas1975
    @amarenpdas1975 6 лет назад +1

    Excellent tutorial

  • @iasamanrhzai5639
    @iasamanrhzai5639 5 лет назад +1

    amazing video thank you so much

  • @TubeY0urGames
    @TubeY0urGames 5 лет назад +1

    You are king! Thank you very much!

  • @kirityrapuru
    @kirityrapuru 9 лет назад

    Excellent Thanks for sharing and for your time to do this

  • @temirkhanamanbaev42
    @temirkhanamanbaev42 9 лет назад +1

    Thank you very much man! Cool video.

  • @DoctorSantosh
    @DoctorSantosh 5 лет назад +1

    Thank you very much for this tutorial. You should really make some bucks out of these videos.

  • @silver19944
    @silver19944 5 лет назад +1

    Good tutorial. Helped me alot!

  • @upgrdman
    @upgrdman  9 лет назад +5

    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

    • @yangmurasame7521
      @yangmurasame7521 8 лет назад

      +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?

    • @Janisg616
      @Janisg616 8 лет назад

      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.

    • @boiii9793
      @boiii9793 8 лет назад

      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

    • @boiii9793
      @boiii9793 8 лет назад

      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);
      }

    • @boiii9793
      @boiii9793 8 лет назад

      but the data is definitely wierd.

  • @jonymentero6471
    @jonymentero6471 7 лет назад +1

    Thank you very much. Very good job.

  • @jorgefossati3701
    @jorgefossati3701 3 года назад +1

    Excelente !!!

  • @alexisfigueroa2296
    @alexisfigueroa2296 8 лет назад

    Great tutorial, thank you very much for sharing!

    • @upgrdman
      @upgrdman  8 лет назад

      +Alexis Figueroa Thanks for the kind feedback. Glad the video helped.

  • @SohailKhanshinwari
    @SohailKhanshinwari 7 лет назад +1

    Great Job sir... It help us very Much....

  • @mademis
    @mademis 8 лет назад

    it was very good and helped me a lot

  • @ahmedlasmar6344
    @ahmedlasmar6344 4 года назад +1

    Many thanks.

  • @upadhyayaman504
    @upadhyayaman504 7 лет назад

    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

    • @upgrdman
      @upgrdman  7 лет назад +1

      Thanks for the feedback. I use screen recording software in my newer videos.

  • @jaehoyoun7077
    @jaehoyoun7077 7 лет назад

    Thank you
    I got a lot of help from your video

  • @iliasilisparrow
    @iliasilisparrow 9 лет назад +2

    Thanks, Great tutorial, but please use a screencast,
    But even with that it's a really good job ;)

  • @amargaikwad8408
    @amargaikwad8408 6 лет назад

    thanks for your great work
    you really deserve it...

  • @fcoGaz
    @fcoGaz 8 лет назад

    FANTISTIC ...THANKS FOR YOU HELP

  • @adnankayace
    @adnankayace 8 лет назад +2

    Thanks very good job!

  • @TheKekilli
    @TheKekilli 8 лет назад +1

    you are great! Thank you so much.

  • @PeakWuNeverSurrender
    @PeakWuNeverSurrender 5 лет назад

    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.

  • @vilmondesribeiro4363
    @vilmondesribeiro4363 7 лет назад +1

    ME AJUDOU BASTANTE OBRIGADO!
    THIS WAS VERY HELPFUL, THANK YOU!

  • @gmauricer
    @gmauricer 7 лет назад

    Found the code below. Thanks.

  • @MrMishaTV
    @MrMishaTV 4 года назад +1

    God bless you

  • @mikesuper5202
    @mikesuper5202 7 лет назад +1

    nice ! good job !

  • @thysavrin
    @thysavrin 3 года назад +1

    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"

  • @LightFykki
    @LightFykki 8 лет назад

    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.

    • @upgrdman
      @upgrdman  8 лет назад

      +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.

  • @Paleloser
    @Paleloser 7 лет назад +1

    Thaks! Great tutorial

  • @limajfrancisco2940
    @limajfrancisco2940 8 лет назад

    thanks for your code :) very helpful....

  • @joenelespejo4082
    @joenelespejo4082 5 лет назад

    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)

  • @gernotleonard3337
    @gernotleonard3337 6 лет назад +1

    Really nice video

  • @kalamdudekula7987
    @kalamdudekula7987 6 лет назад +1

    thanks man it's very helpfull

  • @nginXiwnl
    @nginXiwnl 5 лет назад +1

    keep up the good work

  • @tayfun11100
    @tayfun11100 8 лет назад

    Great tutorial. Thanks...

  • @oxnium
    @oxnium 9 лет назад

    I love you

    • @upgrdman
      @upgrdman  9 лет назад

      oxnium I'm glad to help. Good luck with your class!

  • @angustsang4715
    @angustsang4715 7 лет назад

    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 ?

  • @littco
    @littco 7 лет назад +1

    awesome thank you..

  • @Chanezk
    @Chanezk 2 года назад

    Thanks so much Sir for this tutorial ✨✨ but I’m wondering if I can use it for easyPic with a sensor of temperature 🤔🤔🤔 ?

  • @danielblancorodriguez1623
    @danielblancorodriguez1623 4 года назад

    Excelente Vídeo !!

  • @mushinman1
    @mushinman1 3 года назад +1

    Thanks

  • @brunogbitencourt
    @brunogbitencourt 7 лет назад +1

    Excelent video

  • @aleksandrgorbachev88
    @aleksandrgorbachev88 8 лет назад

    Cool video!

    • @upgrdman
      @upgrdman  8 лет назад

      +Aleksandr Gorbachev Thanks