Saturday, May 20, 2023

Adding an aspect radio switch to CRT TVs

This post is about a simple modification that can be done to many CRT TVs to add an aspect ratio switch.

The main uses for this nowadays would be to make the TV more usable on a distribution system set up for 16:9 TVs, or to allow for correction of the aspect ratio for retro gaming consoles which were designed for NTSC then bodged to produce a letterboxed PAL picture for export to PAL regions.

This mod can be carried out on most TVs except those made at the end of the CRT TV era, which typically use the service menu for control of the vertical size.

The main objective is to find the V Size potentiometer, then add a switch and a second potentiometer. In the circuit below, decreasing the resistance between the wiper and top end of the track on VR301 will decrease the height of the picture. There are two main ways of connecting it up - remove the wiper connection on the existing potentiometer and connect it to the other leg of a double throw switch, which has the benefit of the second aspect ratio's height not depending on both potentiometers, or switching in the second potentiometer, which has the benefit of avoiding the problem of what happens during the time that the switch is not making contact with either throw when changing its position - that shouldn't damage the TV but doesn't look as good in my opinion.

If the purpose of the mod is to add a 4:3/16:9 switch, then the original potentiometer will set the height for 4:3, and the new one will set the height for 16:9.

If the purpose of the mod is to add a switch for the aspect ratio required for PAL consoles, then the original potentiometer will set the stretched height for that, and the new one will set the height for 4:3.

If 4:3, 16:9 and the stretched aspect ratio for PAL consoles are all required, then a double throw (SPDT) switch can be used. The second throw will connect a second potentiometer to the lower side of the V Size potentiometer. In this case, the original potentiometer will set the height for 4:3, and the new ones will set the aspect ratios for 16:9 and gaming.

The next step is to select an appropriate switch and find somewhere to mount it. Switches with any exposed metal should be avoided unless you are absolutely sure that the TV is powered through a fully isolated transformer. The new potentiometer or trimmer should be accessible once the new switch is installed so that the picture height adjustments can be carried out reasonably safely once the modification has been assembled.

Modification on a 21" colour CRT

A hole was cut in the dummy speaker grille.

Modification on a 12" black and white TV

This TV is powered from a 12V DC input or a transformer. The method of using both throws of the switch to select between the original and new potentiometers was used on this one, with the consequence of the vertical height jumping if the switch is moved too slowly between the two positions.

Once the mod is assembled, assuming the original potentiometer has already been set accurately, the new potentiometer can be adjusted while looking at the picture until the correct aspect ratio is achieved.

Sunday, March 5, 2023

ESP32-based Octopus Tracker Unit Rate Display

This project is based on the ESP32 and demonstrates how the chip can be used to connect to the internet, fetch useful data and display it.

octopus Tracker is a tariff which tracks the day-ahead wholesale prices of electricity and gas. This gets around the problem of energy being bought in advance at very high prices in 2022, making it by far the cheapest non-time of use tariff available in early 2023, but this comes at the expense of the tariff prices changing every day, so it's useful to have these prices conveniently displayed.

The project uses the esp-idf-json library and is based on the json-http-client2 example.

The code connects to wifi, then fetches the JSON data which contains the unit rates. The date and time in the HTTP response header is used to get the current date and time and set the ESP32's built-in RTC, which isn't displayed to the user, but used to refresh the prices every hour and determine what the current date is in order to display the correct prices from the JSON data.

The data is updated hourly because the day's unit rates are occasionally not available from the start of the day, and the correct unit rates won't be available for several hours in such a case.

Link to the source code on GitHub

Hardware design

Two three-digit 7-segment displays are used to display the prices. Each display already has three common anodes for the digits and has the matching segments of each digit connected together internally, and the segment pins of each display have been connected together to produce a display which is electrically a 6-digit multiplexed display. The anodes are switched with some general purpose PNP transistors because the peak current exceeds the current limit of a single ESP32 pin, and the segments are connected to ESP32 pins via resistors to limit the current.

