BUS PIRATE: three inexpensive SPI Digital to Analog Converters

Source: Microchip MCP4902 datasheet

As much as possible, we’d like to move control of all the Bus Pirate peripheral hardware to the FPGA. Then everything can be controlled through the state machine command pipeline. In Ultra v1c we moved analog voltage measurement to the FPGA by adding an SPI ADC. In a future revision it would make sense to move a few other things to the FPGA:

  • Pull-up resistor control
  • Programmable output power supply enable
  • Programmable output power supply margining (using a DAC)
  • v1d stuff not yet announced

For debugging and self-testing we need to keep some redundant connections to the MCU as well, but primary control should be through the FPGA.

We had a look at a few chips that could replace the Digital to Analog Converter in the MCU, here’s a few inexpensive options we considered:

MCP4902 8bit dual DAC TSSOP14

Source: Microchip MCP4902 datasheet

MCP4902 seems to be a classic Microchip part, available at Mouser for $0.99 in 100s. However, the smallest package size is TSSOP14 and a quick check of SZLCSC shows they only have the SOIC version with 17 pieces in stock. That’s not a great sign.

X
Source: Microchip MCP4902 datasheet

Each update of a DAC channel uses a 16bit command, maximum speed is 20MHz.

MCP48FVB02 8bit dual DAC MSOP10

Source: Microchip MCP48FVB02 datasheet

MCP48FVB02 appears to be a part Microchip acquired when they bought Micrel. It comes in an MSOP10 package which is an improvement over the MCP4902. It’s a bit cheaper at $0.90 for 100pcs at Mouser. It’s not stocked at SZLCSZ, which is a huge warning sign. Microchip Direct is really good about delivering parts in China if need be, but they can only deliver 1200 today and new stock won’t be available until February (three and a half months away).

Source: Microchip MCP48FVB02 datasheet

MCP48FVB02 uses a 24bit command to update each DAC, which is a full byte longer than the MCP4092. Both the MCP4092 and MCP48FVB02 operate at maximum write speeds of 20MHz, so the MCP48FVB02 will have a significantly slower maximum update rate.

DAC082S085CIMM/DAC084S085CIMM 8bit dual/quad DAC MSOP10

Source: DAC082S085 datasheet

Here’s where it gets a bit interesting. DAC082S085CIMM is a dual 8 bit DAC from Texas Instruments, available for $1.24 in 100s at Mouser. SZLCSC only has 8 in stock for around $2 in 100s (13.20RMB). Low stock is bad news, and a higher RMB price than USD price that points to a limited stock or specialty chip to avoid (i.e. not something with high demand in China).

However, the DAC084S085CIMM is similar but has 4 DACs. We could use the extra DACs to add more programmable output power supplies, or add a simple analog signal generator on a few of the IO pins. It’s available at Mouser for $1.58 in 100s, and at SZLCSC for $1.15 (8.68RMB) with 1700 available and 1300 shipped in the last month. That’s several good signs: it’s cheaper than the 2 DAC version ($2 vs $1.15), RMB price is cheaper than USD price, and there is a fair amount of stock and turnover at SZLCSC which means it’s probably being used in production somewhere. This seems like a good candidate.

Just to further verify, there are 50K in stock at the TI store, and 20K in stock at Digikey for a slightly higher price.

Source: DAC082S085 datasheet

Commands are 16bits, but where it really shines is the 40MHz maximum update speed. Twice as many DACs, and twice twice as fast as the Microchip DACs.

This is by no accounts an exhaustive list, but after looking at stock on Mouser, Digikey, and SZLCSC these were the best options close to $1. Did we miss your favorite DAC?

Building a bluetooth DAC with Raspberry Pi Zero W

bt-dac-final

Sami Pietikainen has written an article detailing the build of his Bluetooth DAC using Raspberry Pi Zero W:

My car comes with a built-in Bluetooth hands-free but unfortunately it does not support audio streaming. Luckily there is an AUX input available which uses a regular 3,5 mm jack. Perfect opportunity for a DIY project. I built the Bluetooth DAC using Raspberry Pi Zero W and a DAC hat. This post depicts the details of this project.

See the full post on Page Fault Blog.

App note: 3V DACs used in ±10V applications

an_maxim_AN2398

Boosting DAC’s output to drive larger voltage tackled in this app note from MAXIM Integrated. Link here (PDF)

Many modern systems have the majority of their electronics powered by 3.3V or lower, but must drive external loads with ±10V, a range that is still very common in industrial applications. There are digital to analog converters (DACs) available that can drive loads with ±10V swings, but there are reasons to use a 3.3V DAC and amplify the output voltage up to ±10V.

Simulating 3-phase AC for energy monitor testing

IMG_20170519_223255-600

Tisham Dhar blogged about his 3-phase synthesizer:

Finding 3-phase is difficult, convincing the owner of the said supply to test some home made hardware is even more so. After building a 3-phase energy monitor my testing options for it appeared very limited. So I set about making my own low-cost 3-phase energy monitor calibration system.

See the full post on his blog.

Check out the video after the break.

App note: DAC ICs: How many bits is enough?

an_ad_AN-327

A very old application notes from Analog Devices that tells about Nyquist Theorem, sampling rate and quantization used on DACs. Link here (PDF)

At the heart of every digital audio playback system lies the single-most critical component for high-fidelity audio: the digital-to-analog converter (DAC). These converters handle the delicate task of translating the 16-bit binary words encoded on the disc or tape into corresponding analog signals worthy of amplification and, ultimately, of the human ear.

