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

แชร์
ฝัง
  • เผยแพร่เมื่อ 10 ก.พ. 2025

ความคิดเห็น • 67

  • @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 2 ปีที่แล้ว

      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

  • @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

  • @tank_tales
    @tank_tales 2 ปีที่แล้ว +5

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

  • @AJAXIMOS
    @AJAXIMOS 4 หลายเดือนก่อน

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

  • @engineering-problems
    @engineering-problems ปีที่แล้ว

    Great explanation thank you , saved me ton of time.

  • @user12sb
    @user12sb 2 ปีที่แล้ว

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

  • @aarjudixit
    @aarjudixit ปีที่แล้ว

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

  • @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 ^^.

  • @mohamednaimi7076
    @mohamednaimi7076 2 ปีที่แล้ว

    Thank you for this, it was very helpful!

  • @devyani_t05
    @devyani_t05 2 ปีที่แล้ว

    thnx dude.. this video really helped a lot!

  • @cikgupython4567
    @cikgupython4567 3 ปีที่แล้ว +1

    Great tutorial!

  • @전후-m6s
    @전후-m6s 2 ปีที่แล้ว

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

  • @noe2540
    @noe2540 2 ปีที่แล้ว +1

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

  • @tiagot6916
    @tiagot6916 2 ปีที่แล้ว

    Thanks a lot! Great tutorial!

  • @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)?

  • @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 ?

  • @faizaanscnz
    @faizaanscnz 2 หลายเดือนก่อน

    Can you help me to make connection between android and arduino using kivy python because pyserial is not supported android

  • @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.

  • @nouirimohammedelmehdi6642
    @nouirimohammedelmehdi6642 ปีที่แล้ว

    thamks so much for this i apreciate it

  • @adeddy8138
    @adeddy8138 2 ปีที่แล้ว +1

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

  • @gerardomtz8435
    @gerardomtz8435 ปีที่แล้ว

    Thank you men!!!

  • @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!

  • @agst480
    @agst480 2 ปีที่แล้ว

    Great content, thanks

  • @noobpook5617
    @noobpook5617 ปีที่แล้ว

    Thanks alot bro for your help

  • @MIKKUCN
    @MIKKUCN 2 ปีที่แล้ว

    Thank you so much 😀😀😀😀😀😀

  • @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

  • @deeppujara4566
    @deeppujara4566 2 ปีที่แล้ว

    Great Work

  • @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 ?

  • @unclestepa
    @unclestepa 12 วันที่ผ่านมา

    thx!

  • @lavanyau4062
    @lavanyau4062 2 ปีที่แล้ว +1

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

  • @firesports8953
    @firesports8953 3 ปีที่แล้ว

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

  • @creativesamurai8372
    @creativesamurai8372 2 ปีที่แล้ว

    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"

  • @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_  ปีที่แล้ว

      Python Tutorial - How to Read/Write Data To/From .CSV Files and Basic Data Parsing/Manipulation
      th-cam.com/video/Nuo8-UrCDrM/w-d-xo.html

  • @NawtieBoy96
    @NawtieBoy96 3 ปีที่แล้ว

    thanks alot , very nice tutorial

  • @joramotorsportteam3277
    @joramotorsportteam3277 2 ปีที่แล้ว +1

    Serial not halted after a few hours?

  • @loperdax
    @loperdax 3 ปีที่แล้ว

    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?

  • @bektasari
    @bektasari 2 ปีที่แล้ว

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

  • @saraluciacontrerasojeda3939
    @saraluciacontrerasojeda3939 3 ปีที่แล้ว

    Thank you!

  • @lahirusandaruwan6124
    @lahirusandaruwan6124 3 ปีที่แล้ว

    thank you grate video!!

  • @avyayjain7896
    @avyayjain7896 3 ปีที่แล้ว

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

  • @benbenameur8429
    @benbenameur8429 2 ปีที่แล้ว

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

  • @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.

  • @a-xp6ly
    @a-xp6ly 11 หลายเดือนก่อน

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

  • @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

  • @oggythepro
    @oggythepro 8 หลายเดือนก่อน

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

  • @palo_540
    @palo_540 2 ปีที่แล้ว +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 2 ปีที่แล้ว

      @@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

  • @freydaniel5134
    @freydaniel5134 2 ปีที่แล้ว

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

  • @shishworld1351
    @shishworld1351 3 ปีที่แล้ว

    Does it matter what kind of arduino I have?

    • @JustinS06
      @JustinS06 3 ปีที่แล้ว

      It shouldn't matter.

  • @riannata8309
    @riannata8309 2 ปีที่แล้ว

    how to save data bro ? thanks

    • @riannata8309
      @riannata8309 2 ปีที่แล้ว

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

  • @taranjeetsingh1712
    @taranjeetsingh1712 2 ปีที่แล้ว

    source code link pls???

  • @versys-research-vietnam
    @versys-research-vietnam 2 ปีที่แล้ว

    I cant do that T-T