I am an absolute beginner and don’t know how or where to start at my project. I want to make a stopwatch on the blynk app using an external push button.
Can somebody help me wit this?
Blynk may not be the ideal system, although it depends on what sort of accuracy and functionality you’re looking for.
If you want to see elapsed time in the app in real time, and with some degree of accuracy, then the latency of communication via the internet to the Blynk server and then on to the app will make the project inaccurate.
If however you want to start and stop a timer using a physical button, then report the elapsed time to the app then it could be done.
I think you’d need to elaborate on the required functionality and on the type of hardware and connection type you are thinking of using.
I think it is not really necessary to see the elapsed time. Only the time where it ends is necesarry. And i indeed want to start and stop with a physical button.
What do you think i should do/learn first to begin this project?
Take a look at s9ne of the sketch builder examples.
This one shows you how to check to see when a button has been pressed:
And this one shows how to send the current millis() value to Blynk:
Millis() is the number of milliseconds since the MCU booted-up, and it increments automatically. You can’t reset it (unless you reboot the device) and it continues to 7ncrement until the number gets to big to hold in a floating point variable, at which point it resets to zero. This happens after around 49.7 days.
You will need to grab the current millis Reading when the button is pressed, and again after it is pressed the second time. Subtracting one from the other will give you the time in milliseconds between the two button presses. You can then push this value out to Blynk.
Decide what hardware you’re using, and how it will connect to the internet, then have a go at combining the two sets of code and see how you get on.
I think I will use the arduino nano and a ESP8266.
I continue tomorrow, so i’ll see how far i get.
If you’re just doing the stopwatch with this then the Arduino Nano is redundant. Just use the ESP8266 on its own.
The esp8266-01 has finally arrived! I searched up how it connects with an arduino nano (I already had that one), but what things do I have to do for the first example (to see when a button has been pressed)? Do i just have to copy the whole file into the arduino program and fill in the code that I get in my mail? Because I don’t really know where to start right now.
What is it that you are trying to achieve?
Do you want the same physical button to be used for start and stop?
What sort of accuracy and duration are you looking for?
What role do you think the Nano will play in the process?
My final achievement is to make a stopwatch with external buttons, but first I want to know how it can recognize a pressed button using a esp8266-01.
It doesn’t really matter if the same button is used for start and stop, but i’d rather have 2 different buttons, but if its easier to use the same button, i’ll do that.
The accuracy of the timer hasn’t to be second-precise. The duration will be i think between 20 -40 minutes.
I think the nano will time the time between when the start and stop button is pressed and send it through the esp to the blynk app
The ESP8266 chip on the ESP-01 has around 5 times more processing power (10 times more if you increase the clock speed) than the Nano, and significantly more memory.
As you’ve chosen the ESP-01 package there are limited GPIOs available to you, but if you went for the one physical button option then you could make the project using just the ESP-01 which is why I said:
There are several methods. The physical button will be connected between one of the GPIO pins and either the positive voltage or ground. When the button is pressed the pin will change state (go LOW or HIGH depending on how you’ve wired it).
This change of state will be identified by either attaching a software interrupt to the pin, or by checking the state of the GPIO pin on a regular and frequent basis - every few milliseconds in this case.
One issue you will have is that physical buttons don’t make/break their contact cleanly. There is always a degree of ‘bounce’ that needs to be handled, otherwise you’ll be getting multiple presses/releases of the button.