Arduino IRIG-B timecode generator - Page 1
Forum section: electronics / general

author: WiseDux
author_rank: Newbie
timestamp: September 22, 2019, 11:48:14 pm
content: I acquired an old UTC timecode display like thishttps://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 dochttp://www.cyber-sciences.com/wp-content/uploads/2019/01/TN-102_IRIG-B.pdfillustrates pretty well what I want to accomplish.

author: jhpadjustable
author_rank: Frequent Contributor
timestamp: September 23, 2019, 01:58:14 am
content: 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.

author: Ian.M
author_rank: Super Contributor
timestamp: September 23, 2019, 06:07:15 am
content: 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.

author: WiseDux
author_rank: Newbie
timestamp: September 26, 2019, 01:09:57 am
content: 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.

author: ConKbot
author_rank: Super Contributor
timestamp: October 04, 2019, 06:02:32 pm
content: Quote from: Ian.M on September 23, 2019, 06:07:15 amBefore 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.

author: Ian.M
author_rank: Super Contributor
timestamp: October 04, 2019, 09:21:35 pm
content: 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.