Archive

Archive for February, 2012

Poor Man’s Jitter Measurement

2012/02/26 7 comments

INTRODUCTION

It is well known that by setting the DPLL bandwidth in the Sabre32 DAC to its lowest level, results in the DAC being “overly” susceptible to incoming jitter. This is manifested by the DAC loosing lock on the signal. We can use this “property” of the DAC to determine a relative value of incoming jitter.

METHOD

In order to measure the number of unlocks, I connected the outputs of the lock LED in the Buffalo II DAC to an Arduino. The Arduino detects the unlocks and logs that event with a time stamp.

The lock LED is replaced by a resistor (I used 5 Kohm) the then the two leads across the resistor are connected to Pin2 and GND in Arduino. The lock signal is a voltage applied to an LED. An unlock pulls that voltage to ground. This can be detected by generating an interrupt in Arduino.

I put tape on the pins that I did not use because I didn’t want to mistakenly connect a wrong pin (say a 5V pin) to the DAC and risk potential damage.

The data is logged to the Arduino serial monitor, which can be copied to a spreadsheet to generate graphs.

RESULTS

Below is the result of my first measurement. The Buffalo II DAC DPLL bandwidth is set at “lowest” and is connected to a Musiland 03US through its I2S input.

Each data point represents the number of unlocks in a 10 minute period. Notice that in the first 10 minutes after I turned on the DAC, there are many more unlocks due to the fact that the DAC goes through a “warm-up” period to stabilize its clock (this is a well observed behavior). The data also shows that it takes about 10 minutes for the DAC to stabilize.

CODE

/*
Code to detect unlocks in BII DAC.
 The lock LED is replaced by a resistor the then the two leads
 across the resistor are connected to Pin2 and GND in Arduino
 By detecting the unlocks and recording it we can measure how
 many unlocks occurr during a specific amount of time.
 
 The lock signal is a voltage applied to an LED. An unlock pulls
 that voltage to ground. This can be detected by generating an
 interrupt in Arduino.
 */

#define INTERVAL 10             // Arbitrary time interval in minutes

static boolean unlock=false;    // Flag
int total=0;                    // Total unlocks
int totalInterval=0;            // Total unlocks every time interval

unsigned long minutes=0;        // Minute count 0 to 59
unsigned long totalMinutes=0;   // Total minute count 0 to ...
unsigned long hours=0;          // Hours count 0 to ...
unsigned long lastInterval=0;   // Time in minutes of last interval

void gotUnlock()                // Interrupt handler
{
  unlock=true;                  // Interrupt indicates got an unlock
}

void printTime(){               // Prints hours:minutes as xx:xx
  if(hours<10)
    Serial.print("0");
  Serial.print(hours);
  Serial.print(":");
  if(minutes<10)
    Serial.print("0");
  Serial.println(minutes);
}

void keepTime(){                // Keeps track of elapsed time
  if(millis()>((60000)+(60000*minutes)+(3600000*hours))){
    minutes++;
    totalMinutes++;
    if(minutes==60){            // For every 60 minutes...
      minutes=0;                // Reset the minutes and...
      hours++;                  // Increase the hours
    }
  }
}

void printData(){
  Serial.print(totalInterval);
  Serial.print(" ");
  Serial.print(total);
  Serial.print(" ");
  printTime();
}

void setup() {
  Serial.begin(9600);
  pinMode(2, INPUT);            // Set pin 2 for input
  digitalWrite(2, HIGH);        // Turn-on pull-up resistor
  attachInterrupt(0, gotUnlock, FALLING);
  Serial.println("start test");
  Serial.println("IntervalTotal Total Time");
  unlock=false;
}

void loop(){
  keepTime();
  if(unlock==true){
    delay(20);                  // Some delay for "debouncing"
    total++;                    // Update total unlocks
    totalInterval++;            // Update total for interval
    Serial.print(". ");
    printData();
    unlock=false;
  }
  if((lastInterval+INTERVAL)==totalMinutes){
    lastInterval=totalMinutes;
    Serial.print("# ");
    printData();
    totalInterval=0;            // Reset the interval count
  }

}

