Anybody know the character limits when writing via the "Bridge"?

Hello all!

I'm creating a morse code machine, basically the Yun is hooked up to a morse key and sounder, and you can use the morse key to write a message. The Arduino side of things listens for the key to be pressed, and basically does a really simple task of recording the length (time) of the presses as well as the length (time) of the pauses between presses.

After a delay of lets say 10 seconds, the Arduino stops listening for input and takes the string of pauses/presses and sends them to the Linux side via the Bridge.put() method.

The problem I'm running into is that the data can actually be pretty sizable. I'm doing all of the encoding of the morse on the server side (I want to be able to get the "raw" input values so I can graph them, amongst other things), so I send all of the lengths. So the letters "TTTN" for instance become "0b52a1b151a0b49a1b168a0b210a1b216a0b106a1b76a0b0".

Now, I've been able to send some messages with as many as 240 characters (possibly more, that's not an EXACT count), but soon after that I hid a wall and something (not sure exactly where) fails.

So, all of this is to ask: does anybody know what sort of character length limits live within the Bridge library? Or within the String object itself?

Any tips?

Thanks all!
<3

I'm not aware of any limits but memory related. The 32u4 has just 2.5 Kbytes of SRAM while the ar9331 has 64Mbytes
The wall you hit, how did it look like? ( = what problem are you experiencing? losing data?)

Thanks for the reply! Much appreciated :slight_smile:

I guess it is perhaps not a character limit of Bridge itself... I recorded a video where I demonstrate the issue I'm having:

Thanks again for any help! And sorry if the video is a bit boring...

Thank for your video, can you also attach the sketch? Makes it easier to play with it, just in case

Sorry, I was going to do that but forgot!

Everything is in github:

A direct link to the sketch itself is here:

The Python code is here:

Thanks again for any help!!!

OK, so I've improved/simplified that data that is passed, so I have managed to get a few more characters over, but I still don't understand why things seem to be "crashing" when I seem to have plenty of memory left.

Any ideas would be very very much appreciated!

Hi shoelessone,
This is a tangential question: how did you make that video of your issue?
Thanks!

bitfrosting:
Hi shoelessone,
This is a tangential question: how did you make that video of your issue?
Thanks!

Actually I just used QuickTime Player - basically the built in version of QuickTime that comes with OSX.

If you've got a mac, you can open QuickTime and click file -> new screen recording and that's pretty much it.

