Featured Post

Beolover SyncDrive: DC Platter Motor Replacement for Beogram 4002 and 4004 (Type 551x and 552x)

Late Beogram 4002 and the 4004 (Types 551x and 552x), which have DC platter motors instead of the earlier synchronous AC motors usually suff...

Showing posts with label neopixel. Show all posts
Showing posts with label neopixel. Show all posts

Friday, October 17, 2014

Beomaster 6000 4-Channel (2702): LED Based Scale Illumination (Pt.3) - Circuits and Arduino Code

This post is part 3 of the documentation of my efforts to replace the incandescent light bulbs of the Beomaster 6000 4-Channel that I was restoring. For a description of the hardware discussed here, please visit this page.
Probably the most difficult aspect of this effort was to provide the Arduino and the Neopixel LEDs with a stabilized 5V supply. After many trials, it turned out that a simple half-wave rectifier in combination with a DC/DC converter directly hooked into the AC power supply of the Beomaster was the best solution. Here is a picture of the circuit:



































The circuit is connected to one of the AC leads from the transformer in the Beomaster 6000 (red circle). The current returns into the '-19V' rail of the Beomaster power supply circuit (blue circle).
The nine diodes drop the 40V amplitude to a safe level for the 7824 regulator, while providing half-wave rectification of the AC wave. From the smoothened AC wave via C1 (220uF) the 7824 produces a stabilized 24V at its output, which is fed into  a TR05S05 DC/DC converter that makes a stabilized 5V output voltage. This potential is then fed into the Advanced Light Source (ALS) circuit that drives the Neopixel LED strings for the scale illumination.

The relevant connection points to the Beomaster 6000 power supply circuit are shown here:


























Connecting the return to the -19V rail of the Beomaster puts the GND rail of the ALS at 0V relative to the 40V AC amplitude.

This diagram shows the ALS circuit (this circuit omits the crystal as well as the ISP port that needs to be implemented to program the Atmega328p):






















The Atmega328p controls the FM dial and Control LED strings based on the two nominally 18V inputs from the Beomaster, which normally control the incandescent light bulbs in either display.

These 18V signals are at about 40V above GND relative to the Atmega328p, hence the large voltage dividers (51k/1k) in the two inputs. The transistors are necessary since the 18V potentials only relax to the internal ground of the Beomaster when the displays are off, i.e. the voltage change at the input is only from 40V to about 20V. Transistors were implemented to translate this change into a digital 5 -> 0 transition at the Atmega328p pins. This enabled to use the two external interrupts of the Atmega chip for triggering the switching of the display LEDs.

Below is the commented Arduino code. The NeoPixel library does all the heavy lifting for driving the LED strings, and the sleep library enables the use of the power saving modes of the Atmega. This was crucial since the tuner section of the Beomaster proved quite sensitive to the digital emissions of the Atmega. The use of interrupts in combination with sleep modes enabled to limit the Atmega activity to a few ms per display illumination change (during which the Beomaster goes on 'mute' anyway), essentially eliminating any interference with the tuner of the Beomaster 6000.

***************code start ***************************************************


#include <Adafruit_NeoPixel.h>//library that provides the methods for running the neopixels
#include <avr/sleep.h>//this AVR library contains the methods that controls the sleep modes

#define Tuner_PIN 8        // Tuner strip Data Out
#define Controlstrip_Pin 7 //Controls strip Data Out

#define Tuner_scalelight_pin 3//This ext interrupt pin (INT1) goes low via the transistor if the tuner is turned on
#define Controllight_pin 2//This interrupt pin (INT0)  goes low via the transistor if the controls are to be lit up.

//these RGB setting give an 'incandescent' emission of the LEDs:

byte red=255;//255
byte blue=2;//2
byte green=196;//196

// New instances of NeoPixel class
Adafruit_NeoPixel Tunerstrip = Adafruit_NeoPixel(4, Tuner_PIN, NEO_GRB + NEO_KHZ800);
Adafruit_NeoPixel Controlstrip = Adafruit_NeoPixel(6, Controlstrip_Pin, NEO_GRB + NEO_KHZ800);

void setup()//this is the setup routine that is executed after initial power up
{
  delay(500);//wait until things stabilize after turn on
  //Serial.begin(9600);
  pinMode(Tuner_scalelight_pin,INPUT);
  pinMode(Controllight_pin,INPUT);
  ADCSRA |= (0<<ADEN); //disable ADC
  Tunerstrip.begin();
  Tunerstrip.show(); // Initialize all pixels to 'off'
  Controlstrip.begin();
  for (int i=0; i <= 6; i++){
  Controlstrip.setPixelColor(i, red, green, blue);        //turn the controls pixels on (the beomaster goes into standby "ON" by default after turing it on at the mains switch.
  }
  Controlstrip.show(); //set pixels
}

void loop()
{

  digitalWrite(13,LOW);   // turn LED off to indicate sleep
 
 
    sleep_enable();
    attachInterrupt(0, controlsISR, CHANGE);//Set pin 2 as interrupt and attach Interrupt Service Routine (ISR)
    attachInterrupt(1, tunerISR, CHANGE);//Set pin 3 as interrupt and attach Interrupt Service Routine (ISR)
    set_sleep_mode(SLEEP_MODE_PWR_DOWN);//define power down sleep mode
    digitalWrite(13,LOW);   // turn LED off to indicate sleep

    MCUCR |= (1<<BODS) | (1<<BODSE);// turn brown out detection off (from:http://forum.arduino.cc/index.php/topic,50109.0.html)
    MCUCR &= ~(1<<BODSE);  // must be done right before sleep
    sleep_cpu();//Set sleep enable (SE) bit, this puts the ATmega to sleep
    //Serial.println("just woke up!");//When it wakes up due to the interrupt the program continues with the instruction following sleep_cpu()
    digitalWrite(13,HIGH);   // turn LED on to indicate wake up
    delay(1000);


  if (digitalRead(Tuner_scalelight_pin)==LOW)//LOW due to transistor; FM scale "ON"
    {
      for (int i=0; i <= 3; i++){
      Tunerstrip.setPixelColor(i, red, green, blue);        //turn the pixels on
      }
      Tunerstrip.show();
    }
  if (digitalRead(Tuner_scalelight_pin)==HIGH)//HIGH due to transistor; FM scale "OFF"
    {
      for (int i=0; i <= 3; i++){
      Tunerstrip.setPixelColor(i, 0);        //turn the pixels off
      }
      Tunerstrip.show();
    }
 
  if (digitalRead(Controllight_pin)==HIGH)//HIGH due to transistor; Stand by "OFF"
    {
      for (int i=5; i >=0; i--){
      Controlstrip.setPixelColor(i, 20, 20, 0);        //turn the pixels off
      }
      Controlstrip.show();
    }  

  if (digitalRead(Controllight_pin)==LOW)//LOW due to transistor; Stand by "ON"
    {
      for (int i=0; i <= 5; i++){
      Controlstrip.setPixelColor(i, red, green, blue);        //turn the pixels on
      }
      Controlstrip.show();
    }
}

***************Interrupt service routines (ISR)**********************************
void tunerISR()//ISR
{
  sleep_disable();//this is important. It is possible that the interrupt is called between executing "attachInterrupt(...)" and sleep_CPU() in the main loop
                  //if that happens without the sleep_disable() in the ISR, the ISR would be called, the interrupt detached and the device put to sleep.
                  //since the interrupt would be disabled at that point, there would be no way to wake the device up anymore.
                  //by putting sleep_disable() in the ISR, sleep_cpu() would not be effective during that loop, i.e. the main loop would run one more time
                  //and then properly attach the interrupt before hitting the sleep_cpu() a second time. At that point the device would go to sleep, but
                  //the interrupt would now be activated, i.e. wake-up can be induced.
  detachInterrupt(1);//disable INT1. This effectively debounces the interrupt mechanism to prevent multiple interrupt calls.

}

