2013. augusztus 19., hétfő

Another batch of attenuators


Hello there!
I already told some bits about how the attenuators are being made. Now I want to share the complete story with you.

First of all I mentioned there is no mass production. That is right, every attenuator is hand built at nights and on weekends at home.
Because of this, there is only a small quantity is built in one time.

But first, the basics, the PCBs are manufactured in a small local shop.
It is nicely made and has routed edges. As the finished attenuators, the boards are made by hand as well, the shop is not automated, and welcome small orders too.

Because of the generally low part availability here, the other parts are ordered from about five different suppliers, some local and some from other countries.
When everything arrives the building begins.

The finished units are being tested, every function plus the remote. Then it is packed and stored and waiting for its new owner to be arrived to.

Finished 8th note Stepped Attenuators

Doing this on a free time basis, I still thinking on new kits for next year, I hope I can do it. It also depends on the popularity of the stepped attenuators, and my free time. Until then, please follow the links to the 8th note Stepped Attenuator,
and don't hesitate to contact me if you have any questions.

The main page:
http://www.8thnote.eu

Product page of the attenuator:
http://www.8thnote.eu/attenuator_details.html

2013. augusztus 8., csütörtök

What is the 8th note Stepped Attenuator, and what it isn't?


I want to make Your decision easier. Is it for your project, or it is not?

One of my design rules amongst the first ones was simplicity.
The cleanest and finer look of an amplifier's face can be found in stereo amplifiers.  Every manufacturer made it, like Onkyo, NAD, Harman/Kardon to mention a few.
The basics of the user interface for a stereo amplifier are not more than a power button, and a volume knob next to a channel selector.
In fact, I am still using a stereo amplifier at my home that does not even have a remote. That's right. I walk there, to turn the knob.

So when the idea of the 8th note Stepped Attenuator came, I wanted it to let me use it with closed eyes. Still knowing where the knob is pointing, it is essential not to use rotary encoders, but traditional pots. Following this idea, turned out that the attenuator have only three LED indicators, to show some functions, but nothing more.

I made the following list based on the most asked questions, I hope it will make your decision easier:

What the 8nSA is?

-It is a superior attenuator for single ended and balanced amplifiers
-It mimics the conventional potentiometer in much higher quality
-It is designed for DIY projects, and needs some soldering
-It have remote control functionality as a secondary control
-It is made in simplicity and compactness in mind
-It is made by hand in low quantities for a limited time

What the 8nSA is not?

-It will not give you total flexibility, but the all the basic things you will need
-It does not have nice display, like numerical displays or similar, but if it is your thing, I made documentation to help you make one

The user experience is unique.
If you have not tried a stepped attenuator, you have to taste it. This unit will give all the clarity your ears desire, with a high tech brain to do it well.

If you choose to try it, you will experience the finest analog attenuation solution we know until now.

2013. augusztus 1., csütörtök

Using Arduino with the 8th note Stepped Attenuator

The gateway to external displays

This text is about how to use an Arduino to read data from the 8th note Stepped Attenuator.
The Arduino is an easy to use programmable hardware, wich is very popular amongst DIY-ers.
If you want to make an external display for your attenuator then this is where you must start.



What is possible?
There are digital ports on the driver board. Using these ports it is possible to read the following:
-is MUTE on?
-is LULO active?
-is SRC2 selected?
-what is the attenuation level?

What is it good for?
You can use these data to output text on a display, or make a led bar show the attenuation level, or do whatever you can think of to do with. You can find inspiring ideas in the last blog entry.

What skills are needed?
You need some experience in using Arduino and programming it. If you are not familiar with Arduino, then stop at Arduino's webpage first. There are many good articles to beginners, helpful communities, user forums and lots of example codes on the internet, which can help you in the first steps.
Because there are many infos out there about Arduino, I will not duplicate it here. This article will focus on helping users to write the 8th note specific part of their own program.

What will we do?
We will read the state of the MUTE, LULO and SRC2 LEDs, which is the simplest task. We will read the digital out (DO) port and decode the attenuation level.

