Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

did I toast my ina260?
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

did I toast my ina260?

by wylbur on Tue Jan 28, 2020 1:02 am

hi Adafruit,

So I've got my little power testing box built and I'm checking it against other voltmeters using first the LM4040 breakout. Great, the ina260 agrees with my clunky Ambprobe 37XR-A and my 30+ year old Fluke 45 to within about a tenth of a mV. Yay!

So I started checking voltages from other sources, including my ATX benchtop power supply. 3.3v, 5v, 12v all ok. Then I tried the -12v, and the ina260 stopped working. No magic smoke, just dead. Ok, dumb, of course the tiny little board doesn't have any polarity protection.

I have another ina260, and when I connected it to the Teensy, it didn't work either. By "didn't work," I mean it failed the `ina260.begin()` test in setup().

So now I'm wondering: did I blow the I2c on the Teensy? Then I checked both ina260 boards on a different Teensy. The one that I put -12v to was not recognized, but the other one was, so the first one is fried and the second one is ok. I tried again with the working ina260 and the original Teensy, and the `ina260.begin()` test failed again.

Other stuff on the Teensy works -- it accepts the upload, runs blink, logs to the SD card and writes to the st7735 tft. But the ina260 isn't recognized.

Is my theory that maybe I damaged the Teensy's I2c reasonable? What would be a good test of the I2c? Is there a way other than attaching some other I2c peripheral? Should I connect an oscilloscope?

thanks for advice -- wylbur.

wylbur
 
Posts: 143
Joined: Thu May 17, 2012 2:40 pm

Re: did I toast my ina260?

by wylbur on Tue Jan 28, 2020 10:53 pm

I haven't solved it, but at least I know that the Teensy *tries* to speak I2c. I put a oscope on SCL and SDA , and as the Teensy boots, I see a series of SCL clock pulses at about 11kHz. After that, SCL stays high and SDA stays low.

DS1Z_QuickPrint3.png
DS1Z_QuickPrint3.png (47.42 KiB) Viewed 217 times


I put the ina260.begin in a loop :

Code: Select all | TOGGLE FULL SIZE
while (1) {
    if (ina260.begin()) {
        Serial.println("found ina260!");
        break;
    }
    delay(500);
  }


And every half second, I see the same pattern of clock pulses. So the Teensy seems to be trying to talk to the ina260.

However, maybe the I2c conversation isn't right? I uploaded the same code to a known-good Teensy and put the scope on SDA and SCL, and got the second image, below.

DS1Z_QuickPrint4.png
DS1Z_QuickPrint4.png (43.69 KiB) Viewed 217 times


I notice that the SCL pulses are the same, but SDA goes high occasionally. In the (maybe damaged?) Teensy, SDA never goes high. Could this be evidence that putting -12v into the ina260 blew out the I2c channel?

thx for thoughts -- wylbur.

wylbur
 
Posts: 143
Joined: Thu May 17, 2012 2:40 pm

Re: did I toast my ina260?

by adafruit_support_mike on Wed Jan 29, 2020 4:38 am

It does look like the connection damaged some part of the Teensy's SDA line.

For the sake of testing, try connecting an external 1k pull-up resistor to SDA though. There's always a chance that the only thing damaged was the pin's internal pull-up.

If SDA stays low even with an external pull-up, it means something has shorted and that board won't be speaking I2C any more.

adafruit_support_mike
 
Posts: 61443
Joined: Thu Feb 11, 2010 2:51 pm

Re: did I toast my ina260?

by wylbur on Wed Jan 29, 2020 1:42 pm

hi Mike,

alas, I already tried with pullups on SDA and SCL, 4.7K as recommended by the Teensy docs, and no change. I think you're right, I shorted the SDA channel somewhere inside the Teensy. Oh well, I have other projects that don't use I2c that the damaged Teensy will be good for.

As I rebuild my power monitor+logger, I'll put a PNP mosfet in front of the ina260 to protect against negative voltages. I'd like to figure out how to get an LED or something connected to the mosfet as a DANGER DANGER reverse voltage indicator. Any pointers?

BTW, the ina260 product page and learning pages say "measure up to +36V," but they don't mention that negative voltages will toast the board (and as we've learned, the attached microprocessor). The product page says the board can "do the work of two multimeters," but of course only for positive voltages. I wonder if you'd be willing to add a note on those pages for EE n00bs that this board is not for measuring negative voltages? thx!

-- wylbur

wylbur
 
Posts: 143
Joined: Thu May 17, 2012 2:40 pm

Re: did I toast my ina260?

by adafruit_support_mike on Thu Jan 30, 2020 5:51 am

I'm not so sure about using a mosfet for polarity protection in this case.

A normal series protection mosfet.. where the current to be measured has to flow through the mosfet to reach the sensor.. usually needs a couple volts of gate-source voltage to turn on fully. For voltages lower than that, current would flow through the mosfet's body diode, which would add nonlinear offsets to your measurements.

The same gate-source voltage would be a problem for a shunt mosfet: one that basically shorts the positive and negative leads together to keep harmful voltages from reaching the sensor. It would take a couple volts to make the mosfet turn on, and by then the sensor would probably already be damaged.

