RTC as a on/off switch for esp

I have trouble using an RTC with a esp32-cam. What I want to do is use a battery to power the esp32-cam, but it doesn't need to be on the whole time. So every hour it has to power up take a picture and send it via wifi to a server.

I thought of using a mosfet between the battery and esp. When the RTC triggers the mosfet power goes to the esp.

The reason I want to do this is, because the esp32-cam in low power mode still take 2.69mA. If I can fix this then the RTC is not necessary.

The problem I'm having is how to make the RTC work without the esp being powered on and how to turn the esp back off. What do I need to do to make it work?

The RTC I have is TinyRTC module and the mosfet is a MJE3055T.

Have a read of this discussion. It may provide some clues:

I think the TinyRTC module has a DS1307, which doesn't have an alarm. I don't know how you would get that to work. You may have to go to a DS3231 module.

Given the extreme shortage of available pins on the ESP32CAM, what pins are you using for I2C on the ESP32CAM to connect the RTC ?

Are you wanting to use the SD card as well ?

I'm not sure. What I want to do with the image is use AI to read values of a watermeter. I haven't looked at that part yet.

Your mosfet is an N-channel. To use the circuits shown in the other thread, you would need a P-channel.

My understanding is that the camera is permanently connected to one I2C peripheral, but there is another one that typically uses GPIO14 as SDA and GPIO15 as SCL. But I have no experience with that setup.

Anyway, the idea in the other thread is that the alarm pin of the DS3231 goes low at the alarm time, which turns on the mosfet. The ESP32-CAM would boot up and do its thing, and then send the command to the RTC to clear the alarm flag. That turns off the mosfet. If you want the alarm to trigger once every hour, you would set the alarm to zero minutes and zero seconds, and that would automatically occur once an hour. If you wanted some other interval, you would just program it into the RTC before clearing the alarm flag.

What is the difference in using an N vs P channel?

N-channel is usually used to switch on/off the ground of your circuit.

P-channel is usually used to switch on/off the positive voltage (e.g. +5v or +3.3v, or the positive battery voltage).

What is the max voltage of your battery, and what voltage regulator are you using for the ESP32 cam? are you just using the 3.3v linear regulator on the board?

After having another look at ShermanP's circuit's, I don't think there's any easy way to use your MJE3055T N-channel mosfet by itself. So just get a P-channel mosfet if your battery is below 5.5V. If battery is above 5.5v, then use 2 mosfet's, like illustrated in those circuits.

I have a 18650 4.2V battery and use it with an MT3608 to get 5V for the ESP-CAM.

Can the RTC work without the ESP32-CAM being on. And if so how would that work?

Ok, the first configuration in the link will work well for you then.

Yes, did you read the link? the RTC is powered by a separate coin cell battery. The rest of the circuit only turns on when the RTC instructs it to.

1 Like

I have read it but wasn't sure how it worked. Now I understand it and will try it out. The only problem now is that I don't have a P channel mosfet. Do you know any that will work for me?

I haven't fully wrapped my head mosfet selection criteria, but I'm pretty sure that logic level mosfets, like AO3401 and DMP1045U will work well for the the entire voltage range of the 18650 4.2v battery, and will also easily handle the peak current the ESP32.

You can solder them to SOT-23-3 to DIP adapter boards with a cheap soldering iron.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.