Skip to content

Commit

Permalink
Merge pull request #19 from hpsaturn/esp32-tjournal-nopsram
Browse files Browse the repository at this point in the history
ESP32 TTGO T-Journal without PSRAM support
  • Loading branch information
hpsaturn authored Apr 27, 2024
2 parents ad229f5 + 05329e5 commit 21185c5
Show file tree
Hide file tree
Showing 10 changed files with 138 additions and 9 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ The ESPNowCam library is a simple and direct video streamer designed for popular

## Performance

The current version tested with:
The current version tested with the next cameras:

| Sender | Receiver | Frame size | JPG Quality | FPS | Status |
|:-----------------|:-----------:|:-------:|:-----:|:------:|:------:|
| TTGO TJournal Camera (NO PSRAM) | M5Core2 / M5CoreS3 | QVGA | 12 | ~11 FPS | TESTING |
| Freenove S3 Camera | M5Core2 / M5CoreS3 | QVGA | 12 | ~10 FPS | STABLE |
| M5CoreS3 builtin Camera | M5Core2 | QVGA | 12 | ~11 FPS | STABLE |
| Freenove S3 Camera | Makerfabs | HVGA | 12 | ~6 FPS | STABLE |
Expand Down Expand Up @@ -57,6 +58,7 @@ Note: Nanobp is not included as a dependency because, despite being 25 years aft

| ENV Name | Target | Status |
|:-----------------|:--------------:|:----------:|
| tjournal-espnow-sender | ESPNow camera transmitter (QVGA) | TESTING |
| freenove-basic-sender | ESPNow camera transmitter (QVGA) | STABLE |
| freenove-hvga-sender | ESPNow camera transmitter (HVGA) | <6 FPS |
| freenove-nojpg-sender | ESPNow camera transmitter (NOJPG) | DEMO ONLY (<2FPS) |
Expand Down Expand Up @@ -89,6 +91,7 @@ Some examples, only needs run `pio run --target upload` into each directory

**Cameras:**

- [x] TTGO T-Journal ESP32 Camera without PSRAM
- [x] ESP32S3 Cam Freenove
- [x] M5CoreS3 builtin Camera
- [x] XIAO ESP32S3 Sense Camera
Expand All @@ -108,6 +111,7 @@ Some examples, only needs run `pio run --target upload` into each directory
- [x] Isolate the ESPNow Receiver and Transmitter in a seperated library
- [x] Unified and migrated to only one header `ESPNowCam.h`
- [x] Add sender callback to improve speed
- [ ] Add callback to Radio send action. issue #20
- [ ] Migration to esp_wifi_80211_tx() to improve Payload and Quality

## ESPNow Transmitter and Receiver
Expand Down
46 changes: 46 additions & 0 deletions examples/tjournal-espnow-sender/tjournal-espnow-sender.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/**************************************************
* ESPNowCam video Transmitter
* by @hpsaturn Copyright (C) 2024
* This file is part ESP32S3 camera tests project:
* https://github.com/hpsaturn/esp32s3-cam
**************************************************/

#include <Arduino.h>
#include <ESPNowCam.h>
#include <drivers/CamTJournal.h>
#include <Utils.h>

CamTJournal Camera;
ESPNowCam radio;

void processFrame() {
if (Camera.get()) {
radio.sendData(Camera.fb->buf, Camera.fb->len);
delay(25); // ==> weird delay for this camera.
printFPS("CAM:");
Camera.free();
}
}

void setup() {
Serial.begin(115200);

delay(5000); // only for debugging

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

radio.init();
if (!Camera.begin()) {
Serial.println("Camera Init Fail");
delay(1000);
ESP.restart();
}
delay(500);
}