void controlsISR()//ISR
{
  sleep_disable();//this is important. It is possible that the interrupt is called between executing "attachInterrupt(...)" and sleep_CPU() in the main loop
                  //if that happens without the sleep_disable() in the ISR, the ISR would be called, the interrupt detached and the device put to sleep.
                  //since the interrupt would be disabled at that point, there would be no way to wake the device up anymore.
                  //by putting sleep_disable() in the ISR, sleep_cpu() would not be effective during that loop, i.e. the main loop would run one more time
                  //and then properly attach the interrupt before hitting the sleep_cpu() a second time. At that point the device would go to sleep, but
                  //the interrupt would now be activated, i.e. wake-up can be induced.
  detachInterrupt(0);//disable INT0. This effectively debounces the interrupt mechanism to prevent multiple interrupt calls.



***************code end ***************************************************

Beomaster 6000 4-Channel (2702): LED Based Scale Illumination (Pt.2) - Arduino Comes to Town

This post discusses my current solution for replacing the incandescent scale lights of my Beomaster 6000 4-Channel (2702). My last post reported about my failed attempt to use amber or white LEDs to replace the incandescents. The problem was that these LEDs provide no (amber) or only an insufficient amount of (white) red light that is needed to illuminate the red scale indicators on the Beomaster's indicator bands. After implementing these LEDs the red indicators were only barely visible. This meant I needed an LED solution that would provide a sufficient amount of red photons. 

The only solution to this are RGB LEDs. In fact, red and green is enough to make incandescent lookalike light by mixing proper amounts of red and green. This meant that I needed at least a two LED bulb, with two resistors to control the currents in the red and green LEDs independently - too many components and wires for a smooth implementation on the Beomaster's scales.

So I came up with something different: Chainable RGB LEDs with built in control electronic, aka as 'Neopixels' or WS2812B.



























They are the rage among Makers right now, due to the cool light effects one can produce with them when using a microcontroller. For my application I appreciated that one can string them on a bus of only three wires, and that they are only 5 mm x 5 mm and have a nice direct light emission, perfect for blasting light into the plexiglass scale bodies of the Beomaster.
Furthermore, I found them on almost perfectly sized breakout boards at Tindie.com offered by Bot-Thoughts: 

























All I needed to do was to Dremel them a bit narrower to the actual width of the chips:





























After this step they fit snugly into the aluminum tubules that previously shielded the incandescent light bulbs. The next step was to integrate them into light strings with four LEDs for the FM dial, and six LEDs for the controls indicators. Each LED has four pins, two are for 5V and GND, the other two are for data in and out. All one has to do is to hook them in parallel to the power rails, and daisy chain each data outputs into the input of the next LED. I built this using leads from an old parallel printer cable. This photo shows one of the two assemblies for the FM scale:





























And here is the string for the controls illumination:





























The red lead is the control line that is hooked up to the 18V output that previously powered the incandescent lights. The four pin Molex connector connects to the control electronics. For insulation I wrapped the neopixel boards with two turns of Scotch tape. Not the prettiest solution, but that was all that came to mind at this point.

Here is a picture of the control board. It is based on an Atmega328p, aka 'Arduino Nano'. The two 4-pin connectors control one light string each, the 2x3 connector in the background is the ISP port for programming the microcontroller, and the 2-pin Molex is the power connector. The controller 'listens' to the 18V connectors for the lights, which tell it when to turn on each of the LED strings for the scales. The 18V lines are connected to the two external interrupt pins of the Arduino via transistors that translate the 18V signal to proper 5V signals that are compatible with the Arduino.




























I designed and 3D printed a small enclosure that fit into the only free space within the Beomaster, above the tuner board. It clamps onto the right shield on that board, i.e. is completely non-intrusive. In fact the entire setup is fully removable without a trace, as it should be for a project like this, in case one would want to go back to incandescent at some point in the future.

Here is a shot of the entire assembly:





























I called it Advanced Light Source (ALS) in homage to the real ALS at Berkeley National Labs. After all they also can change the color of their (x-ray) light...;-).

