Attiny1617 Analog comparator peripheral

Go To Last Post
9 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

 

I'm making a thing which as a current shunt sense resistor, of about 5 mOhm,

 

I have wired it into a pin on the attiny1617 which can work as ADC, I can read the ADC - which is cool.

BUT

 

I checked the datasheet and I see that I can also use the analog (/ analogue) comparator peripheral to compare it with a voltage from the DAC - presumably the AC can work a lot faster than the ADC and give the CPU an interrupt if it exceeds (which is very useful).

 

Would it work? Would it work at low voltages like 50mV? I can see the lowest voltage reference is 0.55V, then I can use the (8-bit) DAC to create a lower threshold voltage, e.g. 50mV, and detect if my current shunt sees 10 amps (for example) ?

 

Is my interpretation of the datasheet ok?

 

I don't have the hardware yet so I can't test it (I can maybe rig something on a breadboard, might do that later)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

markxr wrote:
Would it work at low voltages like 50mV?
Imprecise due to AC's offset; CSA are relatively inexpensive.

markxr wrote:
(I can maybe rig something on a breadboard, might do that later)
tiny1617 is QFN; tiny1616 is in SOIC.

 

P.S.

tinyAVR 2-series has released.

 


ATTINY1617 - 8-bit Microcontrollers

 

Current-Sense Amplifiers from A to “I” | Electronic Design

 

ATTINY1616 - 8-bit Microcontrollers

ATtiny3217 Curiosity Nano Evaluation Kit

Surface Mount Prototyping PCBs | BusBoard Prototype Systems

 

ATTINY1627/26/25/24 availability | AVR Freaks

tinyAVR® 2 Family

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

gchapman wrote:

markxr wrote:

(I can maybe rig something on a breadboard, might do that later)

 

tiny1617 is QFN; tiny1616 is in SOIC.

 

 

I have put some tiny3217 QFN parts on to breakout boards with 0.1 inch headers. It's all good :)

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

surprise

Well done!

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

5 mOhm

At those at low ohms, you need to (or should) use a 4-wire connection to your resistor (amp leads connect direct to the resistor pad).  Better yet, use an actual 4 terminal resistor.

 

At 2 amps, you'd only work with 10mv, nice and noisy to route around town without some amplification.  Take a look at a diff amplifier:

 

https://www.digikey.com/en/produ...

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

Last Edited: Thu. Feb 25, 2021 - 10:04 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Are you worried about false triggering?

 

At those very low signal levels noise and noise spikes / glitches can be an issue, especially if you use the analog comparator.

 

You might well fine that your shunt resistor needs a filter.

 

With the ADC you have the option of taking several readings, ignoring the high and low values, and averaging the rest, (or whatever scheme you wish to use).

 

Know that there are specially designed current sense chips available, although it is sometimes fun to do it yourself.

 

Adding an op-amp on the analog front end would allow you to both filter and amplify the signal, making the subsequent signal detection easier.

 

JC

 

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

With comparators and op-amps and instrumentation amps, you MUST pay attention to the input common-mode range. If the sensing circuit totally floats with respect to the circuit being monitored, then it can float so that the voltages on the current sense resistor are within the common-mode range. However, that is pretty uncommon. 

 

Usually, low-side sensing is OK. It is high-side sensing that is the problem. 

 

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


gchapman wrote:

Imprecise due to AC's offset;

 

Yup, measuring something as low as 50 mV will have up to 40% error.

 

 

gchapman wrote:
tinyAVR 2-series has released.

The internal opamps of the AVR-DB could also make it possible, but they are more costly than a tinyAVR.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

El Tangas wrote:
... but they are more costly than a tinyAVR.
AVR DB are relatively inexpensive though a CSA has reduced offset and greater CMRR.

 

https://www.microchipdirect.com/product/search/all/avr128db

How to Protect Circuits from Overcurrent Spikes | ON Semiconductor (3m1s, 100mA) via Current Sense Amplifiers | ON Semiconductor

"Dare to be naïve." - Buckminster Fuller