Lets start it!
First you have to solder two unpopulated headers into the board. The one called DO (1x3 pin) and located on the bottom right corner of the driver board,
the other has no name and located next to the status LEDs (2x3 pins). We will use these headers or at least part of it.



The "LED header" (lets call it that way) contains pins to read the LEDs status.
You need to wire these pins to GPIO input pins:

You have to check these pins state on the Arduino, it has the value either HIGH or LOW. Choose pins that are not needed later for something else.
Please note, the pins status are LOW when the function (and its LED) is active.
The state of the pins can be read with the following (well known) way:

//let the pins connected to the following:
int mutePin = 7;
int luloPin = 8;
int src2Pin = 9;

//store the pin state in these variables
int mute_State = 0;
int lulo_State = 0;
int src2_State = 0;

void setup()
{
  pinMode(mutePin, INPUT);      // sets the digital pin as input
  pinMode(luloPin, INPUT);      // sets the digital pin as input
  pinMode(src2Pin, INPUT);      // sets the digital pin as input
}

void loop()
{
  mute_State = digitalRead(mutePin);   // read the input pin
  lulo_State = digitalRead(luloPin);   // read the input pin
  src2_State = digitalRead(src2Pin);   // read the input pin
}

Now if you have the variables then you can change your display according to it.

This was the easy part.

How to get the attenuation level?
The attenuation level can be read on the DO header of the driver board.
The DO port uses standard SPI communication. If you are not familiar with SPI, then follow this link to the Arduino SPI reference:
http://arduino.cc/en/Reference/SPI

A short quote from it:
"Serial Peripheral Interface (SPI) is a synchronous serial data protocol used by microcontrollers for communicating with one or more peripheral devices quickly over short distances. It can also be used for communication between two microcontrollers."


This is what we will do.
The SPI protocol uses a Clock and a Serial data line. When the clock ticks, the serial line state in the receiver is stored in a register. When it ticks again, it stores the next value in the register, until 8 bits are received.



In our case, the Master (and transmitter) will be the 8th note Stepped Attenuator and the Slave (and receiver) will be the Arduino. The SPI protocol defines a Slave Select (SS) pin what we don't use, because we have only one slave.
The DO port has the SCK (serial clock), the MOSI (Master Out Slave In) and a GND (ground) pins.


Note that MOSI, and SCK are available in a consistent physical location on the Arduino's ICSP header. You need to wire these pins.

Arduino ICSP header pinout

When finished with the wiring, lets think a little together.
The following is important and specific to the 8th note Stepped Attenuator:
  • The attenuator transmits data only on state change, in other words, you can not request a transmission
  • The transmitted data consists of 16 bits or 2 bytes, and repeated once
  • The two byte long data can be decoded to return the attenuation level

The transmitted data bits are mixed for design reasons, and can be decoded in a quick function that returns a byte between 0 and 127. The attenuator thus has 128 levels, each level means -0.5dB attenuation. So the total attenuation is -63.5dB. You do not have to bother with the repeated transmission, it differs in its bits, but when decoded it returns the same value. You do not need to omit any transmission, just decode it again, it won't hurt.

To receive the data, the Arduino must be listening. It has to receive two bytes, and store it in two variables. When two bytes has been received, call the decode function, so it can refresh the attenuation level variable.
If this is done in an interrupt, then the attenuation level variable keeps refreshing automatically and your display code can use or process this variable.

This flow chart explains the process:
Flow chart of the Arduino SPI receiver and data decoder routine interrupt


You can test and edit the following code for your needs.
Please note this code has not been tested yet, because I don't have my Arduino at the moment. But if you test it, and send me a report, I will update the code with your name.

// Sample Arduino code for 8th note Attenuator
// Written by Kara László
// 22. July 2013.
// Tested by: UNTESTED
// at:

/*
PLEASE NOTE:
The attenuator sends data only on state change. There is no method for requesting transmission.
The attenuation level is stored in the aLevel variable.
(aLevel == 0) means no attenuation or full volume
(aLevel == 127) means full attnuation or lowest volume

To translate the aLevel to dB:
 0 :    0dB
 1 : -0.5dB
 2 :   -1dB
 3 : -1.5dB
 4 :   -2dB
...
126:  -63dB
127:-63.5dB
*/

