Skip to content

Commit

Permalink
Merge pull request #39 from hpsaturn/freenove-esp32-wrover-cam
Browse files Browse the repository at this point in the history
New driver for Freenove ESP32 WRover Cam
  • Loading branch information
hpsaturn authored May 15, 2024
2 parents febd046 + 1a3fd87 commit 536bf28
Show file tree
Hide file tree
Showing 12 changed files with 147 additions and 17 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ The current version was tested with the next cameras:
Add the following line to the lib_deps option of your [env:] section:

```python
hpsaturn/EspNowCam@^0.1.12
hpsaturn/EspNowCam@^0.1.13
```

Or via command line:

```python
pio pkg install --library "hpsaturn/ESPNowCam@^0.1.12"
pio pkg install --library "hpsaturn/ESPNowCam@^0.1.13"
```

**Arduino IDE**:
Expand Down Expand Up @@ -129,7 +129,7 @@ The library includes some pre-defined camera configs to have an easy implementat
CamFreenove Camera;
```

For now, it includes drivers for FreenoveS3, XIAOS3, M5UnitCamS3, ESP32Cam AI-Thinker and the TTGO T-Journal cameras, but you are able to define your custom camera like is shown in the [custom-camera-sender](examples/custom-camera-sender/) example. If you can run it in a different camera, please notify me :D
For now, it includes drivers for FreenoveS3, XIAOS3, M5UnitCamS3, Freenove WRover, ESP32Cam AI-Thinker and the TTGO T-Journal cameras, but you are able to define your custom camera like is shown in the [custom-camera-sender](examples/custom-camera-sender/) example. If you can run it in a different camera, please notify me :D

### PSRAM or DRAM?

Expand Down Expand Up @@ -158,7 +158,7 @@ Then compile and install each sample, only choose one of them **ENV names** in [
pio run -e m5cores3-espnow-receiver --target upload
```

Some examples, *.ino samples, only needs run `pio run --target upload` into each directory
Some examples are for Arduino users (*.ino samples), but is possible too compile and install it from PlatformIO, only needs run `pio run --target upload` into each directory.

## Troubleshooting

Expand Down
3 changes: 2 additions & 1 deletion examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
| custom-camera-sender | Custom settings - optional PSRAM | QVGA | STABLE |
| tjournal-espnow-sender | NOPSRAM, 1FB, internal JPG | QVGA | STABLE |
| m5cores3-espnow-sender | PSRAM, 2FB, JPG built-in camera | QVGA | STABLE |
| esp32cam-p2p-sender | PSRAM, 1FB, IDF-JPG | QVGA | UNTESTED |
| esp32cam-p2p-sender | PSRAM, 2FB, JPG | QVGA | UNTESTED |
| freenoveWR-basic-sender | PSRAM, 2FB, JPG | QVGA | UNTESTED |

### Receivers samples

Expand Down
2 changes: 1 addition & 1 deletion examples/esp32cam-basic-sender/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ build_flags =
extends = env
board = esp32dev

[env:freenove-basic-sender]
[env:esp32cam-basic-sender]
extends = esp32common
lib_deps =
hpsaturn/EspNowCam@^0.1.12
61 changes: 61 additions & 0 deletions examples/freenoveWR-basic-sender/freenoveWR-basic-sender.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/**************************************************
* ESP32Cam Freenove Wrover - Transmitter
* by @hpsaturn Copyright (C) 2024
* This file is part ESPNowCam project:
* https://github.com/hpsaturn/ESPNowCam
**************************************************/

// N O T E:
// -------
// Don't forget first install NanoPb library!
// and also review the README.md file.

#include <Arduino.h>
#include <ESPNowCam.h>
#include <drivers/CamFreenoveWR.h>

// Object for the old ESP32Cam Freenove WRover
CamFreenoveWR Camera;
ESPNowCam radio;

void processFrame() {
if (Camera.get()) {
uint8_t *out_jpg = NULL;
size_t out_jpg_len = 0;
frame2jpg(Camera.fb, 12, &out_jpg, &out_jpg_len);
radio.sendData(out_jpg, out_jpg_len);
free(out_jpg);
Camera.free();
}
}

void setup() {
Serial.begin(115200);
Serial.setDebugOutput(true);
Serial.println();

delay(1000); // only for debugging.

if(psramFound()){
size_t psram_size = esp_spiram_get_size() / 1048576;
Serial.printf("PSRAM size: %dMb\r\n", psram_size);
}

// M5Core2 receiver target (P2P or 1:1 mode)
// uint8_t macRecv[6] = {0xB8,0xF0,0x09,0xC6,0x0E,0xCC};
// radio.setTarget(macRecv);
radio.init();

// You are able to change the Camera config E.g:
// Camera.config.fb_count = 2;
// Camera.config.frame_size = FRAMESIZE_QQVGA;

if (!Camera.begin()) {
Serial.println("Camera Init Fail");
}
delay(500);
}

