Python Tutorial - How to Read Data from Arduino via Serial Port

Поділитися
Вставка
  • Опубліковано 23 лис 2024

КОМЕНТАРІ • 65

  • @m.s.79
    @m.s.79 2 роки тому +8

    It is so great when one of the fist things that look for is exactly the one you need. Thank you very very much for this video.

  • @cdhiva
    @cdhiva 3 роки тому +16

    Hey Andrew! Great tutorial! My guess is that you are new to python and have experience in either C/C++ or Java from your for loop. In python, you can iterate over a list (portList, in your case) with just add the below code after line 4.

    for port in ports: # You could replace “ports” with serial.list_ports.comports() to remove line 3 in your code.
    if port.startswith(“COM” + str(val)):
    portVar = “COM” + str(val)

    ^this would eliminate the necessity of code from line 6 to line 16.
    Kudos to you for helping me learn serial communication using Python.

    • @matthieuduflot3209
      @matthieuduflot3209 3 роки тому

      Also there will be an issue if you have a COM30 or COM31 or…

    • @freydaniel5134
      @freydaniel5134 Рік тому

      program harus berjalan di C:\Users\jhoea\AppData\Local\Programs\Python\Python311\Lib\site-packages

  • @Bularistan4o
    @Bularistan4o 3 роки тому +10

    After literally 3 hours of trying to install pyserial, your code finally came alive. 100% what I wanted. Now I just have to see how to write the data in a file, preferably .csv. As someone that has only coded minecraft blocks on a RPi3, how I find another video like this hahaha

  • @tank_tales
    @tank_tales Рік тому +5

    God please bless this guy with a lot of pizzas and money and grant his every single wish

  • @clicksandbeeps61
    @clicksandbeeps61 2 роки тому +5

    Thanks a lot mate! Great tutorial, explained better than the actual documentation. 👍

  • @hitterobr
    @hitterobr 2 роки тому +1

    you are literally a God on earth. Thank's for saving me

  • @AJAXIMOS
    @AJAXIMOS 2 місяці тому

    great video! thanks a lot man!! It saved me in one project of mine!

  • @subrotoxing8214
    @subrotoxing8214 3 роки тому +5

    It would be great if you make a complete video starting from how you setup the arduino and the temp sensor ^^.

  • @engineering-problems
    @engineering-problems 10 місяців тому

    Great explanation thank you , saved me ton of time.

  • @user12sb
    @user12sb Рік тому

    Thank you so much. This is great tutorial. Recommended!

  • @noe2540
    @noe2540 2 роки тому +1

    Hello ! Thanks for the tuto ! Does it works with Linux on a raspberry pi ?

  • @firealarmapprentice4517
    @firealarmapprentice4517 2 роки тому

    Great video. I am going to connect to my fire panel serial port. How do I set the parameters for bit, parity and stop bit ?

  • @ferrari1
    @ferrari1 Рік тому

    Great video! Would you know how to read the same kind of data but coming from a WiFi connected Arduino such as the Arduino Uno R4 WiFi (not connected to a USB port)?

  • @aarjudixit
    @aarjudixit Рік тому

    Thanks a lot dude for this wonderful tutorial. It helps me a lot.☺✌

  • @cikgupython4567
    @cikgupython4567 3 роки тому +1

    Great tutorial!

  • @AllanYolticGSolis
    @AllanYolticGSolis 2 роки тому

    It is supposed that I have already installed pyserial like 3 times or so, and on Spyder it says that there is no module called serial, and on Visual it does not allow to use the port, and on issues it appears as a missing import. I need solve it asap.

  • @syedfawad8245
    @syedfawad8245 3 роки тому +1

    Hello, very nice tutorial. I have been working on the opposite to this video content i.e. i have to send a list of integers from python to arduino. but i end overflowing the serial port and arduino going crazy. Please do a tutorial on that. THanks

  • @mohamednaimi7076
    @mohamednaimi7076 2 роки тому

    Thank you for this, it was very helpful!

  • @adeddy8138
    @adeddy8138 2 роки тому +1

    Can you do the reverse send from python to serial monitor? I really need it

  • @devyani_t05
    @devyani_t05 2 роки тому

    thnx dude.. this video really helped a lot!

  • @tiagot6916
    @tiagot6916 2 роки тому

    Thanks a lot! Great tutorial!

  • @bektasari
    @bektasari 2 роки тому

    good video. but i take TypeError: Serial.open() missing 1 required positional argument: 'self' error .How can i fix this?

  • @mekatronikmuhendisi8420
    @mekatronikmuhendisi8420 2 роки тому

    I try to this python code with stm32 uart, but it's constantly on the line. after each character. How can I fix it ?

  • @GoTechnobyMkBj
    @GoTechnobyMkBj 2 роки тому

    Thanks a lot for this awesome method. Can you help me further I have a question. I am using ESP32, and want to send AT command to it and then read the Response and use if conditions to do some actions based on the response. Can we do this with python? Please suggest!

  • @nouirimohammedelmehdi6642
    @nouirimohammedelmehdi6642 Рік тому

    thamks so much for this i apreciate it

  • @전후-m6s
    @전후-m6s Рік тому

    Thanks a lot. This is what I want to learn.

  • @creativesamurai8372
    @creativesamurai8372 Рік тому

    Amazing video. Is there a chance you could make a py script video that could teach us how to send and receive serial data? ie. arduino sends "Ready" via serial. Python sees "ready" via serial and sends "im ready too"

  • @firesports8953
    @firesports8953 3 роки тому

    hello, very nice tutorial, i have question is it possible to make it single line data?

  • @noobpook5617
    @noobpook5617 Рік тому

    Thanks alot bro for your help

  • @agst480
    @agst480 2 роки тому

    Great content, thanks

  • @lavanyau4062
    @lavanyau4062 2 роки тому +1

    How to display for 2 values like temp,pressure???

  • @loperdax
    @loperdax 2 роки тому

    i can send data from tkinter and serial to another serial port and read it
    but cand receive
    my app crashing when want to read
    do you why?

  • @gerardomtz8435
    @gerardomtz8435 9 місяців тому

    Thank you men!!!

  • @deeppujara4566
    @deeppujara4566 2 роки тому

    Great Work

  • @fhier6
    @fhier6 Рік тому

    Can you take this one step further and make a video of how to save the serial port data to a .txt or .csv file?

    • @TinkerAssist_
      @TinkerAssist_  11 місяців тому

      Python Tutorial - How to Read/Write Data To/From .CSV Files and Basic Data Parsing/Manipulation
      ua-cam.com/video/Nuo8-UrCDrM/v-deo.html

  • @NawtieBoy96
    @NawtieBoy96 3 роки тому

    thanks alot , very nice tutorial

  • @benbenameur8429
    @benbenameur8429 2 роки тому

    Hello
    I am looking for the equivalent of : arduino.write("X="+str(200)+'
    ') in matlab .

  • @MIKKUCN
    @MIKKUCN Рік тому

    Thank you so much 😀😀😀😀😀😀

  • @atuk5854
    @atuk5854 2 роки тому

    hello nice video, but i'm getting an error on 20.-21. line
    the error is :
    open() missing 1 required positional argument: 'self'

    • @atuk5854
      @atuk5854 2 роки тому

      thanks
      I figure out my solution

  • @lahirusandaruwan6124
    @lahirusandaruwan6124 3 роки тому

    thank you grate video!!

  • @rikerthiessen5027
    @rikerthiessen5027 3 роки тому

    I have an Arduino printing data to the serial port every 100 milliseconds, but when I read the data in python and print it to the console, it does not print nearly as fast (maybe every 500 milliseconds?). Do you know of any fix for this?

    • @rikerthiessen5027
      @rikerthiessen5027 3 роки тому

      @@TinkerAssist_ I print 5 values, each separated by a comma, and the last one prints using Serial.println(), and that is followed by delay(100). I bumped up the baud to 115200 and it is printing slightly faster. I decided to use the time library to get the time difference between starting the method and finishing the method, where I print, and python is telling me it actually is 0.10xxxx seconds. However, I did realize that for some reason the prints show up in packs of 3 (I print the array of 5 values from the arduino in one line, my python output is printing the one line in packs of 3 though. it prints the last 3 input readings every 0.3 seconds, even though it is set to print every time the method gets called)... not sure why.

  • @avyayjain7896
    @avyayjain7896 2 роки тому

    hey can you tell how to store data directly to MySQL from here
    need help asap

  • @palo_540
    @palo_540 Рік тому +1

    Anyone else having issues with val = input("Select Port: COM")?
    For some reason Spyder crashes when this point is reached. What am I missing?
    P.S: For my IT friends, yes, I have tried turning it off and on (if you know, you know) ;)

    • @palo_540
      @palo_540 Рік тому

      @@TinkerAssist_ thank you for the reply! i havent, and i surely will. hopefully it will work for me, as it did for the others in the github thread

  • @a-xp6ly
    @a-xp6ly 8 місяців тому

    I get a permission error when trying to read data from the port, anyone know why and how to fix?

  • @saraluciacontrerasojeda3939
    @saraluciacontrerasojeda3939 2 роки тому

    Thank you!

  • @joramotorsportteam3277
    @joramotorsportteam3277 2 роки тому +1

    Serial not halted after a few hours?

  • @freydaniel5134
    @freydaniel5134 Рік тому

    catatan : program harus berjalan di folder pithon.. dan port serial arduino dan python tidak boleh beradu/sama

  • @shishworld1351
    @shishworld1351 2 роки тому

    Does it matter what kind of arduino I have?

    • @JustinS06
      @JustinS06 2 роки тому

      It shouldn't matter.

  • @taranjeetsingh1712
    @taranjeetsingh1712 2 роки тому

    source code link pls???

  • @riannata8309
    @riannata8309 2 роки тому

    how to save data bro ? thanks

    • @riannata8309
      @riannata8309 2 роки тому

      @@TinkerAssist_ ok, i am waiting for it, thanks

  • @versys-research-vietnam
    @versys-research-vietnam 2 роки тому

    I cant do that T-T

  • @oggythepro
    @oggythepro 5 місяців тому

    Love you My Boy It helps so much Thank you!!!!!❤❤❤❤❤❤❤❤❤❤❤❤😍😍😍😍😍😍💖💖💖💖💖💖🌹🌹🌹🌹🎉🎉🎉🎉🎉🎉