Skip to main content
Share Your Experience: Take the 2024 Developer Survey

Questions tagged [python]

Python is a programming language. Use this tag for questions regarding how to use Python with your Arduino, or on using of pySerial or such software. Also consider using [programming] and other specific tags.

Filter by
Sorted by
Tagged with
-1 votes
0 answers
9 views

LSM6DSOX OSError: [Errno 5] EIO for RP2040 Micropython

I am trying to get the IMU unit to work on my Nano RP2040. I get these same results on multiple Arduino Nano RP2040s I installed the python library into the rp2040 using the command ./mpremote.exe ...
SomeoneElse's user avatar
-1 votes
1 answer
133 views

Reading serial data from Arduino in Python continually

Using a stepper motor and a range finder (TFLuna), I am trying to build a "Lidar" (like a Radar, but with light). Here is the algorithm: Turn motor one step, calculate angle, measure ...
Matthias's user avatar
  • 101
0 votes
1 answer
227 views

Python script cannot connect to serial port

I want to control the LEDs with my hand, for this I used the repository https://github.com/paveldat/finger_counter/tree/main. I want to control the LEDs with my hand, for this I used the repository. ...
Дмитрий Насонов's user avatar
2 votes
1 answer
71 views

Micropython installation on Arduino nano

I am currently trying to use micropython on an arduino Nano 33 BLE using MacOS. Following the instructions from arduino website I was able to complete steps 1-3. At step 4, I can find the bossac file ...
Saif's user avatar
  • 21
0 votes
1 answer
93 views

How to fix UnicodeDecodeError when using Serial.println

I am using an Arduino Uno R3 to send instructions to a serial monitor in a Python program with Serial.println. But when I send a specific line, I get a a UnicodeDecodeError. The line in the Arduino ...
stanley's user avatar
  • 107
3 votes
1 answer
269 views

How to ignore garbage values in serial communication between arduino and python

I have arduino uno. I am trying to send and receive serial data from arduino to python. I have usb to uart converter. I have connected its tx to rx of Arduino and rx to tx of Arduino and gnd is ...
S Andrew's user avatar
  • 183
5 votes
1 answer
682 views

ESP32 SocketIO Client is not connecting to Flask-SocketIO Server

I'm trying to connect a ESP32 client using SocketIO with a Flask-SocketIO server and it's not getting connected. The server uses SSL. The local server address is https://192.168.1.137:3000.Is the ...
Shyam3089's user avatar
  • 165
2 votes
0 answers
114 views

Connecting Arduino Mega 2560 to Python with PyFirmata

I am currently controlling two servos using the Arduino IDE, but now need to integrate my Arduino code into a Python script. I read about how to use PyFirmata and went through the process of uploading ...
Eeshan Mishra's user avatar
1 vote
1 answer
127 views

Sending values with pyserial does not function if there is also sensing on Arduino Due

I'm using an Arduino Due to make a feedback loop using python, but this does not seem to function. The python code I'm using is the following: from serial import Serial board = Serial('COM11',9600) ...
celestin's user avatar
2 votes
0 answers
392 views

Sending an image captured using ov7670 using arduino and serially transmit it to python

I am working on using an ov7670 camera module with arduino uno,capturing the image frame wise and transmitting the image serially line by line of each frame to python for image processing, however i ...
Gunjan's user avatar
  • 29
1 vote
1 answer
202 views

CircuitPython - how to connect Adafruit esp32 AirLift with Adafuit HttpServer - incompatible socket object

I am building a CircuitPython weather station based on Adafruit M4 board stacked with Adafruit ESP32 AirLift module. Both work fine together when it comes to making http calls (via Adafruit_requests ...
smoczyna's user avatar
  • 125
1 vote
0 answers
100 views

Converting more strings from serial monitor to int arrays

I want to transfer 8 lists from a python script, via Serial Monitor to the Arduino. I can get the strings to Arduino and Arduino saves them as String array, but I can't change it to integer (it shows ...
PNarduinouser's user avatar
1 vote
1 answer
944 views

What is the best (fastest and most robust) way to send messages back and forth between Python on a PC and an Arduino, over serial?

I am trying to communicate between a PC running Python using PySerial and an Arduino. The Arduino itself has a CAN shield, and is responsible for interfacing with a motor. My goal is for the PC to ...
ITregear's user avatar
-2 votes
1 answer
222 views

Serial communication between python and Arduino nano BLE sense 33 for running six DC motor

I am controlling six DC motors by varying their voltage. I have figured out the voltage required for each motor in python; now it's time to send this voltage through Arduino Nano BLE Sense 33 to run ...
Vishal Naik's user avatar
-1 votes
1 answer
104 views

Constantly Stream data vía Bluetooth to monitoring

I am using a Bluetooth module HC-05 to Stream data from Arduino to My computer. In they computer I am using a python script to receive They specifications: Baud rate: 9600 But I am getting an error. ...
Elí Flores's user avatar
1 vote
0 answers
1k views

ESP32 wifi server with multiple clients

I have a program where I configure my ESP32 as a server and it sent randomly generated data, the problem is that I can only connect 1 client at a time, what I want is that multiple clients can connect ...
Eduardo23484's user avatar
0 votes
1 answer
261 views

Using pyFirmata with a 360° servo; how do I stop it?

I am testing out pyFirmata. I have a 360° servo, and know how to change its direction, but I dont't know how to stop it. What command, like servo.write(), would work to make it stop moving until ...
JDogJunior's user avatar
1 vote
1 answer
1k views

Sending float values from Python to Arduino using Serial communication

I need to send an array of floating-point numbers from python to Arduino Mega. For that, I read many sources [this this this this this] this] and many more links for the same I referred. But unable to ...
Naseeb Gill's user avatar
1 vote
1 answer
386 views

