Replies: 9 comments 9 replies
-
|
Thanks for reporting tthis. I don't have the resources to run that number of analog inputs, but this suggestion may solve the issue. You can change the analog input scan rate by calling set_analog_scan_interval The default scan rate is 19 ms. Please let me know if this solves the issue. |
Beta Was this translation helpful? Give feedback.
-
|
Thanks a lot, but I am currently using the pymata4 with firmata-express :(. Also wondering why you decided to use the polling mechanism for reading analog input and digital input. Is it because you want to increase the speed of the python reading value of analog and digital pins? |
Beta Was this translation helpful? Give feedback.
-
|
Hi Tony, |
Beta Was this translation helpful? Give feedback.
-
|
I just realized your post says the RX pin. What commands are you sending from Python to the Arduino when the issue occurs? Have you tried adding a small delay between sends? |
Beta Was this translation helpful? Give feedback.
-
|
Also, the RX bytes missing issue can be solve by using an external USB to TTL converter. But another issue come up when using external one, which is return value of analog_read and digital_read methods from python site is not correct. I guess the TX from Arduino to USB have another problem, but I did not research more into it. |
Beta Was this translation helpful? Give feedback.
-
|
I think I may find the answer. Previously I run pymata4 on Raspberry PI and I did another test which run the same pymata4 script on Window device. The Arduino RX sometime still having some bytes delay, but it happened less frequent. In my point of view, this may because of Raspberry PI and Window device they are not Real Time OS. But PI compared with Window it runs a little slower such that the problem occurring much more. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
|
But I still have a question about firmata-express. Since once it received the header, it will just wait for number of data bytes and response to it https://github.com/MrYsLab/FirmataExpress/blob/7149014763f3e0395ca9f718c4b523c56c2065e1/FirmataParser.cpp#L159 But from the screenshot, Arduino did not change PIN 14 value by more than 0.5 second. Keen of interest to know if you can explain it a little bit :) |
Beta Was this translation helpful? Give feedback.
-
|
I am glad that it is working out for you. |
Beta Was this translation helpful? Give feedback.


Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have config 15 Analog pin to be analog input pin and then I found sometime Arduino did not received correct message that I sent from Python. (I have verified the message send from python is correct)
It seems like a problem with continue reporting back analog pins and digital pins from TX back to python. The RX sometime will lose few bytes.
So, I used oscilloscope to monitor RX pin from Arduino, and sending [0x91, 0x40, 0x00] and [0x91, 0x00, 0x00] each 0.5 second. But sometimes it will drop the last or last two bytes.

This problem can be solved by changing the baud rate from 115200 to 9600, but then for those pins be config as analog input become a problem since the baud rate is dropping. Another way to hide this issue is only setting one or two pins to be analog input pin.
I also try to use an external USB to TTL converter to bypass this issue, it kind of fix the RX issue but the data sending back from Arduino to python is not correct at using the original USB to TTL converter micro in Arduino.
Beta Was this translation helpful? Give feedback.
All reactions