Author Topic: Arduino IRIG-B timecode generator  (Read 4419 times)

0 Members and 1 Guest are viewing this topic.

Offline WiseDuxTopic starter

  • Newbie
  • Posts: 2
  • Country: us
Arduino IRIG-B timecode generator
« on: September 22, 2019, 11:48:14 pm »
I acquired an old UTC timecode display like this https://web.archive.org/web/19990225150428if_/http://www.bancomm.com:80/9520-2000.pdf, which takes an IRIG-B time signal and displays it in big 7 segment LEDs.  I put together an Arduino sketch that reads NMEA data from a GPS receiver, and outputs IRIG-B B000 format (DC pulse width coded).  Just my luck, this time display only works with a carrier modulated signal.

Is there a simple way to modulate a 100 PPS signal onto a 1 kHz carrier?  My first thought is something analog, though I'm not sure where to start.  As it stands, the Arduino is having a hard time keeping up with both serial reads (from GPS) and sending the IRIG-B signal, so I don't think I can do this in software without some clever trick I'm not aware of.

Page 3 on this doc http://www.cyber-sciences.com/wp-content/uploads/2019/01/TN-102_IRIG-B.pdf illustrates pretty well what I want to accomplish.
 

Offline jhpadjustable

  • Frequent Contributor
  • **
  • Posts: 295
  • Country: us
  • Salt 'n' pepper beard
Re: Arduino IRIG-B timecode generator
« Reply #1 on: September 23, 2019, 01:58:14 am »
Try creating a plain 1kHz output with one of the on-chip timer/counters, perhaps with a PWM library. Low-pass filter it well using an external RC, then use another output controlling a 2:1 analog mux/demux to switch the clock panel output between the filtered wave at the high level vs. the filtered wave at the low level. That control output can be generated using a GPIO, another timer, even a second USART running at 1000bps if you're careful. Interrupts are likely required to produce an accurate signal.
"There are more things in heaven and earth, Arduino, than are dreamt of in your philosophy."
 
The following users thanked this post: WiseDux

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12806
Re: Arduino IRIG-B timecode generator
« Reply #2 on: September 23, 2019, 06:07:15 am »
There's a bit more refinement needed than that as, to avoid waveform distortion due to runt pulses, you need to switch the mux at the carrier zero crossings.  If the phase shift due to the low pass filter is carefully controlled, you can make it work if you control the mux from within an ISR off the PWM timebase, so its locked to the carrier phase, but if you use an external carrier, or your filter's phase shift cant be tuned to get an interrupt coincident with the zero crossing, you'll need to add a comparator to square up the carrier to feed to an external interrupt pin, so you can get an interrupt when youi need it.
 
The following users thanked this post: WiseDux

Offline WiseDuxTopic starter

  • Newbie
  • Posts: 2
  • Country: us
Re: Arduino IRIG-B timecode generator
« Reply #3 on: September 26, 2019, 01:09:57 am »
I have this working using a variation on jhpadjustable's suggestion.  My sketch already had a 20 kHz timer interrupt for setting the DC pulse width coded IRIG-B signal, so toggled a second output pin high/low every 500 us for the 1 kHz carrier.  A fifth order RC lowpass made it look enough like a sine wave.

I didn't have an analog mux on hand, so I used an op amp and transistor to make a voltage controlled amplifier.  The DC pulse width coded IRIG-B signal controls amplification of the 1 kHz carrier, which yields the modulated output.  My code and circuit need a bit more refinement, but I'll post a link to the final product when I get there.

Carrier zero crossings don't line up perfectly with the pulses, but the time display doesn't seem to mind.

Thanks again for your help.
 

Offline ConKbot

  • Super Contributor
  • ***
  • Posts: 1380
Re: Arduino IRIG-B timecode generator
« Reply #4 on: October 04, 2019, 06:02:32 pm »
There's a bit more refinement needed than that as, to avoid waveform distortion due to runt pulses, you need to switch the mux at the carrier zero crossings.  If the phase shift due to the low pass filter is carefully controlled, you can make it work if you control the mux from within an ISR off the PWM timebase, so its locked to the carrier phase, but if you use an external carrier, or your filter's phase shift cant be tuned to get an interrupt coincident with the zero crossing, you'll need to add a comparator to square up the carrier to feed to an external interrupt pin, so you can get an interrupt when youi need it.
Before the filter, add a resistor divider, and switch the low-leg of the divider with a micro pin (toggling between hi-z and low)  the switching still needs to be done in a synchronized manner, but the phase shift of the filter isn't a factor any more. Just make sure the filter is happy with the variable source impedance, or buffer it.
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12806
Re: Arduino IRIG-B timecode generator
« Reply #5 on: October 04, 2019, 09:21:35 pm »
I thought of that, but if you want the edges of the modulation envelope to be as square as possible, you must modulate after the carrier harmonic suppression filter.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf