0

Publish picture from Arduino into a feed
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Publish picture from Arduino into a feed

by sundukevi4 on Mon Apr 25, 2016 6:02 pm

Hello guys,
I am trying to make my arduino (Huzza) publish a picture from ArduCam to Adafruit IO feed.
First I took some pic and converted it into base64 by some online converter. Next I manually added resulted long string into the feed. Eventually I saw the picture on my Dashboard. That's how I checked it works in general.
Publishing simple integers works like a charm, but task with a picture seems to be too complicated for me.
I know you provide some program for Raspberry Pi to publish pics into IO feed. But is there way to do it on Arduino?

Any help please?
Thank you!

sundukevi4
 
Posts: 2
Joined: Wed Mar 23, 2016 8:14 pm

Re: Publish picture from Arduino into a feed

by jwcooper on Thu Apr 28, 2016 11:47 am

Unfortunately, I don't think the Arduino would have the processing power to convert an image to base64, and the long strings would likely cause memory issues. The raspberry pi or more powerful devices are definitely what I would suggest for this workflow. If someone else has success with this, please reply with a solution though!

jwcooper
 
Posts: 666
Joined: Tue May 01, 2012 9:08 pm

Re: Publish picture from Arduino into a feed

by sundukevi4 on Sat Jan 14, 2017 1:31 pm

So it's been a while since I started with this task and eventually I got it done.
That's how it works in general:
1. install on laptop/router your own mqtt server - for example mosquito
2. make your arduino publish to this server your picture by small chunks, 128 bytes for example. You have to use some kind of protocol to sign the start and the end of specific image. I send 'S' char for first chunk of image and an 'E' char for the last one.
3. write script in python that is subscribed to the same feed (use paho-mqtt library) and put your image from chunks back to a whole one.
4. after the image was assembled - publish it to adafruit.io

So it goes like
a. start reading from camera buffer by 128 bytes
b. send 'S' by mqtt - python script creates a new file
c. send 128 bytes of data by mqtt
d. send 'S'
e. send 128 bytes
.... we reached the last packet
f. send 'E' - python waits for next packet and closes the file
g. send last bytes of data
h. encode picture into base64 and publish to io.arduino feed

As a bonus - add another feed to be used as a logger to publish messages from arduino device to io.adafruit (pic is captured, image is sent, etc..), to trigger image capturing from feed in io.arduino (arduino device subscribes to this feed and checks whether the value you add to the feed should trigger the camera)


Another approach would be to purchase SRAM chip/shield to extend available memory and use SPIRAM library but I didn't have a chance to try this.

Best regards

sundukevi4
 
Posts: 2
Joined: Wed Mar 23, 2016 8:14 pm

Re: Publish picture from Arduino into a feed

by RayAE86 on Sat Jun 15, 2019 6:10 pm

Hi, how can this be programmed for Arduino IDE? I'm using Feather Huzzah and I'm trying to accomplish the same operation using Arducam 0V2640. I can make feeds, triggers, and dashboard to Adafruit IO with PIR, IR, and reed switch, but this one (camera file saving and retrieving to/from the internal flash memory), I've been clueless where to start. Any guidelines available for this task would help. Thanks!

PS
I can make the Arducam function as posted from their site - sending to url or camera app via Wi-Fi. Saving and retrieving from flash memory is where I'm clueless.

RayAE86
 
Posts: 2
Joined: Wed Apr 10, 2019 12:14 am

Please be positive and constructive with your questions and comments.