void loop() {
processFrame();
}
26 changes: 26 additions & 0 deletions examples/freenoveWR-basic-sender/platformio.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
; ESPNowCam Freenove ESP32S3CAM
; https://github.com/hpsaturn/esp32s3-cam
; @Hpsaturn 2024

[platformio]
src_dir = ./

[env]
platform = espressif32
framework = arduino
monitor_speed = 115200
monitor_filters =
esp32_exception_decoder
time
build_flags =
-D CORE_DEBUG_LEVEL=3
-D BOARD_HAS_PSRAM=1

[esp32common]
extends = env
board = esp32dev

[env:freenoveWR-basic-sender]
extends = esp32common
lib_deps =
hpsaturn/EspNowCam@^0.1.12
6 changes: 3 additions & 3 deletions examples/unitcams3-basic-sender/unitcams3-basic-sender.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/**************************************************
* ESPNowCam video Transmitter
* by @hpsaturn Copyright (C) 2024
* This file is part ESP32S3 camera tests project:
* https://github.com/hpsaturn/esp32s3-cam
**************************************************/
* This file is part ESPNowCam project:
* https://github.com/hpsaturn/ESPNowCam
*************************************************/

#include <Arduino.h>
#include <ESPNowCam.h>
Expand Down
4 changes: 2 additions & 2 deletions examples/xiao-espnow-sender/xiao-espnow-sender.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/**************************************************
* ESPNowCam video Transmitter
* by @hpsaturn Copyright (C) 2024
* This file is part ESP32S3 camera tests project:
* https://github.com/hpsaturn/esp32s3-cam
* This file is part ESPNowCam project:
* https://github.com/hpsaturn/ESPNowCam
**************************************************/

#include <Arduino.h>
Expand Down
4 changes: 2 additions & 2 deletions examples/xiao-fpv-sender/xiao-fpv-sender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
* this board to have some power consumption improvements
*
* by @hpsaturn Copyright (C) 2024
* This file is part ESP32S3 camera tests project:
* https://github.com/hpsaturn/esp32s3-cam
* This file is part ESPNowCam project:
* https://github.com/hpsaturn/ESPNowCam
**************************************************/

#include <Arduino.h>
Expand Down
3 changes: 2 additions & 1 deletion library.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "EspNowCam",
"version": "0.1.12",
"version": "0.1.13",
"homepage":"https://github.com/hpsaturn/esp32s3-cam",
"keywords":
[
Expand All @@ -15,6 +15,7 @@
"Esp32s3",
"XIAO",
"AI-Thinker",
"Freenove",
"M5CoreS3",
"M5Core2",
"Nanopb"
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=EspNowCam
version=0.1.12
version=0.1.13
author=@hpsaturn
maintainer=Antonio Vanegas <[email protected]>
sentence=ESPNowCam, a straightforward video streamer for popular ESP32Cam models, leveraging the ESPNow protocol. No need for IPs, routers, or credentials—keeping it simple! :D
Expand Down
4 changes: 2 additions & 2 deletions src/ESPNowCam.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ extern "C" {
typedef void (*RecvCb)(uint32_t lenght);
}

#define CSL_VERSION "0.1.12"
#define CSL_REVISION 077
#define CSL_VERSION "0.1.13"
#define CSL_REVISION 078

class ESPNowCam {
private:
Expand Down
41 changes: 41 additions & 0 deletions src/drivers/CamFreenoveWR.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#ifndef CAMFREENOVEWR_H
#define CAMFREENOVEWR_H

#include "CameraBase.hpp"
#include "esp_camera.h"

class CamFreenoveWR : public CameraBase {
public:
using CameraBase::begin;
using CameraBase::free;
using CameraBase::get;

CamFreenoveWR(){
config.pin_reset = -1;
config.pin_xclk = 21;
config.pin_sccb_sda = 26;
config.pin_sccb_scl = 27;
config.pin_d7 = 35;
config.pin_d6 = 34;
config.pin_d5 = 39;
config.pin_d4 = 36;
config.pin_d3 = 19;
config.pin_d2 = 18;
config.pin_d1 = 5;
config.pin_d0 = 4;
config.pin_vsync = 25;
config.pin_href = 23;
config.pin_pclk = 22;
config.xclk_freq_hz = 20000000;
config.ledc_timer = LEDC_TIMER_0;
config.ledc_channel = LEDC_CHANNEL_0;
config.pixel_format = PIXFORMAT_RGB565;
config.frame_size = FRAMESIZE_QVGA;
config.jpeg_quality = 12;
config.fb_count = 2;
config.fb_location = CAMERA_FB_IN_PSRAM;
config.grab_mode = CAMERA_GRAB_WHEN_EMPTY;
}
};

#endif

0 comments on commit 536bf28

Please sign in to comment.