Arduino and Python Serial Communication with PySerial Part 1

  Рет қаралды 157,988

WaveShapePlay

WaveShapePlay

Күн бұрын

Пікірлер: 138
@SmilesChimichanga
@SmilesChimichanga 6 жыл бұрын
This is the best video I've found on this subject, Very clear breakdown of how the data is generated/transferred/handled. Thanks a lot!
@AliG.G
@AliG.G 4 жыл бұрын
Indeed one of the best by far
@yoente
@yoente 4 жыл бұрын
True
@fibulacat5025
@fibulacat5025 3 жыл бұрын
This is the best tutorial I've ever seen. Thumbs up.
@chrismartinez9735
@chrismartinez9735 5 жыл бұрын
This is an excellent series. Every module is well articulated. I learned a lot!
@yeshu9985
@yeshu9985 7 ай бұрын
quick tip: close ur serial monitor before u start ur python code or else u would end up getting an error
@soumyadipdutta17
@soumyadipdutta17 Ай бұрын
Thanks
@jackmanjls
@jackmanjls 5 жыл бұрын
This is an excellent presentation. Clear, concise and enough detail to make this extremely useful. The only comment I would have is that the rate at which you poll the arduino. From what I roughly calc...The actual conversion took 4.58 µs for 12 bits in single conversion mode with a 2 MHz ADC clock. If you read any faster than that you may get inconclusive data. Any comments?
@markm817
@markm817 Жыл бұрын
Sir, you said so clear that I can understand the knowledge, thank you wholeheartly.
@rsa4510
@rsa4510 6 жыл бұрын
Absolutely great tutorial! A lot of times, people posting "how to" videos skip the basics in their explanations. This leaves the beginner confused and unable to enjoy the steps associated with learning. I fully understood this tutorial, and I have hope that it will let me debug a related issue I'm having with my own application. Thanks for your work.
@stefanopadoan8684
@stefanopadoan8684 5 жыл бұрын
Fantastic! Simple, clear, useful! Thanks a lot!
@ArulFrances
@ArulFrances 4 жыл бұрын
Great Explanation! Keep up the good work! Thanks for sharing the amazing information!
@WaveShapePlay
@WaveShapePlay 4 жыл бұрын
Thank you for your kind feedback!
@rightdelo
@rightdelo 2 жыл бұрын
thanks for teaching and breaking it down into simple-to-understand terms. THANKS
@9205aidme
@9205aidme 4 жыл бұрын
Great work, keeps it really simple, but it works, gave me just the start I was looking for. Running Python 3.8.3
@WaveShapePlay
@WaveShapePlay 4 жыл бұрын
Great to hear Gregory! That is definitely my goal. Thank you for the feedback!
@vyashas4483
@vyashas4483 5 жыл бұрын
bro this was the best video that i found on this topic thx buddy. you explained it very well.
@brandon_wallace
@brandon_wallace 4 жыл бұрын
This series on Pyserial is great and really helpful!
@HydeParkCAC
@HydeParkCAC 4 жыл бұрын
Thank you for posting! It was very helpful to see your coding with explanations such as how to use the decode command.
@WaveShapePlay
@WaveShapePlay 4 жыл бұрын
Thank you for the feedback Jenny! It is confusing at first, but once you get the hang of it it becomes more clear!
@n9583
@n9583 2 жыл бұрын
thank you so much but i have a question can you use the arduino mega instead of the arduino
@SimoneIovane
@SimoneIovane 4 жыл бұрын
SerialException: could not open port 'COM3': PermissionError. Why?
@ruancastro5973
@ruancastro5973 4 жыл бұрын
in my python version (3.7.6) i need to write ".decode('utf-8"')" instead .decode('ascii) . Great Video, thanks from Brazil for share the knowledge with us !
@WaveShapePlay
@WaveShapePlay 4 жыл бұрын
Thank you for sharing Ruan!
@TyeDougherty
@TyeDougherty 4 жыл бұрын
Thank you sir I was wondering why the decode function was not working!
@alexoriginals
@alexoriginals 3 жыл бұрын
Raun, tudo bem, será que você poderia me ajudar? você consegue converter estes valores em integer? a sintaxe valor=int(arduinoData) não funcionou no 3.8
@MilanKarakas
@MilanKarakas 3 жыл бұрын
Why it works sometime, and sometime not? Windows 10. Installed serial, but it complains that it is not installed. Once worked, then after changing parameters, does not work. Then again work... confusion.
@cmoulali4835
@cmoulali4835 6 жыл бұрын
I like your videos on the Python ardiuno ,I excited Ooooo
@Swesh99
@Swesh99 4 жыл бұрын
The first video that is realy helpful, thak you so much!
@darshanpanchal3046
@darshanpanchal3046 4 жыл бұрын
Hello sir, can i use pyserial to collect and process data from power analyzer or this works only with arduino?......please answer my question
@WaveShapePlay
@WaveShapePlay 4 жыл бұрын
If it uses the Serial protocol then yes. Perhaps look up the documentation for your power analyzer and see if there are existing examples.
@JNouveau
@JNouveau 3 жыл бұрын
is it possible to replace the integer with string?
@diegogomez1640
@diegogomez1640 5 жыл бұрын
te mereces una medalla de oro al conocimiento, thank you by your aport
@mohamedjaveed1366
@mohamedjaveed1366 5 жыл бұрын
Thank you so much for this!! Very well explained 👍
@moshk6460
@moshk6460 2 жыл бұрын
hey, why I get this error: serial.serialutil.SerialException: could not open port 'COM3': PermissionError(13, 'Access is denied.', None, 5)
@wisesoar
@wisesoar 4 жыл бұрын
Hi, Thanks for the video. Is there a video talking how to set up the hardware? Which pins did you use from the adruino to computer? Did you use a USB to serial (e.g. UART) adapter or just the USB cable to arduino? Thanks.
@WaveShapePlay
@WaveShapePlay 4 жыл бұрын
Hey - I do not have a video for the Hardware setup, I can make one in the future. For this setup I am using standard USB interface for the Arduino UNO. It uses a USB cable type A/B to connect between the Arduino and the computer.
@paulramasco6769
@paulramasco6769 6 жыл бұрын
This is cool, will be helpful for my data acquisition devices.
@prasadvaidya9563
@prasadvaidya9563 4 жыл бұрын
I’m setting the timeout to 2 while creating the serial object. When I’m reading from serial port I’m checking wether data is present in input buffer by : if(obj.inWaiting>0) : If the data packets are interrupted it hangs in there.... I have given timeout value as 2 still it’s waiting indefinitely... why it’s not considering timeout value????
@halitekmekci8304
@halitekmekci8304 4 жыл бұрын
smooth exercise, thanks for that.
@lakshagajyothi258
@lakshagajyothi258 3 жыл бұрын
Hi sir, Is it possible to get the digital inputs and print them as the output using println?
@ManojKumar-pj8tr
@ManojKumar-pj8tr 4 жыл бұрын
Thnx this is the best tutorial I have come across
@WaveShapePlay
@WaveShapePlay 4 жыл бұрын
Awesome to hear! Thank you Manoj!
@CN-kc3em
@CN-kc3em 5 жыл бұрын
How to communication by Usb?
@fernandohood5542
@fernandohood5542 4 жыл бұрын
what about parity ,stop bit and number of bits?
@thisunnishama4285
@thisunnishama4285 4 жыл бұрын
Hello!....what if i need my python program to give instructions to arduino to do something(like....switch on a specific LED?)
@rverm1000
@rverm1000 6 жыл бұрын
how do you set it up?
@chinmaykulkarni7835
@chinmaykulkarni7835 4 жыл бұрын
Can you explain why we declared ser for serial.Serial()
@waleedaiad3411
@waleedaiad3411 2 жыл бұрын
How can i use hc-12 with arduino using python language?.
@johnger
@johnger 3 жыл бұрын
Hello, I need make file pdf or excel with information of Serial
@perinoveriza1658
@perinoveriza1658 4 жыл бұрын
You are the best brother 👍
@kavyajohnson225
@kavyajohnson225 3 жыл бұрын
The video is explained excellently .I have a doubt regarding the timeout value , will be it be delaying the whole data transmission. I am doing a data rate calculation. So my doubt is regarding the timeout parameter. It would be very helpful to if I get a reply
@shaider1982
@shaider1982 4 жыл бұрын
Hi there. Will this also work if the python runs from a raspberry pi? Tnx.
@edwintoapanta1975
@edwintoapanta1975 5 жыл бұрын
hi how can i send an excel file from the pc to the arduino
@elosurfer6238
@elosurfer6238 17 күн бұрын
Really good stuff, thank you!
@charanmakkar7732
@charanmakkar7732 4 жыл бұрын
smooth exercise, thanks for it sir , awesome stuff and in best easy way
@WaveShapePlay
@WaveShapePlay 4 жыл бұрын
Glad you liked it!
@controlautomation6875
@controlautomation6875 5 жыл бұрын
Hi Good tutorial !!! Please how we can making python send a float or int data to arduino and arduino get it (not str only )???
@afettouchemassinissa9149
@afettouchemassinissa9149 6 жыл бұрын
hello, thanks for the video : good explanation , but for me when I execute the code it returns to me an error : No module named 'serial' ;;;; what should I do
@thomasmarques8040
@thomasmarques8040 5 жыл бұрын
Hi, that was three months ago. Did you find the solution? I have the same error.
@sarthakdas815
@sarthakdas815 5 жыл бұрын
I solved it py pip install pyserial and use a conda environment
@sarthakdas815
@sarthakdas815 5 жыл бұрын
@@thomasmarques8040 I solved it py pip install pyserial and use a conda environment
@mayanmaster92
@mayanmaster92 6 жыл бұрын
What if the arduino puts out strings and not bytes? Is there a way to get python to output those strings?
@TheCarloszoom3000
@TheCarloszoom3000 5 жыл бұрын
Hi, I'm getting the following error: AttributeError: module 'serial' has no attribute 'Serial' The libraries serial and py serial are already installed. Could it be that you have Python 2.7 and i have 3.7. If so, how different would the code be? Regards,
@sarthakdas815
@sarthakdas815 5 жыл бұрын
yep getting the same error
@sarthakdas815
@sarthakdas815 5 жыл бұрын
I solved it py pip install pyserial and use a conda environment
@lubanmahfuz8271
@lubanmahfuz8271 4 жыл бұрын
Sir I got error permission Denied problem
@Inkieto92
@Inkieto92 6 жыл бұрын
why dont you need the following code in your void setup? pinMode(analogPin, INPUT); don't you have to tell it that it's an input pin?
@mehmetfesli5775
@mehmetfesli5775 3 жыл бұрын
This is a very good explanation!!
@joshuacanlas4679
@joshuacanlas4679 4 жыл бұрын
great video. May I know the version of python that you are using there and the pyserial. Thanks.
@WaveShapePlay
@WaveShapePlay 4 жыл бұрын
The version of Python was 3.7.
@kunalgoyal9866
@kunalgoyal9866 5 жыл бұрын
Please can anyone tell how to compare this arduinodata to integer value please!!!!
@shaneebkottakkal3491
@shaneebkottakkal3491 4 жыл бұрын
Can we upload python code into arduino
@DurgeshKumar-ui6jq
@DurgeshKumar-ui6jq 5 жыл бұрын
I am getting the data from python , but there is significant gap can you help you that. Thanks in advance :)
@darminaxel5809
@darminaxel5809 6 жыл бұрын
Is pit possible to print this to a webpage with cgi/python?
@leonhs1476
@leonhs1476 4 жыл бұрын
I get an error that says No module named 'serial'
@WaveShapePlay
@WaveShapePlay 4 жыл бұрын
Hello - Did you download the pySerial model from the pySerial website? This is not a built-in module, it is from a 3rd party.
@cindyespindola4946
@cindyespindola4946 5 жыл бұрын
This video is great, easy to understeand and it works great. One question if someone can help me, is there a way to get the name of the connected port via script?
@ユンユン-b8y
@ユンユン-b8y 3 жыл бұрын
Thank you, this is really helpful to me!
@roflcopter645
@roflcopter645 6 жыл бұрын
Thanks for making these videos.
@rverm1000
@rverm1000 6 жыл бұрын
do you have a link to import serial?
@gracewood6768
@gracewood6768 5 жыл бұрын
Oh wow i didn't know this Library is commonly used in Arduino =). My thesis uses this library to communicate on Router =)
@acy1335
@acy1335 4 жыл бұрын
Where do I write this code in?
@WaveShapePlay
@WaveShapePlay 4 жыл бұрын
You can write the python code in IDLE, which is the default Integrated Development Environment (IDE) for Python. For Arduino I would recommend downloading the IDE from their website.
@vaughntaylor2855
@vaughntaylor2855 3 жыл бұрын
Very nice tutorial, Thank you!
@joecandoit5341
@joecandoit5341 5 жыл бұрын
Nice and clear. Thank you! You have a sub.
@swaralipibose9731
@swaralipibose9731 4 жыл бұрын
Best on the best
@NguyenDat-sn2pb
@NguyenDat-sn2pb 5 жыл бұрын
how to convert it to int , when i use int(arduinoData) it call the error :: invalid literal for int() with base 10: ''
@kevindrouglazet2379
@kevindrouglazet2379 5 жыл бұрын
I might be wrong but since the incoming information are bytes, I would assume that you need to use int.from_bytes() to convert the data from bytes to int .
@NguyenDat-sn2pb
@NguyenDat-sn2pb 5 жыл бұрын
@@kevindrouglazet2379 thank you , i will try your code
@NEGOX47
@NEGOX47 5 жыл бұрын
Nguyen Dat worked?
@ishansmith549
@ishansmith549 5 жыл бұрын
very good series
@punjabilog
@punjabilog 4 жыл бұрын
Thank you very much Sir, Its great video...
@ashabgaming8205
@ashabgaming8205 4 жыл бұрын
THX MAN IT WAS VERY HELPFUL!!! You goa like frome me!👍
@dawkos8631
@dawkos8631 4 жыл бұрын
error: module 'serial' has no attribute 'Serial' wtf
@dawkos8631
@dawkos8631 4 жыл бұрын
I find out, i installed "pip install serial", instead "pip install pyserial" :D
@WaveShapePlay
@WaveShapePlay 4 жыл бұрын
Very good! Yup, pip is great but we have to be accurate!
@mrberry43
@mrberry43 6 жыл бұрын
Many thanks this has helped a lot.
@rverm1000
@rverm1000 5 жыл бұрын
so good and simple. Can you send me more info?
@reactorark
@reactorark 4 жыл бұрын
Thanks a lot..!! best regads !!! great job,, SUSCRIBED.!
@idealzone3652
@idealzone3652 4 жыл бұрын
Im very interesting about this
@WaveShapePlay
@WaveShapePlay 4 жыл бұрын
Great to hear, it really opens up a lot of applications for us!
@3Dprintingshorts
@3Dprintingshorts 3 жыл бұрын
I love your videos i hope you will make more advance tutorials regarding uart communication as well. Just sub to the channel.Love you bro
@user-sd9ff5yj2t
@user-sd9ff5yj2t 4 жыл бұрын
Nice video. Thanks man!
@muhajirikhsanushabri9644
@muhajirikhsanushabri9644 6 жыл бұрын
what version of your python?
@YosefYarinEdri
@YosefYarinEdri 6 жыл бұрын
i thing its python 3
@qvd3533
@qvd3533 6 жыл бұрын
3.5.1 you can see it at the top of the screen
@idealzone3652
@idealzone3652 4 жыл бұрын
Amazing work
@ДаниилГалимзянов-э4л
@ДаниилГалимзянов-э4л 6 жыл бұрын
Thanks, very good video.
@baykus790
@baykus790 3 жыл бұрын
amazing. it works..
@WaveShapePlay
@WaveShapePlay 3 жыл бұрын
😎
@lazarocamargo
@lazarocamargo 4 жыл бұрын
Excellent tutorial!
@emreT_T
@emreT_T 3 жыл бұрын
If you're getting this error: arduinoData = ser.readline().decode() UnicodeDecodeError: 'utf-8' codec can't decode byte 0xfe in position 0: invalid start byte I found out first byte that coming from arduino is can't convert with decode, so i added a loop like this ; for _ in range (0,2): arduinoData = ser.readline() i am taking first two value and don't use them and added while loop right after this loop. Full code: import serial ser = serial.Serial("COM3", baudrate = 9600, timeout=1) for _ in range (0,2): #It's giving an error for first byte so with this loop we eliminate first two byte. arduinoData = ser.readline() while 1: arduinoData = ser.readline().decode() arduinoData = int(arduinoData) arduinoData = (arduinoData/1024)*5 print(arduinoData) Ps. Yep, my bad that i don't read the error but I have searched this problem for one our and couldn't find anything :')
@oscara.quirozbarrera7312
@oscara.quirozbarrera7312 5 жыл бұрын
WHY? UnicodeDecodeError: 'ascii' codec can't decode byte 0xff in position 0: ordinal not in range(128)
@Alfayeeed
@Alfayeeed 5 жыл бұрын
i got the same errror. Any luck solving it?
@oscara.quirozbarrera7312
@oscara.quirozbarrera7312 5 жыл бұрын
@@Alfayeeed I am trying with pyfirmata, so far is the best option.
@oscara.quirozbarrera7312
@oscara.quirozbarrera7312 5 жыл бұрын
@@Alfayeeed try this: from pyfirmata import Arduino placa=Arduino('COM4') print("vamos a entrar al for") for i in range(12): placa.digital[13].write(1) placa.pass_time(3) placa.digital[13].write(0) placa.pass_time(1.5) print("primera conexion real",i)
@tarunkashyap8515
@tarunkashyap8515 5 жыл бұрын
try this: arData = arData.decode('ISO-8859-1')
@gebrehiwotmengistu1590
@gebrehiwotmengistu1590 6 жыл бұрын
This is Great! Thank you
@paulo.galvao
@paulo.galvao 6 жыл бұрын
arduinoString = arduinoData.readline().decode("utf-8") #read the line of text from the serial port dataArray = arduinoString.split(',') #Split it into an array called dataArray may be more easy... github.com/labF212/pyhton-arduino/blob/master/test2serial3.py
@EunchanPark
@EunchanPark 6 жыл бұрын
it is a cool video! Thank you
@sacredinclinations
@sacredinclinations 3 жыл бұрын
great job thanks
@ShivamKumar-rp8kr
@ShivamKumar-rp8kr 4 жыл бұрын
thanks man
@banditboy6444
@banditboy6444 4 жыл бұрын
Have my thumbs up!
@WaveShapePlay
@WaveShapePlay 4 жыл бұрын
You rock!
@emreakman5007
@emreakman5007 5 жыл бұрын
Thank you much
@dennisyildirim2708
@dennisyildirim2708 4 жыл бұрын
Can I read data from this device; au.element14.com/amphenol-advanced-sensors/sm-uart-04l/ir-laser-dust-sensor-97ac8394/dp/3021584 By only using my computer, and python ? Without Arduino....
@idus
@idus 11 ай бұрын
its not ardreno Thanks for the video.
@123hihoo
@123hihoo 4 жыл бұрын
KING!
@idealzone3652
@idealzone3652 4 жыл бұрын
Thankyou
@eliredpower9633
@eliredpower9633 2 жыл бұрын
I love you bro
@charlesklein7232
@charlesklein7232 6 жыл бұрын
im confused? clearly, your audience is more educated then me. im interested in how to do what you are talking about doing using arduino with "PYSERIAL" which is a program. in order to use python you need a program to run it. two are "ATOM" and "PYCHARM" however their is something called "PYSERIAL" would you consider doing a video on how to get these programs to work, how to install them! im running Ubuntu 16.04 on 64 bit and i have "pIP" but am confused about what to download from pyserial. sorry for my "BABBLING," clearly, im confused. it appears your are doing this manually probably using an "idle" notepad that comes with python.
@WaveShapePlay
@WaveShapePlay 6 жыл бұрын
Hey Charles! Pyserial is a 'module'. A module is code that someone wrote, for the purpose of re-use. We can utilize modules that are already created, so we do not start our programs from scratch. PYCHARM is an integrated development environment (IDE). The IDE allows us to write programs and run them. We use a combination of our own code and existing modules to create a program, then run the program in the IDE.
@jaredjones6570
@jaredjones6570 Ай бұрын
Great tutorial!! But.. and I'm sorry, I can't help myself, Ar-dwee-no Not Ar-dree-no
@razinrafiqrinuddin1373
@razinrafiqrinuddin1373 2 жыл бұрын
how about receiving from python and reading it on arduino?
@youtuberzp6665
@youtuberzp6665 4 жыл бұрын
when i try to run the code in python 3.7 idle why it is showing invalid syntax?
Serial Communication with Arduino - The details!
16:51
Programming Electronics Academy
Рет қаралды 68 М.
Air Sigma Girl #sigma
0:32
Jin and Hattie
Рет қаралды 45 МЛН
Python GUI for Arduino Control
12:52
Anas Kuzechie
Рет қаралды 41 М.
Use PyVISA to Program Test Tools with Python - Workbench Wednesdays
13:35
element14 presents
Рет қаралды 42 М.
I Made a Tool to Debloat Windows in 2 Clicks
15:01
TotallyNotK0
Рет қаралды 1,1 МЛН
Reading USB in Python
8:12
Alex Lugo
Рет қаралды 133 М.
Hacking a weird TV censoring device
20:59
Ben Eater
Рет қаралды 3,4 МЛН
Making Animations in Python using Matplotlib!
22:05
Younes Lab
Рет қаралды 22 М.