I'm new to blender and python. I want to read analog data from arduino to blender. I'm using the bellow code and it works fine. Even though arduino sends data quickly blender reads them very slow(about 800 ms). Does anyone knows whats the mistake I have done here?

ser = serial.Serial('COM3', 9600 , timeout=1)
 sensor00 = ser.read(size=1)
 sensor0 = ord(sensor00)
 print ("sensor0=",`sensor0)

This code is repeated 9 times for 9 other sensors (flex sensors).


1 Answer 1


Serial communication uses start and stop (1,1.5 or 2 bit length) and optionally a parity bit. Assuming it would be 10 bits 9600 bits/s would transfer 960 bytes in a second.

You're reading the data byte by byte.

If you have messages with variable length it would be better to transfer a header containing the size of your message and read this first.


<Header>     <message>
0x0000 0100  256 bytes of data

then you could read first the header (size=4) followed by reading the message at once.

To make the protocol more robust you could introduce a checksum (in the header) and an end-of-message marker which is not contained in the data (or escaped there), this would allow you to recover from transmission errors and re-synchronize.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .