Featured

Technics RS-B665 Cassette Deck Remote Control

One of the small benefits of spending more time at home since the COVID-19 pandemic is having the opportunity to really appreciate music at home, like properly take some time out and listen to a whole album, uninterrupted. Especially analogue stuff – pop a tape in the tape deck or slap a record on the platter…
Pre-COVID my job had me travelling a lot and most of my music consumption had been whilst on the move – Spotify in the car or on the train or possibly listening to downloaded playlists/albums through noise cancelling headphones on a plane…

Like many people my age I have a few old Hi-Fi pieces stashed away in the loft or cellar, things like “music centres”, record decks, cassette decks etc. In the 1990s I had a “proper” Hi-Fi separates system comprising Linn turntable, Creek amp and Technics cassette deck and have never been able to part with it so it sits most of the time in storage, coming out occasionally to impress the kids with tales of what life was like before the internet. (And also to bore them rigid with the “when Dad played bass in a band at school” tape. Yay for “Aquainted with the Nite“!)

Around October 2020 I got the cassette deck out again and this time it was a little ill. Common with all decks of this range & era a small plastic motor drive wheel becomes brittle & cracks with age but thanks to a quick visit to tapeheads.net I managed to diagnose & fix the problem. Another issue these Technics decks suffer with is tarnishing/oxidation of the contacts behind the front panel push-buttons used for all the main functions (STOP/PLAY/FF Dolby off/on etc.) and mine was displaying some intermittent symptoms – i.e. I would press “FF” but the deck actually goes into “PLAY”.

Technics RS-B665 in all its glory….


Luckily I found a service manual on the internet for the deck and the push-button front panel part of the schematic can be seen below:

Pin 9 of CP5 is earthed via points in the resistor chain R701/2/3 for STOP/FF/REW/PLAY

A very common mechanism is used in lots of consumer electronics of this type: a resistor chain is grounded at various points to signal to the mechanism control logic what mode is requested. This explains why a tarnished button contact with a higher resistance is interpreted by the logic as a mode further up the chain (e.g. “PLAY” instead of “FF”).
As a long term fan and avid user of the Raspberry Pi ever since its introduction I’m always looking for ways to modernise old equipment and add extra functions using a Pi here and there – what if I could replicate the resistor chain and have a series of relays, RPi GPIO controlled, to remotely control the tape deck from my phone over wifi? I already had a Pi sat next to the Hi-Fi as I had a new turntable with a built-in USB audio output and had used Icecast/Darkice on the Pi to stream the turntable audio around the house. I reckoned I could interface relays/resistors controlled via GPIO to the the existing connector CN5/CP5 with only 2 wires (GND & input) to control the cassette deck. I imagined a web interface to the RPi with buttons on to mimic the tape-deck’s control panel that would ground the resistor chain at the appropriate point to send the correct signal to the control mechanism. The relay only needs to be operated for a fraction of a second to simulate what happens when a user presses the button.

A short video of remote control in action :: Google Photos album here too

I found some great resources on the internet such as Thomas Stewart’s RasPi control for a reel-to-reel deck. I prototyped two different approaches: a minimalist python-based script and a Node-Red version (both of them inspired by Henry Cheung’s E-tinkers.com blog). The python script performed both the web server function and controlled the relays directly via GPIO pins, the Node-Red implementation produced a UI with buttons that executed individual python scripts to control the GPIO signals.
I went for a 4-relay module initially to give me STOP/PLAY/FF/REW but there’s no reason why this couldn’t be expanded to add more relays to cover other functions like REC/PAUSE/DolbyB/DolbyC etc. The 4 functions are enough for me right now, occasional listening to old cassettes. Selecting a relay module that’s controlled via I2C would make more sense if I were going for replicating all 16 buttons on the deck’s front panel, but a direct GPIO pin–>relay mapping for now is not too cumbersome for the main 4 functions.
I decided to install the relay module outside the tape-deck so that either a Pi can be used to control the relays or another dedicated piece of passive hardware like a box on a long-ish lead with plain old push button switches….

Time to take a drill & soldering iron to the deck:

I extended pins 8 & 9 of CP5 to a socket on the back panel with screened cable.

