Giter VIP home page Giter VIP logo

gnss_timestamp's Introduction

GNSS Timestamp

Idea

This is intended as a timestamping device, triggered by a external pulse, sends the current timestamp over serial in ISO 8601 format with milliseconds.

It connects to the host computer via USB-serial, most arduinos have this built in.
For testing it can also be triggered by sending any character to it over this serial port.

Hardware

Pinout
On devices with separate HardwareSerial available, like the Arduino nano every:

0: TX to GNSS module, not used for now.
1: RX from GNSS module, sends NMEA 0183 to mcu.

On SoftwareSerial devices:

4: TX to GNSS module
5: RX from GNSS module

Common for both:

2: PPS from GNSS module, rising pulse that happens exactly at the start of the second.
3: Trigger input, a falling edge sends out the timestamp. Use a optocoupler or similar, uses pullup.

The trigger input needs to be debounced properly, else it will trigger many timestamps. Make sure the external signal is conditioned to stay within safe limits of the mcu, avoid connecting directly to it.
Recommended to use a opto coupler on the trigger input to isolate that device from the arduino and host computer. This needs a trigger source that can supply it's own current to the LED inside the opto.

The connection to the GNSS should be 3.3V signals for a MCU that runs on 3.3v, there is versions that run on 5V and the io and supply needs to be managed properly to avoid frying something.

Building

This project is built using the platformio ide.
By default it builds for a few platforms as specified in platformio.ini, uncomment the default_envs and set it to the platform you want to use. This simplifies the build and upload. Use the PlatformIO: Upload with the mcu of choice connected to the computer.

gnss_timestamp's People

Contributors

kng avatar

Watchers

 avatar

Forkers

mfkiwl

gnss_timestamp's Issues

Potential rollover problem

sprintf(ts, "%04d-%02d-%02dT%02d:%02d:%02d.%03lu", year(), month(), day(), hour(), minute(), second(), (millis() - ppsTime) % 1000);

Executing all individual steps of this line doesn't take that much time, but if execution starts just before the clock rolls over (to a new minute, hour, day, month or year).

For example, if the execution starts at 2024-12-31 23:59:59.9999 this could happen:
year() would return 2024
the clock would roll over to the new year
month() would return 01
day() would return 01
hour() would return 00
minute() would return 00
second() would return 00
so we could get a timestamp of 2024-01-01 00:00:00.0000 which is 1 year offset from the correct time.

A rollover at the year exactly when the shutter is triggered is of course very unlikely, but if the minute rolls over we get a similar problem with 1 minute offset.

Also, we might get a PPS interrupt while this line is being executed, which would create similar effects.

Depending on how fast/slow the mcu is, how the ram is cached ad how often she shutter is triggered, this might be an insignificant problem, or a problem that actually happens quite often.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.