A photodiode has been added to dim the display in conditions of low ambient light. An LDR would also be suitable. The voltage generated by the voltage divider is read using an ADC input and used to select one of four brightness levels. Filtering and hysteresis are used to avoid the brighness flickering in certain lighting conditions.

As an ESP32 WROOM 'dev kit' has been used for this project, the UART and 3.3V voltage regulator are built into the dev kit, so these components didn't have to be included in the circuit. Power to the project is supplied via a USB cable which is plugged into a convenient USB power supply.

Schematic

Schematic

Hardware

The prototype has been carefully built on the copper side of some stripboard, taking care to ensure that no leads are sticking through to the component side on which only the 7-segment displays and photodiode are mounted. The perfectly smooth surface of the component side has been used to apply some labels.

Hardware front
Hardware back

Saturday, September 24, 2022

Bush WI-1810 Internet Radio - Quick Teardown and Analysis

The Bush WI-1810 is a budget internet radio and Bluetooth speaker sold by Argos. At the time of writing, it was discounted to £25, but at its usual price of £49.99 it still represents the low end of the internet radio market. The radio is based on the Magic Systech platform, which is a popular platform and is found on many internet radios, but more premium brands such as Roberts and Pure use the competing Frontier Silicon SmartRadio platform. Both platforms allow set designers to incorporate a variety of features in a set including but not limited to internet radio, Bluetooth, uPnP streaming, FM, DAB+, CD player, and line in, but this set analysed here only features the first three of those features.

Inside the Bush Internet Radio
Close-up view of the PCB

The current consumption of the radio is 0.25A @ 6.0V when in standby and 0.3A when on but nothing is playing. The current goes up by a negligible amount when an internet radio station is playing and the volume is turned down. When the volume is turned up to maximum, the current varies according to the audio and peaks at around 0.5A.

The level of integration in this product is surprisingly low. My original expectation was that there would be a Magic Systech-branded chip inside performing most of the key functions of the radio, much like the Frontier Silicon radios, but all of these functions are carried out by independent ICs and the CPU is an off-the-shelf one not specifically designed for radios. Despite the complexity of the design, components have been carefully selected to lower the cost whilst still delivering a reasonable level of performance where it matters - the audio quality.

Electrolytic capacitors - all off-brand through-hole 10V types, but surprisingly rated for 105 degrees C. Through-hole electrolytic capacitors are still cheaper than surface mount ones for some reason, so the extra assembly effort is often worth it.

CHMC SBE SCA108 Voltage regulator - I couldn't find anything for this part number, but the 0.33R resistor between pins 6 and 7 and the connections to the inductor, schottky diode and timing capacitor point to this being a really cheap Chinese clone of the MC34063, which itself is the cheapest widely available Western switching regulator IC. The 51k and 33k feedback resistors give an output voltage of 3.18V. This IC has a rather high maximum input voltage so this should give good headroom against overvoltage on the input.

The MC34063 is generally a good choice for this application. The only real disadvantage it has is that its switching frequency is low, which means it needs a fairly high-value inductor (typically 220uH), which is physically quite large at the regulator's typical rated current of 0.5A. Large inductors are expensive, so the designer has used a rather small inductor here.

I don't know how much current this design uses at 3.3V, or the current rating of the inductor, so I can't comment on whether it is comfortably adequate or being stressed. However, as both the inductor and chip get rather warm when the set is running, and the set uses 0.3A @ 6V when it's not producing any sound and it runs Linux, I would guess that the current it uses at 3.3V is much closer to 500mA than it is to 0mA, so if the device fails, I would check this inductor.

Nuvoton N32905U3DN main CPU - a surprisingly exotic chip which can run Linux and drive LCDs up to 1024x768. I found some limited information elsewhere on the internet which indicates that the Magic Systech software platform is Linux-based and that it is not exclusive to Nuvoton CPUs. The chip itself is not very old but the ARM926EJ-S CPU core itself is rather dated, which probably keeps costs down and contributes to the general sluggishness of the user interface.

W25Q32JV flash - this 32Mbit capacity (4Mbyte) flash chip will contain the entire program of the product as the CPU does not have any significant program memory of its own.

