interfacing a resistor ladder to an arduino analog input

Discussion in 'The Projects Forum' started by Steve C, Aug 25, 2009.

  1. Steve C

    Thread Starter Active Member

    Nov 29, 2008
    86
    0
    Hi guys,

    I've got a project, I'm trying to interface my car's steering wheel controls into an arduino. The problem is that the controls are already interfaced to my car CD player. I want to split the signal and sent it into an arduino ALSO so I can control a secondary device. If I plug the lines into the AI of the arduino, the car CD player has a fit. So the arduino AI pins are doing something to the existing circuit that is undesireable.

    Is there a way I can buffer the lines so I can get the signal into the arduino without affecting the existing circuit?

    Thanks guys,

    -Steve
     
  2. RiJoRI

    Well-Known Member

    Aug 15, 2007
    536
    26
    1) Please post a schematic.
    2) Why are you using the analog inputs? -- Even the "Hold-to-Change" buttons need not be analog.
    3) What are the signal voltages coming from your controls? (Test them to see what kind of levels or waveforms the controls deliver, also.)

    In automotive work, a buffer is A Very Good Thing.

    HTH,
    --Rich
     
  3. Steve C

    Thread Starter Active Member

    Nov 29, 2008
    86
    0
    OK, so the circuit is a little tough to show. But here goes. pic 1 shows two resistor ladders. pic 2 shows their termination straight into the MPU, pins 38 and 39.

    pic1 shows an interface to a ribbon cable. I have intercepted the two lines here and added my own duplicate resistor ladders for additional wired control.

    All this together works just fine. Great, in fact.
    -----------------

    The trouble happens with the new circuit. What I tried to do, is build a breakout cable to intercept the same two lines again. These two wires I routed directly to the two analog input pins of an ATMEGA168.

    If I plug all this in, the CD player shuts down. I don't want to tempt fate any more. Especially working around a direct line to the MPU.

    frying the ATMEGA would be a darn shame. But frying that MPU would be tragic.

    You mentioned a buffer. Can you go into more detail what might be involved in an analog buffer?
     
    • 1.JPG
      1.JPG
      File size:
      95.3 KB
      Views:
      96
    • 2.JPG
      2.JPG
      File size:
      28.3 KB
      Views:
      71
  4. RiJoRI

    Well-Known Member

    Aug 15, 2007
    536
    26
    "Can you go into more detail what might be involved in an analog buffer?"

    I would look into using a pair of op-amps in a voltage-follower configuration. I assume you have the Arduino's pins properly programmed?

    Do you intend to have the Arduino send signals back to the car's MPU?

    --Rich
     
  5. Steve C

    Thread Starter Active Member

    Nov 29, 2008
    86
    0
    no I don't intend to have the arduino send signals back to the MPU. It'll be one way communication with the arduino controlling separate hardware that is completely open loop. Ideally, the MPU never knows about any of the additional circuitry I've created.

    how do opamps present themselves to the input circuit? do they just have X impedance based on the opamp circuit, a path to ground? or vcc? do they float as far as the input sees?

    The arduino pins are properly programmed in that I can hook up a pot to both AI and read an analog signal.
    ----
    Oh, and thanks for taking the time for me. I appreciate the education. Especially when solving my problem results not only with a successful project, but in enhanced knowledge so I can adapt the tools learned for future projects :)
     
  6. RiJoRI

    Well-Known Member

    Aug 15, 2007
    536
    26
    See http://www.allaboutcircuits.com/vol_3/chpt_8/4.html An opamp with its output connected directly to its negative input is a voltage follower -- as explained, the output will follow the input voltage. As a rule of thumb, opamps have a very high input impedance, and a very low output impedance. This way, the opamp will have very little loading effect on the MCU, while providing a signal for the Arduino. As to floating, you want to avoid that by having all the grounds common. Search on this board for automotive circuits, and the problems associated with them.

    Finally, I shall be away for the next two weeks; I may be able to drop by next week, but the week after I'll be out of e-comm totally.

    --Rich
     
  7. Steve C

    Thread Starter Active Member

    Nov 29, 2008
    86
    0
    thank you much. :)
     
  8. Steve C

    Thread Starter Active Member

    Nov 29, 2008
    86
    0
    Alright, so I've got this up and running and it works like a champ! ...almost. :(

    The opamps are working perfectly. My CD player is happy and I'm seeing voltage at the arduino inputs. Here's what happens:

    CD player is grounded to the car chassis, arduino is grounded to the car chassis, so I put my meter there. I test continuity at the CD player chassis, test continuity at the arduino ground pin. good to go. Next, I read voltage at BOTH analog input pins right at the arduino. Read 4 volts when idle and between 0 and 4 when I press a button on the ladder. this is EXACTLY what I want. Good to go!

    So I plug in a laptop to the USB port on the arduino so I can debug some code. I write a program that reads the analog pins used and reports the value in hyperterminal.

    But it doesnt work! Reads a constant 0, as if the pins are grounded! Even with nothing pressed, the analog inputs should be reading around 800 or so (reads analog lines as 0-1023 based on a voltage from 0-5 volts), but I read straight 0!

    I wouldnt think grounds would have anything to do with it, I'd assume the arduino and CD player having the same ground would be good enough, and no matter what ground the PC was using (technically shared once that USB plug is plugged in! should be the car ground too!) it would get the report back from the arduino anyways. I would think?

    I just can't think of any reason why the analog pin would report back a 0 to hyperterminal when there is a measured 4 volts on the pin! Am I on the wrong track looking at grounds?
     
Loading...