Translate

Showing posts with label Radio. Show all posts
Showing posts with label Radio. Show all posts

Saturday 28 March 2020

Hospital radio streaming codec and monitor.

Things have been getting a bit, well, unreliable at the hospital radio studio of late. We've been plagued with power outages, and things don't recover well.

Mainly the old Ubuntu 16 box, which supplies shoutca.st with the MP3 stream.

It usually comes back on OK, but half the time fails to run the darkice service on start-up. No amount of fiddling the cron job that starts the service has helped.

What's needed is a system that checks and monitors itself, and attempts to repair what's broken.

Here's what I've got in mind.

Two Raspberry Pi's, one transmitting, one receiving. The receiver will be monitored to ensure that the stream is up.

The Pi's audio will be fed into and internet-equipped Arduino of some description, which will do the monitoring for us.

It'll work something like this:


  • If the received audio is ok, do nothing. All is well.
  • If the received audio is missing, check there's audio coming in to the transmitter. If there isn't then there's nothing we can do except to flash a "something's up" LED to get someone to fix it.
  • If the received audio is not present, but there's audio to the transmitter, check there's internet access; If there isn't there's little we can do, except for flash a "something's up" LED and wait for it to come back. If there is, then we need to take some action:


  1. Shut down and restart the receiver, just in case it's crashed. If that doesn't work, then ...
  2. Shut down and restart the transmitter, just in case that's crashed.


OK, so there are a good few guides on getting internet radio receivers to run on a headless Pi. I've tried a couple, and have found one that is very tolerant of dodgy internet connections, it's called mplayer, it's a bit processor hungry for what it is, but runs on a model A+ Pi I have.  It comes back if the internet goes missing as soon as it recovers, and starts reliably on boot. I did this a while back, and it's been sat on the workshop shelf for ages, reliably receiving :)

It's dead easy to install..

apt-get install mplayer

add a cron job...

crontab -e

and add the following line...

@reboot     sleep 29; nohup mplayer -loop 0 http://188.165.192.5:8525/stream 2>&1 > /dev/null

(replacing the IP address and mount point with your own, unless you want to listen to Cotswold hospital radio!)

You may need to adjust the output volume.. Just type

alsamixer

adjust as required, then type

sudo alsactl store

to store the setting.

Now we need to add a bit of Python script in to safely reboot the monitor receiver in the event of a failure, and also add a shutdown function, so we can safely shut our unit down, without risking corruption of the memory card.

We are going to use the Pi's GPIO pins 18 and 23. Pulling 18 low will instigate a safe shutdown. Pin 23 will force a shutdown and restart.

I've copied the code from here, but duplicated it here as well, just in case it ever goes missing.

First off SSH into the Pi...

Once logged in, type

mkdir Scripts

cd Scripts

touch shutdown_pi.py

sudo nano shutdown_pi.py

Then cut and paste this code into the editor.

#!/bin/python
# Simple script for shutting down the raspberry Pi at the press of a button.
# by Inderpreet Singh https://www.element14.com/community/docs/DOC-78055/l/adding-a-shutdown-button-to-the-raspberry-pi-b

import RPi.GPIO as GPIO
import time
import os

# Use the Broadcom SOC Pin numbers
# Setup the Pin with Internal pullups enabled and PIN in reading mode.
GPIO.setmode(GPIO.BCM)
GPIO.setup(18, GPIO.IN, pull_up_down = GPIO.PUD_UP)
GPIO.setup(23, GPIO.IN, pull_up_down = GPIO.PUD_UP)

# Our function on what to do when the button is pressed
def Shutdown(channel):
        os.system("sudo shutdown -h now")
def Restart(channel):
        os.system("sudo shutdown -r now")

# Add our function to execute when the button pressed event happens
GPIO.add_event_detect(18, GPIO.FALLING, callback = Shutdown, bouncetime = 2000)
GPIO.add_event_detect(23, GPIO.FALLING, callback = Restart, bouncetime = 2000)

# Now wait!
while 1:
        time.sleep(1)


Press CTRL + X and yes to save and exit

now type