Pins 8 + 9 of CP5/CN5 – GND + Input
Back panel with new 4-pin “Remote Control” input πŸ™‚

I used a 4-pin connector and 2-core screened cable in case I wanted to expand the functionality & pick up the other input signal at a later date. You could actually pick up the input signal from CN5 pin 9 on the main PCB, as it’s tracked through one of the soldered wire links (marked with a tiny black sharpie * in the photo) close to Q912, and any GND signal would probably suffice.

The Node-Red flows are about as basic as you can get – I created a button on the dashboard/UI that links to an “exec” block that just runs the relevant Python script that toggles the correct GPIO pin on for 0.3s then off again.

prototyping Node-Red UI layout

Example python code to enter “PLAY” mode – this operates relay #4 for 0.3s via GPIO22 (pin 15 of the Pi 40-way header)

pi@pistreamer:~/RS-B665_control $ cat PLAY.py 
import RPi.GPIO as GPIO
import os
import time
GPIO setup
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(22, GPIO.OUT)
GPIO.output(22, GPIO.HIGH)
time.sleep(0.3)
GPIO.output(22, GPIO.LOW)

The 4-way relay module I had for testing was a really cheap-and-nasty thing – and it was active low triggered which means I had to switch from using NO contacts to NC for testing. (Amazon reviewers claim the relays only last a few hours!) During testing I had some pretty dodgy wiring – I used a croc clip to pick up 5V from the Pi header – but it worked!

Not a complete schematic – only the relay outputs are shown in full πŸ˜‰

This approach should work with all Technics decks that use the same mechanism – I’m guessing RS-B555, RS-B655, RS-B765 at least, maybe more. If they share the identical “SECTION K OPERATION SWITCH CIRCUIT” as part of their schematic then you’re good to go πŸ™‚
Now the basic functionality is there I’m thinking of adding a bit more intelligence, maybe sensing if the deck is powered on, what mode it’s in: getting some info from the deck back into the Pi…

Raspberry Pi controlled tape deck with obligatory “1980s music is still the best” product placement πŸ˜‰

Some really cool cassette tape hacking right here. If you’ve found any of this useful I’m always ready for a latte πŸ˜‰ @zedstarr

Reading a 27C512 EPROM with a Raspberry Pi – ROM-dumping!

Recently I retrieved my Elektor SCMS “copybit killer” from storage and a quick Google search brought up this forum post from just under a year ago – someone was looking to build the project and needed a (binary) image of the ROM contents…

27C512 – 512kbits (64k x 8 bits) of 5V CMOS ROM

Initially I offered to physically send my ROM to someone with a dedicated reader (probably something from the TL866 family that seems to be popular amongst hobbyists) but then decided that seeing as I had breadboard, wires and plenty of small/embedded microcontrollers & Raspberry Pis lying around I really should have a go at reading the ROM myself!


Old Pi Model 2B I’d been using as an LCD Clock – LCD removed ready to read ROM!

How hard could it be? Wire up the address & data buses to GPIO, step through all the addresses 0-65535 and record the data to a file. Easy. (If you ignore level-shifting issues that is πŸ™‚ more about that later… )

Old Pi 2B GPIO to Elektor ROM on breadboard

I discovered this post (which talks about dumping C64 ROMs & also references a previous Instructables.com article) which uses a Raspberry Pi… The Python on the site didn’t work quite right for me, I had to add some debug print statements to work out what was going on and then add some unhexlify from the binascii module to get an actually binary ROM image. There are other ways to do this (properly) but this was the first hack that worked for me, so it stuck. My python to read the chip is available to download below:

Eventually it worked; I had a binary image of the ROM contents. The original Elektor article that refers to the Pascal used to generate the binary ROM contents mentions an output file size of 32768 bytes. My image is all zeros after 0x7FFF so I think it’s all good!

Sanity check – peeking inside the binary image of the ROM

