Skip to content

Some quicks updates to make this more amazing #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
settings.h
103 changes: 103 additions & 0 deletions camera_pins.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,25 @@
#define HREF_GPIO_NUM 26
#define PCLK_GPIO_NUM 21

#elif defined(CAMERA_MODEL_M5STACK_V2_PSRAM)
#define PWDN_GPIO_NUM -1
#define RESET_GPIO_NUM 15
#define XCLK_GPIO_NUM 27
#define SIOD_GPIO_NUM 22
#define SIOC_GPIO_NUM 23

#define Y9_GPIO_NUM 19
#define Y8_GPIO_NUM 36
#define Y7_GPIO_NUM 18
#define Y6_GPIO_NUM 39
#define Y5_GPIO_NUM 5
#define Y4_GPIO_NUM 34
#define Y3_GPIO_NUM 35
#define Y2_GPIO_NUM 32
#define VSYNC_GPIO_NUM 25
#define HREF_GPIO_NUM 26
#define PCLK_GPIO_NUM 21

#elif defined(CAMERA_MODEL_M5STACK_WIDE)
#define PWDN_GPIO_NUM -1
#define RESET_GPIO_NUM 15
Expand All @@ -75,6 +94,25 @@
#define HREF_GPIO_NUM 26
#define PCLK_GPIO_NUM 21

#elif defined(CAMERA_MODEL_M5STACK_ESP32CAM)
#define PWDN_GPIO_NUM -1
#define RESET_GPIO_NUM 15
#define XCLK_GPIO_NUM 27
#define SIOD_GPIO_NUM 25
#define SIOC_GPIO_NUM 23

#define Y9_GPIO_NUM 19
#define Y8_GPIO_NUM 36
#define Y7_GPIO_NUM 18
#define Y6_GPIO_NUM 39
#define Y5_GPIO_NUM 5
#define Y4_GPIO_NUM 34
#define Y3_GPIO_NUM 35
#define Y2_GPIO_NUM 17
#define VSYNC_GPIO_NUM 22
#define HREF_GPIO_NUM 26
#define PCLK_GPIO_NUM 21

#elif defined(CAMERA_MODEL_AI_THINKER)
#define PWDN_GPIO_NUM 32
#define RESET_GPIO_NUM -1
Expand All @@ -94,6 +132,71 @@
#define HREF_GPIO_NUM 23
#define PCLK_GPIO_NUM 22

#elif defined(CAMERA_MODEL_TTGO_T_JOURNAL)
#define PWDN_GPIO_NUM 0
#define RESET_GPIO_NUM 15
#define XCLK_GPIO_NUM 27
#define SIOD_GPIO_NUM 25
#define SIOC_GPIO_NUM 23

#define Y9_GPIO_NUM 19
#define Y8_GPIO_NUM 36
#define Y7_GPIO_NUM 18
#define Y6_GPIO_NUM 39
#define Y5_GPIO_NUM 5
#define Y4_GPIO_NUM 34
#define Y3_GPIO_NUM 35
#define Y2_GPIO_NUM 17
#define VSYNC_GPIO_NUM 22
#define HREF_GPIO_NUM 26
#define PCLK_GPIO_NUM 21

#elif defined(T_Camera_V17_VERSION)
#define PWDN_GPIO_NUM -1
#define RESET_GPIO_NUM -1
#define XCLK_GPIO_NUM 32
#define SIOD_GPIO_NUM 13
#define SIOC_GPIO_NUM 12
#define Y9_GPIO_NUM 39
#define Y8_GPIO_NUM 36
#define Y7_GPIO_NUM 23
#define Y6_GPIO_NUM 18
#define Y5_GPIO_NUM 15
#define Y4_GPIO_NUM 4
#define Y3_GPIO_NUM 14
#define Y2_GPIO_NUM 5
#define VSYNC_GPIO_NUM 27
#define HREF_GPIO_NUM 25
#define PCLK_GPIO_NUM 19
#define I2C_SDA 21
#define I2C_SCL 22
#define BUTTON_1 34
#define SSD130_MODLE_TYPE 0 // 0 : GEOMETRY_128_64 // 1: GEOMETRY_128_32
#define AS312_PIN 33
#define ENABLE_IP5306