Super Chip SC2314 audio processor - this applies effects like volume, balance, bass, treble, etc. I'm surprised they didn't integrate these functions into the main CPU and implement them in software. Both channels appear to be in use, so there's an opportunity to mod in a stereo headphone jack to replace the mono jack it comes with. The L and R outputs from this chip go to C15 and C14, the other ends of which are connected together. I haven't tested it to see if the channels are stereo before that point.

CS8509E - Class D amplifier. Rated for operation up to 9.2V, and can deliver up to 8.5W into a 4-ohm load at 8.5V or 3W into a 4-ohm load at 5V. When powered from 6V, the maximum power would only be just over 3W at 1% THD according to a graph in the Chinese-language datasheet, which is probably why the Argos listing says it only has an output power of 3W despite the speaker being rated for 5W.

MT7601 Wi-Fi chip - commonly found in cheap Wi-Fi dongles, and probably selected for availability of Linux drivers. There is no Ethernet port on this set, which keeps the price down, but can result in reception being wiped out if the microwave is used in the kitchen (a common location to deploy a radio like this).

Bluetooth receiver - Beken BK8000 (under the sticker). This chip is commonly used on those Bluetooth-to-3.5mm modules which can be found on Aliexpress for next to nothing. Some of those Aliexpress modules look identical to the module in this radio. The module features a flash chip with a quarter of the capacity of the main processor's flash chip! All the audio decoding is done inside the BK8000, so the main processor just drives the module with some GPIO and presumably routes the audio to the speaker via the SC2314.

Speaker - 5W. This rather hefty speaker is not hi-fi quality but it's much better than that which would typically be found in an entry-level DAB/FM radio or even some entry-level boomboxes and the sound quality is quite reasonable for such a cheap set. I don't have a proper sound level meter so I can only give approximations of the frequency range, but when connected to a phone running a signal generator app via Bluetooth, the volume started to drop off below 80Hz and nothing was heard below 50Hz. At the high end, it sounded fine up to at least 9kHz.

Monday, May 30, 2022

Experimenting with RF modulators part 2: Sky IO Link and control via a Raspberry Pi

Following on from Experimenting with a programmable RF Modulator (making a controller for it and testing harmonics), I have continued my work on this topic with these goals in mind:

  • Make a neater VBIT-Pi assembly by integrating the modulator, VBIT-Pi hat and Raspberry Pi into a single unit
  • Control a Sky IO Link

Raspberry Pi control

The Raspberry Pi already has I2C support, and it is fairly straightforward to use it from the command line and in a Python script. In my application, the Raspberry Pi is already being used with a VBIT-Pi hat, an open-source hardware teletext generator which adds teletext data to an external video signal, which has two ICs on it connected to the I2C bus. Fortunately, the modulator IC's I2C address is different to the two ICs, so it's simply a case of wiring up the I2C pins to the same pins used on the VBIT-Pi.

The i2cdetect command can be used to test that all the I2C devices are connected:

pi@raspberrypi:~ $ i2cdetect 1
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will probe file /dev/i2c-1.
I will probe address range 0x03-0x77.
Continue? [Y/n]
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- 25 -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- 44 -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- 65 -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

The modulator can then be tested from the command line with a command like this: i2cset -y 1 0x65 0x80 0x10 0x25 0xF4 i (this will set the output to C21)

I modified the VBIT-Pi to remove the composite video output, since that was now wired into the modulator, and add an audio input for the modulator instead. I also added a micro USB port (wired to a GPIO pin via a resistive divider) with the intention of connecting that to the USB port on the set top box that will supply the video signal, so that the modulator is only active when the set top box is on.

RF modulator mounted on the Pi

I wrote the script to control it in Python. To keep things simple, I only implemented the maths for UHF channels, even though the modulator supports VHF channels.

When pressed into service, the Pi can be set up to run the script at startup. During testing, it can be started from the command line with python3 ./rf-mod.py and terminated with Ctrl+C. If you have no need for the external enable, then all the code concerning the GPIO interrupt can be removed.

