Giter Club home page Giter Club logo

arduino_irig's Introduction

Arduino IRIG Timecode library

IRIG Timecode encoding/decoding library for Arduino and STM32duino, IRIG has been implemented to the standards here

Support for both IRIG A and IRIG B, however the library does not support IRIG with year nor SBS in either IRIG A or IRIG B mode.

Warning Some embedded processors could have trouble with IRIG A due to its 100 microsecond precision requirement, a >20MHz processor is recommended, however I have been able to rather easily generate valid IRIG A signals on a 16MHz Arduino Uno, but the board struggles to receive them with a ~30% failure rate

Examples

  • irig_simple_rx: Receives IRIG-B signals on pin 8, prints the timecode to serial
  • irig_simple_tx: Transmits uptime as IRIG-B signal on pin 13
  • ethernet_irig_ntp_client: Gets time via NTP, sends it via IRIG on pin 8

Installation

cd arduino/libraries
git clone https://github.com/abc123me/arduino_irig.git

Documentation

IRIG Timecode structure

struct irig_time_t {
	uint8_t secs = 0;
	uint8_t mins = 0;
	uint8_t hours = 0;
	uint16_t day_of_year = 0;
	uint8_t tenths_of_secs = 0;
	
	void fixup();
	void uptime();
	void add_ms(uint32_t tdiff_ms);
	void add_s(uint32_t tdiff_s);
	uint16_t to_strn(char* str, uint16_t n);
};

Fields

  • secs: Seconds, from 0 to 60
  • mins: Minutes, from 0 to 60
  • hours: Hours, from 0 to 24
  • day_of_year: Day of year, from 0 to 365
  • tenths_of_secs: 1/10 Seconds, from 0 to 10

Methods

  • fixup(): Called by IRIG_TX::send, makes sure time fields are in range
  • uptime(): Copies current system uptime into struct
  • to_strn(char* str, uint16_t n): Copies contents into str, up to n, returns length
  • add_ms(uint32_t t) / add_s(uint32_t t): Adds a certain amount of time to the time struct

IRIG Modes

  • #define IRIG_A 0: 1ms IRIG, frames should be sent every 100ms
  • #define IRIG_B 1: 10x slower version of IRIG, frames should be sent every 1 second, not accurate to the tenth of a second
  • If an invalid mode is specified, it will default to IRIG_B

IRIG_TX

  • IRIG_TX(uint8_t mode): Constructor for the IRIG_TX class, takes a mode listed above
  • begin(int16_t pin): Initialize output on pin
  • send(irig_time_t timecode): Sends the timecode
  • uint16_t getSendRate(): Gets the recommended interval in which to send timecodes

IRIG_RX

  • IRIG_RX(uint8_t mode): Constructor for the IRIG_RX class, takes a mode listed above
  • begin(int16_t pin): Initialize input on pin, iterrupts not yet supported
  • uint8_t recv(irig_time_t* into): Receives timecode into into, returns 1 on success, blocks until a specified timeout has been reached (frame_time * 3 * 10)

arduino_irig's People

Contributors

abc123me avatar

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.