I wasn’t sure of the data integrity as the 27C512 is a 5V part and the Raspberry Pi’s GPIO is all 3V3 (and not 5V tolerant) and I had powered the ROM from 3V3 too. In the python script I’d inserted pauses of 1ms after setting the address/OE/CE before reading the data bus. Looking at the contents of my binary image it looks mostly sensible: it’s easier to judge by eye with this particular ROM due to its function as a finite state machine (FSM), it’s not just “random” binary data (like executable code might appear). There are some anomalies to the repeating patterns though: e.g. 0x7FE8 in the image above and a few other locations I’ve spotted too. I can’t say for definite at the moment if they are corrupt locations or good data.
(UPDATE [2021-02-22]: turns out they’re good data. Very good data. They’re the cool locations that do the magic! Thanks to the very clever people at the SonyInsider forums (well, Kevin Allen especially) – they reverse engineered the state machine function from the ROM contents and the S/PDIF spec… and even wrote some simple C code to generate the binary ROM contents. Truly epic work. I converted the C into python, (not pretty!) so we can at least re-generate the ROM image! Tested & working on Fedora 33, RaspiOS (buster) & MacOS Catalina.)

hexdump – data looks reasonable & uniform…

Datasheet says “No” – minimum Vcc is 4.5V – hmmm. To satisfy my curiosity I gave in and purchased a USB EPROM programmer from eBay.co.uk (the TL866IIplus) and imaged the chip again. Looks like reading the 27C family slowly at 3V3 is viable as the image from the Pi and the USB reader are identical:

$ md5sum elektor_scms_rom.bin
64bd11d7cd3a2ffcde307e94fd8fd679 elektor_scms_rom.bin
$ md5sum TMS27C512@DIP28.BIN
64bd11d7cd3a2ffcde307e94fd8fd679 TMS27C512@DIP28.BIN

TL866II plus GUI on windows – XGpro

There are other ways around reading a 5V part in a 3V3 system – there are numerous level-shifting devices built into modules that can be placed between the ROM’s data outputs and the Pi’s GPIO, or a simple 2k2/3k3 resistor divider on each data line (address lines etc. can be driven directly from 3V3).

Conclusions:
Reading this particular device (Texas TMS27C512) with Raspberry Pi GPIO at 3V3, with Vcc=3V3 worked for me. It might not work with other manufacturers’ devices and/or other sizes of device. The original Elektor article sparked my hunt for the source which, via the fascinating work done on reverse-engineering the FSM operation from the S/PDIF spec, ultimately led to the C/Python code that can re-generate the binary ROM image.

code extract – python to re-generate the binary ROM image

Working with these old EPROM components took me right back to when I first started work in the Telecom industry and that was a long time ago πŸ˜€

Minidisc copybit stripper – the Elektor SCMS killer

Minidisc was a promising format when it was introduced in the 1990s but ultimately the convenience of file formats like MP3 that allowed computer (and phone!) playback and unlimited copying sealed minidisc’s fate. The record industry was going through an existential crisis at the time and felt it had to protect itself in any & every way possible against any digital media that allowed unlimited copying. In the minidisc world Sony (as music label owner as well as equipment vendor) had a vested interest in enforcing the standards for controlling how many digital copies consumers could make of their music on minidisc with SCMS (Serial Copy Management System). A digital copy from CD to MD would have the SCMS bits set so that no further digital copies could be made. Professional audio gear didn’t have these restrictions however. The problem with SCMS was its blanket application – it would stop copying regardless of whether copyright was involved or not… users were prohibited from copying their own or non-copyrighted audio.

Elektor, an electronics magazine, published details in 1998 of a kit that had been designed to furtle the SCMS data (actually set copy protection to “unrestricted”) in the S/PDIF digital audio signal on the fly so that all restrictions on further digital copies were removed (actually published earlier in Dec 1997 in German/Dutch issues of the magazine). The so-called “copybit killer”. The design used a novel approach using a handful of widely available standard chips (no specialist audio devices required) and the data matching/stripping was handled by a state-machine realised with shift registers + ROM. It’s a handy piece of kit that also doubles as an optical/electrical format converter. The kit was available from “Stippler Elektronik” in Germany – either fully assembled or as components + PCB.


I purchased the kit of components + PCB in January 2000 from Stippler and assembled it shortly after. I recently found the original order which I had sent over to Germany by Fax πŸ™‚ (back then it was 126DEM, or around 64EUR and with postage it cost me just under 50GBP)

Utilising the anti-static mat properties of vinyl album cover πŸ™‚

