What is the input range of the comparator of the ATmega328p? I can't find it listed in the datasheet.
Nick Gammon measured it working down to 100mV but, unfortunately, didn't say what the upper limit is
What is the input range of the comparator of the ATmega328p? I can't find it listed in the datasheet.
Nick Gammon measured it working down to 100mV but, unfortunately, didn't say what the upper limit is
Thanks.
I now see that you're quoting from the version of the datasheet labelled "01/15". I happened to be looking at the "11/2016" version which doesn't say that. Weirdly, the "01/15" version is the most recent one on the Microchip website.
I can set the reference voltage to whatever I like. I just wanted to be "somewhere near the middle". I'm used to, for instance, the LM393 whose input range is 0V to Vcc-1.5. It's nice that the "free" one in the 358P is better that that.
I'm experimenting building magnetometers and I want to measure an interval as precisely as I can. If I use the ICR1 register triggered by the comparator, I ought to get 62.5nS resolution.
The LM393 propagation delay is different depending on the direction of travel and the "input overdrive". The 328P datasheets I've found don't really discuss whether or how it varies. The "01/15" datasheet says the propagation delay is 500nS. The "11/2016" version doesn't seem to mention it at all.
Any thoughts?
If you need fast response, it is extremely unlikely that the comparator on the 30 year old ATmega328p design is competitive with modern comparators.
True.
If this was a commercial design, I'd use "proper" chips but I'll probably just publish it as an Instructable. And Instructable readers love Arduinos.
@peterbalch
2020 version DS40002061B
Table 30-1
propagation delay = 500ns Vcc=4.0V
Input range is the same as the ADC, so it's 0V to 5V
For hobbyist (like me
) to use a DIP-8 chip is not a big problem. I think that LM311 or LM319 are faster than LM393. Still easy to find and a bit less venerables.
Probably there are others, but in DIP package it's getting hard to find anything except the old 'jellybeans'.
Usually I look for something of SOP/SOIC size (and even that is 'big' nowadays), but for hobbyist maybe is not so straightforward.
Sounds interesting the project! I would like to know more
![]()
There are two main problems: what core material to use and what overall design of coils and circuitry.
The majority of magnetometers you might build yourself rely on the core material saturating *. Finding a core material that will saturate is hard. Ferrite requires too high flux density and the materials that NASA use are unobtainium (even for NASA nowadays). After a lot of experimenting I decided that "electrical steel" was the best I could do - i.e. laminations from transformers.
Most people have settled on flux-gate circuits as the way to go but I've been finding they have a lot of noise. I can't get below 500 nanoTesla **. I think it's because you need analog circuitry around the sensor and low noise electronics is hard. And hand-wound coils don't work too well. I'd like to do 10 times better.
Other designs are available based on timing: how long does it take for the core to saturate as the external magnetic field changes? Timing is easy for a microprocessor and is inherently digital so maybe I can do it better that way. If my experiments suggest it's a good approach then I might switch to a faster processor.
I'll write it all up as an Instructable when I've finished.
*(I haven't yet tried to build a proton magnetometer)
**(the Earth's magnetic field is 50uT)
Wow, that sound amazing! ![]()
I don't know much about it. I can only think in low noise and performant opamps and comparators. And maybe a small pcb with the components very close to the sensor, even shielded.
Looking forward to see the project in Instructables!
Yes, reducing noise in the electronics is just something annoying that you have to work through. I've got some decent (SMD) op amps I could use. And more resolution than the 10 bit ADC in the 328P would be nice. But I'd prefer to use components that "everyone" has in their box of random parts. Plus I'm not yet convinced that electronics is where the noise originates.
I can't tell whether what I'm seeing isn't just the noisy background magnetism at my workbench. There's a lot of equipment here. Or maybe it's magnetism generated by the circuit itself.
But it could also be something called Barkhausen noise which is due to the changes of the domain walls during magnetisation.
You study magnetism at school and you think you understand it but it turns out to be much more complicated that that. It was just one of those loose threads left over from my education that I thought I could tidy up. Of course, it turns out that my area of ignorance is greater than when I started.