May 2014: BenchBuddE DAC Troubleshooting

May 27, 2014

Got to spend all day working on the DAC circuit… it isn’t working on either board. Here’s what I know…

1. I am using classmate Eelco’s very simple, very clear DAC code from his build page. I have only modified it to have it step upwards over the span of delay(1000) instead of delay(100). I connected my scope up with channel 1 on CSN and channel 2 on MOSI so that I could verify that the timing was working as expected. (sorry for lack of focus)

DAC Troubleshooting

This is a transcript of the build log forum I maintained during the Contextual Electronics Session 1B class. I didn’t log the steps taken during the circuit design and layout portion, but since most of that was rip-up, re-drawing and time spent searching Digi-Key, you’re not missing much, I promise.

2. On the official class board, I see a rising voltage from 0ish to 100ish mV at DAC_OUT. The traces on the scope are really fuzzy so I’m guessing that is what noise is.

DAC Troubleshooting

3. On the custom board, I see this exact same signal at DAC_OUT.

HOWEVER… while both boards shows the rising signal entering the opamp on pin 5 as expected, the output on pin 7 is pranged straight to 10V. Constantly. Even when I disconnect the arduino and send no signal to the opamp, I’m 10V at OpAmp pin 7, and a full on 1.5A at FAN_OUT+/-.

Chris Gammell said…
Hey Dan,
I liked your stabilizers for the pots, I need to try that. You’re right, the twisting is bad.
As for the signal coming from your DAC, that definitely is noise! Of course, “noise” can mean a lot of things. Is your scope probe properly grounded? Does your power supply (5V) have a similar amount of noise?
As for the op amp, you also need to check pin 6, which is the negative feedback from the sense resistor. I’m betting that it does not match the voltage on Pin 5 like it should. Did you already install Q3 around the sense resistor (R16)? If so, is it on? In the event the voltage at pin 6 is low, the output (pin 7) will continue to try and rise to compensate for it, turning the pass transistor (Q4) on more and more. But this is just a guess. Let us know what the voltage is at pin 6.

The probe is grounded by clipping it to a jumper wire that is plugged into one of the GND sockets that would lead to the arduino, which are connected to star ground via 0Ω resistors.

Neither Q3 or Q2 are populated on either board.

Custom board, arduino disconnected…

  • DAC_OUT = ~0.04V
  • OPA Pin 5 = 0.00V (3KΩ resistor still in place)
  • OPA Pin 6 = 0.00V
  • OPA Pin 7 = 11.67V

Class board, arduino disconnected…

  • DAC_OUT = ~0.03V
  • OPA Pin 5 = 0.00V (3KΩ resistor still in place)
  • OPA Pin 6 = 0.00V
  • OPA Pin 7 = 12.00V

Chris Gammell said…
That’s kind of odd…why would the DAC_OUT and the OPA pin 5 be different voltages? That implies that there is current flow through the 3K resistor when there really shouldn’t.
Did you install Q2? Is it possible that it is shorting things out?
For the op amp, did you check the power rails? What do those look like? Also, could you post a picture of your top and bottom side?

Further troubleshooting…

Q2 is not populated yet.

My thinking was that if I remove the jumpers entirely from the FE bypass posts, that means the OPA is unpowered. When I turned to board on and measured at FAN_OUT, no current was flowing. Then I turned V+_ADJ all the way down to 1.68V and fed it into the DAC_OUT testpoint. Current began to flow at FAN_OUT. As I dialed V+_ADJ upwards, more current flowed until it maxed out at ~1.57A. The entire time, there was no voltage at OPA Pin 6.

Testing continuity (the IT guy in me keeps wanting to type that out as connectivity)…

From: DAC Pin 8
To: R15 (test as 3KΩ)

From: R15
To: TP10 / OPA Pin 5

From: OPA Pin 7
To: R62 (tested as 0Ω)

From: R62
To: Q4 Gate

