We’re rewarding the question askers & reputations are being recalculated! Read more.

Questions tagged [time]

Use this tag for questions regarding how to get the time on an Arduino, how to create or use clocks with an Arduino, or anything that has time as a substantial factor in it. Also consider using [programming] or other more specific tags.

Filter by
Sorted by
Tagged with
1
vote
2answers
77 views

Converting human readable date to a unix timestamp [duplicate]

Can anyone provide a sample code that would convert a human readable date like 2019-10-27 22:10:35 to a unix timestamp like 1572214235? I found many topics about it, but they eider refer to out of ...
0
votes
0answers
18 views

Send information from computer to Arduino via USB (basic clock)

I've created a small project using an Uno. I usually mess around with ESP8266 chips, because they have WiFi and are relatively easy to work with. However, this time I've decided to go right back to ...
-1
votes
1answer
29 views

how to convert date to timestamp? [duplicate]

How should I convert date format(dd-mm-yyyy) to timestamp value . Can anyone suggest code how to convert and where to put code .
0
votes
1answer
47 views

Time information from GPS receiver: how to tell whether it is fresh or stale?

I see that TinyGPS++ library extracts time information from GxRMC and GxGGA NMEA sentences streamed by GPS receiver. However, in my experiments I observed that both of my GPS receivers generate GxRMC ...
0
votes
4answers
84 views

When GPS can't see satellites, how can I continue to tick off a smooth-ish time?

I'm getting 10 updates/sec from my GPS unit (The MTK3339 used in the Adafruit breakout board), and using it to update a clock display. This works well enough, though there's one minor problem that I'd ...
0
votes
1answer
43 views

Using a Force Sensing Resistor and time input

So the code below measures how much force is exerted on the FSR. I would like to know what would I have to change in this code so that it can record for how long the FSR is being pressed for. So ...
0
votes
1answer
42 views

Arduino is running as a server, but want to occasionally act as a client to update time

My Arduino (actually an ESP32-based Adafruit HUZZAH32) is running as a wifi server. Its main job is to service GET requests from a user, and to periodically turn devices on and off based on the ...
0
votes
1answer
45 views

Why does a function inside void set up is repeating after some minutes

