I am trying to use the Arduino Uno to read an AVCLan bus on a Toyota vehicle. Logic 0 is when +/- drive are 120mV or more apart, and logic 1 is 20mV or less. See Toyota AVC-Lan description.

I currently set the TCNT1 timer to /1 prescaler for resolution, and waiting in a loop until the ACO bit sets in ACSR. Using this, I measure the amount of time the signal was logic 0, and calculate each bit based on the how long the timer ran, and then resetting it.

While this works fine for most messages, I do receive a "glitch" every couple messages, with on-times around 2uS - 4uS, which shouldn't happen on this bus. I'm guessing the analog comparator is tripping up if the drive is around 10mV - 20mV, when it shouldn't set.

Is there any way to set up a threshold, so that it will only fire the comparator at say 100mV or above?

  • 2
    I think what you want is a 2-stage system consisting of a differential amplifier to convert the signal into a single-ended signal, then a comparator to compare the single-ended voltage with a reference voltage. – Majenko Sep 30 '16 at 17:34
  • @Majenko I suggest you transform your comment into an answer – Roberto Lo Giacco Oct 1 '16 at 9:28
  • @RobertoLoGiacco I will when I get round to working out a suitable schematic for it. – Majenko Oct 1 '16 at 9:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.