MIDI DAC for Vintage Synth Hacks

A lot of classic synthesizers rely on analog control voltages to vary parameters; this is a problem for the modern musician who may want to integrate such hardware with a MIDI setup. For just this problem, [little-scale] has built a MIDI-controllable DAC for generating control voltages.

It’s a simple enough build – a Teensy 2 is used to speak USB MIDI to a laptop. This allows the DAC to be used with just about any modern MIDI capable software. The Teensy then controls a Microchip MCP4922 over SPI to generate the requisite control voltages. [little-scale]’s video covers the basic assembly of the hardware on a breadboard, and goes on to demonstrate its use with a performance using the MIDI DAC to control a Moog Mother 32 synth. [little-scale] has also made the code available, making it easy to spin up your own.

We can see this project being indispensable to electronic musicians working with banks of modular synths, making it much easier to tie them in with automation in their DAW of choice. This isn’t the first MIDI interfacing hack we’ve seen either – check out this setup to interface an iPad to guitar pedals.


Filed under: musical hacks

An Eye-Catching Raspberry Pi Smart Speaker

[curcuz]’s BoomBeastic mini is a Raspberry Pi based smart connected speaker. But don’t dis it as just another media center kind of project. His blog post is more of a How-To guide on setting up container software, enabling OTA updates and such, and can be a good learning project for some. Besides, the design is quite elegant and nice.

boombeastic_02The hardware is simple. There’s the Raspberry-Pi — he’s got instructions on making it work with the Pi2, Pi2+, Pi3 or the Pi0. Since the Pi’s have limited audio capabilities, he’s using a DAC, the Adafruit I2S 3W Class D Amplifier Breakout for the MAX98357A, to drive the Speaker. The I2S used by that part is Inter-IC Sound — a 3 wire peer to peer audio bus — and not to be confused with I2C. For some basic visual feedback, he’s added an 8×8 LED matrix with I2C interface. A Speaker rounds out the BoM. The enclosure is inspired by the Pimoroni PiBow which is a stack of laser cut MDF sheets. The case design went through four iterations, but the final result looks very polished.

On the software side, the project uses Mopidy — a Python application that runs in a terminal or in the background on devices that have network connectivity and audio output. Out of the box, it is an MPD and HTTP server. Additional front-ends for controlling Mopidy can be installed from extensions, enabling Spotify, Soundcloud and Google Music support, for example. To allow over-the-air programming, [curcuz] is using resin.io which helps streamline management of devices that are hard to reach physically. The whole thing is containerized using Docker. Additional instructions on setting up all of the software and libraries are posted on his blog post, and the code is hosted on GitHub.

There’s a couple of “To-Do’s” on his list which would make this even more interesting. Synced audio being one: in a multi-device environment, have the possibility to sync them and reproduce the same audio. The other would be to add an Emoji and Equalizer display mode for the LED matrix. Let [curcuz] know if you have any suggestions.


Filed under: digital audio hacks, Raspberry Pi

Hybrid Raspberry Pi + PIC32 = Oscilliscope and Function Generator

The PicBerry is a student final project by [Advitya], [Jeff], and [Danna] that takes a hybrid approach to creating a portable (and affordable) combination digital oscilloscope and function generator. It’s based on the Raspberry Pi, features an intuitive Python GUI, and can generate and measure simultaneously.

But wait! The Raspberry Pi is a capable little Linux machine, but meeting real-time deadlines isn’t its strong suit. That’s where the hybrid approach comes in. The Pi takes care of the user interface and other goodies, and a PIC32 over SPI is used for 1 MHz sampling and running a DAC at 500 kHz. The idea of combining them into PicBerry is to get the best of both worlds, with the Pi and PIC32 each doing what they are best at. The readings are sent in batches from the PIC32 to the Pi, where the plot is updated every 30 ms so that user does not perceive any visible lag.

The project documentation notes that improvements can be made, the speeds are a far cry from regular bench equipment, and the software lacks some typical features such as triggering, but overall not bad at all for under $50 of parts. In fact, there are hardly any components at all beyond the Raspberry Pi, the PIC32, and a MCP4822 digital-to-analog converter. A short demo video is embedded below.

Thanks to [Bruce Land] — who in the past created a zero CPU cycle function generator — for giving us a heads up!


Filed under: Raspberry Pi, tool hacks

App note: WM8731 Suggested power-On/Off sequence

an_cirrus_logic_WAN0111

Interesting app note from Cirrus Logic on how to minimize popping sound on the output when turning on/off the DAC on their WM8731 digital to analog converter. Link here (PDF)

As with any consumer audio product, it is important that any on/off power noise be kept to a minimum. Generally, this is done with some sort of external mute circuit at the output socket of the application. Although effective, this does increase the BOM (bill of materials) cost, which in many cases is a critical factor.

With this in mind, the WM8731 DAC signal path may be powered-on in such a way that power on/off noise is kept to a minimum with no need for an external muting circuit, reducing the BOM cost.

Output voltage control of DC/DC converters

ipp

Thomas Fischl writes:

Some applications needs to control the output voltage of a dc/dc converter instead using a fixed output voltage. For example battery chargers has to adjust the output voltage to the current battery level. This page shows how to add such a control function to a buck converter circuit.

Control output via external voltage source
Typically a voltage divider is used in dc converters to adjust the output voltage to the needed feedback voltage. To control the feedback signal by an external voltage source, a third resistor is added to the circuit.

More info at Fischl’s site.