esp32cam

chandana
Posts: 5
Joined: Sat Mar 21, 2020 6:58 am

esp32cam

Postby chandana » Sat Mar 21, 2020 7:08 am

how to take photo and send to server when interrupt is called without storing into sdcard of esp32 cam??

PeterR
Posts: 311
Joined: Mon Jun 04, 2018 2:47 pm

Re: esp32cam

Postby PeterR » Sat Mar 21, 2020 11:33 pm

Seems that you have a code example which saves a CAM image to sdcard?
If so then you could convert the example as follows.
On interrupt trigger the capture process. You should wake a task which captures rather than capture from ISR. ESP drivers do not generally work well from an ISR.
Next use VFS to capure the example's file image fwrite() calls. This should just require that you change the example's path name and add a VFS driver. You probably only need to add fopen() and fwrite() methods. This way allows you to avoid changing the CAM capture code.
Now sending to a sever has a whole range of possibilities. You did not say which server so I will duck the complicated ones and suggest TCP.
That has you using TCP accept to allow your server to open() and then TCP send() when vfs file fwrite() (using Berkley sockets). Symantics a little weird as the server must connect first. I am guessing that you can ignore this reality and simply tell the capture routine that the file open/write have worked regardless of server connection (and drop data). Does capture care if the file does not exist? I doubt it. If you must save every image well given you have a remote connection then you need offline storage and 'every' becomes 'every I have room to store'. In that scenario an ESP FTP client file store may be better.
Pretty simple all the same.
You could also make a FTP VFS and so transfer a file to the server. You could also HTTP post a file etc, etc. Realy depends what is catching the file server side.
IMHO Berkley sockets will provide a near one:one relpacement of file I/O and so an easy client side implementation.
Server side is usually easier to arrange.
Anyway each part is testable in its own right. You can create a TCP/HTTP/etc VFS and bench test '1234' transfers before adding the capture routines. Nice n decoupled.

chandana
Posts: 5
Joined: Sat Mar 21, 2020 6:58 am

Re: esp32cam

Postby chandana » Sun Mar 22, 2020 5:00 am

Thanku for the reply
Can I get arduino code of that example??

chandana
Posts: 5
Joined: Sat Mar 21, 2020 6:58 am

Re: esp32cam

Postby chandana » Tue Mar 24, 2020 7:12 am

why interrupt is not working consistently with esp32cam??
why interrupt is not working properly with esp32cam. Sometimes it is working sometimes it is not working,may i know the reason for this issue

Here is my code


const byte ledPin = 14;
const byte interruptPin = 2;
volatile byte state = LOW;

void setup() {
pinMode(ledPin, OUTPUT);
pinMode(interruptPin, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(interruptPin), blink, CHANGE);
}

void loop() {
digitalWrite(ledPin, state);
}

void blink() {
state = !state;
}

ESP_Sprite
Posts: 3262
Joined: Thu Nov 26, 2015 4:08 am

Re: esp32cam

Postby ESP_Sprite » Tue Mar 24, 2020 8:16 am

How is the interrupt wired? If it is to a button, you may be seeing switch bounce and you need to debounce that input somehow.

chandana
Posts: 5
Joined: Sat Mar 21, 2020 6:58 am

Re: esp32cam

Postby chandana » Tue Mar 24, 2020 8:30 am

Interrupt is not working with esp32cam may i know the reason. It is working fine with other boards(arduino uno ,esp32)
I am trying to work with interrupt by shorting that pin not with button, i kept led to check my output and by touching interrupt pin with male wire iam checking interrupt.

ESP_Sprite
Posts: 3262
Joined: Thu Nov 26, 2015 4:08 am

Re: esp32cam

Postby ESP_Sprite » Tue Mar 24, 2020 1:52 pm

That bounces even worse than a button. Again, refer to button debouncing techniques to solve this.

chandana
Posts: 5
Joined: Sat Mar 21, 2020 6:58 am

Re: esp32cam

Postby chandana » Mon Mar 30, 2020 6:21 am

Thanku for the reply

Who is online

Users browsing this forum: Bing [Bot], chris007 and 43 guests