Pan and tilt bracket move to sound, control servo motors using microphone sound sensors

I'm trying to code the pan and tilt bracket to turn based on where I speak, I know how to move the servo motors, but I really need help with the sound sensing. This is the code I've got currently: #...
Kevin Zefi's user avatar
0 votes
1 answer
58 views

Controlling Arduino through python

How to set the registers of Arduino through python code to vary the sampling rate of Arduino? Can we control Arduino through python?
varman's user avatar
  • 21
1 vote
1 answer
658 views

`time.sleep` in python script reading serial output causes erratic behavior

I am attempting to control the position of my computer's cursor using a potentiometer hooked up to my arduino nano. The arduino is running the following code: int potPin = 3; // select the input ...
Manav Bokinala's user avatar
3 votes
2 answers
866 views

get data from arduino using python

I am trying to read potential meter data from Arduino using python, with the program on Arduino as follows : #include <cvzone.h> SerialData serialData; int sendVals[2]; void setup() { ...
M. Al lail Qadrillah's user avatar
1 vote
0 answers
248 views

I can get arduino code/board to show voltage using analog input but not python/board

I am trying to simply read a voltage from a battery. I am able to work out how to do this using arduino code on an arduino board. (UNO) When I try to do the same thing on a board using python the ...
user avatar
1 vote
0 answers
29 views

Serial communication between Python & Arduino: [duplicate]

I need to transfer information between pyton script and arduino. Data is always built like this "wheelbase:1000" wheelbase can be another word and 1000 can be another value, : is always the ...
vib's user avatar
  • 113
2 votes
0 answers
503 views

esp8266 wifi/ read serial data with python

I'm trying to read some serial (ADC) data from my esp8266 nodeMCU v3 over wifi using python. I connected the esp on my local wifi and set it with fixed local IP using arduino IDE, but I couldn't find ...
Joe123456's user avatar
1 vote
1 answer
187 views

opencv reading the display and doesnot provide serial communication with arduino

I was creating a project where the following part of the code reads certain area of the display(which i screen shared from mobile) import cv2 as cv import numpy as np from PIL import ImageGrab import ...
Akash's user avatar
  • 13
2 votes
1 answer
196 views

Arduino randomly stops sending data to python over serial

I want to send commands to Arduino over USB Serial from my python program and Arduino should send back received command to make sure data wasn't lost. However Arduino randomly stops sending data back. ...
Wisien's user avatar
  • 41
1 vote
1 answer
345 views

How do I control a servo with python through an Arduino

I'm trying to make it so I can control 2 servos with data that I get from a python script that tracks my face. I have found 2 libraries that do this:pySerial and pyfirmata. Is one superior to the ...
WaddleBoy's user avatar
1 vote
0 answers
542 views

Pyfirmata util.Iterator causes serial communications issues with more than one Arduino

I'm using two Arduino Megas in a project to read data from a bunch of analog sensors and then output PWMs on digital pins according to their value. These analog signals are also being plotted on a ...
Han Zhang's user avatar
1 vote
1 answer
379 views

Arduino , python , pyfirmata , standard firmata

Is there a way to change arduino analog reference to EXTERNAL IN PYTHON using pyfirmata or any other library ? Necessary Links : https://www.arduino.cc/reference/en/language/functions/analog-io/...
Shahan hasan's user avatar
2 votes
0 answers
55 views

Initial setup print getting cut off from printing

I am writing a program in Python (using PySerial) that needs to read data from the Arduino quickly. For this reason I have set the serial timeout to 0.01 seconds. (Baud rate is 115k) If I don't set ...
ngpop's user avatar
  • 21
0 votes
1 answer
47 views

How to receive commands to a running arduino program from a raspberry pi?

I have looked all over for a solution to this. I'm a noob in the arduino space and am really just getting my feet wet. It's possible that I am interpreting what I am reading wrongly. If so I apologize....
Dan's user avatar
  • 103
2 votes
1 answer
276 views

What is the difference when an arduino has been unplugged vs when a serial port connection was closed?

