Closed alexw22 closed 4 years ago
Bigger the better I think. 😄
The general solution is to move your power supply closer and connect it with thick wires.
I was using a 6 foot usb from a laptop, through a ftdi, then 2-3 breadboard wires before it got the the +5v pin of the esp32 .... and it world constantly brownout. So I was putting bigger capacitors and multiple capacitors directly adjacent to the +5 and GND on the esp32.
But switch to a 6 inch usb connecting a little 5v power bank and it works great. Or a breadboard power supply with good jumper wires directly to the +5v and GND of the esp32, and it works.
The cap is still useful it you are powering it from a battery and the battery is getting weak but still able to power the circuit, but the wifi radio turning on will cause a brownout. If you have a 220 or 470 uF it will keep things going during the current surge of the wif radio, and the weak battery will continue for another couple hours.
Thanks for your reply! Yeah my setup is similar to the first one you describe above. Long usb cable -> FTDI -> breadboard for now as just a proof of concept before I’ll solder everything together. I’ll move to a more robust power solution there. The one 220uF cap I had did the trick and I’m checking out your awesome project as we speak! Thanks for answering my question!
Serial monitor keeps printing PIR Enabled -> PIR disabled -> PIR Enabled -> PIR disabled ..... Not sure why this is.
Have the output pin connected to GPIO 13 through a 10K resistor putting a high output on GPIO13 when triggered (I haven’t seen anything mentioned about a transistor being used like other projects are using with the PIR sensor and ESP32 Cam board). Looks like I am using the same PIR sensor as you are looking at the picture from your update one Feb 25, 2020, do you have your PIR sensor jumper set to the H or L setting for triggering? I was unable to find that in the Readme documentation.
I think your sd card is grounding the touch sensor, so it thinks you are touching it trying to turn the pir on and off. It happens with some of my cheap sd cards, but not with the name-brands. What brand do you have?
You can comment out this line to disable the touch sensor -- i've been meaning to add that to the settings.h file
touchAttachInterrupt(T5, get_touch5, 30);
And active-high PIR.
Commenting out this line worked. I am using a "Kingston Canvas Select Plus 64GB" sd card. Yeah I believe that there seem to be some sort of SD card problems happening I will attach some snippets from my serial monitor below.
Oh and when asking about the PIR sensor above I meant the jumper setting that for re-trigger as labeled in this picture After reading about this I am pretty sure the more useful setting is to keep it at the default "L" setting. Worth mentioning is that some other variants exist with exposed solder pads that can be bridged instead of the jumper.
`Boot number: 1 Wakeup was not caused by deep sleep: 0 Get took 1 Good settings in the EPROM Internet_Enabled 1 DeepSleepPir 0 record_on_reboot 1 PIRpin 13 PIRenabled 1 framesize 10 repeat_config 100 xspeed 30 gray 0 quality 12 capture_interval 1000 total_frames_config 1800 xlength 1800 EnableBOT 0 Starting wifi ... Disable brownout
Brown regsiter was (in hex)40028000 . Internet connected mDNS responder started 'cam1' Waiting for system time to be set... (1/15) -- 70 Waiting for system time to be set... (2/15) -- 70 Waiting for system time to be set... (3/15) -- 70 Waiting for system time to be set... (4/15) -- 70 Waiting for system time to be set... (5/15) -- 70 Waiting for system time to be set... (6/15) -- 70 Waiting for system time to be set... (7/15) -- 70 Waiting for system time to be set... (8/15) -- 70 Waiting for system time to be set... (9/15) -- 70 Waiting for system time to be set... (10/15) -- 70 Waiting for system time to be set... (11/15) -- 70 Waiting for system time to be set... (12/15) -- 70 Waiting for system time to be set... (13/15) -- 70 Waiting for system time to be set... (14/15) -- 70 Local time: Thu Jan 1 01:00:17 1970
Enable brownout
Starting sd card ...
SD card mount successfully!
Name: SD64G
Type: SDHC/SDXC
Speed: 40 MHz
Size: 59638MB
SD_MMC Begin: 1
Starting server ...
http task prio: 5
Camera http started
Starting ftp ...
Total space: 59607MB
Used space: 7MB
Starting tasks ...
camera, core 1, priority = 2
aviwriter, core 1, priority = 3
ftp, core 0, priority = 4
Starting camera ...
PIRpin = 0, 0, 0, 0, 0,
Touch T5 = 1, 1, 1, 1, 1,
Camera Ready! Use 'http://192.168.0.100' to connect
Starting an avi
File name will be >/sdcard/19700101/cam1 1970-01-01 01.00.20 uxga_Q12_I1000_L1800_S30.avi<
Recording 1800 video frames ...
the loop, core 1, priority = 1 assertion "0 && "fatfs internal error"" failed: file "/home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/fatfs/src/vfs_fat.c", line 251, function: fresult_to_errno abort() was called at PC 0x4013a60f on core 1
Backtrace: 0x400935e0:0x3ffde7b0 0x40093811:0x3ffde7d0 0x4013a60f:0x3ffde7f0 0x4011a307:0x3ffde820 0x4011aaab:0x3ffde840 0x40134996:0x3ffde870 0x4000bd83:0x3ffde890 0x4000117d:0x3ffde8b0 0x40058af1:0x3ffde8d0 0x4013adb5:0x3ffde900 0x4013ae01:0x3ffde940 0x400d5fd6:0x3ffde960 0x400d6da1:0x3ffde990 0x400d6df5:0x3ffde9d0 0x4008f7d9:0x3ffde9f0
Rebooting...
Boot number: 1 Wakeup was not caused by deep sleep: 0 Get took 1 Good settings in the EPROM Internet_Enabled 1 DeepSleepPir 0 record_on_reboot 1 PIRpin 13 PIRenabled 1 framesize 10 repeat_config 100 xspeed 30 gray 0 quality 12 capture_interval 1000 total_frames_config 1800 xlength 1800 EnableBOT 0 Starting wifi ... Disable brownout
Brown regsiter was (in hex)40028000 .....................Cannot connect - try again . Internet connected mDNS responder started 'cam1' Waiting for system time to be set... (1/15) -- 70 Waiting for system time to be set... (2/15) -- 70 Waiting for system time to be set... (3/15) -- 70 Waiting for system time to be set... (4/15) -- 70 Waiting for system time to be set... (5/15) -- 70 Waiting for system time to be set... (6/15) -- 70 Waiting for system time to be set... (7/15) -- 70 Waiting for system time to be set... (8/15) -- 70 Waiting for system time to be set... (9/15) -- 70 Waiting for system time to be set... (10/15) -- 70 Waiting for system time to be set... (11/15) -- 70 Waiting for system time to be set... (12/15) -- 70 Waiting for system time to be set... (13/15) -- 70 Waiting for system time to be set... (14/15) -- 70 Local time: Thu Jan 1 01:01:41 1970
Enable brownout Starting sd card ... E (40245) sdmmc_common: sdmmc_init_ocr: send_op_cond (1) returned 0x107 Failed to mount SD card VFAT filesystem. Error: ESP_ERR_TIMEOUTTry again... E (45275) sdmmc_common: sdmmc_init_ocr: send_op_cond (1) returned 0x107 Failed to mount SD card VFAT filesystem. Error: ESP_ERR_TIMEOUT Major Fail 0 / 10 Major Fail 1 / 10 Major Fail 2 / 10 Major Fail 3 / 10 Major Fail 4 / 10 Major Fail 5 / 10 Major Fail 6 / 10 Major Fail 7 / 10 Major Fail 8 / 10 Major Fail 9 / 10
JZ low voltage handler Starting at 102650 Thu Jan 1 01:02:45 1970
low volt, core 0, priority = 0
slept 200 seconds - does not work! 3 seconds to close files - does not work 28 ms, i = 0 29 ms, i = 1 30 ms, i = 2 31 ms, i = 3 32 ms, i = 4 34 ms, i = 5 35 ms, i = 6 36 ms, i = 7 37 ms, i = 8 39 ms, i = 9 40 ms, i = 10 41 ms, i = 11 42 ms, i = 12 44 ms, i = 13 45 ms, i = 14 46 ms, i = 15 48 ms, i = 16 49 ms, i = 17 50 ms, i = 18 52 ms, i = 19 53 ms, i = 20 54 ms, i = 21 55 ms, i = 22 57 ms, i = 23 58 ms, i = 24 59 ms, i = 25 61 ms, i = 26 62 ms, i = 27 63 ms, i = 28 65 ms, i = 29 66 ms, i = 30 67 ms, i = 31 68 ms, i = 32 70 ms, i = 33 71 ms, i = 34 72 ms, i = 35 74 ms, i = 36 75 ms, i = 37 76 ms, i = 38 78 ms, i = 39 79 ms, i = 40 80 ms, i = 41 81 ms, i = 42 83 ms, i = 43 84 ms, i = 44 85 ms, i = 45 87 ms, i = 46 88 ms, i = 47 89 ms, i = 48 91 ms, i = 49 92 ms, i = 50 93 ms, i = 51 94 ms, i = 52 96 ms, i = 53 97 ms, i = 54 98 ms, i = 55 100 ms, i = 56 101 ms, i = 57 102 ms, i = 58 104 ms, i = 59 105 ms, i = 60 107 ms, i = 61 108 ms, i = 62 109 ms, i = 63 111 ms, i = 64 112 ms, i = 65 114 ms, i = 66 115 ms, i = 67 116 ms, i = 68 118 ms, i = 69 119 ms, i = 70 121 ms, i = 71 122 ms, i = 72 123 ms, i = 73 125 ms, i = 74 126 ms, i = 75 127 ms, i = 76 129 ms, i = 77 130 ms, i = 78 132 ms, i = 79 133 ms, i = 80 134 ms, i = 81 136 ms, i = 82 137 ms, i = 83 139 ms, i = 84 140 ms, i = 85 141 ms, i = 86 143 ms, i = 87 144 ms, i = 88 146 ms, i = 89 147 ms, i = 90 148 ms, i = 91 150 ms, i = 92 151 ms, i = 93 152 ms, i = 94 154 ms, i = 95 155 ms, i = 96 157 ms, i = 97 158 ms, i = 98 159 ms, i = 99 161 ms, i = 100 162 ms, i = 101 164 ms, i = 102 165 ms, i = 103 167 ms, i = 104 168 ms, i = 105 170 ms, i = 106 171 ms, i = 107 173 ms, i = 108 174 ms, i = 109 176 ms, i = 110 177 ms, i = 111 179 ms, i = 112 180 ms, i = 113 181 ms, i = 114 183 ms, i = 115 184 ms, i = 116 186 ms, i = 117 187 ms, i = 118 189 ms, i = 119 190 ms, i = 120 192 ms, i = 121 193 ms, i = 122 195 ms, i = 123 196 ms, i = 124 198 ms, i = 125 199 ms, i = 126 201 ms, i = 127 202 ms, i = 128 204 ms, i = 129 205 ms, i = 130 207 ms, i = 131 208 ms, i = 132 209 ms, i = 133 211 ms, i = 134 212 ms, i = 135 214 ms, i = 136 215 ms, i = 137 217 ms, i = 138 218 ms, i = 139 220 ms, i = 140 221 ms, i = 141 223 ms, i = 142 224 ms, i = 143 226 ms, i = 144 227 ms, i = 145 229 ms, i = 146 230 ms, i = 147 232 ms, i = 148 233 ms, i = 149 235 ms, i = 150 236 ms, i = 151 238 ms, i = 152 239 ms, i = 153 240 ms, i = 154 242 ms, i = 155 243 ms, i = 156 245 ms, i = 157 246 ms, i = 158 248 ms, i = 159 249 ms, i = 160 250 ms passed - try to extend before 300ms wdt -- does not work 256 ms, i = 161 258 ms, i = 162 259 ms, i = 163 261 ms, i = 164 262 ms, i = 165 264 ms, i = 166 265 ms, i = 167 267 ms, i = 168 268 ms, i = 169 270 ms, i = 170 271 ms, i = 171 273 ms, i = 172 274 ms, i = 173 276 ms, i = 174 277 ms, i = 175 279 ms, i = 176 280 ms, i = 177 280 ms passed - deepsleep #########################################################
Enable brownout Starting sd card ... SD card mount successfully! Name: SD64G Type: SDHC/SDXC Speed: 40 MHz Size: 59638MB SD_MMC Begin: 1 Starting server ... http task prio: 5 Camera http started Starting ftp ... Total space: 59607MB Used space: 7MB Starting tasks ... camera, core 1, priority = 2 aviwriter, core 1, priority = 3 ftp, core 0, priority = 4 Starting camera ... [E][camera.c:1049] camera_probe(): Detected camera not supported. [E][camera.c:1249] esp_camera_init(): Camera probe failed with error 0x20004
Major Fail 0 / 10 Major Fail 1 / 10 Major Fail 2 / 10 Major Fail 3 / 10 ##########################################################`
Several errors there.
The PIR is a minor detail with all of that. I think I use the default of "not re-trigger"
Regarding the 3 issues you outline above:
Internet is in fact working. I have it set up to seconds acces point that is not connected to WAN (outside internet) for testing, this is why it is not finding a NTP server. When I get into the LAN network for this second (backup) acces point I can in fact connect to the ESP over its local ip.
I have the SD card formatted as FAT32. You’re correct that >32 GB SD cards come pre-formatted as ExFat out of the box from the store however you can Re-format the cards as FAT32. Which I have done. The FAT32 filesystem supports a filesystem size of 2TB max and a maximum single file of ~4 GB. I do not think the single AVI file is going to reach this size with default settings in the sketch so this should not be an issue. It is weird this SD card is acting up. In fact checking via ftp most of the .avi files fail to write something into the file, the file usually gets created but are 0kb. On one occasion it managed to write about 8 seconds of footage which are quite some frames actually but crashed after that. So it manages to write data on the rare occasion but fails after some time even when it manages to do so.
Ok, yeah this third one is not the usual error that I’m getting but I though I’d share it as it did show up once. I am still testing on a breadboard for now with the 220 uF cap in. Maybe also the SD card is acting up because of low power? I will just solder one of my ESP32 cards and see if the same errors occur
I would pursue the sd card path. I think the technology changed between the 32gb and 64gb which might have implications for the sd file system drivers, maybe electrical issues, and the 1-bit versus 4-bit sd card interface. You could try removing everything from pins 4, 12, and 13 to see if those voltages are getting through to the sd controller and the sd card. ???
I changed to a new ESP32 board and a new SD card and soldered everything together. I have the camera now set up for testing for the next 24h. Initially everything seems to be working as expected (the new SD card is also 64GB, same brand and model "Kingston Canvas Select"). The SD card I used in the (old/first) ESP32 looks like it died completely, (sad because it lasted only 4 days out of its new package) as I am unable to even format the card, I tried multiple formatting tools on MacOS and even switched to Windows. IO errors keep coming up. I am not sure if it was the SD cards fault as the first thing I noticed with the new ESP32 is that the flash led is not turning on briefly when writing to the SD card as the old one was doing, a brief flash with the same code. So I suspect it could also be a faulty ESP. The new ESP does not flash at all. I will report back after testing the coming 24h and will close this issue as we got somewhat off topic ;-) Hope this new ESP32 and/or SD card will not die on us, fingers crossed :-)
Thank you very much for the support through this journey. I appreciate it a lot!
P.S. Is there a way to rotate the image by 90 degrees? In the online preview the image is 90 degrees rotated to how I am mounting it.
This board is a little dodgy as there are 4 data pins going from the sd card to the gpio's of the esp32, but 12, 13, and 4 can be re-used for other things in the 1-bit data line mode. The board uses gpio 4 for the Blinding-Disk-Active LED so it will blink and glow during a 4-bit sd write, and then 12 and 13 are re-used for various things, that could put voltages into the sd card that are meant for the gpio of the esp32. My dollar-store EAGET brand sd did not work on programs/circuits that worked fine with Lexar or SanDisk, but who knows what those voltages are doing to the sd card that are still wired, even if the esp32 is just communicating with 1-data line.
I don't think there is a rotate, but just a horizontal or vertical flip that you can set during camera config. https://randomnerdtutorials.com/esp32-cam-ov2640-camera-settings/
Just wanted to ask about the 220uF capacitor selection to prevent brownout detection. I am unfortunately running out of 220uF caps but still have many 100uF or 470uF caps. Is there a reason for the 220uF capacitor or did you find out it works well to prevent brownout by trail and error?
Just wanted to say this project looks amazing! Very excited to try this project out without brownout detection restarts😁