There were all sorts of other ways around SCMS for users with consumer-grade equipment – like recording to or from PC via S/PDIF enabled sound card but MD-deck to MD-deck copying at the time was always problematic on consumer-grade machines.

The company that produced the kit, Stippler Elektronik, has since disappeared. Unfortunately the binary contents of the 27C512 EPROM are not available anywhere. The original Elektor article refers to a Pascal programme used to create the binary file but doesn’t offer a listing or any other details apart from saying that “the pre-programmed ROM is available from suppliers”. The design was attributed to “H Hanft” (actually Dipl.-Ing. Hans-Juergen Hanft) – if you’re still around, or indeed if anyone anywhere has another ROM to compare contents with please get in touch πŸ™‚ Maybe Georg Stippler knows? The programmed ROM is known by its part number “EPS 976516-1” and the whole kit is 970069 or E970069
(UPDATE [2021-02-22]: thanks to some very clever people over at the SonyInsider forum we now have C, Python & Tcl code that can re-generate the binary contents of the ROM πŸ˜€ )

Title: Einfacher Copybit-Eliminator: Digitales Kopieren ohne Beschraenkungen
In: ELEKTOR -GANGELT THEN AACHEN-; 324; 30-38
Year of publication: 1997
Publisher: ELEKTUUR B.V.;
ISSN: 0932-5468
Document Type: Article (Journal)
Type of Material: Print
Language: German
Classification:
DDC: 621.3
Database provider: Technische Informationsbibliothek (TIB)
Database name: TIB-Portal

Tiny Oscilloscope kit based on STM32F103 ARM microcontroller

I discovered this tiny oscilloscope kit the other week. It’s a DSO138 by JYE Tech – Β£30 from Amazon(UK) or less than Β£20 if you can wait for delivery from China πŸ™‚
It took me less than 2 hours to build and worked first time! I’ve still got some soldering skills lol. It comes in two versions – one with the SMD components already soldered or one with completely bare PCB.


There’s open-source firmware available that supports data export to PC and it can be made 2-channel with the addition of a little extra hardware. Based on an ARM cortex A3 MCU, it can be re-programmed using Arduino tools.
Great little project for STEM & electronics education.

A couple of days after I’d built the DSO138 I realised there’s a newer/better version on the JYE Tech website – the DSO138mini, and I also came across another project – this one turning a STM32F429 discovery board (which I happened to have lying around πŸ˜‰ ) into a tiny ‘scope:


