Unable to send long string to Dashboard

Hi everybody, I’m working for one of the projects of the Nova contest and we are having some troubles trying to send our string using the Python SDK.
We were trying to send a JSON of about 20kB and somehow the socket failed, so I started from the beginning and tried to use the CLI to send a long string (instead of Python SDK) and we have the same issue.
We’ve found that we can not send data longer than 432 characters… I’m not sure if my dev environment is the problem or may be there is some kind of limitation.

Dev environment: Raspberry Pi Zero W (with Raspbian Lite) + Nova Hologram.

This is the error message we are getting:

Thanks!

Seba.

I got support from Ben via https://hologram.mobilize.io/main/groups/18359/lounge/posts/139454

Hope it helps you too!

I got it working! YAY! So the initial issue I was running into was with the modems AT commands not supporting long strings. That must be a Ublox limit. I instead opened a PPP session to our socket server. I was able to send any size file that way. Here is a Gist of my simple script. Hope this helps!

Example using base64 encoding to send a image over cellular on a Raspberry Pi with Hologram.io · GitHub

Hi @Seba_Gondor , sorry for the delay.

@Dillon1337 you beat me to this by seconds LOL!

1 Like

Hello! Thanks @Dillon1337 and @benstr for the support! I was trying some code using .connect() and it works, now I can send long strings, but I still having problems if the string is too long, when I try to send it I got the next error:

Send result: Connection was closed so we couldn't read the whole message

And then in the dashboard I only got a partial string, not the full string.

Basically what I do is the following every 60 seconds:

# Connect only if not connected
 if (connection_status == 0):
	connect_status = hologram.network.connect()
	if(connect_status == False):
		print ("Connection failed")
		return
	else:
		print ("Connected to network")

# Send message
response_code = hologram.sendMessage(_message, topics=_topic, timeout=_timeout)
# Log send status
print ("Send result: {}".format(hologram.getResultString(response_code)))

Thanks again for your answers! I hope you can help me with this too.

Thanks, @Seba_Gondor for reporting back. Depending on the string size and network strength you may need to wait longer than 60 seconds for the message to upload.

We’ll do further testing on our end. As a quick fix could you slice your message into small chunks before sending?

substring1 = _message[0:10000] #first 10,000 characters
substring2 = _message[10001:20000] #second 10,000 characters
# etc

You’ll probably want to put that in a while loop to iterate over the string. Also, make sure you do not send all the messages at once. The modem cannot handle that. So another loop or if statement to trigger a new hologram.sendMessage() after the previous succeeds. To keep them in proper order maybe use different topics??

Cheers

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.