#elif defined(T_Camera_JORNAL_VERSION)
#define PWDN_GPIO_NUM -1
#define RESET_GPIO_NUM 15
#define XCLK_GPIO_NUM 27
#define SIOD_GPIO_NUM 25
#define SIOC_GPIO_NUM 23
#define Y9_GPIO_NUM 19
#define Y8_GPIO_NUM 36
#define Y7_GPIO_NUM 18
#define Y6_GPIO_NUM 39
#define Y5_GPIO_NUM 5
#define Y4_GPIO_NUM 34
#define Y3_GPIO_NUM 35
#define Y2_GPIO_NUM 17
#define VSYNC_GPIO_NUM 22
#define HREF_GPIO_NUM 26
#define PCLK_GPIO_NUM 21
#define I2C_SDA 14
#define I2C_SCL 13
#define BUTTON_1 32
#define SSD130_MODLE_TYPE 1 // 0 : GEOMETRY_128_64 // 1: GEOMETRY_128_32

#else
#error "Camera model not selected"
#endif
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/**

This is a simple MJPEG streaming webserver implemented for AI-Thinker ESP32-CAM
and ESP-EYE modules.
Expand All @@ -18,9 +18,11 @@
Flash Size: 4Mb
Patrition: Minimal SPIFFS
PSRAM: Enabled
*/

// ESP32 has two cores: APPlication core and PROcess core (the one that runs ESP32 SDK stack)
**/

// ESP32 has two cores: APPlication core and
// Process core (the one that runs ESP32 SDK stack)
#define APP_CPU 1
#define PRO_CPU 0

Expand All @@ -34,28 +36,24 @@
#include <esp_sleep.h>
#include <driver/rtc_io.h>

// Select camera model
//#define CAMERA_MODEL_WROVER_KIT
#define CAMERA_MODEL_ESP_EYE
//#define CAMERA_MODEL_M5STACK_PSRAM
//#define CAMERA_MODEL_M5STACK_WIDE
//#define CAMERA_MODEL_AI_THINKER
/* == Brownout Handler ==*/
#include "soc/soc.h"
#include "soc/rtc_cntl_reg.h"

#include "camera_pins.h"
/**

/*
Next one is an include with wifi credentials.
This is what you need to do:

1. Create a file called "home_wifi_multi.h" in the same folder OR under a separate subfolder of the "libraries" folder of Arduino IDE. (You are creating a "fake" library really - I called it "MySettings").
2. Place the following text in the file:
#define SSID1 "replace with your wifi ssid"
#define PWD1 "replace your wifi password"
1. Copy the file `settings.h.example` to `settings.h`
2. Change the values to their proper defaults (wifi and camera)
3. Save.

Should work then
*/
#include "home_wifi_multi.h"

**/
#include "settings.h"
#include "camera_pins.h"

OV2640 cam;

Expand Down Expand Up @@ -387,7 +385,8 @@ void setup()

// Setup Serial connection:
Serial.begin(115200);
delay(1000); // wait for a second to let Serial connect
// wait for a second to let Serial connect
delay(1000);


// Configure the camera
Expand Down Expand Up @@ -432,6 +431,8 @@ void setup()
ESP.restart();
}

// disable brownout detector
WRITE_PERI_REG(RTC_CNTL_BROWN_OUT_REG, 0);
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some chips dont handle wifi power consumption and trigger a brownout restart; this disables that till after wifi is started


// Configure and connect to WiFi
IPAddress ip;
Expand All @@ -451,6 +452,9 @@ void setup()
Serial.print(ip);
Serial.println("/mjpeg/1");

// enable brownout detector
WRITE_PERI_REG(RTC_CNTL_BROWN_OUT_REG, 1);


// Start mainstreaming RTOS task
xTaskCreatePinnedToCore(
Expand Down
32 changes: 32 additions & 0 deletions settings.h.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/**

1. Copy this file to `settings.h`
2. Change the below values

**/

/**

Choose your camera model. (uncomment one)
Not all of these have been tested

**/
//#define CAMERA_MODEL_WROVER_KIT // Has PSRAM
#define CAMERA_MODEL_ESP_EYE // Has PSRAM
//#define CAMERA_MODEL_M5STACK_PSRAM // Has PSRAM
//#define CAMERA_MODEL_M5STACK_V2_PSRAM // M5Camera version B Has PSRAM
//#define CAMERA_MODEL_M5STACK_WIDE // Has PSRAM
//#define CAMERA_MODEL_M5STACK_ESP32CAM // No PSRAM
//#define CAMERA_MODEL_AI_THINKER // Has PSRAM
//#define CAMERA_MODEL_TTGO_T_JOURNAL // No PSRAM
//#define T_Camera_V17_VERSION
//#define T_Camera_JORNAL_VERSION


/**

Set your Wifi info

**/
#define SSID1 "YOUR_SSID"
#define PWD1 "YOUR_WIFI_PASSWORD"