void loop() {
processFrame();
}
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "EspNowCam",
"version": "0.1.7",
"version": "0.1.8",
"homepage":"https://github.com/hpsaturn/esp32s3-cam",
"keywords":
[
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.7
version=0.1.8
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
8 changes: 8 additions & 0 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ lib_deps =
https://github.com/hpsaturn/SerialTerminal.git
hpsaturn/ESP32 Wifi CLI @^0.2.1

[env:tjournal-espnow-sender]
platform = espressif32 @ 4.4.0
extends = env
board = esp32dev
build_src_filter = -<*> -<*common*> +<tjournal-espnow-sender/>
build_flags =
-D CORE_DEBUG_LEVEL=0

[m5cores3_common]
extends = esp32common
lib_deps =
Expand Down
4 changes: 2 additions & 2 deletions src/ESPNowCam.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ extern "C" {
typedef void (*RecvCb)(uint32_t lenght);
}

#define CSL_VERSION "0.1.7"
#define CSL_REVISION 072
#define CSL_VERSION "0.1.8"
#define CSL_REVISION 073

class ESPNowCam {
private:
Expand Down
3 changes: 1 addition & 2 deletions src/drivers/CamFreenove.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ static camera_config_t camera_config = {
.jpeg_quality = 0,
.fb_count = 2,
.fb_location = CAMERA_FB_IN_PSRAM,
.grab_mode = CAMERA_GRAB_WHEN_EMPTY,
.sccb_i2c_port = 0
.grab_mode = CAMERA_GRAB_WHEN_EMPTY
};

bool CamFreenove::begin() {
Expand Down
55 changes: 55 additions & 0 deletions src/drivers/CamTJournal.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#include "CamTJournal.h"

static camera_config_t camera_config = {
.pin_reset = 15,
.pin_xclk = 27,
.pin_sscb_sda = 25,
.pin_sscb_scl = 23,
.pin_d7 = 19,
.pin_d6 = 36,
.pin_d5 = 18,
.pin_d4 = 39,
.pin_d3 = 5,
.pin_d2 = 34,
.pin_d1 = 35,
.pin_d0 = 17,
.pin_vsync = 22,
.pin_href = 26,
.pin_pclk = 21,

.xclk_freq_hz = 20000000,
.ledc_timer = LEDC_TIMER_0,
.ledc_channel = LEDC_CHANNEL_0,

.pixel_format = PIXFORMAT_JPEG,
.frame_size = FRAMESIZE_QVGA,
.jpeg_quality = 12,
.fb_count = 1,
.fb_location = CAMERA_FB_IN_DRAM,
.grab_mode = CAMERA_GRAB_WHEN_EMPTY,
};

bool CamTJournal::begin() {
esp_err_t err = esp_camera_init(&camera_config);
if (err != ESP_OK) {
return false;
}
sensor = esp_camera_sensor_get();
return true;
}

bool CamTJournal::get() {
fb = esp_camera_fb_get();
if (!fb) {
return false;
}
return true;
}

bool CamTJournal::free() {
if (fb) {
esp_camera_fb_return(fb);
return true;
}
return false;
}
17 changes: 17 additions & 0 deletions src/drivers/CamTJournal.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#ifndef CAMTJOURNAL_H
#define CAMTJOURNAL_H

#include "esp_camera.h"

class CamTJournal {
private:
public:
camera_fb_t* fb;
sensor_t* sensor;
camera_config_t* config;
bool begin();
bool get();
bool free();
};

#endif
4 changes: 2 additions & 2 deletions src/drivers/CamXiao.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ static camera_config_t camera_config = {
.pin_pwdn = PWDN_GPIO_NUM,
.pin_reset = RESET_GPIO_NUM,
.pin_xclk = XCLK_GPIO_NUM,
.pin_sccb_sda = SIOD_GPIO_NUM,
.pin_sccb_scl = SIOC_GPIO_NUM,
.pin_sscb_sda = SIOD_GPIO_NUM,
.pin_sscb_scl = SIOC_GPIO_NUM,
.pin_d7 = Y9_GPIO_NUM,
.pin_d6 = Y8_GPIO_NUM,
.pin_d5 = Y7_GPIO_NUM,
Expand Down

0 comments on commit 21185c5

Please sign in to comment.