Sending Data from an Arduino to Python | Pyserial | DHT11
Вставка
- Опубліковано 10 лют 2025
- Sending Data from an Arduino to Python Tutorial | Pyserial | DHT11
This video will look at how sensor data can be transmitted from an Arduino to Python via the serial port. The Pyserial and Schedule python libraries will be used, along with a DHT11 sensor.
--------------------------------------------------------------------------------------------------------------------
Arduino and Python scripts
Arduino code:
github.com/Cha...
Python code:
github.com/Cha...
Circuit diagram:
github.com/Cha...
---------------------------------------------------------------------------------------------------------------------
DHT11 Sensor:
www.amazon.com...
---------------------------------------------------------------------------------------------------------------------
Intro music:
Happy Rock
Attribution license: www.bensound.com
----------------------------------------------------------------------------------------------------------------------
Thumbs up and Subscribe Icons are made by
Pixel perfect from www.flaticon.com
-----------------------------------------------------------------------------------------------------------------------
Hope this video helps.
If you have any questions, please leave a comment, and don't forget to like and subscribe.
Cheers!
Solved all my problems in such a short video. Amazing!
Very clear and precise video. I appreciate it. In all the videos I have watch on how to send data from Arduino to Python this one actually clearly defined the steps and why we do what we do.
you are genious explaining this things to others, thank you
Thanks, I was just looking for this .
Up and running reading data from the Arduino in less than 10 minutes. Thanks.
This person just saved my degree🤣🤣🤣
Superb..work dude....👍👌👏👌👍👌👏👌👍👍👌👌👏👍👍......and I subscribed..too...I will encourage..to my extreme...as we have the same...passion..and interset.....anyway....all the very Best from Electrical Coder 👍
Thanks and my pleasure
thankyou for the tutorial
very helpful, thanks!
I want to use a 16 to 1 mux chip with an arduino to read 16 voltages continously. This video will help in accomplishing that
Thank you!
good video mate :)
good job
thank you
In python codes, what if I want to split multiple data values, for example I have 3 sensors reading. So what codes need to be done? it is the same?
Thanks for help you . It doesn't work for Atmega 2560,
receives erroneous information from serial . Do you have a solution please?
Why open and close the serial port in a loop? Why not open, enter a loop, close when loop finishes? Is there some disadvange to keeping a quiet serial port open?
So the values sensor are in
list_variables [1]
list_variables [2]
???
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????
can we do the reverse?? like send a string of data to arduino because i wanted to send my x and y stepper values to the arduino from python
Yes, you can try the arduino.write (variable_name) attribute of the Pyserial lib
Thanks for the video.I have question.How can we do this without Arduino USB cable? How can we communicate python and arduino without cable?
You could use a wireless USB cable, but the computer must be connected to the arduino via an USB cable in order to get the data from the python code.
Can we add a counter to the values that are being read from arduino?
why should the connection be re-established everytime as shown here?
is there a way to constantly read the arduino without it pausing everytime it reads
Greeting
How can i transfer data from Arduino serial monitor to website automatically.
Why your (-) of HDT11 is connected to 3.3V?
then what if we want to send data from Arduino via the internet, please explain how, thank you
You would need a WiFi module to connect the Arduino to the internet. You can use an ESP8266 module or a NodeMCU (ESP 12) to do this.
thanks, tried this but was only able to get it working by using
arduino_data = arduino.read()
instead of
arduino_data = arduino.readline()
Also, I do not get the exact values, decimals, just rounded to the nearest value.
How can i write in the serial port of the arduino tho?
I am getting empty data while reading the lines from serial like empty b ' ' could any one help me on this
can it be done if i want to send data via bluetooth?
Hey. Have you found any solution for bluetooth connection between Arduino and Raspberry Pi then saving the data?!! I have the same problem!!!!
Can we send data from pc to MCU?
Thanks for interesting video.
However, this line in my program: "arduinoData=serial.Serial('/dev/ttyACM0',115200)" gives me
error: arduinoData=serial.Serial('/dev/ttyACM0',115200) AttributeError: module 'serial' has no attribute 'Serial'
I am running my program in a virtual environment (venv) an have imported module pyserial3.5.
have you installed pyserial. If yes and still you have problem then I believe you might have named your python file as serial.py . If that is the case change the name .
i have a error in your arduino code and i cant fixed.
why does my python look so different im confused