Musiland 03 – IL715 -Buffalo III

2012/02/21 Leave a comment

A reader sent me this photo of  his implementation of the IL715 (inspired by “project 1” in this post)

It works well with Buffalo-III and Musiland Monitor 03 – it solved my problem with hissing noise that was injected through GND. Sound is much better now – absolutely quiet background.

Musiland Mac Driver Beta Finally Out

2012/02/14 15 comments

Update 2/15/12: Discussion boards indicate that everyone is having the “license invalid” problem. Customer service “promised” a new version soon.

Check out the beta folder: http://www.musiland.com.cn/downloads/drivers/beta/

The file name is MlCyMon.pkg with date 2/13/12. It is compatible with all the Musiland USB Devices.

Installation Instructions [link]

  • Make sure you update the firmware by first using it with the latest Windows driver in a Windows PC
  • If you previously installed the (non-working) Mac driver, you must delete that software first. Look at system/library/extensions/MlCy* files (there are two files) and the Musiland application in the applications folder (one file). The new driver installer does not seem to overwrite the extensions.
  • Install the driver without connecting the USB device. The installer will then ask you to restart.
  • Connect the USB device. There is no more “installation”. (After a little while the new USB device will show up in the Sound control panel as an output device)
  • Restart the computer. (Probably not necessary)
  • Select the output device in the sound control panel
  • Start the Musiland application which is in the applications folder (it will show up as in icon in the menu bar. Click on it to see the pull down menu and then click “show”)

I am getting a “license invalid” message and therefore no sound. Maybe some of you will have better luck. I am using MacOS Lion and a Musiland 03. Share your experiences in the comments…

Arduino Leonardo (early) Resources

2012/02/11 12 comments

Update 4/5/12: More Interrupt resources. See interrupt section.

The Arduino Leonardo is not yet available for sale, but it seems it will become the most popular board as there are many other 32U4-based implementation appearing and/or claiming compatibility with the Arduino IDE.

I don’t think the Arduino team popularized this microprocessor, but their implementation in the Leonardo board is making everyone coalesce around the Arduino IDE.

You can read an earlier post on the differences and advantages with the “standard” Arduino board

Arduino IDE support for the Leonardo board is still under development. But here are some resources and compatible boards that you can use in the meantime:

The latest Arduino software: [link]

Burning the Leonardo bootloader with another Arduino board[link]

The process has been a bit complicated because of several “bugs”, but this seems the latest:

1- Download both the latest Arduino 1.0 software  [link]. Only Arduino 1.0 has built in s/w to burn bootloaders with an Arduino board.