sudo nano /etc/rc.local

and add this line just above the last exit 0

python /home/pi/Scripts/shutdown_pi.py &

now safely shutdown the pi

sudo shutdown now

wait for a minute and remove the power.

Remove the memory card and make an image of it and keep that safe, just in case...

Job done.

The transmitter is a new Raspberry Pi 3, and I followed the instructions here to load up darkice. I don't need to run icecast, as this is provided to us by remotely by shoutca.st, I just need to send the stream to them. I also ignored the warning about not installing the latest version of Raspbian. Seems to work great, never fails to start reliably, and seems to be tolerant of errant internet connections. You'll need an external USB sound card, as the pi's inbuilt card can't record.

Also, add in the shutdown and reboot python script in the same manner as before.

Image the memory card just in case!

Now our incoming audio is balanced, so we need a balanced line receiver, a buffer for the received audio monitoring, and whilst we're there, a couple of little drivers for some VU meters (because meters are cool), which we can also use to feed our Arduino monitor.

As an aside, I've now made the jump to Kicad, as since Autodesk have purchased Eagle, they no longer wish to honour my original Cadsoft licence, without incurring unwanted expense.

A circuit is conjured up ...



A board designed... 

And modelled ...
And turned into reality using toner transfer.
Loving Kicad...

U1 and U2 form the balanced to unbalanced audio receiver, and it's output level is adjusted by RV3. This then feeds the transmitting Pi's external sound card. There's also a buffer (U2A) which feeds a small monitoring amp. ICU2B is a variable gain precision rectifier, the output of which is used to drive the VU meter, and also feed one of the Arduino's A to D converters.

The same circuit is also duplicated and used to buffer the audio from our receiving Pi to drive the monitoring amp, and to drive a VU meter and the Arduino. 

There's a regulated +/- 15V supply. As it turns out I had a suitable switched mode supply, with +/- 12V and 5V outputs, so I utilised that, and just bypassed the regulators.

An Arduino nano was pressed into service, to do the monitoring and control.


Received rectified monitor audio is passed from the analogue PCB from the VU drive circuit to A0 , rectified transmitted audio is received likewise, and fed to A3. A front panel mounted LED is connected to Digital pin 3, to serve as our error indicator. I'll also make the Arduino Nano's USB interface available on the rear panel to facilitate debugging/ updating as required.

An Ethernet module (EN28J60) is connected to the Arduino's SPI interface, and is powered from a 3.3V regulator derived from the main +5V supply. The EN28J60 consumes around 120mA, and that's more than the available 3.3V supply on board the nano. The EN28J60 module is provided with network access from the same hub that distributes the network to the Raspberry Pi's.

Two additional outputs (D5 & D6) on the Arduino are used to pull a GPIO pin low on the respective Pi to initiate a graceful reboot, and D7 is diode "anded" to shutdown the two Pi's. A push button is connected to D2 to shut down the system. 

If it all goes really badly wrong, I've also added two reset buttons on the front panel to manually hard reset the Raspberry Pi's (and arduino, via a diode "and").

D4 is coupled back to the arduino's reset pin, to reset the controller completely. This is coded to happen if we fail to obtain a DHCP lease more than 5 times.
The VU illumination is connected to D8 via a BC547 transistor. This is used to flash the VU illumination during shutdown to give the user some feedback that shutdown is in progress.

In the event of failure of the monitor audio, the transmit audio is checked.

If the transmit audio has failed, the error LED on the front panel will flash 3 times. The monitor circuit will repeat these tests until audio is resumed.

If the monitor audio has failed, and transmit audio is present, the controller checks internet connectivity. If the internet connectivity is not present, attempts are made to restore DHCP. If this process fails, the fault is presumed to be external, and the error led will flash 5 times, followed by illuminating permanently. If the internet does not recover after 5 DHCP renew attempts, the controller will restart and repeat the process.

If the monitor audio has failed, TX audio present, and internet OK, two possibilities remain. Either the monitor receiver computer has crashed, or the TX computer has crashed. Firstly the controller will shut down and restart the monitor computer. If this fails , the TX computer is restarted.


