Hot answers tagged

4

While it looks interesting as idea, IHMO you have keep in mind: Include some code for button denouncing logic. Actually you will receive couple of “resets” during ~20ms during button press. Without denouncing you may end up with reset signal right at the moment you write to the EPROM. While EPROMs are pretty “solid” nowadays, it many not be good practice. ...


3

In order to make the ultrasonic sensor work, the Arduino has to run some code to control it. So it won't do anything while the Arduino is asleep. What you can do is have the Arduino sleep for some reasonable amount of time, wake up and read the sensor, and then go back to sleep. Maybe wake it up once every few seconds. Do you really need to react to a ...


3

The example shows a Sparkfun Thing, which the article notes doesn't have extra peripherals. What you show is something different, like a NodeMCU dev board, which typically has a linear regulator, possibly a power LED (which the article notes can be removed). I see you're using a DHT11 or DHT22, which has a pull-up resistor. The pull-up resistor is ...


3

You're making it too hard on yourself. There is a method to re-start the USB, but it only works if the USB has been properly stopped - and the method that is supposed to do that is empty. This is a little sketch that works on my Leonardo: #include <LowPower.h> void setup() { } void loop() { USBCON = 0; LowPower.powerDown(SLEEP_8S, ...


2

The Nextion screen has a command for this. It is called wup and defines the id of page that the screen should go to on wake from sleep. The default is set to 255, which means that the display wakes up on the page it was on before the sleep event. 16 wup Wake Up Page wup=2, n0.val=wup Sets which page Nextion loads when exiting sleep mode min is 0, max is #...


2

I solved the problem using a Nextion timer. (tm0) I got a timer and change tim value. ( unfortunately Nexion allow to maximum to 65535mS). vscope should be globle, otherwise you cant use timer in every page. I reset the timer in page touch event. In timer event I put this code. if(tm0.tim==60000) //reset time in mS { page 0 //specific page to load }


2

I would go for option 2. You can wake up the controller immediately, but only the processor. Then just start waiting for the "long enough" time that you defined, regulary checking the button state. If the button is still pushed, then initiate full wake up. If it is released, go back to sleep. This is the easy option, requiring no extra hardware, and only ...


2

WDTCSR = bit(WDCE) | bit(WDE); // enter a very brief change mode WDTCSR = bit(WDP2); // prescaler without reset mode, 1001 means 8 seconds, 0101 means 0.5 seconds, 0100 means 0.25 seconds, 0011 means 0.125 seconds WDTCSR = bit(WDIE); // use interrrupt mode because we do not want an WDT triggered reset Your code above is not doing a WDT interrupt every 0.25 ...


1

This is actually somewhat more tricky than you would at first thing. First off, the "shock sensor" is merely a spring inside a tube. This will create lots of triggers while it's being "shocked", which really is messy. Secondly, you only want those shocks to make it through to the ESP when you are in deep sleep. Thirdly, you don't want whatever you ...


1

Totally agree with Serge. To cover issues #3 and #4 of Serge's answer I recommend you to have a look at FRAM. It has more durability with 10 trillions of write cycles.


1

The answer for this actually goes to Juraj. It was the fact that I was missing a delay. In hindsight it makes sense, as even though I am competing tasks in order, the system is shutting down, before the actual message is sent. I added a delay(1000) between the "sendMQTTMessage()" and "ESP.deepsleep()" and it worked.


1

You should add pull-down resistors generally of 10k on the interrupt pin, this will resist the unwanted signals on that pin.


Only top voted, non community-wiki answers of a minimum length are eligible