2- In Arduino-1.0/Hardware/Arduino/boards.txt, uncomment the Leonardo lines (remove the “#”). This allows the Leonardo option to show up in the “Boards” menu. If you already see “Arduino Leonardo”, then you don’t have to do this step

3- Get the latest version of Arduino ISP: [link]. An earlier version required that you compile with Arduino 022, but this version compiles with Arduino 1.0. Copy the sketch and paste it into a blank sketch. Then compile and upload to the Arduino you are using as the programmer. Now you have the programmer ready to burn the bootloader into a destination board.

4- Make the connections [link] (bottom board is the programmer)

You can also use the ICSP header, which has the following pin assignments:

 

Note that the ICSP header perfectly matches the wiring for the destination board (because it assumes you will use an ISP programmer to program the chip). For the source board, the Reset pin is not used. Instead you must use Pin10 as shown in the connection diagram

Arduino®-Leonardo HID Keyboard & Mouse Tutorial and Advanced Examples [link]

This tutorial covers the Arduino “Leonardo” platform which uses the new USB-enabled ATmega 32U4 MCU, with a very powerful bootloader environment that emulates both a USB mouse and keyboard (standard HID devices, no drivers needed), as well as a virtual COM port!

Arduino®-Leonardo Interrupts

As of Arduino 1.0, interrupts are not supported on the Arduino Leonardo…Long story short, I ended up copying the macros for interrupt bitmasks/registers from the Teensyduino project, which has a mega32u4 target board. [link]

I used the vinciDuino in the Arduino IDE 1.0, the original Leonardo isn’t in stock, the IDE didn’t support the Board completly (it’s not nessesary at this piont). I have integrated the PCINT and Interrupt (attachinterrupt, detachinterrupt) functionality in the files from the IDE.  fm did me a great favor and look with me at the result, so here are the edited files. (need account to the forums to see the files) [link]

Serial communications with 32U4/Arduino

The 32U4 has two serial ports. One that communicates with the computer through USB to the serial monitor (the serial monitor in the Arduino software) and one that communicates through hardware pins in the board. Code example:

/* Pro Micro Test Code
   by: Nathan Seidle
   modified by: Jim Lindblom
   SparkFun Electronics
   date: January 20, 2012
   license: Public Domain - please use this code however you'd like.
   It's provided as a learning tool.
   
   This code is provided to show how to control the SparkFun
   ProMicro's TX and RX LEDs within a sketch. It also serves
   to explain the difference between Serial.print() and
   Serial1.print().
*/
int RXLED = 17;  // The RX LED has a defined Arduino pin
// The TX LED was not so lucky, we'll need to use pre-defined
// macros (TXLED1, TXLED0) to control that.

void setup()
{
 pinMode(RXLED, OUTPUT);  // Set RX LED as an output
 // TX LED is set as an output behind the scenes

 Serial.begin(9600); //This pipes to the serial monitor
 Serial1.begin(9600); //This is the UART, pipes to sensors attached to board
}

void loop()
{
 Serial.println("Hello world");  // Print "Hello World" to the Serial Monitor
 Serial1.println("Hello!");  // Print "Hello!" over hardware UART

 digitalWrite(RXLED, HIGH);   // set the LED on
 TXLED1; //TX LED is not tied to a normally controlled pin
 delay(1000);              // wait for a second
 digitalWrite(RXLED, LOW);    // set the LED off
 TXLED0;
 delay(1000);              // wait for a second
}

Leonardo clones/ATmega32U4-based boards

These boards are compatible with Arduino 1.0 software. Basic compatibility with Arduino s/w requires that the Arduino bootloader be loaded into the microprocessor.  Because Arduino s/w is still under development, expect re-loading the bootloader in the future. Some boards come with the more generic AVR bootloader.

Teensy 2.0 [link]. The Grandfather of 32U4 boards.

  • Not an Arduino clone
  • But compatible with Arduino s/w after installing the necessary files
  • The Arduino Leonarno board is not yet available and the s/w is still under development. Right now, theTeensy board and the associated software “Teensyduino” is the more mature environment for USB HID development.

Vinciduino [link] -Arduino Leonardo bootloader preinstalled

  • Same form factor and pin arrangement as Arduino Pro
  • Unlike Leonardo, the board has the second UART conveniently broken out from the board
  • Discussions here: [link]

Olimex T32u4 board [link]: T-shaped Leonardo derivative

  • Designed for proto-board integration

Adafruit Atmega32u4 Breakout Board [link] and [link] -ARV109 bootloader preinstalled

Paperduino Leonardo [link] -100% Do it Yourself

Leostick [link] -Arduino Leonardo bootloader preinstalled

SparkFun Arduino Pro Micro [link] -Arduino Leonardo bootloader preinstalled

Strawberry Linux [link] and [link] -Arduino Leonardo bootloader preinstalled

MattairTech [link] CDC (Arduino/AVRDUDE) or DFU (FLIP) bootloader preinstalled

zoneCoffee [link]

  • ZonCoffee is an Arduino sketch (and board) created for the purpose of espresso machine temperature regulation. The sketch reads the temperature with a thermocouple, and uses the temperature to control the boiler temperature with a PID loop.

CalEng BreadBoarder-32U4 Arduino®-Leonardo Compatible Breakout-Prototyping Board [link]

  • A key feature of the BreadBoarder is how the pinout of the headers matches* the standard Arduino board pinout, making it much more intuitive to work with compared to other breadboard solutions.

MK90 Freeduino 32U4 [link]

C.I.R.E., 100% DIY [link]

Micropnedous2 [link]

  • Features a microSD connector in SPI Mode (in the back side).

? [link]

Leonard Pirate [link]

And here is the Arduino Leonardo for reference

Hifiduino with AckoDAC

2012/02/09 3 comments

Saw this cool project at diyaudio:[link]. Recognized the UI :-) Good to see the code being used in other ES9018-based DACs