A board is designed, but I've made it up on perfboard...










Arduino code can be found on my git https://github.com/andydoswell/transmitter-monitor

Power is supplied to the whole rack from a switched mode supply, recovered from some redundant equipment... It supplies +/-12V and 5V. Excellent.

Putting things together and running some tests, and there's an irritating 4KHz whistle on the audio, both transmitted and on the in built monitor amp... nasty

Scoping up the outputs from the power supply shows there's a 4KHz tone superimposed on our 5V rail. It's about 170mV, and enough to cause the annoying whistle. Tests show this isn't down to a failure in the supply (I suspected caps, but changing them out made no discernible improvement)

A simple C-L-C filter is quickly made up from some junque parts, and greatly improves the situation.

Much improved.

And the finished product, ready for installation once this damn virus goes away...


Monday 13 May 2019

Ekco U353 - a quick restoration.

Ages ago Steve was good enough to bring up Sam's Queen Anne for some repairs. Also in the boot of Steve's car was a broken Ekco U353. Now, I have one of these, (see here!) which I repaired ages ago. It's a basket case, and remains unused as it's knobs are missing.  The knobs are an essential electrical safety item, as the chassis is connected directly to the neutral of our mains supply (common practice back then).

Anyway here's Steve's...


Much better nick than mine, although there's a crack to the right hand side of the cabinet... 











... and the back's a little distressed where the heat from the rectifier and output valve has made the back brittle, and damage has occurred. Some of the brackets are in poor shape too.










Removal of the chassis is straight forward, off with the knobs (there are two small grub screws to undo), and removal of four screws on the underside of the case.










It all looks very clean and unmolested.












Amongst the dust in the bottom of the cabinet, a tell-tale blob of wax shows something's been getting hot...











... and sure enough ...












... C61 has had a right sweat on! As usual, these waxy caps will all be shot, if not now, in the very near future, and will all be evicted. C61 is the mains input filter cap, so it's replaced with a brand new X2 class safety capacitor. It's 0.01uF.







Now in my example, the output valve had been cooked as the cathode bypass capacitor had failed short, so this is also replaced. In fact there's very few capacitors in the whole receiver, so every electrolytic, paper/wax and hunts capacitor is replaced, except the main multi-section smoothing capacitor.








The cathode bypass capacitor is C55. C50, C49, C46, C1 and C20 are all replaced. C1 is a horrible black hunts thing.






After the caps are replaced, it's time for action. The receiver is connected to the variac, and the voltage slowly increased for about an hour, monitoring the HT voltage, and periodically checking the temperature of the main multi-section smoothing capacitor to see if it's getting warm. It wasn't.

After a quick tune about, stations are coming in, and the FM seems to working too. The receiver is aligned in accordance with the service sheet, and it's performing well, except the exclamation mark magic-eye isn't illuminated :(

R14 (68K) has risen in value to many megohms, and crumbles as I remove it! After it's replaced the exclamation mark works as it should.









The guilty parties!












... and the elusive knobs ...












A piece of car body re-enforcing mesh is cut out to cover the damaged areas of the back...











... and it's filled, drilled and painted. Not the tidiest job in the world, but it'll render the set electrically safe, and allow the required ventilation.









The set's plug is fitted with a more suitable 3A fuse (there's another 13A fuse I've gained!!) and it's reassembled and given a nice long soak test.










Another saved from landfill :)

Tuesday 26 June 2018

Cotswold Hospital Radio

After a bit of messing around... it's now available to all and sundry.

There's a little webplayer thing temporarily available at the top of the site (or click here) It's only a test at present.

Music while you surf.

Enjoy.

Sunday 7 January 2018

National AE-670 Basket case repairs and restoration.

A while ago I offered to restore my friend Richard's late fathers radio.

It's a National AE-670 radio, dating from around 1960. It's got medium wave, and two short-wave bands, and a "gram" input.


It's also a basket-case! It's been dropped at some stage in it's life, the glass dial is broken, and case front is cracked, and the woodwork's in a bad way... let's see what we can do....

