Page 1 of 1

ESP32-cam with ds1302?

Posted: Sun Jan 26, 2020 6:41 pm
by Chuma87
Hello partners. I would like to know if an RTC module DS1302 can be connected to esp32cam. GPIO13 already in use, what other pins can I use for CLK, DAT and RST?

Code: Select all

DS1302 rtc(GPIO_NUM_2,GPIO_NUM_12,GPIO_NUM_15);
it doesn't let me use GPIO4 because FLAsh is already using it

Re: ESP32-cam with ds1302?

Posted: Mon Jan 27, 2020 5:23 pm
by pipi61
If you do not use the sd card, then this pins available
Check the esp32 schematic...

Re: ESP32-cam with ds1302?

Posted: Mon Feb 03, 2020 2:51 am
by Chuma87
pipi61 wrote: If you do not use the sd card, then this pins available
But if I use SD later, can it?

In this link the DS1302 is avaiable for ESP32

Code: Select all

#include <ErriezDS1302.h>

// Connect DS1302 data pin to Arduino DIGITAL pin
#if defined(ARDUINO_ARCH_AVR)
#define DS1302_CLK_PIN      2
#define DS1302_IO_PIN       3
#define DS1302_CE_PIN       4
#elif defined(ARDUINO_ARCH_ESP8266)
#define DS1302_CLK_PIN      D4
#define DS1302_IO_PIN       D3
#define DS1302_CE_PIN       D2
#elif defined(ARDUINO_ARCH_ESP32)
#define DS1302_CLK_PIN      0
#define DS1302_IO_PIN       4
#define DS1302_CE_PIN       5
#else
#error #error "May work, but not tested on this target"
#endif

// Create DS1302 RTC object
DS1302 rtc = DS1302(DS1302_CLK_PIN, DS1302_IO_PIN, DS1302_CE_PIN);

analyzing this and this

This guy uses the following pins for the ESP32 wroom

Code: Select all

DS1302RTC RTC(14, 13, 16); // CLK, IO, CE

So, I check the pinout of the esp32 wroom
Image


And I compare it with esp32 ai thinker
Image

Sketch:

Code: Select all

#include <DS1302.h>

DS1302 rtc(16,12,14); // rst, dat, clk

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

void loop() {
 
   Serial.println(rtc.getTimeStr());
    Serial.println(rtc.getDateStr());
     delay(1000);

}
Why do I get this on serial monitor?

Code: Select all

Guru Meditation Error: Core00,len:6352
entry 0x400806b8
f001c,len:1216
ho 0 tail 12 room 4
load:0x40078000,len:9720
ho 0 tail 12 room 4
load:0x40080400,len:6352
entry 0x400806b8
Guru Meditation Error: Core  1 panic'ed (LoadStoreError). Exception was unhandled.
Core 1 register dump:
PC      : 0x400d0f38  PS      : 0x00060330  A0      : 0x800d0d21  A1      : 0x3ffb1f50 
A2      : 0x3f400f05  A3      : 0x00000002  A4      : 0x00000009  A5      : 0x00000003 
A6      : 0x00000001  A7      : 0x00000000  A8      : 0x00000032  A9      : 0x0000001b 
A10     : 0x3ffb1f5c  A11     : 0x3ffb1f6e  A12     : 0x00000009  A13     : 0x3ffb1f64 
A14     : 0x000000ff  A15     : 0x0875eb55  SAR     : 0x00000010  EXCCAUSE: 0x00000003 
EXCVADDR: 0x3f400f05  LBEG    : 0x4000c349  LEND    : 0x4000c36b  LCOUNT  : 0xffffffff 

Backtrace: 0x400d0f38:0x3ffb1f50 0x400d0d1e:0x3ffb1f90 0x400d1b35:0x3ffb1fb0 0x4008a53d:0x3ffb1fd0

Rebooting...
ets Jun  8 2016 00:22:57

rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1216
ho 0 tail 12 room 4
load:0x40078000,len:9720
ho 0 tail 12 room 4
load:0x40080400,len:6352
entry 0x400806b8
Guru Meditation Error: Core  1 panic'ed (LoadStoreError). Exception was unhandled.
Core 1 register dump:
PC      : 0x400d0f38  PS      : 0x00060330  A0      : 0x800d0d21  A1      : 0x3ffb1f50 
A2      : 0x3f400f05  A3      : 0x00000002  A4      : 0x00000009  A5      : 0x00000003 
A6      : 0x00000001  A7      : 0x00000000  A8      : 0x00000032  A9      : 0x0000001b 
A10     : 0x3ffb1f5c  A11     : 0x3ffb1f6e  A12     : 0x00000009  A13     : 0x3ffb1f64 
A14     : 0x000000ff  A15     : 0x0875eb55  SAR     : 0x00000010  EXCCAUSE: 0x00000003 
EXCVADDR: 0x3f400f05  LBEG    : 0x4000c349  LEND    : 0x4000c36b  LCOUNT  : 0xffffffff 

Backtrace: 0x400d0f38:0x3ffb1f50 0x400d0d1e:0x3ffb1f90 0x400d1b35:0x3ffb1fb0 0x4008a53d:0x3ffb1fd0

Rebooting...
ets Jun  8 2016 00:22:57/code]

Re: ESP32-cam with ds1302?

Posted: Wed Feb 05, 2020 2:43 pm
by Chuma87
Extra fact:

I use the GPIO_13 pin (wake up) to receive a frequency sent to me by the CDM324 sensor, then analyze it, and after that, take a photo and save it in the SD, which also uses GPIO_13. All this works.
But when using the DS1302, it does not work, and the 5 pins are connected, including VCC & GND (DS1302) to POUT 3.3 / 5v & GND (ESP32-cam)

Re: ESP32-cam with ds1302?

Posted: Wed Apr 22, 2020 12:54 pm
by fede2k
have you succeed using ds3231 clock with esp32cam?

Re: ESP32-cam with ds1302?

Posted: Wed Apr 22, 2020 4:01 pm
by Agree007
Depending in your code, you can implement OTA, the use gpio 1 and 3 😉

Re: ESP32-cam with ds1302?

Posted: Fri Nov 27, 2020 8:12 pm
by sionut
Chuma87 wrote: ↑
Wed Feb 05, 2020 2:43 pm
Extra fact:

I use the GPIO_13 pin (wake up) to receive a frequency sent to me by the CDM324 sensor, then analyze it, and after that, take a photo and save it in the SD, which also uses GPIO_13. All this works.
But when using the DS1302, it does not work, and the 5 pins are connected, including VCC & GND (DS1302) to POUT 3.3 / 5v & GND (ESP32-cam)
Hi,
Did you have any success with DS1302 ? I bought a couple of DS3231 then I realized that I cannot use them with ESP32-CAM (or at least I don't think so).
Looking for another RTC to work with ESP32CAM I found your post. Could you share your results, please ?
Thank you in advance !

Re: ESP32-cam with ds1302?

Posted: Sun Dec 13, 2020 7:59 pm
by agussupriadi
Chuma87 wrote: ↑
Sun Jan 26, 2020 6:41 pm
Hello partners. I would like to know if an RTC module DS1302 can be connected to esp32cam. GPIO13 already in use, what other pins can I use for CLK, DAT and RST?

Code: Select all

DS1302 rtc(GPIO_NUM_2,GPIO_NUM_12,GPIO_NUM_15);
it doesn't let me use GPIO4 because FLAsh is already using it
hello, i really hope someone could help me with these too. it is difficult for me to find the way to connect esp32 cam with RTC..

Re: ESP32-cam with ds1302?

Posted: Mon Dec 14, 2020 7:50 am
by alanesq
If you use the sd card in 1-bit mode this frees up pins 4, 12 and 13
SD card access will be slower as it is only using one of the 4 data pins.

i.e. in Arduino IDE the command is: SD_MMC.begin("/sdcard", true)

You need to define them is input or output after initialising the sd card

I have then been able to connect a MCP23017 to pins 12 and 13 giving 16 gpio pins to play with, although this may not help in this case it shows you can use i2c with them.
If you don't need the flash you could desolder the LED from pin 4?

BTW - I have been experimenting recently with what I can do with these esp32cam modules and included it all in a "demo sketch": https://github.com/alanesq/esp32cam-demo
Any info/advice/suggestions would be very welcome. e.g. I would like to find a way to switch camera modes without having to de-init the camera as this is very slow (i.e. switch from greyscale to JPG mode).