I also encoded the video using Handbrake (http://handbrake.fr) to make it a bi (TONS) quicker to upload to youtube, hence the semi-poor quality of the video itself.

Well I improved my "encoding" (which is way too fancy of a word for what I'm doing :)), but am still confused/curious about why things might be failing.

To summarize (I'm going to make these numbers up here, for a better idea check out the video :)), I can use Bridge to send 200 characters from the Linux side to the Arduino without an issue, and with ~900b of memory left. I can also use Bridge to send 400 characters fro the Linux side to the Arduino side, without an issue, with say ~700b of memory left, BUT if I try to send 600 characters across then the arduino side seems to "crash" or something along those lines. Things come back after a while, but the code that should read the characters and spit out the free memory is never run.

Again the video probably demonstrates this a lot better, but I understand people may not want to waste 15 minutes of their lives watching it :wink:

Thanks again for any help! <3

I am seeing similar behaviour. I wrote a very simple test to see at what message length things start to crash:

  • the Linino puts random characters using key1 (then waits 3 seconds)
  • the Sketch side gets on key1, and puts the same message on key2 (should happen in the 3 seconds)
  • the Linino gets on key2 and compares with what it had put on key1. If OK, it restarts with a longer message. If it fails it tries another get.

At a message length of 266 (always that length) it seems to FAIL, hereby the resulting script output:

Trying length 262
put AZORBF9S9C8E1V2YR531TS4GOFRN5YHOLCI5T7KAP1E6SLVH3UPK4SVABTLB7RC80JTCHBPEZHK5ZFE183G5GMHHD552DUBTKJD2PPTU5VANVBHFANI01SIDCEK2PN88REU7V0RJX0T0PS8JPDJX988PBF78Y37XYWHHBOL0FGCZ7AXJPXFKF0MKUH5I2EN89EAN1I9NPWEYVKB5DWCL7NWKTDBDXHQ62MCOOHP348SGNO2J5LPHW8TFVAW9E913T9UGN7
got AZORBF9S9C8E1V2YR531TS4GOFRN5YHOLCI5T7KAP1E6SLVH3UPK4SVABTLB7RC80JTCHBPEZHK5ZFE183G5GMHHD552DUBTKJD2PPTU5VANVBHFANI01SIDCEK2PN88REU7V0RJX0T0PS8JPDJX988PBF78Y37XYWHHBOL0FGCZ7AXJPXFKF0MKUH5I2EN89EAN1I9NPWEYVKB5DWCL7NWKTDBDXHQ62MCOOHP348SGNO2J5LPHW8TFVAW9E913T9UGN7
OK
Trying length 263
put DA4VIB5FV9B8K669U3POPSNQHO1U8NI3JWLBG1LW9YW9028ME309HHPCGW39ZQZQYJ43T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Z46EY1Z2NBL3I46244MF88NBPGRUIRREXZWZBS5TFI4XMBZXZVIUR2VLYV9FSHBCMWWQ23TNQ8229RKFWX3Q27APKLWCLP80IDVH0NNQU4HJF2DPG3RN1EYH3FGUFHDS2SH34JH34TITEPPA9IB7QWXV7AMEMNXBK5NMF91026XV2BE9FS1PQPW93CUY4QDOUA29KI
FAIL
got WY8XFBQL8ND0WMVVE1TU409M90YJXC2VMUAD6FSVFUNWD112NPD5ZP389X7SNOIF6D6Z46EY1Z2NBL3I46244MF88NBPGRUIRREXZWZBS5TFI4XMBZXZVIUR2VLYV9FSHBCMWWQ23TNQ8229RKFWX3Q27APKLWCLP80IDVH0NNQU4HJF2DPG3RN1EYH3FGUFHDS2SH34JH34TITEPPA9IB7QWXV7AMEMNXBK5NMF91026XV2BE9FS1PQPW93CUY4QDOUA29KI
FAIL

From that length on it seems the datastore is no longer updated from the Sketch side....possibly it crashed. When resetting the Sketch side things work again.

If anyone is interested, you can find the scripts I used here Yafa! How to make a fermentation controller using an Arduino Yun.: Bridge communication - part1

and with ~900b of memory left

As a side question: how did you find out how many free memory you have?

I was also wondering, if instead of a memory problem, it could be caused by a time-out somewhere?

NewLine:
I was also wondering, if instead of a memory problem, it could be caused by a time-out somewhere?

Hm, Bridge is more on the slower site. So maybe. Have you made tests using more that 3s waiting time?

I tried with different time delays on both sides. Didn't make a difference. As you can see, the data store just doesn't update.

NewLine:
As a side question: how did you find out how many free memory you have?

I was also wondering, if instead of a memory problem, it could be caused by a time-out somewhere?

Thank you SO much for replying here! This is driving me crazy, and it sounds like you are having a similar issue!

The memory question: I'm using a library called "FreeMemory" (or maybe it's called AvailableMemory, I don't know): Arduino Playground - HomePage - see the sketch lines 142/143.

Your testing strategy is great by the way. If it really is a 266 character limit of some sort suppose I could always split up the data into multiple "buffers" or whatever and use Bridge to chain them together, it's just a bit of a pain.

Any luck NewLine?

I've started implementing a buffer, but it's a bit of a pain :frowning:

I abandoned using "long" messages, and will also send them in smaller parts.

Cool, I guess I'll go that route too. Thanks for the response :slight_smile:

Out of curiosity, I was mainly focusing on the transfer from the python/linino side to arduino - did you do any testing the other way around (sending longer messages from Arduino TO the linino side)?

for me, it was exactly the same.
I wanted to transfer 72 characters, but the bridge was after a few hours more and more slowly and then completely stopt. Now i change my project and transfer only 10 characters in time and see what happens

Did you try with new Bridge library? This solved a lot of other problems, maybe this one as well?

do you speak about the library in the new ide 1.5.5 ?
nightly build ?

I meant 1.5.5