At some stage, someone has added a two pin connector on the rear .... I hope that hasn't got mains on it, as it's pins are exposed....
..and it is! Connected to come on with the radio! I wonder if it was used to drive a table lamp or similar. Some TV's and radio-grams had similar sockets, although not exposed. I disconnect the socket, as it's not safe...

The chassis looks complete and largely un-molested.





Removal of the front panel knobs, and four screws underneath the cabinet allow easy withdrawal of the chassis. I also remove the speaker board, and the damaged dial glass. A Piece of veneer on the front comes away when I remove the surround. I'll glue this back later.







On this inside of the cabinet, there's a circuit diagram, layout and re-stringing information. Something looks to have eaten it a bit!

The valve line up is 6X4 rectifier, 6AR5 output, 6BE6 frequency changer, 6BA6 IF amp, and a 6AV6 AGC, detector and 1st audio amp. There;s also a 6DA5 indicator tube.






The circuit will come in handy later...












With the chassis removed, we can start on the electronics....












The chassis has quite a few waxy capacitors, which will need replacement. There's also a 3uF 300V electrolytic which is probably past it's prime!









The main smoothing can is something else... look at all those sections!



















After a few cursory checks to the mains and output transformers to check they're not open-circuit, I change all the waxy capacitors for modern equivalents.















There are a couple of wax caps I can't change. They are C50, a 0.003uF and C29, a 0.05uF.

These need to be modern safety components.

C29 must be X2 rated, as it's connected across the mains. C50 must be Y rated as it's between the mains and chassis. If C50 were to fail short-circuit, our chassis would become live. Not good.

I've ordered the X2 and Y rated caps, but for now the set will function without, so the wax capacitors are simply snipped out.

You can also see the chassis has a mains transformer, so is an isolated design, unlike many British sets of the time.



There's also some rubber insulated wire that's perished. It drives the dial lamps on the front panel. It's replaced.











I gently bring the mains up via a variac and isolation transformer, monitoring the HT as I gently wind up the voltage. This allows the electrolytic capacitors to reform.








The main multi-section electolytic shows no rise in temperature, and is pronounced fit. The small 3uF cap is not in such good condition, and is replaced.


The set performs well, although the indicator is a bit dim... they never seem to be very bright thesedays...











Here's a long exposure pic!











I leave the set on soak test once I'm happy with it, and set about the cabinet.













The dial back, escutcheon and knobs get a good wash in the sink...










Where the front panel is damaged and de-laminating it's glued back together with PVA glue. The missing piece of lamination is made up with pieces of paper and glue, a bit like decoupage, until it's level. If I don't do this, the replacement speaker cloth will never sit straight.








The centre rib has been pushed in. It's repaired and glued. The croc clips will hold it all in place until the glue dries.

The speaker cone is ripped. It's been glued in the past, but has really had it. I'll get a replacement.













And on to the case...

The years have not been kind...
































The piece of veneer from the front moulding is glued back...











.... and the deeper scratches filled with some fine wood filler.













Now to don a dust mask, and rub the thing down....

Looks good eh? Now to stain the wood again...

First off hoover up all the dust left from the sanding, and wipe the cabinet over with a tack-wipe.




Now, I must admit I bought this stuff ~10 years ago to paint a front door with... came out nicely too. There's still a good 3/4 of a tin left...

Now...

Step 1. Read the instructions on the tin.

Step 2. Ignore the instructions on the tin!



It does say on the tin "Apply evenly by brush along the grain" ... which is great if you're doing a front door... Find yourself a good lint-free cloth, dab it in the woodstain, and wipe it on, along the grain. It's really easy to get a nice, thin even coat like this. Not only that, but it will have dried by the time you've finished reading this paragraph!






Now that's looking good. If you want to go darker, just add another coat or two, until you get to the shade you're happy with. As it is, I think just the one coat is about right. You'll notice it's not too shiny. The woodstain gives us a satin finish, I intend to add a gloss varnish when I'm done...







Now we need to re-create the black front, with the fade towards then centre. we can do this with some black aerosol paint. The end result is the given a coat of lacquer.









I'm rather pleased...












