Teletext Experimenter’s Board – Tutorial 3 – Decoding

When Philips created Teletext ICs like the SAA5246, their target customers were other manufacturers of televisions. The selling point of the SAA5246 was that it allowed a manufacturer to implement Teletext-support (and all the certification and testing that goes with it) with a minimum amount of effort.

You fit the IC into your television. The “host” processor of the TV sends it commands over I2C, and a composite video feed is fed in which carries the Teletext data. The RGB signals coming out of the IC are connected to the tube driver, optionally mixed with the RGB signals that the TV creates for the display. Easy!

So for this tutorial, we’re going to use the Teletext Experimenter’s Board in the manner in which it was intended. The board provides us with the SAA5246 and the supporting electronics to display decoded Teletext on a screen, and we’re going to use an Arduino Uno as the host processor. The only thing missing is that we need some Teletext to decode.

Where to get Teletext

Hopefully if you’re reading this, you already have a source of Teletext-on-composite-video that you want to decode. Teletext has been deactivated in many parts of the world (though not all). But for the purposes of this tutorial, I’m going to use vbit2.

https://github.com/peterkvt80/vbit2/wiki

This is a rather marvellous project which coaxes a Raspberry-Pi (with a composite video output) to generate a valid Teletext feed. This is combined with an active community of Teletext content creators, who have created a framework for distributing user-made Teletext pages over the Internet. vbit2 can be configured to get these updates on a regular basis.

I had intended to write a separate tutorial just on installing this on a Raspberry-Pi, but honestly … it’s so straightforward and the Wiki is so clear, there’s no point me repeating it. The summary is:

  1. Find a Raspberry-Pi. Your oldest and slowest will be fine, but it needs to have network connectivity.
  2. Install latest Raspbian on it. Don’t bother with the graphical desktop – just text mode will be fine.
  3. Run the single command at the bottom of vbit2’s Wiki page (under “Installing VBIT2”).

Set it to install TEEFAX, and to start automatically on boot and get regular page updates … and that’s it!

If you have an old analogue TV, it can be useful to connect a running vbit2 system to it, and browse Teletext on the TV as normal. It’s a good way of verifying that vbit2 is running. For example:

(I’m not a big fan of the font or spacing on this TV.)

To do this, I just connected the output from the Raspberry-Pi into the “video in” on the TV, and then pressed the “Teletext” button on the remote.

Connecting to the Experimenter’s Board

Wherever you get your Teletext-on-composite from, you connect it to the phono socket on the board (or the two-way header close to it, if that’s better for you). Here is my Raspberry-Pi running vbit2, connected to my board, and the Arduino controlling it:

The connections between the Experimenter’s Board and the Arduino Uno are the same as for the last two tutorials – just +5v and I2C.

Overview of controlling the SAA5246

In the previous two tutorials, we saw how we control behaviour of the SAA5246 by writing values into registers. We continue that method here – it’s just that we’ll be using some registers we’ve not touched already, to control page selection, hold, reveal, zoom, and so on.

Example Software

I’ve written an example sketch that controls the Experimenter’s Board and provides the same sort of functions that you’d expect from a television. Download it here and have a look.

One thing to point out is that some of this code needs to know how how registers have been set, when deciding what to do next. For example: to iterate between the different “zoom” settings (top-half, bottom-half, off) we need to know what state it is in now, so we know what state to change it to.

Unfortunately, some of the registers in the SAA5246 are “write-only” – we can change them, but we can’t read them back. To get around this, we keep a “local copy” of registers in the Arduino’s RAM, as an array of bytes. It then becomes quite convenient to write register settings into this array first, and then implement functions like UpdateSingleRegister and UpdateRangeOfRegisters which write those to the SAA5246.

I didn’t bother with this in the first two tutorials, because I wanted to keep the code examples as simple as possible. But this project is a bit more involved, so it seems a good time to introduce this technique.

Interacting with the Arduino

For this tutorial, I’d originally planned to implement a keypad, other buttons, and so on … but then realised that I’d be bloating the software with unnecessary functionality that might make the “useful” code harder to see.

So, for the purposes of this tutorial, you connect to the Arduino with the Serial Monitor (at 9600 baud) and then send it a command as a line of text. Here is a summary of the commands it currently supports:

  • P<three digits> – change to page. For example: P123
  • D – download page (prints it to serial port in human-readable form. See Tutorial 4.)
  • H – toggle hold
  • R – toggle reveal
  • Z – toggle zoom

If there’s enough interest, I might implement proper button input as a project in its own right.

Output from the Teletext Experimenter’s Board, decoding the vbit2 feed, controlled by the Arduino Uno.

Click here to visit the Teletext Experimenter’s Board main project page.