#include <SPI.h>

volatile byte FirstByte = 0; //the first storage
volatile byte SecondByte = 0; //the second storage
volatile boolean FirstByteReceived = false; // True if first byte is stored, second is transmitting
volatile byte aLevel = 0; // the attenuation level (0-127)
byte aLevel_Temp = 0; //temp to be able to compare the next aLevel with
float adB = 0; //attenuation in dB only for display

void setup (void)
{
// have to receive in "Master Out Slave In" pin
pinMode(MOSI, INPUT);
// turn on SPI in slave mode
SPCR |= _BV(SPE);
// turn on interrupts
SPI.attachInterrupt();
// set up Serial library at 9600 bps
Serial.begin(9600);
Serial.println("Hello 8th note Stepped Attenuator!"); // prints hello with ending line break
} // end of setup

//decoder function
byte DecodeaLevelData(byte data1, byte data2)
{
unsigned int inData = (data2) | ((unsigned int)(data1)<<8);
unsigned char decodedData = 0;
decodedData |= (unsigned int)(0b0000000000000010 & (inData))>>1;
decodedData |= (unsigned int)(0b0000000000001000 & (inData))>>2;
decodedData |= (unsigned int)(0b0000000000010000 & (inData))>>2;
decodedData |= (unsigned int)(0b0100000000000000 & (inData))>>11;
decodedData |= (unsigned int)(0b0001000000000000 & (inData))>>8;
decodedData |= (unsigned int)(0b0000100000000000 & (inData))>>6;
decodedData |= (unsigned int)(0b0000001000000000 & (inData))>>3;
return decodedData; //sending back 0-128 level
}

// interrupt routine on SPI transmission end
ISR (SPI_STC_vect)
{
// grab byte from SPI Data Register & put it in temp
byte temp = SPDR;
//if first byte is received then store it in FirstByte
if (!FirstByteReceived)
        {
        FirstByte = temp;
        FirstByteReceived = true;
        }else{
//if second byte is received then store it in SecondByte
        SecondByte = temp;
//now we have two bytes that need to be decoded
//aLevel will have the attenuation level
        aLevel = DecodeaLevelData(FirstByte, SecondByte);
//reset byte counter
        FirstByteReceived = false;
        }
} // end of interrupt routine SPI_STC_vect

// start of main loop
void loop (void)
{
if (aLevel != aLevel_Temp)
    {
    //calculating attenuation in dB
    adB = ((float)aLevel * (-0.5));
    //printing message
    //will output like "Attenuation: 31 dB"
    Serial.print("Attenuation: ");
    Serial.print(adB, DEC);
    Serial.println(" dB");
    //stores aLevel to temp
    aLevel_Temp = aLevel;
    }
} // end of loop

Considerations:
If you use the Arduino's MOSI pin, it can not be used for another SPI communication.
But If you need that, you can implement the SPI in any GPIO pin by software. You will not have time issues because the attenuator SPI transmission is slow.
The microcontroller of the attenuator runs on only 1MHz, compared to the Arduino's 20MHz.

I hope this article was useful, and easy to understand. If you have any questions, contact me. If you have a project, or idea You would like to share with others, feel free to do so in the comments area.

2013. július 19., péntek

Display ideas for a "display-less" attenuator


It is possible to make diyplays for the 8th note Attenuator.
The headers area big help in this, as the LEDs of the attenuator can be mounted externally to an enclosure front plate. But there is more. It is possible to read the volume level from a digital port marked DO on the panel.

As this is a digital method, displays for the 8th note attenuator need a microcontroller or Arduino board and some programming.

Currently no out of the box display but I will help anyone who want to make one. Reading the digital value of the attenuation level (volume) means it gives back a value between 0 and 127.

You can do anything with that, display it on a LED bar, on a Character display, or any clever light feedback You like.

I never was a fan of numbered displays. I have yet to see one that turned out nice. Until that I am only interested in LED displays. 

I try to show some ideas here:

Background ring using the external LED output


Background ring using the external LED output

External LED driver showing attenuation position


External LED driver showing 128 attenuation position on 64 LEDs


