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

ATTINY's are designed to easily do this since they can wake from power down sleep mode by a pin change... Basically you want to... Connect a normally-open push button between an IO pin and ground. Enable the pull-up on the IO. Enable the pin change interrupt on the IO pin. Enable interrupts. Enter "power down" sleep mode. When the button is pushed, it ...


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

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

SLEEP is an assembly instruction. You can execute assembly with GCC's Inline Assembly facility. In short: asm volatile("SLEEP"); will do what you want. The avr/sleep.h file has sleep_cpu() defined as: #define sleep_cpu() \ do { \ __asm__ __volatile__ ( "sleep" "\n\t" :: ); \ }...


1

The reset pin of the ESP8266 has internal pull-up. Connecting the pin to ground activates the reset of the ESP. To create a reset button, wire a momentary push button between reset pin and ground. Pushing the button will connect reset to ground, causing a reset of the esp8266. The io 16 pin is connected internally to RTC, which in deep sleep counts down ...


1

As described here the ESP8266 can be waken up using Timer Wake Up or external interrupt. The idea is simple: almost everything inside the ESP is powered down (including Wi-Fi and/or System clock or even the CPU) with only a timer running which was told when to activate before the ESP went to sleep. After the desired amount of time has passed the timer ...


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

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.


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.


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