Arduino UNO I2C connection through a 5V to 3.3V level converter (upper right corner); connection to AckoDAC I2C header (lower left corner)

Musiland CD11T

2012/02/07 1 comment

ore information here: [link]

New liquidCrystal Arduino Library

2012/02/05 10 comments

A new, 100% compatible with the current liquiCrystal Arduino library is available from: https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home.

With the same interface, the new library supports:

  • 4 bit parallel LCD interface
  • 8 bit parallel LCD interface
  • I2C IO bus expansion board with the PCF8574* I2C IO expander ASIC.
  • ShiftRegister adaptor board as described Shift Register project home.

HIGHER PERFORMANCE

In addition, it is faster than the existing liquidCrystal included in Arduino. In 4-bit mode (which is sort the “standard” mode), the new library performs operations an average of 3.73 times for a write operation. There is really no need for the current Hifiduino code to have faster LCD operations, but the performance increase is “free”.

SUPPORTS SERIAL INTERFACE

Further (and without any change in the code), you can purchase/build an I2C adapter for the LCD and free up 9 pins in the Arduino to do other things. The I2C adapter is explained here: [link]

In Summary,

The nice thing about the library (if we set a side its speed improvements) is that its been written as a virtual class that can be extended to accommodate multiple ways to drive an LCD with the Hitachi chipset or compatible. The only thing that you need to do to include a fully compatible new driver (for example an SPI buffer) is to implement how to write to the buffer and the function to initialise the LCD using that device. All the support functions in the LiquidCrystal library are there and compatible.

The other nice thing, is that if you already have a project that uses a particular LCD driver (say 4 bits) and you now want to change it to I2C the only thing that would change in your code would be the way you create the “variable” to control the LCD. The rest is the same.

This is a bit different approach with respect to the huge collection of libraries that control LCDs and do more or less the same thing.

So with one library, you can control LCDs that use different devices or ways to control them, for example: 4bit, 8bit, I2C, shiftregister (2 and 3 wires) and shortly with just 1 wire.

TESTED WITH HIFIDUINO CODE

After downloading the libraries (LiquidCrystal_V1.1.6.zip), I replaced the folder arduino-1.0\libraries\LiquidCrystal with the new LiquidCryistal folder (save the original folder somewhere else). Compiling the existing code resulted in no errors. It also runs as before.

There is no apparent differences in the way the text is displayed. Even thought the write operation to the LCD is faster, the refresh rate of the LCD is the limiting factor, so the display “feels” exactly the same. The only difference is in the “DIM” function: returning from DIM to the current volume setting is about 20% faster. For example if your volume is set at 00 and you DIM the volume (-70 db), it takes 4 seconds to return to 00 volume whereas the code with the original library took 5 seconds.

CONTRIBUTION FROM SPAIN’S ARDUINO ENTHUSIASTS

This library is a contribution by Francisco Malpartida, an Arduino enthusiast from Spain and also one of the developer of “vinciduino” [discussion], an open hardware clone of the Arduino Leonardo.

(The vinciDuino Logo was done by Inizul from the Spanish Arduino forum the creator of the paperDuino. The idea behind the logo was to simulate Leonardo Da Vinci’s habit of writing. In addition, it reads the same rotated 180 degress)

Be sure to check the project’s home page to see what is new…

Follow

Get every new post delivered to your Inbox.

Join 119 other followers