The standard input protection is a reverse-biased Schottky diode between the input and GND. It's a simpler, low-voltage shunt circuit: if the input goes more than about 500mV below GND, the diode becomes forward biased and starts to conduct.

Trying to fit an LED into the signal path raises similar problems, but you could make a separately powered circuit that can detect negative voltage on the input pin: connect the base of an NPN transistor to GND and connect the emitter to the input, then connect an LED to the collector. For input voltages positive to GND, the NPN's base-emiter junction will be reverse biased just like a protection diode. If the input voltage goes low enough for the protection diode to kick in, it will also forward bias the NPN's base-emitter junction, and the transistor will start to conduct.

Strictly speaking, it would be best to have the NPN control a PNP that lights an LED, so you get plenty of LED current while the NPN is only weakly forward biased:

reverse-polarity.jpg
reverse-polarity.jpg (23.72 KiB) Viewed 191 times


wylbur wrote:BTW, the ina260 product page and learning pages say "measure up to +36V," but they don't mention that negative voltages will toast the board (and as we've learned, the attached microprocessor). The product page says the board can "do the work of two multimeters," but of course only for positive voltages. I wonder if you'd be willing to add a note on those pages for EE n00bs that this board is not for measuring negative voltages? thx!

I'll mention it to the folks who handle the shop pages, but as a rule, all ICs tend to die when connected to voltages below their negative supply voltage.

adafruit_support_mike
 
Posts: 61443
Joined: Thu Feb 11, 2010 2:51 pm

Re: did I toast my ina260?

by wylbur on Thu Jan 30, 2020 11:19 am

hi Mike,

thanks! This is super cool and I look forward to a quiet weekend to play with this circuit on a breadboard. Alas, I have A Day Job, so it's going to take a couple of weeks before I have the free time, but I'm really looking forward to learning more. I really appreciate your thinking on this.

best, wylbur.

wylbur
 
Posts: 143
Joined: Thu May 17, 2012 2:40 pm

Re: did I toast my ina260?

by wylbur on Thu Jan 30, 2020 8:23 pm

Ok, I couldn't help myself. Your remark about how the mosfet would behave nonlinearly at low voltages made me curious. I put a variable bench power supply on the mosfet's drain and measured the output on the source every 50mV from 0-2v.

mosfet-voltages.png
mosfet-voltages.png (111.17 KiB) Viewed 172 times


It seems that the mosfet turns on around 1.3v. Is that V_GS? The datasheet for this mosfet (IRF4805) says that V_GS is -2V, but I'm not at all sure if I'm reading it correctly.

Empirically, above 1.3v on the drain, the source is within about 10mV of the output. Is this what you'd expect to see?

wylbur
 
Posts: 143
Joined: Thu May 17, 2012 2:40 pm

Re: did I toast my ina260?

by adafruit_support_mike on Fri Jan 31, 2020 2:34 am

wylbur wrote:It seems that the mosfet turns on around 1.3v. Is that V_GS?

Yep.

Mosfets work kind of like the old Wooly Willy toys, with a bunch of iron filings and a picture of a face under a plastic cover: the silicon channel is normally non-conductive, but you can pull electrons into the region below the gate by applying a positive voltage on the other side of the gate. Then the electrons make a conductive layer that allows current to flow from the source to the drain.

The amount of voltage you need to get conductivity is the gate-source voltage, or Vgs. The amount of Vgs you need varies from one kind of mosfet to another. Older versions needed at least 10V, while newer ones can operate below 3V.

wylbur wrote:The datasheet for this mosfet (IRF4805) says that V_GS is -2V, but I'm not at all sure if I'm reading it correctly.

For P-mosfets, the gate voltage needs to be lower than the source voltage. Instead of pulling electrons up to the region below the gate, you're pushing them away so the region below the gate is full of empty electron orbitals called 'holes'. Electrons can jump from one hole to another, so that also makes a conductive region through the channel.

If the mosfet's gate was connected to GND, the graph above shows that the channel started to conduct when the gate was about 200mV below the source voltage, and became more conductive as the source voltage increased. The exact conductivity through the channel is proportional to the square of the gate-source voltage, so between 0V and the rated Vgs value, there's a region where the channel acts like a voltage-controlled resistor. That's what's happening in the part of the curve below about 1.3V.

The value of Vgs listed in a datasheet is where the channel falls to a certain resistance value, or can conduct a certain amount of current.

wylbur wrote:Empirically, above 1.3v on the drain, the source is within about 10mV of the output. Is this what you'd expect to see?

Yep. A mosfet's channel is purely resistive, so you have what amounts to a voltage divider with the mosfet's channel resistance on top, and the resistance of the load (in this case, the panel meter) below. You'll get some amount of voltage drop across the channel resistance based on the amount of current that flows through it.

adafruit_support_mike
 
Posts: 61443
Joined: Thu Feb 11, 2010 2:51 pm

Re: did I toast my ina260?

by wylbur on Fri Jan 31, 2020 12:52 pm

hi Mike,

