0

I am going to make a project that needs four boards of Arduino which synchronization in time is needed. The project is about capturing the timestamp (in ms resolution) whenever something is crossing ultrasonic proximity sensor. The following are the modules I am going to use:

  1. Arduino Uno R3 4 units
  2. Ultrasonic Proximity sensor 4 units
  3. DS1302 RTC modules 4 units
  4. Micro SD Card modules 4 units

The boards will be placed in 4 different places which it is quite far from each other that makes it is hard to make wired connection. The detecting object will move back and forth during a certain interval of time, so that is why the time synchronization is needed.

My idea is, by using the timestamp from RTC modules, I turn all the boards together into deep sleep mode at the time I have set in the code and wake them up together after 10 seconds. I don't have any problem with RTC modules, but my problem lies in the millis() function which did not back to zero after woke up from deep sleep mode. I need this function since the DS1302 RTC does not provide ms resolution, yet I can not achieve sync if the millis() function does not back to zero.

I tried the code (edited with millis() added in the loop) from here: https://www.youtube.com/watch?v=8fiYvnBDsDE

Do you have any solutions? Or another RTC module which provides ms resolution instead. Thank you

  • 2
    why are not able to treat the millis() value, at wake time, as the zero reference point? – jsotola Jun 23 at 17:13
  • 2
    I don't actually think that millis() is supposed to be reset on a wakeup... – Sim Son Jun 23 at 18:18
  • 1
    This looks like an XY problem. X: you need to synchronize the times, Y: you want to reset millis(). – Edgar Bonet Jun 23 at 18:20
  • I can not achieve sync if the millis() function does not back to zero ... change your code so that it does not require millis() to be reset – jsotola Jun 23 at 20:04
  • You should read edgar's reference to the XY problem. Although it sounds like it might relate to tracking an object in two dimensions. It is actually talking about something else. – GMc Jun 23 at 22:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.