External LED driver showing 64 attenuation position on 64 LEDs


I hope You like one or get an idea for your own display.
Making one is not that difficult, and if there is more interest I will develope an universal chip to make a few types of displays without programming skills.

But now, it is time to understand a little bit what is behind.
I try to make it beginner friendly.
Even if you are not familiar with programming, it is nice to understand what is behind.

But what is possible at the first place?
a) Using the LED headers without any additional circuit status LEDs can be mounted as an indicator on the faceplate or as back-light.
b) With additional circuits, it is possible to make a LED bar turn on and follow the level of attenuation (volume).
c) When doing this with a lot of LEDs, mounted around the pot itself it can even follow the pot position.
d) The last solution could be a character display with seven segment LED displays, or a more advanced text based character display.
e) Any cool idea of yours...

The a) is already covered by the documentation (check www.8thnote.eu), it needs no additional parts but the LEDs.
The d) is out of the scope of this text but the point is, you can do whatever you want when you already get some data out. Lets see how.

Getting information out of the attenuator is possible on two headers:
1. LED header
2. DO header

1. The LED header is the simplest, with a state check, a pin next to the LED can be checked against GND.
This can tell the same information as the LED status. Thus we can read which channel is selected, if mute has been pressed, or if LULO is on (pot or remote is master).
Later we can use this information as variables (true or false) in our program, and do whatever we want. Turn on lights, or send a message to a display.
To a microcontroller it is as simple as it gets:
Click the image to open in full size.

2. The DO header is an SPI communication port that outputs a coded word on each volume change. This code can be decoded to get the attenuation level 0-127 or 0dB-64dB.
The data can be read with a microcontroller, and processed to get a single number variable. It is something like...:
Click the image to open in full size.

If we have the attenuation level, we can easily do actions according to it:
Lets see if we have a LED bar like this (Seed Grove LED bar).
Click the image to open in full size.

It has 10 LEDs. Let it have the bottom red LED indicating only the level 0 or MUTE. So we have 9 LEDs left for indicating 127 levels. Easy math, 127 / 9 = 14,11 so we will have one LED for every 14 setting.
Actually we will have one LED for level 1, 14, 28, 42, 56, 70, 84, 98, 112, 126
Now you only need a small code that checks the current level, and light up LEDs according to that level.
For a real circuit, you need transistors or a LED driver too, because no microcontroller outputs are designed to drive LEDs.

Using lots of LEDs in a circular arrangement is very cool. See images for a real example of the above idea #4 or idea #5.
It is an advanced version of the LED bar above if you believe it.

This one or a similar panel I will make opensource / free to copy / if it is ready.




2013. május 24., péntek

The 8th Note Stepped Attenuator II


This is the most advanced attenuator I made. One controller board supporting two relay boards below. The boards are connected with headers. It uses the already introduced LULO controller logic, and remote control function next to the single potentiometer control. Additional function LEDs added, with headers to mount LEDs on front panel. The software has been fine tuned to excellent controller noise reduction, useful when long wires are used between potentiometer and the controller input.

Finally, it is ready. Enjoy!
Ordering is possible in the shop: www.8thnote.eu

Pictures of the 8th note Stepped Attenuator II:






Ordering starts now!

For more information please visit the shop at www.8thnote.eu

2013. április 1., hétfő

A fantastic gerber file viewer


Hello there! I found a very good web application I want to show you!

It is called 3D Gerber Viewer from Mayhew Labs.

This is a gerber file viewer, it is free to use, but it does more than an average gerber viewer. It shows You how your PCB will look in 3D. It may not the best for checking for errors, for this I use a simple gerber viewer called Gerbv. But the 3D Gerber Viewer creates fantastic pictures from gerber files, that you can rotate and zoom in and save it as picture like this one:

8th Note Stepped Attenuator version II Driver board PCB



It is easy like a 5 years old boy could use it. Once you open the viewer it loads in you browser and you simply need to drag and drop your gerber files into the window.
If you drop the gerber files to the browser window it sorts them to layers according to the file extensions automatically.

 You can change the layer function from the drop-down menu if you had unusual file extensions of you can omit layer as you will. Then press the Done button.

