mungewell / pico-timecode

A budget friendly LTC/TimeCode device built from a RaspberryPi Pico - using the PIO blocks and MicroPython
https://github.com/mungewell/pico-timecode
MIT License
31 stars 0 forks source link
ltc micropython micropython-rpi-pico raspberry-pi-pico timecode

Why am doing this? Primarily because it's a fun challenge. I've been interested in Timecode for a while and the PIO blocks on the Pico make it very possible...

DIY Timecode made real (cheap).

The Rev-1 PCBs have been assembled and tested, although the project can run on a un-modified Pi Pico - optionally with a display.

The primary concern would be the accuracy/stability of the XTAL, testing so far shows that the stock XTAL on the Pico is not temperature stable enough. A few degrees of temperate change is enough to throw the calibration off, which will result in the timecode eventually drifting off.

Rev-1 Board Assembled

I have designed the first revision of hardware to be flexible, with the intent of being used in multiple ways and with different 'Pico Boards'. The schematic will show you how simple it is.

There is a fair bit of testing, and we'll need to select the optimum components. But did I say that it WORKS!!! :-)

Render of Rev1

The code now contains a 'calibrate' mode, where the incoming RX LTC is monitored and the XTAL frequencies are adjusted to match. The stock XTAL can be used in the short term for testing/etc, but a replacement TCXO is/would be better.

I am qualifying a number of replacement candiates.

Demo Video - Rev 1

The main.py scripts has a menu which can be used to control the device, and to navigate the settings. The incoming LTC is now validated before Jam is performed, and the RX monitor has indicator bar to show the relative timing between RX and TX.

This 'code' is seven files; upload all seven if you have the same hardware.

PicoOled13.py is library of screen functions, umenu.py is menuing library, neotimer.py is timer library, pid.py is a PID controller and config.py holds the settings for the unit.

pico_timecode.py and main.py combine to make the GUI app.

The first 5 are from other projects, which I use permissively under their own licenses:

(*) actually using my port, as some changes are not yet accepted upstream

I created a sub-directory for the 'libs' to clarify that they are not really part of this project.

Save to Pico

The pico_timecode.py script is also self contained for use without a display, ie can be used on its own on a 'bare' Pico board.

Build Your Own

My intent is that the project could be used to build your own devices. The proof-of-concept script(s) can just be dropped onto a 'bare-bones' Pico.

There's some DIY suggestions.

If you do use my code for a personal project, drop me an email/picture. If you make a device to sell, please send me a sample to test (and promote).

How it works

It's fair to say that this task should be far above a $1 MCU (chip).

All of the LTC decoding is done in the PIO blocks, each has it's own task. Communincation between the PIO is via their in/out pins, and with interrupts.

The pico_timecode.py script just needs to monitor the FIFOs, to keep them feed or emptied.

The main.py forms the user interface/application, and controls the OLED screen

There's an indepth description on the workings.

So how good is it?

Time will tell...

Given my interest (nee obsession) with TimeCode, I have already aquired some specialised test equipment. I have also purchased an UltraSync One to use as a reference, and see how well Pico-Timecode can interoperate.

As it stands the code will 'Jam' to incoming LTC (if available) and then 'free-run' it's output LTC.

The code itself has the ability to monitor the RX LTC, however the display is not fast enough to display every frame (this does NOT affect the output though), the display includes a bar-graph showing the 'phase' difference between RX and TX.

A stock Pico can be calibrated to accurate over many hours, but the XTAL sensitive to temperature changes. A better solution is to replace the XTAL with a TCXO, which improves accuracy significantly.

For more details see testing.