(Updated version + link to the original project at https://github.com/deividAlfa/STM32F429-Discovery-Oscilloscope )

A couple of traces I captured with the “export via serial port”. Easy as
cat /dev/ttyUSB0 > image.bmp

Replacing white LED stylus target light on Audio-Technica AT-LP120X

I recently bought a new turntable, the Audio-Technica AT-LP120XUSB. I wanted direct drive, decent quality (to match my ageing & damaged hearing!) and USB built in so I could hook up recording/streaming devices. I found an eBay listing for less than RRP and had a 20% off eBay voucher too so it was a no-brainer…

I really like the turntable, but the white LED “stylus target light” is absolutely dreadful – it’s cheap and plasticy and gives out a bright white light when all the other LEDs on the turntable are red. The idea is that if it’s dark then this light helps you see the gaps between tracks so you can select the right one. They’ve obviously cost-reduced this part compared to previous versions of this model and it’s a removable thing that plugs into a phono (RCA) socket on the turntable’s plinth. I immediately began to plot to replace it…

Original white LED stylus target light

Shopping list: cheap phono lead (RCA) cables with metal bodies that I could hack apart (thanks again to eBay) and some superbright red LEDs (thanks Amazon)

Measuring the voltage coming out of the phono socket shows 8V when no LED is connected but it collapses to ~2.4V when the white LED is plugged in – leading me to think that there’s already a current limiting resistor in the circuit internally. A quick calc on the Electrodoc app for the superbright red LED says I need another 27R to make everything happy.

I hacked the connectors off the el-cheapo leads and drilled a hole in the side of the connector barrel. I soldered the resistor & LED onto the base of an old metal phono plug and tested it for brightness and correct height to actually light up the platter. When I was happy with the height I put the LED & plug into the barrel and filled it from the top with sugru, smoothing off the top to make a nice(-ish) finish πŸ™‚

Testing for correct height

Really pleased with how it looks now with everything red.

Red, red and more red.

Streaming Vinyl Audio around the house (and beyond) with Raspberry Pi and Icecast + Darkice

I recently acquired a turntable with a built in USB audio interface and while that’s not the main reason I bought it it got me thinking about hooking it up to some sort of streaming server so the audio would be available anywhere… I have Google chromecast (audio) along with Volumio & Sonos devices around the house so it would be good if I could support them all.

I installed a Raspberry Pi as a permanent companion to the turntable and started looking for existing projects that might have done similar.

I found some good info in this medium post by Guy Dupont. This introduced me to Icecast and Darkice to handle the audio stream and HTTP encapsulation. I installed the stock versions as Darkice seems to support mp3 anyway (one of the sub-references Guy Dupont’s piece includes a custom build of “Darkice+MP3” but I didn’t use that). I didn’t need an external USB i/f as my turntable already had one built in and I didn’t need another app to control streaming to chromecast etc. – the excellent VLC can do just about anything, including streaming to chromecast. I also use Volumio and Sonos in other rooms: Volumio can handle “web radio” which is effectively what the Icecast/Darkice combo is creating and Sonos can do the same via TuneIn Radio’s “My Radio Stations/Add new radio station” option:

“Add Webradio” option on the My Web Radios menu
Add your icecast address in the Url box like http://icecast.server.address:8000/mountpoint.mp3
From the menu in “My Radio Stations” in the TuneIn section of the Sonos app
Add your icecast address in the “Streaming URL” box like http://icecast.server.address:8000/mountpoint.mp3

Of course if you have a VPN connection back to home, you can listen to your home audio from anywhere whilst you’re out and about – I listened to one of my old LPs through my phone/car audio on the way to do the school pick-up πŸ˜€

Turntable analogue audio –> A/D –> USB –> Pi –> Darkice/Icecast –> network –> VPN –> Internet –> 4G –> phone –> Bluetooth –> in-car Audio

Of course this method isn’t limited to audio from the turntable. I’ve since added an external USB interface to the Pi and hooked up the cassette & minidisc decks too. The same Pi is handling all the audio and also performing remote control functions for the old cassette deck.

Bosch-Worcester 35CDi Fan Failure

It was a cold start to 2021, outside temps well below freezing, I guess that was the final straw for the ~20yr old fan in my combi boiler. On New Year’s Day I’d noticed it was making more noise that usual as I was putting some rubbish in the wheelie bin, nothing more than a very faint screech…. but the next day the central heating came on at 7am and the poor old fan ran for about 5 mins then gave up…
(temperature graphs courtesy of my Grafana/Influx logging system πŸ™‚ )

Boiler CH temps rise a little bit, then fan dies 😦
Bedroom temperature falls whilst boiler is dead 😦

Bearing in mind that the fan in this design of combi boiler sits on top of the hot exhaust gasses (and blows them out of the flue) they’re also surrounded by the cold fresh air coming in to the combustion chamber so they must have a pretty tough life.

The plumber & I both tried to source a replacement part from the usual plumbers’ merchants and online stores but not with much luck as a 20yr old part is considered “very obsolete” πŸ˜€

I thought I’d found a source of re-furbished units via eBay but when it arrived they’d sent me the wrong part. The family and the house were getting colder by the day and even with a wood-burning stove and a handful of electric fan heaters they’re no substitute for the 25kW of the boiler. The plumber’s son (also a plumber!) remembered using a local business a few years ago that refurbished electric motors, worth a shot?

A phone call and a day later the old fan had had its motor refurbished and was working in the boiler again. The local business that did it was a one-man-band outfit, traditional engineering type with stereotypical workshop full of old scrap bits of electrical machines. It looked a lot like parts of “Mad Max”. As I picked up the fan (a few hours after dropping it off) the proprietor told me “I did it straight away as I knew you didn’t have any heat at home” bless him. Cost less than a replacement unit would have too.

So a big thanks to David Bowers, Electrical Motor Repairers and Mechanical Engineers πŸ‘πŸ»πŸ‘πŸ»πŸ‘πŸ»

Grafana, Influxdb & telegraf based home temperature monitoring with Raspberry Pi and the humble DS18B20

This all started with tomatoes. And grew into a Raspberry Pi based whole-house + boiler temperature logging system…

During the 1st UK lockdown of 2020 my elderly parents were shielding and my Mum was looking for things to occupy her time. She started looking online to buy tomato plants/seedlings to grow in her greenhouse – seems like everyone had the same idea as they were in short supply (or maybe she just started looking a bit too soon in the growing season!) – she was buying them in 3’s and 6’s from lots of different sellers on eBay and Amazon. She ended up with way too many, her greenhouse was overflowing and she wanted to give some to me.

This was still early on in the growing season, I don’t have a greenhouse but do have a conservatory. I was worried about putting the plants in there if it was too cold overnight so wanted a way to monitor & log the temperature. I’d been thinking about building some sort of Raspberry Pi temperature monitor for my 20yr-old combi boiler just to check up it was still working OK and so as it turned out the tomato plants were the final thing that spurred me into action.

From this tiny idea I ended up with a total of 7 Pis monitoring 9 temperatures around the house displayed on a dashboard that also shows live electricity consumption data too. Yay.

I already knew that the DS18B20 single-wire temperature sensor was a favourite for this type of project so I ordered a handful from Amazon that were already built into metal probes with long cables. I soldered them along with the required 4k7 resistors onto some 40-pin 0.1″ pitch headers ready to attach to the Pis.

Looking around for software projects that have already done similar I found temperature-machine. I soon grew tired with some of the limitations of this software and eventually discovered Grafana dashboards with Influxdb. Influxdb is a database that’s designed to deal with time-series data (like temperature logging!) and lots of people had already successfully used it for similar applications to what I wanted. I modified existing python I found in other projects to match my setup so that each of my temperature sensor nodes would write directly to an influx database on my server node. Grafana dashboards can then be created to process & display the data however you like.

I already head a few spare Raspberry Pis (some model 2B/3B/3B+) that could be made into remote probes and the new-ish Pi 4 4GB I had would be the server.

Prototyping probes & sensors around the house

Turns out the cheap DS18B20 sensors I’d bought from Amazon have a nasty habit of locking up, and rebooting the Pi isn’t enough to bring them back to life – the Pi has to be re-powered. Luckily I had a few spare remote control mains switches that knew I could control from IFTTT so I set up a bash script on each Pi to monitor the sensor and when it locks up I call an IFTTT action via the webhooks service then shut-down the Pi. The IFTTT action would call a “scene” on the smart sockets app that would wait 40s (for Pi to shutdown cleanly), turn off the socket, wait 20s then turn the socket back on. A real nasty workaround for some cheap sensors but so far it’s worked like a dream πŸ™‚ I later bought some (much more expensive) DS18B20 sensors from a reputable source but haven’t got round to replacing all the cheapo ones just yet…

I bought a couple of Pi Zero models and one of them was used to monitor the boiler’s central heating and hot water outputs as well as the room temperature, another one was put in the bedroom. I already had a Pi in the cellar next to the broadband router doing PiVPN duty so that had a sensor added too.

I also installed telegraf to collect general performance data on all the Pi sensor nodes as I was curious to see how heavily loaded they were. Telegraf also gave me the opportunity (via a bash script) to query my smart meter/home energy monitoring service and display electricity consumption on the same dashboard as the temperatures.

One of the great benefits of the whole grafana/influx/telegraf system is its flexibility and customisability – it can easily be extended to take in other data sources and types and can also send configurable alerts. I have mine configured to send me a Slack DM + email if any sensors die or of the boiler temps get too high.

How it all looks on my phone:


Flashing LEDs with a 555 timer – and not a lot else

Just dug this out of storage – some electronics I made in the late 80s/early 90s. Most of it is old/scrap components – only the 555 and the MC14526 counter/divider actually do anything – flashing the LEDs long the edge. I can remember making it at work during quiet times as a side project, I had no idea why or what it might be good for πŸ™‚

Some years later this found use on a Ghostbusters proton pack I made (cobbled together in a few hours on the day of the do!) for a Hollywood themed charity fancy dress bash…