Using python code for a serial port connection to an arduino, it sends a value to the arduino, which then starts printing values to serial. The python code will print the value on the first or second ...
user14094230's user avatar
1 vote
1 answer
823 views

How to use pyserial to write two separate message?

I'm using pyserial to communicate with my arduino. I set up the connection and everything works fine. Now I have these two writing commands: pyserial.write("conn".encode()) pyserial.write(&...
Ai4l2s's user avatar
  • 161
1 vote
1 answer
3k views

Why do I need to use latin-1 instead of utf-8 when using python with arduino?

When reading and writing with a python serial port connection to arduino, if I don't use latin-1 ('ISO-8859-1'), the results are not as expected. Like if I have int outP = 5; //... int outV = Serial....
user14094230's user avatar
0 votes
1 answer
352 views

5V pin out, 8 pins and micropython/circuitpython support: does such a board exist?

For a project, I am looking for a board to connect eight different neopixel-strips to, on eight different data pins. Because of the great length between the board and the first pixels of these strips, ...
Bart Van Loon's user avatar
1 vote
0 answers
172 views

Computer freezes while collecting serial data from Arduino Uno

I am an arduino noob. I have been searching for some interesting arduino projects recently and making a game controller using Arduino UNO seemed interesting. So I hooked up two dual-axis joystick ...
Mukesh M's user avatar
-2 votes
1 answer
907 views

How to fix "expected primary-expression before '%' token" error code? [closed]

I'm trying to use this code to get temperature and humidity values from DHT11 sensor and send it to Python and I need to write the temperature and humidity values in the same line. But I keep getting ...
vueenx's user avatar
  • 19
-1 votes
2 answers
256 views

How can I execute a string in my Arduino Uno board?

I was making a project with Arduino Uno , It's working is like this it connects to a key pad and a 7segment display ,and when you press a run button connected to Arduino it should run the code written....
Aryan Bhosale's user avatar
1 vote
1 answer
1k views

ESP8266 SocketIOclient constant disconnect with Python WebServerSocket

I am writing a program that echos back the message sent to the web socket server on a host machine. When running the ESP module, the connection is established but immediately disconnects as seen in ...
John Mason's user avatar
1 vote
1 answer
240 views

EEPROM programmer works with serial monitor but not with pySerial

I'm trying to modify Ben Eater's eeprom programmer to flash a 32K eeprom, since the arduino has 32K of program data total the data wouldn't fit in the program. So I wrote a python program using ...
bobbbob's user avatar
  • 21
2 votes
1 answer
113 views

share enum between python and arduino

I have created a gui in python that allows an arduino controlled mecanum wheel cart to move around. The cart allows for 8 different move directions and can rotate left and right. Commands are sent ...
juerg's user avatar
  • 121
2 votes
0 answers
54 views

Two LED Patterns Task Controlled by GUI

I am very new to Arduino and coding/programing. I set a task for myself to make a simple circuit of 5 LEDs controlled by pins 2, 4, 8, 11, 12. I want to be able to make two different pattern for the ...
Tayler Hasson's user avatar
2 votes
0 answers
2k views

Reading JSON from Arduino over serial in python and writing to a JSON file on computer

I'm fairly new to Arduino so I used a sample code before integrating this into my main code. I'm printing my value in a JSON format over serial. My Arduino outputs this and the python receives this ...
Mike's user avatar
  • 21
1 vote
0 answers
47 views

My servo wont follow my cam

So i am trying to make the servo follow my face which will end up my camera following my face But the servo isnt doing anything please look at this (Also im only using Horizontal because I would like ...
Darkziken's user avatar
1 vote
0 answers
160 views

Connect and detect multiple arduinos using firmata

i am trying to connect several arduinos to usb ports and have the abillity to define between them. i added Firmata.attach function on the arduino board. how do i call it from my python script? thank ...
Nir Ben Zeev's user avatar
1 vote
0 answers
157 views

Arduino code equivalent for python code binascii.unhexlify command

I want to convert a hexadecimal string or an array of bytes to binary data. For example, if i have a string like '424D368403' my output should be like b'BM6\x84\x03' The python code binascii.unhexlify(...
Sashi Kant's user avatar
1 vote
0 answers
198 views

Change arduino output from input

I'm trying to change values such that the arduino uno outputs comes from what is input, with the code, int PinOutput = 11; int PinInput = A0; int inph; int inpl; int input; void setup() { // put ...
user14094230's user avatar
1 vote
1 answer
1k views

wdt reset cause:4, boot mode:(3,6)

I'm working on Python and nodeMCU with websocket connection. So, I send a string from Python to nodeMCU and nodeMCU collects the string and decodes to set values to a stepper motor. Initial code ...
Ihsan's user avatar
  • 11
1 vote
1 answer
421 views

Best way to ask Arduino for data from Python?

I'm trying to send numerical data from inertial sensors from my Arduino to a Python script via serial (PySerial). I found that if I continuously send the data from the Arduino without stopping, the ...
james_erikson's user avatar