esp32cam
Re: esp32cam
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.
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.
& I also believe that IDF CAN should be fixed.
Re: esp32cam
Thanku for the reply
Can I get arduino code of that example??
Can I get arduino code of that example??
Re: esp32cam
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;
}
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;
}
-
- Posts: 9739
- Joined: Thu Nov 26, 2015 4:08 am
Re: esp32cam
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.
Re: esp32cam
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.
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.
-
- Posts: 9739
- Joined: Thu Nov 26, 2015 4:08 am
Re: esp32cam
That bounces even worse than a button. Again, refer to button debouncing techniques to solve this.
Who is online
Users browsing this forum: No registered users and 88 guests