From: Q4 Source
To: R63 (tested as 0Ω)

From: R63
To: OPA Pin 6

OPA Power Rails…

With no jumpers…
OPA Pin 4 = 0.00V
OPA Pin 11 = 0.00V

No Bypass…
OPA Pin 4 = 10.44V
OPA Pin 11 = -10.50V

With Bypass…
OPA Pin 4 = 12.00V
OPA Pin 11 = -11.51V

I’m going to go on a hunt for solder bridges and shorts, it seems weird that both boards would act up in exactly the same way, considering the layout is different between the official board and the custom board. For purposes of this troubleshooting though, I’ll stick with examining and testing the official board since that provides the whole class with value… and will probably fix the custom board simultaneously when it gets sorted out

Chris Gammell said…
Cool, thanks for posting those pictures. One final question here: Does the instrumentation amp circuit still work? I ask because that would be a good test as to whether the op amp itself might be suspect. Replacing the op amp is always a possible solution, though not an easy one, so we want to make sure we know we should replace it or not.

Good point… I’ll test after I grab something to eat. Troubleshooting makes me hangry 🙂

May 28, 2014

Man, this is so frustrating. I’ve tested the exact same scenario through about eight times, and each time it’s different. The only consistent thing is absolute inconsistency.

And now it seems that I’ve fried the entire V+ power regulation section… both LM317s are outputting -0.16v now. Pin 4 on the OPA was at 12.00V up at comment 10630, and now bupkus.

So, I basically don’t trust anything the official board is telling me. Give me a couple minutes here to yank the 317s out, replace them, and start over.

* * *

Ok, turns out it wasn’t the voltage regs, but the 22µH inductor, L3. Unfortunately, I removed both 317s and a 337 first (because I spaced out while I was clipping leads with the side cutters). Somehow the bag from Digikey with the inductors is empty, so I just bridged the pad with a 0Ω in Contextual Electronics style. Anyway, back to our original program…

Following along with the OpAmp Testing Video…

Setup: test leads running from headphone jack on iPhone with Signal Generator app outputting a 100Hz sine wave, volume adjusted to roughly 1V peak-to-peak. OpAmp in bypass and gain jumper removed. Scope ground connected to AGND test point when measuring OPA output.

Probe at TC_IN+/- with board power off…
(image from oscilloscope corrupted)

Signal disconnected, board powered on and testing voltage at OPA pins 4 and 11…
Pin 4 = 12.00V
Pin 11 = -11.51V (matches PSU output)
(image from oscilloscope corrupted)

Probe at CH0/TP3 – Gain Jumper Off:
(image from oscilloscope corrupted)

Signal reconnected – probe at TC_IN+/- with board powered on…
(image from oscilloscope corrupted)

Just confirmed, with the arduino disconnected and the board powered on…

OPA Pin 5: 0.00V
OPA Pin 6: 0.00V
OPA Pin 7: 12.00V

Also confirmed the instrumentation amp is functioning on the custom board too.

* * *

Wanted to test the MOSFETs and see if they were acting as expected. Since I don’t know what to expect, I’ll just post the results here and hopefully someone can tell me if this made sense…

Mosfet Test Circuit Schematic

Using the idea that, if I provided a signal at the gate of the MOSFET, starting at 0v and slowly increasing, I should see a corresponding drop in resistance between the drain and the source. I put this together on a breadboard and then soldered test leads into the pads on each board in turn.

Mosfet Test Circuit Physical

* * *

Replaced the opamp (who knew that heat gun I bought 15 years ago would finally have a use!) with a new one out of the tape, no change.

Another data point, the voltage out at OPA Pin 7 is FE_V+. OPA Pin 7 changes as I move the bypass jumper, from 12V to 10.5V.