wow, thanks so much for this explanation! I'm trying to understand more deeply the EE theory part of making, rather than just hooking stuff up by recipes, so this is a giant help to me. I've been writing software for 30+ years but I've never quite understood how voltages become bytes: I get a little blurry about how the stack works from memory addresses down to transistors. Much appreciated, and feel free to ghost when this gets boring for you. I promise to buy *tons* more Adafruit stuff in the coming months to cover this ;)

Back to your recommended polarity protection circuit: if I understand correctly, you've put the diode between Vin and GND such that it blocks when the circuit is wired correctly, but allows current/shorts Vin-GND if the polarity is reversed. Should I put a fuse in series before the diode and ground? Otherwise if the polarity is reversed, the power supply could be damaged when the diode shorts, right?

In the correctly-wired case, the diode is simply blocking, right? So it has no effect on Vin as long as Vin > GND? If that's true, I'm not worried about the diode's Vf, so would I prefer some non-Schottky diode that has better blocking properties? Said differently, what parameters of the diode should I be thinking about?

thanks again -- wylbur.

wylbur
 
Posts: 143
Joined: Thu May 17, 2012 2:40 pm

Re: did I toast my ina260?

by adafruit_support_mike on Sun Feb 02, 2020 3:22 am

wylbur wrote: if I understand correctly, you've put the diode between Vin and GND such that it blocks when the circuit is wired correctly, but allows current/shorts Vin-GND if the polarity is reversed.

That's correct.

Forward-biased diodes have an exponential voltage-to-current function: if you increase the voltage across a diode by about 60mV, it lets ten times as much current through. That relationship applies all the way down to 100mV or so, at which point the current flowing through the diode is down in the femtoamp range (1e-15). By convention, we usually assume the current through a silicon diode is about 1mA when the voltage across the diode is 645mV, and that below about 400mV, the current through the diode is so low that we can safely ignore it.

The current through a reverse-biased diode stays down in the femtoamp range.. the 1mA @ 645mV estimate is based on about eleven +60mV->x10 current jumps. Again, for most purposes, that rounds down to 'none'.


wylbur wrote:Should I put a fuse in series before the diode and ground?

That wouldn't hurt. Connect the fuse between your circuit and the power supply's positive terminal. That way when the fuse blows, it cuts off the connection to the power supply completely.

wylbur wrote:Otherwise if the polarity is reversed, the power supply could be damaged when the diode shorts, right?

Not if the power supply is well made.

Power supply designers know the risks of having a shorted connection too, so any reasonable design includes protection measures. The power supply will probably have its own internal fuse, but it will also have 'foldback current limiting', which makes the maximum output current proportional to the output voltage. It might also have a thermal foldback circuit that reduces output current if the main control transistor starts to get hot.

That doesn't mean you want to short a power supply's output for the fun of it, but does mean most supplies can survive a momentary short without being damaged. A good power supply with a datasheet will probably specify the maximum short-circuit current and the amount of time it can maintain that kind of short.

wylbur wrote:In the correctly-wired case, the diode is simply blocking, right?

Yes.

wylbur wrote:So it has no effect on Vin as long as Vin > GND?

Also yes.

wylbur wrote:If that's true, I'm not worried about the diode's Vf.

This isn't quite correct.. most ICs have their own reverse-biased diodes connected to all the IO pins for protection against static electricity.

The average doorknob spark has a voltage around 1.5kV, which is more than enough to blow holes through a mosfet's gate insulation. That was a big problem back in the 1980s when mosfet devices first hit the market, and people got obsessive about ESD protection. The spark only has a couple nanocoulombs of charge though (enough to charge a 1nF capacitor to 2V), and the spark only lasts a few nanoseconds. The actual current during that time is less than 1A.

IC designers add small reverse-biased diodes from the pin to VCC and GND to give the spark's current a safe path through the chip. That leads to a party trick where you can power most ICs through an IO pin while the official VCC pin is disconnected. The power to run the device comes in through the IO pin's upper protection diode.

The protection diodes start to conduct at about 300mV, so you have to take those Vfs into account when you think about external protection diodes. If you use a regular silicon diode whose Vf is about 825mV @ 1A, that's enough for a pair of 300mV diodes to turn on, plus about 110mV of extra bias voltage for each one.. enough for maybe 50mA to flow through them. That's less than the current from a spark, but it lasts longer, and gives the diodes time to heat up and suffer thermal damage.

wylbur wrote:so would I prefer some non-Schottky diode that has better blocking properties?

Nope.. Schottkys are the way to go. They have about the same forward voltage as the ESD protection diodes inside a chip, and still follow the same +60mV->x10 current rule as silicon diodes. The vast majority of externally-applied power will go through the Schottky before a chip's internal protection diodes reach a voltage high enough to conduct more than a couple milliamps.

The parameters you want to look for are low Vf and high Id (maximum diode current). Schottky diodes are used in power applications all the time, so you can find versions rated for a few hundred amps.

In practice, look for one whose continuous current rating is about 2x the value of the fuse you select. That way you can count on the fuse blowing to protect the diode, instead of the diode blowing to protect the fuse.

adafruit_support_mike
 
Posts: 61443
Joined: Thu Feb 11, 2010 2:51 pm

Please be positive and constructive with your questions and comments.