I am trying to time sync my arduino hardware to NTP server. I have a `setSyncProvider(getNtpTime)´ function to do it and called inside the void setup. I have another function (mainFunction) inside the ...
0
votes
0answers
50 views

Send time with ctime to firebase (time library , esp8266)

#include <ESP8266WiFi.h> #include <time.h> const char* ssid = ""; const char* password = ""; int timezone = 3; int dst = 0; void setup() { Serial.begin(115200); Serial.setDebugOutput(...
0
votes
1answer
31 views

RDTSC alternative for Arduino

To calculate an operation execution time, I was saving the millis() result before and after the operation to calculate the interval time. Is there an alternative on the Arduino Uno like the RDTSC ...
0
votes
2answers
35 views

Timestamping AnalogBinLogger data

I would like to timestamp the data collected from AnalogBinLogger.ino on an Arduino Uno. The sketch uses 512-byte buffers, and I have read that writing data in 512-byte chunks is 'better' in terms of ...
2
votes
1answer
245 views

NTP rollover-safe design with ESP8266 (Curiosity)

The Arduino NTP implementation is rather naive in some respects. It basically just grabs the time in seconds from the raw packet, and then converts it to Unix time via subtraction. How would it be ...
0
votes
0answers
105 views

Create file with timestamp

I have a code which creates a file then store relevant data. My first purpose was creating then rewriting (delete & write again) with same filename. However, now I have to log different data to ...
0
votes
1answer
44 views

How do I start a task and have it run for a set amount of time?

I have a project where I need to turn a 24V solenoid on for a set amount of time, then have it turn off. I am rather new to Arduino and not certain how to do this or really where to start. Ideally the ...
0
votes
2answers
87 views

Is there a way to get my MacBook's date and time into Arduino IDE?

I am using a DS3231 RTC module. It requires to set the time every time it is reset. I was wondering if I could read my MacBook's time and date and feed into the module at the setup stage. Is this ...
0
votes
0answers
280 views

Set local stratum 0 NTP server without internet

Currently, I'm doing a running track timing gate project to measure an accurate acceleration (a runner for example). The idea is when the runner triggers the first gate (start gate), the system will ...
0
votes
1answer
85 views

Verifiy NTP server update - at start

I have function to start an NTP service, right after obtaining wifi connection ( using ESP8266 board ). from time to time, I get an error saying date and time is01-01-1970... which I assume is due to ...
2
votes
0answers
57 views

Why would using the += operator on an unsigned long crash my sketch? [closed]

I wrote a simple Timer class that's designed to work even in the face of the 49 day wrap of the millis() counter. I wanted a library that I could easily re-use and I could never remember the right way ...
0
votes
1answer
1k views

How to converte EPOCH time into time and date on Arduino?

I have a question on how to convert EPOCH timestamps, which I receive as char*, into DD.MM.YYYY and HH:MM:SS format seperately? Here are more information to my Arduino project: The Arduino is ...
-1
votes
1answer
379 views

Handling overflow in micros() [duplicate]

The documentation for micros() says: Returns the number of microseconds since the Arduino board began running the current program. This number will overflow (go back to zero), after approximately ...
0
votes
1answer
381 views

How to find the difference between two timestamps

I'm using this time library to access the properties of unix timestamps like hours / minutes / etc. What I want to do is get the current time, and an estimated arrival time, and find the difference ...
0
votes
1answer
44 views

Loops fail after ~5 minutes when making two API calls every 10 seconds using WiFi client

I am running into an issue with a loop call on an Arduino MKR1000. I have tried the solutions suggested in this question and it usually works for 5 minutes and then collapses. I am trying to make two ...
0
votes
1answer
61 views

How to know which event fired first?

I want to automate the chicken coop of my grandmother. To do so, I want to use Arduinos and NodeMCUs, respectively. I want to check if all chickens are in the coop at night and then close a little ...
0
votes
1answer
127 views

TimeAlarms stops working when using setSyncProvider(RTC.get) DS1307

Been working on this project for some time now, like title states when I un-comment setSyncProvider(RTC.get) in the setup the program fails to get any of the Alarm.timerOnce to run. I have been stuck ...
0
votes
1answer
75 views

What is the smallest duration that can be measured using micros()? [closed]

What is the least value of time that I could measure(count) using micros()?
0
votes
2answers
758 views

Getting FFT arduino code to run over 9+ hours, utilizing micros()

I am a beginner in Arduino, coding, and electrical engineering (learning on my own time) and am working on creating an EEG. I've got the hardware down and have managed to get numerical data output ...
0
votes
1answer
167 views

Hibernate Arduino for 12hrs with rtc1302 module

ok, Good morning, guys, with a data acquisition project, in this, I get data every 12 hours, even if it's only 12 hours, the arduino gets connected directly, and it's being powered by a 9v battery, ...
0
votes
2answers
123 views

Parse UNIX-time from char[]

I want to parse a large number to sync time on my arduino. For this i send it a string with the current time in Unix time format wich looks somethink like this: 1535441277 For this I just call a ...
0
votes
4answers
259 views

How to repeat the code

I want to make my biped robot keep walking, but it only move for twice, this biped robot project is important for my Capstone project. The code below is the code that I used #include <Servo.h> ...
1
vote
7answers
1k views

How to parse 20180810T143000Z to time_t

What is the shortest/most elegant way (i.e. use existing lib functions) to parse a string in the form of 20180810T143000Z to a time_t? Note that the literal always represents a UTC timestamp. I ...
0
votes
1answer
77 views

Arduino sketch- How to add Time Stamp for outgoing MQTT

I'm writing a sketch in order to upload to a Sonoff device ( Remote relay, based ESP8266 ). All is working great, but I wish my MQTT pubs to contain following format: [ DATE & TIME ] msg ...
0
votes
1answer
472 views

Arduino - Calculating the time for which a Pushbutton is pressed and held without being released

I'm working on a project that requires calculating the time for which a pushbutton is kept pressed without being released. Is there a code snippet that i can use for this particular need ?
3
votes
2answers
162 views

What precision can I expect by syncronising DS3231 with PC serial?

The point here is to syncronise a DS3231 module (on an Arduino) via serial port with NTP time by computer. The problem here is that I'd like to know how much time is taken by the serial and I2C ...
1
vote
2answers
83 views

Need Input: Wait for voltage input to begin script & when voltage maintains 0V for X amount of time Reset and wait for Voltage Input

So I'm currently working on an automotive set up. I'm using a 555 timer to emulate a turn-signal alternating voltage pulse (12V to 0V and repeat) for debugging purposes which is output to turnPin/A1. ...
0
votes
1answer
103 views

Set computer time on arduino uno [closed]

How to set computer time on Arduino Uno, and then control it (Arduino) with Serial monitor. For example show time on LCD. I have no idea, how to make it using Arduino IDE. So, maybe I can write code ...
0
votes
1answer
102 views

comparison in a time sequence [closed]

in an Arduino sketch a user is invited to input a number representing a time in the format HH:MM, this number is to be added at the end of an ordered and limited sequence of times --the first input (...
0
votes
2answers
52 views

Tian stops working after some hours

I'm having a very strange problem. I have a Tian that is programmed to send out sensor data to a server every x seconds. My program run well but after 14,15 hours of operation it stops working and I ...
1
vote
2answers
879 views

How do I execute some code at a certain time without RTC module?

I am building a project when I need my arduino to execute some code at two given hours of the day, for example one at 19:00 and another at 06:00. I know that with a RTC module I can do this easily, ...
1
vote
0answers
78 views

Storing random and different values of millis() while inside a loop? [closed]

Is it possible to store a value of time while you're inside a loop? Entertain the condition: if (condition && value > 0) { timeTrans = millis() + 2000; timeTrans - millis() = value; } ...
1
vote
1answer
236 views

How can I handle micros() double rollover?

I know that I can handle a single rollover with subtraction: if (micros() - lastTime > period) { lastTime = micros(); ... } But how it can be handled if this is not true or it is not checked ...
0
votes
1answer
408 views

Is it possible to disable functions/methods?

I recently started using the TimeAction library (which allows for proto-threading) and I noticed it has a really useful function for enabling/disabling threads. I want to use the same idea but apply ...
0
votes
1answer
49 views

Increasing number of iterations not increasing time

I am using Arduino Uno with Atmel Atmega328. I am using micros() function in Arduino IDE to measure time taken for execution. Here is my code: void setup() { Serial.begin(9600); } void loop() { ...
0
votes
2answers
400 views

Alternative of relay

I am carrying out a physics experiment using an Arduino. This experiment requires accurate time measurements of upto a millisecond. However I am using a relay to turn on/off an electromagnet and there ...
2
votes
3answers
846 views

Can't stop my variable value at zero?

In my recent project, I want to set my time according to the requirement. And somehow I'm able to manage that. But when I'm decreasing my time value then one weird problem happens. When decreasing my ...
1
vote
2answers
716 views

How to fade an LED in response to a sensor?

As the sensor "sees" an object nearby, it makes the LED go to full brightness and it remains like that for as long as the sensor keeps on sensing the object. Then, as soon as the sensor stops sensing ...
0
votes
2answers
38 views

Does old/low charge battery affects internal clock?

Totally newbie in eletronics here, but could not find the answer for this one. When a battery is nearly-exhausted, it's voltage and or amperage dims, right? My question is if this kind of scenario (...
0
votes
0answers
69 views

5 * tm1637 displaying different school bells timings

I am working on a project which displays time of School bells for a school, I have got 5*TM1637 Display Tubes which displays 5 Periods/Classes start timings.I can set digits of each TM1637 using the ...
1
vote
5answers
3k views

What is a faster alternative to parseInt()?

I'm making an LED spectrum analyzer with an Arduino Due and my PC. The audio processing is done on the PC, and then sent to the Arduino. The exact data sent is a 'coordinate', or more specifically, a ...
3
votes
3answers
4k views

The exact time for functions or CPU cycles for any function

I'm trying to read input data from the parallel port of a PC and send it to another device. For this purpose the input data is saved, when it's available and is sent if a flag is set. The whole ...
1
vote
0answers
16 views

Deceleration time logger between frequencies

i need to measure the air resistance and roll resistance of a vehicle. I plan on using a toothed disc with a proximity sensor which will output a square wave signal in to an arduino. Then I will drive ...