Eelco said…
You’ve done quite a few measurements already, in fact so many that I’m a bit confused. Would you mind doing some more measurements? 😉
With the board powered, the Arduino connected, FAN_OUT+ and – shorted and the DAC outputting a (preferably constant) voltage of let’s say 100mV, could you check the voltage at the following locations:

  • the three pins of Q4
  • pins 5, 6, 7 of the opamp
  • both sides of R16

Hopefully that should give a clue as to where the problem is.
It would probably also be good to check the resistance of R16 (with the board powered off). Based on what you’ve written so far the only explanation I can come up with is that R16 is shorted, or maybe R63 is open circuit.

Chris Gammell said…
Eelco might be onto something. The inputs to the op amp look like they’re zero, but could be quite small. Yet another test would be to check if the 12V is actually being delivered to the top (drain) of the FET. In the PTC isn’t connected properly, no current will be able to to flow from 12V , through the pass transistor and then through R16.

Ok, so, I took some time this morning to really understand how to make the DAC dance. I went through this a little bit back when I first got my Uno and got an understanding of the analogWrite() function, but this is a little bit different in terms of ease of use. After working out a formula in Excel (because I have to see the numbers; can’t do any of this in my head), I figured out that I needed to send the binary value 0011 0000 1101 0000 to the DAC, to get out a 100mV signal as Eelco mentions above. I tried to do it fancy with highByte and lowByte and using unsigned integers, but as this is troubleshooting, I abandoned that in favor of the brute force approach and created…

Then ran…

With the 100ms delay between repeats, I can pull that entire command string up on my scope to verify, CH1 is SCLK and CH2 is MOSI. For me, it is indescribably cool to see code actually become electricity

DAC Troubleshooting

So, DAC programmed, here are the requested measurements. I really have no idea what the measurements mean. This is the first time I’ve directly shorted FAN_OUT+/- together with wire, previously, I had the DMM there to measure current.

Board Powered Off…

  • R16 = 1.0 Ω
  • R63 = 0.0 Ω
  • R15 = 2.94K Ω
  • Resistance: OPA Pin 7 to Q2 Gate = 0.0 Ω
  • Resistance: DAC Pin 8 to OPA Pin 5 = 2.94K Ω
  • Resistance: 12C at ATX to FAN_OUT+ = 0.6 Ω

Board Powered On, FAN_OUT+/- shorted together…

  • DAC Pin 8 = 105mV
  • OPA Pin 4 = 11.88V
  • OPA Pin 11 = -11.49V
  • OPA Pin 5 = 2.46V
  • OPA Pin 6 = 100mV
  • OPA Pin 7 = 11.88V
  • Q4 Gate = 11.88V
  • Q4 Drain = 102mV
  • Q4 Source = 101mV
  • R16 High Side = 101mV
  • R16 Low Side = 0V

Thomas said…
I don’t think this looks right:
DAC Pin 8 = 105mV
OPA Pin 5 = 2.46V

The voltage at pin 5 of the OpAmp should be about the same as the output voltage on pin 8 of the DAC. Double check the measurements at these points.
Also with the power off measure the resistance from the Pin 8 on the DAC to Pin 5 on the OpAmp just to make sure the resistance end-to-end is ~3K ohm.
If that checks out, inspect the board for solder bridges around the trace between R15 and Pin 5 of the OpAmp. For example, make sure pin 5 isn’t shorted to pin 4. Also check the bottom side of the board where Q2 is installed and make sure the Drain connection isn’t shorted to one of the adjacent via’s.

Chris Gammell said…
Tommy gives good advice. For troubleshooting purposes, you could also try removing Q2 until your DAC and op amp are working harmoniously together. That will remove it as a possible source of error.

I checked Q2 and the gate was shorted to the drain, which is odd because there are no vias in that area that would allow that to happen, so I suspect there must have been a filament of solder under the chip connecting the two where I couldn’t see it. Also, I had to take the heatgun to it to get it off, because doing the “hold the soldering iron to either side back and forth quickly” never loosened it up. I think I’ll find that new “Part Removal” video enlightening 🙂