Anyway, this baby needed a precise 5V supply, something difficult to find in the Beomaster. The Beomaster's power supply is pretty basic, typical for its pre-digital design. First I thought I would simply run this set-up from the -5 supply of the Beomaster using a low dropout regulator to make sure that there are no unruly above 5V spikes that could kill the Arduino. But it turned out that the on-board 'stabilized' power supply is not very capable to stabilize the -5 output. It is better at keeping the +18V supply constant, but this was not useful. During trials with this setup the LEDs would pull the Beomaster ground down by about 2V, which resulted in a -3 and +20V split of the regulated voltage of the power supply...that did not work, the Arduino browned out and became unreliable in its operation. So I needed to find my power elsewhere.
My next thought was to use the entire -5 to +18 range and employ a DC/DC converter that would make 5V with only little conversion loss. This worked for the LEDs, but introduced some digital harmonics from the 100kHz DC/DC chopper into the amplifier of the Beomaster. This was audible when cranking the volume up to maximum without input signal...sounded like a bunch of mice having a wild party. Of course this was not acceptable for a rarefied piece of audio history such as the Beomaster 6000!

The final solution turned out to be as follows:
I went directly to the AC output of the transformer, and used the 40V AC signal, which I fed via 9 diodes for an initial voltage drop and half-wave rectification into a 7824 voltage regulator using a 220uF capacitor to stabilize the voltage into a DC voltage with acceptable ripple. The stabilized 24 output was fed into an XP-Power common ground DC/DC converter (TR05S05) that produces a stabilized 5V supply from up to 28V for output currents up to 500mA (my setup draws about 350 mA when all LEDs are on). The dissipating elements of this circuit were mounted on a small heatsink, which was modified to fit on top of the 23V supply capacitor at the right front corner of the Beomaster enclosure next to the tuner wheel. Here are a few pictures of the set-up:

The diode drop and half-wave rectifier. The green part is 3D printed and serves to clamp the diodes and the 24V regulator against the heatsink.





























Entire set-up from the bottom. The green part also holds the 7824 against the heat sink:





























From the top:





























And installed in the Beomaster. The entire set-up is held in place by a tab that goes underneath the fuse holder and is clamped in-place when the fuse holder is bolted down. Again fully reversible with no alteration on the Beomaster. The heat sink reaches about 30C after an hour of operation, which is tolerable without forced air flow.


























Here is a pic with the ALS in place above the tuner:





























And finally: The set-up in action. Warmly incandescent-like light pouring from evenly illuminated scales, while properly illuminating the red indicators. Beautiful!





























And here a detail shot of the controls indicators with the plexiglass cover on. The picture was taken in a darkened environment. One would never notice that there is a bit of new-millenium under the hood...;-):





























More details about the circuit and the Arduino code in Part 3 of this story.

Tuesday, October 14, 2014

Beomaster 6000 4-Channel (2702): LED Based Scale Illumination (Pt.1)

Something different today: While I am waiting for a set of Beocord 5000 belts from Martin (Dillen on Beoworld.org; thanks much for providing all these great replacement parts! - much appreciated), I thought it was a good time to report about my efforts to convert the scale lights of my Beomaster 6000 (2702) to LEDs. I have to admit that I am a bit of a LED fan, and that I never appreciated small incandescent light bulbs. They just break too easily, especially during transport, and I think if the designers in the 70s had had shorter wavelength LEDs at their disposal they would never have used incandescents. I am aware that there is a discussion out there about whether to converting to LEDs is somewhat sacrilegious, but this is a free country, as they say...;-):

Here we go: When I opened the Beomaster 6000 up for the first time several of the light bulbs illuminating the scales on the controls and the FM dial were broken. Worse, several of the small plastic bulb sockets had broken out tabs as seen here:

 


