Welcome new user! You can search existing questions and answers without registering, but please register to post new questions and receive answers.
Welcome to JeVois Tech Zone, where you can ask questions and receive answers from other members of the community.

How to Transfer a .jpg file via Hard serial from the A33 microSD to an Arduino (to store there as a .jpg file)

0 votes
Hi,

What I want to do with my A33 cam is: I take a Picture and save it as a .jpg file on the A33 microSD card. That is not a problem. But after this I want to send this file via Hard serial to my connected Arduino. How can I do it? Do everyone have a Python sample code and on the other side an Arduino sample code for it? I have a solution for a cam VO0706 connected to an Arduino (Here I only have to send some parameters to the cam and then receive serial datas which I have to connect and store on the Arduino microSD card.

I would be thankfull for an answer.

Regards

Peter
asked Feb 17 in Programmer Questions by Peter (340 points)

2 Answers

0 votes
Which Arduino are you using? And what libraries are you using to transfer the JPG? The Uno that I'm familiar with doesn't have any concept of storing files and doesn't have a SD card.
answered Feb 18 by PeterQuinn (1,000 points)
I am using an Arduino Mega 2560 with an aditional microSD card board. It is working. In the Moment I use a OV0706 cam and they have diferent libraries. But I want to transfer the File from a A33 cam to my Arduino.
Regards
Peter
0 votes
maybe not the nicest way to do it, but here is how i would tackle the issue (i used a similar approach, albeit not with jevois <-> arduino)

On jevois/python side, you convert the open cv image to a jpg byte array, then to a base64 string. Finally dump the image on the serial link like this:

img:dXNlIHJhdyBqcGcgZGF0YSBpbnN0ZWFkIG9mIGR1bW15IHRleHQgaGVyZQ==\n

Then on the arduino side, it shouldnt be very hard to decode that back to raw values to be written on a file on your SD card.

I do not have a JeVois cam nearbyt to check python base64 support with bundled libs, but i think the following code should work out-of-the-box

C:\Users\user>python -c "import binascii; data=b'use raw bytes of your jpg here instead';  print(binascii.b2a_base64(data).decode('ascii').strip())"
dXNlIHJhdyBieXRlcyBvZiB5b3VyIGpwZyBoZXJlIGluc3RlYWQ=

C:\Users\user>

Do keep in mind that using base64 will likely add 33% of extra bytes on your serial communication link compared to raw binary. It's unlikely you will get realtime stream. dunno if those limitations suit your usecase. At least that's how i would handle it.
answered Feb 20 by fourchette (550 points)
...