Skip to content
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

Esp32 receives only the first messages #24

Open
Berta2001 opened this issue Sep 17, 2022 · 9 comments
Open

Esp32 receives only the first messages #24

Berta2001 opened this issue Sep 17, 2022 · 9 comments

Comments

@Berta2001
Copy link

After connecting the device to the wifi, correctly writing the chat-id etc ... I sent the message / start from telegram and he received all the possible commands safely. After about half a day, esp32 no longer receives any commands as if it were blocked. To make it restart again I have to disconnect the power supply and reconnect it; so as to reboot it.
How can I solve this problem?
Thank you

@jameszah
Copy link
Owner

How many messages is that - like dozens or hundreds or ????.
Are there big bursts of messages?

Do you have the serial monitor during this problem?

@FBMinis
Copy link

FBMinis commented Sep 28, 2022

Poor signal; less than perfect connection to the power supply and/or multiple consecutive PIR false positives have caused my project to malfunction like that. Under adequate conditions, this program works reliably and is very versatile - I'm very thankful for James to have shared it with us.

Reducing the sensitivity of the HC-SR501 PIR will help it not being triggered by the wind, plants rocking or door curtains dangling;
Placing it in the shade or away from reflections should help too;
Increasing the ON time by positioning the Tx potentiometer at "9 o'clock" seems to trigger the interrupt better and the photo+clip to be delivered without trouble;
Increasing the LOW time to 2minutes by changing the capacitor above the yelllow pin to 4,7uF (attached photo; Ti value in BISS0001 datasheet), will reduce the frequency of Motion Detection if the disturbance persists;

If you don't need the motion detector feature, just don't plug the PIR to GPIO13. You can send recurring messages to the Telegram bot to retrieve a photo or a clip by using IFTTT and Macrodroid (free Android apps).

  1. Create a macro in Macrodroid that tweets "{system time}" to your twitter account every 10min;
  2. Create a Telegram group or channel comprised of yoursel, your camera bot and the IFTTT bot.
  3. Create an applet in IFTTT that sends the word "/photo" to that group whenever there's a new tweet. You will receive a photo every 10min.

IMG_20220919_154813_814
IMG_20220925_193700

@Berta2001
Copy link
Author

It usually occurs after a period of time of about one night; there are few messages in the order of tens.
What do you mean by serial monitor?

@jameszah
Copy link
Owner

jameszah commented Oct 3, 2022

Arduino serial monitor receives the print statements from the arduino code - used for debugging and information. You have to have the esp32 rx/tx connected to the usb on your computer to observe it.

I'm guessing your problem is the wifi disconnecting, and not reconnecting. Look at your router when the problem occurs to see if it has lost connection. Might need some more robust reconnect code... including reboot if cannot find wifi.

@jameszah
Copy link
Owner

jameszah commented Oct 3, 2022

  1. Create a macro in Macrodroid that tweets "{system time}" to your twitter account every 2min;
  2. Create a Telegram group or channel comprised of yoursel, your camera bot and the IFTTT bot.
  3. Create an applet in IFTTT that sends the word "/photo" to that group. You will receive a photo every 2min.

Nice - I'll give that a try

@jameszah
Copy link
Owner

jameszah commented Oct 3, 2022

code to restore wifi after failing

if (millis() > Bot_lasttime + Bot_mtbs ) {

@FBMinis
Copy link

FBMinis commented Oct 3, 2022

  1. Create a macro in Macrodroid that tweets "{system time}" to your twitter account every 2min;
  2. Create a Telegram group or channel comprised of yoursel, your camera bot and the IFTTT bot.
  3. Create an applet in IFTTT that sends the word "/photo" to that group. You will receive a photo every 2min.

Nice - I'll give that a try

I've noticed an interval of 2min is too short for IFTTT, sometimes it wont check for new tweets for 10 min or more, then you receive 5 photos consecutively. It's been working fine for me with a 10min interval.

@jameszah
Copy link
Owner

jameszah commented Oct 4, 2022

I've noticed an interval of 2min is too short for IFTTT, sometimes it wont check for new tweets for 10 min or more, then you receive 5 photos consecutively. It's been working fine for me with a 10min interval.

Do you know if telegram has message limits?
10 min or 6x24 jpgs per day is not too much, but at some point they might get annoyed ???

You could also add a line of code to send a image every 2 minutes to your id -- and still have enough free time for other commands.

I take it your scheme has ifttt triggered by the twitter message, and then it tells the esp32 to send the picture to telegram, so there is nothing (no image) on twitter in the end?

@FBMinis
Copy link

FBMinis commented Oct 4, 2022

Do you know if telegram has message limits?
10 min or 6x24 jpgs per day is not too much, but at some point they might get annoyed ???

I've read there are limits in the order of a few gigabytes per day, with single file max size of 2Gb but unlimited cloud storage space. There's people running bots inside groups or channels with thousands of users, serving them movies, which is a much larger operation.

I have a channel that I use to test these ESP32-Cam projects, it's been online since March 2021 and it currently has almost 2500 photos. I've tried deleting them but Telegram client always downloads the thumbnails again, leading me to think they'll be in some server for a long time. Nowadays it's possible to have photos automatically deleted after 1 day (or 1 week, month or custom interval), but those 2500 precede this feature and seem undeletable.

You could also add a line of code to send a image every 2 minutes to your id -- and still have enough free time for other commands.

This would be an handy feature but your code is running so well I wont touch it because I'm just a hobbyist...
Wifimanager with extra parameters would be a welcome feature, for example having a checkbox for PIR or Avi disabled on boot or how many minutes interval to automatically take the photo. I'm still reading about these libraries and experimenting with a Wemos D1.

I take it your scheme has ifttt triggered by the twitter message, and then it tells the esp32 to send the picture to telegram, so there is nothing (no image) on twitter in the end?

Exactly. I setup Macrodroid to only tweet system time, as it's a variable that is constantly changing and twitter doesn't get suspicious this way. When IFTTT detects there's been a new tweet, it sends the instruction to the telegram channel through the IFTTT bot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants