Loading ...

Translate

Sunday, 5 February 2017

Arduino PPM monitoring and switching.

I got involved with the local hospital radio station back in 2000, as station engineer. Been there ever since.

Now the station's studio used to be in a rather damp basement of a building built in about 1860. The hospital have decided to sell the building, so the station was evicted. They found us some nice new accommodation in a nice new building, and built us a super studio. All we had to do was move the kit and get it back on the air.


 The old studio used an undocumented "TX bay" rack to route the signals from 2 separate control studios and one presenter booth to the broadcast output. One studio would be live, and one for rehearsal/production.

Now we had one studio, so a lot of the switching could be eliminated. We would still need a rehearsal solution though.

This is the old TX bay, now minus it's switching and compressors etc... It was designed and built in the early 80's by person or persons unknown. It had a propensity to blow logic and transistor arrays up with the slightest hint of a rumble of thunder within a 100 mile radius! I shan't really miss it!



So, the desk was moved, and a nice new rack donated to house all the broadcast gear!

After a long day, the thing is back on the air!
















I built up a new headphone distribution amplifier, using 5 Class-D PM8403 amplifiers, wired for mono. A note here, the PAM8403 does not allow you to tie the -ve speaker outputs together for stereo headphone operation! The station is mono anyway, so it doesn't matter!










Completed headphone distribution amplifier.









Looking all quite nice and professional...


 


... but there's no method of switching the studio into rehearsal mode, and the PPM monitoring (allowing the operator to set her or his levels before going live) was lashed up using an old box donated by my good friend Piers at Raycom.

So... we need a small box, that will allow the following...

PPM level display from the monitor output from the mixing desk.
Switching to allow the desk output to be disconnected from the transmitter feed, and switch in the output from the 24 hour play out computer, to allow rehearsal mode.
Drive the "MIC LIVE" red lights.

So... after a bit of head scratching ....



Now the studio uses professional level, balanced audio (mostly). The output from the 24 hour playout system isn't. This is fed into the box, and it's turned into a balanced signal by IC5, and IC6A. There's a bit of amplification there too, to take the level up match the rest of the studio. This signal is fed back out to it's own fader on the desk, to allow for a seamless transition between live and rehearse.
In rehearsal mode, this signal is also fed straight out to the transmitter feed.
The live/ rehearsal switching is carried out by the microcontroller, controlling relay K1
In "live" mode, the signal from the desk is routed straight from the desk to the transmitter feed.

The monitor signal is also sent to the box, and is unbalanced by IC6B, and fed to the analogue input of our microcontroller. R29 and R31 are used to give the signal a 2.5V off-set.

The "mic live" signal (18V active low) is connected from the desk, via an opto-coupler, to the micro, where it's inverted in the code, and used to control the Mic live output FET Q2.

You will notice there are two, quite separate power supplies. One supplies +/-15V for the audio stuff, and the other an unregulated +15V and a regulated 5V for the micro and switching duties. The grounds are only commoned at one location.

There's a couple of LEDs to indicate the rehearsal status, and for peak (overload) warning. A 20x4 LCD provides the same information, as well as Mic live status and the level monitoring...

Now the level display. I wanted something smooth, not just using whole character blocks...
So I've defined a bunch of single pixel wide special characters, which are written to the display on the fly.

I also wanted a slower responding "peak" display. This is implemented in a similar manner.

(When I refer to the Pin's here, it's the physical pin on the ATMEGA328 IC itself, NOT arduino pin numbers.)

The audio is sampled (in the void getSample) from the ADC 0 pin, 48 times. This provides the required 5mS delay to stop the meter flickering around wildly. The maximum value is taken, and centered around 512 (our 2.5V offset) and then converted into a log scale.
The bar graph level is then plotted.

If the peak level is exceeded, it's updated and plotted too. It decays 0.1dB every loop cycle. It's limited to -54.19 dB to prevent a divide by zero error!

The mic live signal is read in via pin 14 and inverted, and then output on pin 12, which causes the output FET Q2 to switch the LED lamps on.

The Live/Rehearsal switch is read, and used to start a timer, which provides debounce, and plots a bar graph to give the user some feedback that switching is about to occur. The switching is carried out at pin 16, which switches T1, and the relay.

The Mic live lamps themselves, are a 3W LED, and a simple LM317T constant current source set to about 500mA.

 Construction was on three boards, the display has the digital and switching board "piggybacked", the analogue stuff is kept separate, and the two power supplies are on the third board.

All the interconnecting signal and power supply connections are twisted where possible.














Mic-live lamps are simple....












... but effective, and much more energy efficient than the old 60 watt incandescent lamps!











I'm rather pleased with the look of the thing.

It was built up into a second hand case, which I put in the dishwasher and re-painted :)








Here's a quick video of the thing in action!


There, the patients at two hospitals can enjoy some relaxing music and requests once more!

Here's the code:

No comments:

Post a Comment