# RF modulator example code
# This example controls an MC44BS373CA RF modulator
# from a Raspberry Pi. The GPIO set as an input
# can be used to enable and disable the RF modulator
# on demand, and if connected to the USB port on a
# set top box, will automatically turn the modulator
# on when the set top box is on.

import time

import smbus
# Set I2C bus number (may vary according to the Pi used)
bus = smbus.SMBus(0)

import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)

# GPIO 23 set up as input.
GPIO.setup(23, GPIO.IN)

device_address = 0x65
# Set desired channel here (UHF only)
desired_channel = 38
# Set to 1 to enable test pattern or 0 for normal behaviour
test_screen_enable = 0
desired_frequency = (desired_channel - 21) * 4 * 8 + 1885
desired_n = (desired_frequency << 2) & 0x3ffc
desired_n_h = (desired_n >> 8) | (test_screen_enable << 6)
desired_n_l = desired_n & 0xff
config_values = [0x80, 0x10, desired_n_h, desired_n_l]

def configureModulator(gpioChannel):
        #gpioChannel only needed for setting up event handler; it doesn't do anything
        try:
                time.sleep(1)
                bus.write_i2c_block_data(device_address, config_values[0], config_values[1:4])
                print("RF Modulator configured: C", desired_channel, " System I")
        except:
                print("I2C Bus Error (Modulator probably not powered)")

#Configure now just in case modulator is already powered
configureModulator(0)

try:
        GPIO.add_event_detect(23, GPIO.RISING, callback=configureModulator, bouncetime=2000)
except KeyboardInterrupt:
        GPIO.cleanup()       # clean up GPIO on CTRL+C exit

#Loop forever - should not be resource intensive
while True:
        time.sleep(1000)

GPIO.cleanup()           # clean up GPIO on normal exit

This works very well and reliably. The output of the modulator is fed into the house AV distribution system, making it available at every TV point in the house. In retrospect, it may be more useful to use the set top box signal to control a multiplexer which switches the video input between the set top box and Raspberry Pi's composite video out, instead of turning the modulator off. The Pi could then be used to display an "in vision" service or other video content when the set top box is turned off.

Sky IO Link

The Sky IO Link is an RF modulator in a small box which was introduced alongside later Sky+HD boxes where the built-in modulator was removed to reduce costs. This modulator is still made today (2022) by various manufacturers and sold at a low price (~£10), which makes it a great choice for any project requiring a modulator.

Photo of IO Link

The modulator is similar to the ones that were previously built into the Sky boxes, but with an Abilis modulator IC rather than the Freescale one used previously, but the IC claims to be a drop-in replacement, so it should work with the code I've already developed.

The short cable is terminated with a 10-way mini DIN connector, and probing around suggests the following pinout: (wire colours on my unit shown)

IO Link Pinout

The VBIT-Pi's open-source PCB layout could be modified to include the mating connector, which would allow neat and tidy integration with the Pi.

10-way mini DIN PCB connector wiring

For testing, I wired the connector up to the Pi's GPIO header and connected the video input to the Pi's video output:

  • 4 (Power supply) - 2 (5V)
  • 5 (GND) - 9 (GND)
  • 6 (SCL) - 5 (GPIO 1 / SCL 0)
  • 7 (SDA) - 3 (GPIO 0 / SDA 0)

The SCL and SDA pins require pull-up resistors, and should be pulled up to 3.3V (not 5V as shown in my photo, but I got away with that bodge).

I ran my Python script from earlier (changing the SMBUS port to 0 for the original Pi in use here) and it worked perfectly.

IO Link connected to Pi and TV

Monday, May 2, 2022

Outdoor LED lighting controller

Introduction

This is a simple project which is a lighting controller for the inexpensive LED tape which is widely available from marketplace sites and is designed to be powered from 12V.

LED tape lights

The requirements for this project were:

  • Automatically turn the LEDs on at dusk and turn them off at dawn
  • Run the LEDs at a dim brightness during normal operation, or at high brightness when high brightness mode is enabled
  • Have a button for selecting high brightness mode. High brightness mode shall automatically be turned off after a time period
  • Have good efficiency