That's it!  For larger board you may need to wait a little to render, but once it is ready you will find a menu next to the rendered 3D image, there you can turn on or off layers, and you find some instructions.

I found it extremely helpful to see the whole board. It is the exact look you have to get from the PCB lab. Moreover it is easy to show boards this way as taking a good photo from a PCB is not very easy especially without a good camera. I had a great time checking a few of my other projects gerber files with this. It is a must to try for design geeks!

Check it out at: http://mayhewlabs.com/3dpcb for a few more examples and for the online 3D Gerber Viewer.

2013. március 28., csütörtök

Simplifying multiple user interfaces for a pre-amplifier: LULO


Now it is clear that the 8th note attenuator (as a passive pre-amplifier) will use a single linear potentiometer for control. In the last post I already listed the benefits of potentiometers over rotary encoders or simple tactile buttons in this application.

For a reminder, a potentiometer gives us a specific value if we turn it to a specific position. This is why we like it and this is what we call a natural behaviour.

The attenuator has an option for IR remote controlling. In fact, for control you get a potentiometer reading, and an IR receiver. You can omit any of those literally.

Option 1: use only remote control
You may ask why would anybody do that but I know of at least one headphone amplifier that has this only user interface, the Trilogy Audio 933.

Option 2: use only the potentiometer
For my own headphone amplifier I will follow this route. With headphones on my head I would not run to anywhere. Next to my chair or sofa the amplifier is always within reach, and I like to turn that big shiny knob.

Option 3: use both the potentiometer and the remote
For my DIY power amplifier I will use both. It is not like a headphone amplifier and it need to be controllable from moderate distances.
There are some things I think worth to mention in connection with option 3.
Usually a remote controlled amplifier has either digital controls (buttons, rotary encoder, etc.) or a motorized potentiometer.

In a traditional amplifier a motorized potentiometer follows the remote control, so basically you only control the motor with the remote. The potentiometer shows you the actual volume setting. Not using a motorized potentiometer somehow the volume need to be tracked when using the remote.

If it has digital control, like a rotary encoder, then usually it has a volume setting display, numbers, or sliders. Without this you would not know what percent of the volume it has. Because the knob actually don't give you a clue what is the setting

So these are the currently known options to have full control either from a remote or touching a volume knob.

But what if the potentiometer is not motorized and the amplifier neither has rotary encoder or display. Because the 8th note attenuator does not have those. Instead it has a volume lock function, called shortly voLULOck or LULO.

LULO:

This feature of the 8th note stepped attenuator takes care of switching between the remote and the potentiometer control.

If you use the remote to change the volume, the actual volume may be lower or higher than the position of your potentiometer (because it does not follow the remote). What LULO does is "unlocking" the volume knob when this happens. To "lock" your knob again, you have to turn it to the actual volume level.

But it would not be perfect like this. You may not know if the desired position to "lock" the knob is clockwise or counter-clockwise.

Because of this it only "unlocks" in one of the possible two cases.
Case 1:
You use the remote to turn up volume, higher than the knob setting. Next time you touch the volume knob, it sets the volume. No "unlocking". Remember if you move the potentiometer it sets the volume thus it may end up in sudden decrease in volume. But it does not harm you. You can turn it up again to wherever you like.
Case 2:
You use the remote to turn down volume, lower than the knob setting.
Now the "unlock" happens.
Without unlocking the knob, any change of the potentiometer would end up in immediate increase of the volume. Without some protection this incident could damage of your hearing or even your equipment.
To prevent this, the LULO "unlocks" the volume knob. It will not work if you touch it. To "lock" again your potentiometer you have to turn the knob to as low as the current volume. So now you know direction is counter-clockwise. If you reach the current volume setting, the knob will be "locked" again.
This sounds weird first but trust me, it is quite intuitive after you try it.

The trick is, if you touch the knob and nothing happens, you know LULO kicked in to unlock the knob to prevent volume jump, so the knob need to be turned down, and suddenly it "locks". I am using this for almost a year now and I like it.

So that is voLULOck, that protects you and your equipment, with deciding whether the knob should be in control after using the remote control.