I want to send string 50 to Arduino through serial port, the Arduino UNO seems it communicates with port COM25 but it doesnt receive the string properly:

import serial # if you have not already done so

ser = serial.Serial('COM25') 
ser.baudrate = 9600

Btw Arduino code is correct I checked it with other serial com programs. How can I fix the above code?

  • 2
    serial.Serial() resets Uno and it spends some time in bootloader after then. add a delay/sleep after serial.Serial
    – Juraj
    Nov 21, 2018 at 16:35
  • I dont understand ;so how can I send string in Python as done in hyperTerminal? My Ard code works with hyperTerminal but I have been looking for a day and couldn't find a code which work for Python.
    – floppy380
    Nov 22, 2018 at 11:37
  • you need to wait 2 seconds until sending something over that Serial from python. Serial Monitor resets the Arduino too when opening a connection. At opening of window, not before every sent data
    – Juraj
    Nov 22, 2018 at 11:55

1 Answer 1


The AVR Arduinos (Uno, Nano, Mega) have auto-reset function. At opening of USB connection the circuit around USB resets the MCU. After reset the bootloader waits a second for a new upload. If the upload doesn't happen the bootloader starts the current sketch.

The serial.Serial() command in python opens the USB connection. With that the Arduino is reset and waits in bootloader while you send the data. The data doesn't arrive in your sketch. Add a two seconds wait time after Python's serial.Serial().

  • Thanks for this answer. This was driving me nuts. Alternatively, I added a line in Arduino setup() to send a byte and waited for that in python to get things started.
    – SaTa
    Oct 13, 2019 at 16:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.