Preliminary testing

Prior to building the controller, the waterproof LED tape was installed as desired around the outside of my house. Around 8 metres of LED tape was installed in three separate lengths and mains flex was wired between each of the three runs and a central location where the controller will be installed along with its light sensor.

The LED tapes were all connected to a bench power supply in parallel for testing.

At the design voltage of 12V, the LEDs are at full brightness and consume around 2A of current for a total of 24W of power. The LEDs are quite bright at this power and the brightness is far too excessive to be used all night, not to mention the high operating costs over the long term.

The voltage was turned down until a sensible brightness for all-night operation was found. This was found to be in the range of 7.90V to 8.10V, with the current varying from 0.05A to 0.10A, and the power from 0.395W to 0.810W. With this in mind, a target voltage of 8.00V was chosen, which should result in a power consumption of only 0.6W (plus overheads from the mains power supply), resulting in low running costs.

Design

The power section of the design was be based around one of the inexpensive and widely available LM2576 buck converter boards. The board was modified to replace the trimmer potentiometer with fixed resistors to avoid future unreliability, and the Enable pin was carefully desoldered from the PCB so that it could be externally driven. A connection was also added to the feedback junction so that an extra resistor could be wired in parallel with the main resistor; this would form the basis of the brightness selection, where this resistor can be left floating or shorted to GND via a transistor to modify the lower resistance value in the feedback network and hence change the output voltage of the buck converter.

Originally I planned to use a comparator wired as a schmitt trigger to control the Enable pin and a 555 timer in monostable mode to control the high brightness mode, but I decided to change to a microcontroller to allow more flexibility and make it easy to implement multiple time-out periods for the high brightness mode which can be stepped through by pressing the button repeatedly. I used a PICAXE-08M (educational microcontroller) since I already had a few, but a bare PIC or ATtiny would also work well.

Schematic

Hardware

I built most of the circuit on stripboard and placed all the components to allow it to fit inside a plastic case.

Some extra resistors have been used in the feedback network compared to the schematic to trim the output voltage more accurately. Polyfuses were also added to each of the three outputs to provide independent short-circuit protection for each channel, which I thought would be a good idea given that the lights are outside.

Assembled project
Interior of the project

The case was screwed to the wall and the LDR was positioned where it could be illuminated by light from outside without being illuminated by very much from the lighting it controls, and it works very well.

Monday, December 27, 2021

Wireless temperature display with bare glass LCDs

First completed: 2018

Introduction

I had previously developed a simple wireless temperature display system using a network of battery-powered transmitters which transmit the temperature from their current location using low-cost 433MHz AM transmitters spread around the house to a custom-made display unit. I wanted to add a second display to show the temperatures from the same transmitters in another location, and also wanted to take the opportunity to experiment with the LCD drivers that are built into selected Cypress PSoC microcontrollers.

The PSoC 4 is a microcontroller based around the ARM Cortex-M0 processor core which features a comprehensive range of built-in peripherals and a small amount of programmable logic.

The LCD

The DGL-0401YG-4EH LCD was included in the Kemo Electronic S043 "lucky bag" of surplus displays and likely originated as a heating controller display. Such a supply method would be completely inappropriate for a commercial product due to no guarantee of supply, but for a hobby project it's fine.

the LCD has 4 common pins and 12 segment pins, meaning it is designed for 1/4 duty cycle multiplexed operation. The waveforms for multiplexing an LCD are more complex than for multiplexing LED displays because intermediate voltages are required and DC bias must be eliminated to avoid long-term damage to the LCD, so they're usually generated using a dedicated driver IC or by an LCD driver peripheral built into certain microcontrollers.

The PSoC's LCD driver is capable of up to 1/8 duty or 1/16 duty depending on the part chosen, so driving this LCD is no problem. In theory, multiple 1/4 duty LCDs could be wired for 1/8 or 1/16 duty to save I/O compared to using 1/4 duty, but there's a catch! The lower the duty (higher the denominator), the smaller the viewing angle becomes, which means that the LCD only has good contrast over a smaller range of viewing positions.