During all the cabinet work, I had a thought... Gram input. Be nice if it was bluetooth....

There's precious little on MW and SW these days, and this would give the receiver a bit of a lift!!

Enter the BK8000L bluetooth module and adaptor board.




A simple 7805 power supply is built up on some perfboard. The keen eyed amongst you will notice there's only a single diode. The board uses half wave rectification. This is because the board is to be powered from the heater winding on the transformer. One side of this winding is referenced to chassis ground, so we can't use a bridge rectifier. The module only uses about 50mA when it's running, so there's not a lot of smoothing required either (220uF seems to work well).




The module's left and right output "positive" outputs are coupled together via two 0.1uF capacitors, and the signal fed into the gram socket.

It works really well :)

And the radio reception isn't affected by it either!






The speaker board gets a nice piece of blue cloth glued, clamped and clipped into place....











... groovy ....












The hole where the magic eye pokes through is given a coat of PVA glue. This will make it stiffer, and easier to cut. It'll also stop it from sagging after I've cut it.

It's left to dry.







Meanwhile, the X2 and Y class safety capacitors have arrived......










... and are duly fitted.














Now onto the dial glass... it's in a bad way ...












 in fact it's in three pieces...













The rubber grommets are removed from abound the holes for the control shafts, as they've gone hard and have shrunk. I'll find some new ones...

But what to do about the broken glass? I've had very little success over the years attempting to glue it. Superglue is just too brittle. Epoxy works, but has to applied thickly to get it to stick and the results are generally not nice to look at.



My mate Stephen showed me this glue the other day. "It'll stick anything" he says. It comes in a pen, and is cured by the UV LED mounted in the end....

Further research show people have been using it to repair broken and cracked mobile phone digitisers, as a sort of stop-gap repair.

What have I got to lose?











Having carefully cleaned the edges of the broken parts with isopropyl alcohol, I apply a line of the glue from the pen, and shine the UV LED at it...

It allegedly cures in 5 seconds...

I'm sceptical...








... but it works superbly!

Where the glue ran out of the join when I put the two halves together, there's a bit of a bead, which is very slightly soft. The packet says the stuff can be shaped, sanded, drilled, polished and painted... so I clean up the surface with a bit of wire wool.





I repaint the rear of the dial, where it's supposed to be opaque, with some black paint, as some of this was damaged when the glass was broken.

At this point, the dial breaks again, in the middle of the "V" ... there was a hairline crack there before... It again glues well...






Now onto the speaker. It's a 20cm x 12cm elliptial. It's shot. Not only is the cone torn, but the edges are all breaking up. It's also 3 ohms. Digging about in my box of spare speakers turns up a couple of similar sized speakers, but they're 8 ohms. I asked the usual sources and put out a couple of requests on various forums for something suitable. No good. eBay was not forthcoming either. Then, whilst googling I found this ....







I'm lucky enough to have a branch of Halfords locally, so I popped down, and picked one up...

It's a similar size, and 4 ohms... near enough. Notice on the label it states "Min. Input 20 watts" .. I've only got 4 or 5 .... I'm sure they don't mean that really ..... only one way to find out!





The speaker is mounted up onto the speaker board and fixed back into the case. The output transformer was originally mounted on a bracket mounted to the old speaker. I'll worry about that later ...








Now to refit the dial-glass. This was originally mounted by two rubber grommet type mounts, located on the four holes around the holes where the control shafts pass through, on each end of the chassis, as shown here .....








The rubber has long since turned into some kind of gunge...  I had a look in the box of rubber grommets, and selected a couple of these conical shaped things. They're designed for accepting wiring looms though the bulkhead of cars. I used a few on the mini...







A grommet is fitted to the hole in the chassis, and the conical grommet cut to size.











The output transformer is mounted to existing holes that fix the front bezel to the cabinet and speaker board. The dial lights are re-fitted, and the magic eye back into it's spring-loaded holder.

The bluetooth receiver is glued to the bottom of the cabinet.







... the back replaced,  and it's given a thorough testing. The "min 20 watts" label on the speaker proves to be meaningless, as I thought.....