Contents[Hide]

AD5662

If you need a high resolution DAC for the Arduino, the AD5662 is good choice:

  • 16 bit resolution
  • Low price $4
  • No extra components required
  • 5V operation
  • Simple 3 pin interface

MSOP package

The disadvantage is that the AD5662 can't be used on a perfboard because it is not available in a dual in-line package. The only available package is 8 pin SOT-23 or MSOP with a pin pitch of 0.65 mm.

AD5662 MSOP package
AD5662 MSOP package

You can use a MSOP adapter to mount the AD5662, but even than, soldering is not so easy. Because I was afraid to ruin a chip, I had already ordered two pieces. And indeed, the first chip was destroyed while messing around with soldering. Note that the allowed soldering temperature is just 260ºC. And it doesn't hurt to use an anti static wrist strap.

Soldering fine-pitch SMD components

Pitch 0.8mm or larger

For SMD components, with a pitch of 0.8mm or larger, use drag soldering: http://www.hakko.com/english/tip_selection/type_bc_c.html

But soldering in the traditional way is possible too. We just need a fine soldering iron tip, a steady hand, a fine tweezers, and good eyes. We can even solder wires to the pins:

FOTO NOG PLAATSEN

Pitch 0.65mm or smaller

The problem with fine pitch, 0.65mm or smaller, is not the lack of the necessary watchmaker skills, but the problem that tin will be sucked immediately in between the pins, due to the capillary effect. Drag soldering doesn't work here, use the flood and wick method. Simply solder all pins together and suck the excess tin away with desoldering wick: http://store.curiousinventor.com/guides/Surface_Mount_Soldering/QFP/

MSOP adapter

On eBay you find plenty of adapter boards.

MSOP adapter from eBay
MSOP adapter from eBay

16 bit Arduino DAC example program

The example program creates a sawtooth.

#if ARDUINO >= 100 
  #include "Arduino.h"
#else
  #include "WProgram.h"
#endif
 
#include "DAC16.h"
 
const byte SYNCpin = 2;
const byte SCLKpin = 3; 
const byte DINpin = 4;
 
DAC16 dac16(SYNCpin, SCLKpin, DINpin);
 
void setup(void) 
}
 
void loop(void) 
{ for(unsigned i=0; i<65536; i+=1024) dac16.write(i); // create a sawtooth 
}

Library

/* 
AD5662 16 bit DAC for the Arduino
 
Copyright (C) 2012  Albert van Dalen http://www.avdweb.nl
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License
as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License at http://www.gnu.org/licenses .
Version 21-6-2013
*/
 
#if ARDUINO >= 100 
  #include "Arduino.h"
#else
  #include "WProgram.h"
#endif
#include "DAC16.h"
 
DAC16::DAC16(byte SYNCpin, byte SCLKpin, byte DINpin):
SYNCpin(SYNCpin), SCLKpin(SCLKpin), DINpin(DINpin)
{ pinMode(SYNCpin, OUTPUT);
  pinMode(SCLKpin, OUTPUT);
  pinMode(DINpin, OUTPUT);
  digitalWrite(SCLKpin, HIGH);
}
 
void DAC16::write(unsigned dacValue)
{ digitalWrite(SYNCpin, HIGH);
  digitalWrite(SYNCpin, LOW);
  
  for(int i=23; i>=0; i--)
  { digitalWrite(DINpin, (dacValue >> i) & 1);
    digitalWrite(SCLKpin, LOW);
    digitalWrite(SCLKpin, HIGH);
  } 
}

 

#ifndef DAC16_H
#define DAC16_H
 
class DAC16
public:
  DAC16(byte SYNCpin, byte SCLKpin, byte DINpin);
  void write(unsigned dacValue); 
  
private:
  byte SYNCpin, SCLKpin, DINpin;
};
 
#endif

Do you have any comments? Please let me know.
Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.