Ultimately, due to the amount of I/O available on the CY8CKIT-042, 1/8 duty was chosen as a good compromise between the viewing angle and number of I/O used. Some of the heating-related symbols were unused, so not all of the segments needed to be connected either. The segment lines for the °C symbol could also be commoned to save a further I/O line as there would be no need to control these symbols individually.

The one button added to the front switches the backlight brightness between three levels.

Wireless communications

The 433MHz transmission system is a very simple system which does not define a protocol and is unidirectional, which means an unlimited amount of receivers can be added without any changes needing to be made to the firmware in the transmitters. The task of decoding and receiving the data was passed off to an NKM2401 to save time and due to reasons relating to the design of the temperature transmitters which was done previously, but it wouldn't be difficult to implement this directly in the PSoC. For debugging, the 3.5mm jack in the bottom left corner can be connected to a computer serial port with a PICAXE programming cable and serves the dual purpose of allowing the monitoring of the received packets and the generation of test packets.

The data is transmitted in 8 byte packets. The first byte represents the ID of the temperature transmitter and is unique to each transmitter; the display unit uses this ID to decide which of the four LCDs should be updated with the newly received temperature. The second byte represents the type, allowing for future expansion with types other than temperature (e.g. humidity). Bytes 3 and 4 contain the temperature, bytes 5 to 7 are unused/reserved, and byte 8 is a very simple checksum which augments the error detection already implemented in the NKM2401.

Sunday, July 11, 2021

Animated dot matrix display radio-controlled clock

First completed: May 2013

Small dot matrix display hardware

Introduction

This project was my first attempt at driving a dot-matrix LED display from a microcontroller without using any dedicated driver chips. It was also, at the time, my most advanced PCB design. Prior to this project, the most complex LED multiplexing I had done directly from a microcontroller was a 6-digit 7-segment display, which in terms of complexity is equivalent to a single 8x6 LED dot matrix.

I decided to use an ATmega328p pre-programmed with the Arduino bootloader for this project.

Hardware

The main elements of the design are the microcontroller with its supporting components, the displays with their shift registers (these are hidden behind the displays on the PCB), and a switching regulator.

The schematic below shows the design excluding the switching regulator.

Schematic

The shift registers are a serial-in-parallel-out type, and were needed because the ATmega328p does not have enough pins to drive the display directly. The shift registers are 74HC164, as with the Noughts and Crosses game.

The PCB layout was done by me, but the board itself was made by a third party. The PCB was made on a PCB router and the board is not through-hole plated - I learned a very important lesson here as to why through-hole plating is usually important. The design relied on through-hole connections being connected to both sides, so it was necessary to solder some of the pins on both sides to simulate through-hole plating.

Software

The LED displays are multiplexed. Only one row of the display is lit at a time; each row is switched on in turn very rapidly, and this technique relies on persistence of vision to make it look like the entire display is continuously lit.

The animation below shows the technique in action but for column scanning.

Multiplexing animation

Initially, the software was a simple design which just used delays in the main loop of the code to switch between the rows. This method works reasonably well on the ATmega328p at 16MHz because it can execute instructions fast enough to avoid functions in the main code from having a visible effect on the display, but it makes writing the code more difficult because delays and "slow" commands cannot be used. The software design was later enhanced by using a timer interrupt to run the display software, making its timing independent of what happens in the main code.

The display shows the time, and a scrolling effect is used whenever a digit changes. The time is synchronised using a "Time from NPL" receiver, the signal from which is decoded by the software. The use of the timer interrupt for driving the display, the author's extra experience with using the ATmega328p, and the removal of the external RTC allowed the time decoding to be done without the extra microcontroller that was used in the 6-inch jumbo radio-controlled LED clock/timer project.

Adding an aspect radio switch to CRT TVs

This post is about a simple modification that can be done to many CRT TVs to add an aspect ratio switch. The main uses for this nowadays wo...