The only way to fix them in their proper places would have been with tape...not something I am into...Beolover only likes neat solutions!

So, my first response was trying to reproduce the sockets, but I could not find anything resembling the metal brackets that are inside the original sockets. Then I considered using LEDs, and I thought that amber colored LEDs would give a pretty good interpretation of incandescent light. So I designed same-formfactor replacements for the lamp sockets, which would hold an LED and a current limiting resistor. This worked really nice with the Makerbot II using its highest resolution settings and 50% infill. Here is a pic of the result:





























Pretty! The LEDs were Dremeled into cylinders to make them emit light in a non-directional diffuse fashion. Here is a pic of the setup in comparison with the original incandescents:





























I enthusiastically put them in place. Here at the bottom end of the control scales (the color appears a bit too orange in these pics...in real, it really looked quite like small incandescents):





























And at the top:





























Pretty neat, I thought. Here is a pic of the FM dial with LEDs installed:












So far so cool...unfortunately, after installing the controls and the FM dial back in place, when I put the dark plexiglass cover of the Beomaster 6000 on, I had my first Waterloo moment with this project:
I turned the light in my lab off, and observed the Amber light coming from the scales, and first I was happy, it all looked very authentically incandescent, but then it occurred to me that the red lines on the indicator bands were hardly visible.
At this point it dawned on me that there is a significant difference between incandescent light that looks amber and amber LED light.

I used CREE C503B-AAS-CY0B0251 amber LEDs with an emission wavelength of 596 nm. Here is the emission spectrum from the data sheet:



One notes the narrowness of the amber emission peak, which hardly overlaps with the peak of their red LEDs, and herein lies the problem. The red indicators look red because they reflect only red light (or in other words, they absorb all photons that are not red), hence if one throws amber photons at the red indicators, they will simply absorb those photons and no light is coming back from them.
That the indicator looks red in the photo of the FM dial is a result of the ambient incandescent light in the room that was present when I took the picture. I forgot to take a picture of the vanishing indicators when I observed it...was just too disappointed. They were really almost as black as the rest of the bands...

This meant, I needed to find some red photons! Initially I thought to use white LEDs instead. White LEDs usually down-convert blue LEDs via a phosphor layer, which produces a certain amount of red photons (hence the white looks). Here is a spectrum from the white LED I used, made by Multicomp (MCL053SWC-YH1):



Note the strong blue light peak...that comes from the LED, and then the fairly broad, but much weaker incandescent-like down-conversion 'hump'. The problem with this is that the blue part of the spectrum is very strong, i.e. this is much more like sunlight than a small incandescent light bulb. Here is a spectrum of a typical incandescent light bulb (from here):



Note the weak overlap with the visible spectrum, and the practical absence of blue light. Mostly IR radiation, i.e. heat and very little visible light. This suggests that the scales would look way to white, while the red indicators would be reflecting red light at a much weaker level. Here is an impression from the very white light coming from these LEDs (of course I had to try it despite knowing better at this point, but hope springs eternal...;-):




























It became clear at that point that the only way to replace the lightbulbs with LEDs would be with RGB LEDs, or at least with red-green types (which are available). The only problem with these is that two resistors are needed to control red and green independently to be able to select the right incandescent sheen, while providing enough red for a solid reflection on the indicators. I realized that there would not be enough space for discrete resistors of the proper wattage in my printed sockets.
So, my solution was to use WS2812B digitally controllable RGB LEDs with built-in control electronic. I always wanted to build something with them, and here was an opportunity. Here is a pic of these cool devices (from Adafruit):



They are just 5 mm square, i.e. fit perfectly into the cavities for the light bulbs. One can chain them up with just three leads and then address them like a shift register. This enables awesome multicolored tens or hundreds of LED ribbons that are able to display fast colored patterns. My application is of course more quaint with only six resp. four units, but more about that in my next blog entry.