I *think* it’s working now, especially since OPA Pin 5 matches DAC Pin 8, and OPA Pin 6 matches Pin 5, and Pin 7 isn’t at RAIL+ anymore. But I wanted to see what the change at each location would be with a change in the value of the DAC output, so that hopefully, seeing it all written out, it will make more sense to me. There’s no way that I can find to present a formatted table with this forum software, so I’ve taken a screen shot of excel instead.

DAC Output Table

I couldn’t complete the measurements up in the 0.506 output range, because TH5 kept popping.

Chris Gammell said…
Yep, that looks good! You want the op amp output high enough to turn the Q4 FET on, but not so high it SLAMS on, dumping all the current it has available from drain to source. That balance point of “sorta on” should be near the gate threshhold of the FET, which it appears to be.
The TH5 PTC popping surprises me. What about if you write a short program to ramp from 400 mV output on the DAC to 500 mV output on the DAC? It seems like it should be able to handle 500 mA through the PTC.
Another way to verify now is to remove the wire the connected FAN_OUT+ to FAN_OUT- and instead pipe that through the current input on the DMM. This should verify your readings.

Thomas said…
Looks much better now! I had the same problem with the PTC cutting out. If I drive more than 300mA for any length of time (a few minutes) it cuts out. I think heat from the MOSFET is transferring though the board to the PTC causing it to heat up more than it would normally which in turn is causing it to cut out.

Eelco said…
Strange, on my board TH5 only cuts out around 1.2A, which was actually rather unfortunate because my DMM has (well, had…) a 630mA fuse on the milliamp range.

Well, I replaced the OPA on the custom board, no change, but since they were both showing the same problem, I removed Q2 from the custom board and suddenly it’s working too. Knowing that this was probably going to be the issue, I thoroughly checked the little ^%$#@!! for any form of solder bridges or filled vias. It was totally clean and everything had expected continuity to the places they were supposed to go, but for some reason, it seems to have been the culprit both times.

I checked the part, and Q2 on both boards was a MOSFET N-CH 60V 310mA SOT23, MFG P/N DMN65D8L-7, based on the Digikey bag it came out of.

Here’s an updated table with the current measurement taken at FAN_OUT+/- …
DAC Output Table 2

As far as TH5 goes, I pulled out a thermocouple I had laying around from a previous DMM I destroyed, and plugged it into the Extech. Here’s what I saw…

FAN_OUT = 400mA MOSFET = 170°F ( 76°C) PTC = 145°F (62°C) (steady after 2 min).
FAN_OUT = 500mA MOSFET = 272°F (133°C) PTC = 190°F (87°C) (took 10 sec then popped).

I’m with Thomas on the heat transfer. Kind of a Yosarian Circuit: it powers a fan, which is good, because it needs the fan to cool it off 🙂

* * *

Just thought of something… for those of you with Q2 soldered down… 1) have you soldered the zero ohm resistor in place to enable FAN_PWM on the arduino and 2) have you pulled that pin low in your code explicitly?

My answer to those questions is 1) yes and 2) no. Which I suspect means that Q2 is, in fact perfectly fine… and I was dumping all my DAC signal straight to ground because the pin was probably floating. In fact, this is so annoying me right now, that I’m going to delay going out for a beer to check…

(checking occurs)…

Yep! That little SOB is sitting there pumping out 5V.

(soldering occurs)…

So, I just soldered down Q2 again, and modified my code to include the following…

In setup…

And in the main program loop: analogWrite(pin_dac_pwm, 0);

Guess what’s working like a charm now 😐

* * *

Final note on the whole DAC issue… Q2 on the custom board was fine, when I soldered it down, the board worked flawlessly. Q2 for the official board, though, was totally fried – the Gate and Drain were shorted together when I tested it off the board. I just soldered a new one on and now the official board is all caught up. Good thing too because it was my last one 🙂

On to programming the PWM…