Actual size of serial data
-
Hi,
I'm trying to send a string of 128 digits (which go from 0 to 9) to an Arduino with "Send Serial Data".I would like to have a refresh rate as high as possible (24Hz: perfect 16Hz: Ok 12Hz: minimum).Setting speed at 115200 (tried 230400 but doesn't change anything, maybe limitation on A rduino side?), I can get:24Hz for 8 digits / 12Hz for 32 digits / 6Hz for 128 digitsSo there's clearly a data rate problem here....With my calculation I thought it would be ok, so i'm misunderstanding on either 2 points:-each digit takes more bits than I thought?-My calculation are wrong?If anybody as a tip to improve this that would be great, I'm definitely not a hardcore programmer, so I'm going in circles right now!thanks!Maxime -
Dear Maxime,
Well, I am guessing that changing the baud rate setting doesn't really matter since you're going over USB. It's simply to make it compatible with the old systems that actually used a wire. (I'm not certain about this... but I think it might be true.)Regardless, if your sending 8 bit data, and no parity, then it's 10 bits per character. So 1280 bits * 24 x per second = 30720\. So your baud rate doesn't need to be very high.My fear is that you are overloading the input buffer of the Arduino. Is there any documentation on that? The arduino must be able to empty the buffer as fast as you send the data. Depending your Arduino program that might not be happening.But really, the data rate isn't so high. So I don't think it's a simple matter of not having enough bandwidth -- unless the Arduino is actually limited to something less than 30kbits/second.I'm not sure how to help you further on this one. You could post your Arduino program I suppose.Best Wishes,Mark -
Thanks a lot @mark for this suggestion, I didn't think about that before.
I've red that the default buffer size on Arduino is 64 bytes.You can apparently change it, and I tried but it's not changing anything so far, so it's hard to know if I didn't manage to change the buffer size or if it's just that the problem is somewhere else.For the baud rate, you were right, I can go down to 38400 without any change.I've attached my (ugly) arduino code.The idea in the end, is to control 128 leds brightness with these values i'm sending.The problem could also come from the refresh rate of my led driver chip (Tlc5940), but then i should have this problem no matter how many values i'm sending, right?thanks for your help -
Dear Maxime,
Just to let you know, I've got a trillion Isadora tasks to handle also. I'll take a look if I find some time, but maybe some other users here can help?Best Wishes,Mark -
Yes of course, everyone's help is welcome! :)
-
Ok, so the problem is solved, I just had an unfortunate delay lost in my arduino code that caused the issue.
Everything is working perfectly now!