Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 4 of 4

Thread: Multiple AnalogRead Pins Measuring the Same Wire

  1. #1
    Member
    Join Date
    Aug 2016
    Location
    Raleigh, NC
    Posts
    21

    Multiple AnalogRead Pins Measuring the Same Wire

    Hi,

    I am laying out a Teensy synth project and wanted to confirm something before I get too far with it.

    The design I had in mind would use four rotary switches which will be input into the Teensy. I am planning on using a collection of resistors in series biased at 3.3V and 0V at either end. Depending on where the rotary switch is, I'd measure the voltage between two of those resistors with AnalogRead().

    As far as I know this is pretty common practice, but I am new to microcontrollers. Here's a diagram: http://dboyer.us/wp-content/uploads/...tch_analog.png

    My question is, if I were to do this with with up to four rotary switches, would there be any issue with two or more of the analog pins reading the same point?

    Thank you for any input!
    -Matthew

  2. #2
    Senior Member Jp3141's Avatar
    Join Date
    Nov 2012
    Posts
    461
    You can't connect the 'A0 COM' connections together from the multiple rotary switches -- you won't be able to read the switches independently (or correctly). You can connect multiple Teensy analog input pins to the same 'A0 COM' and read it on all those channels, but why ?

  3. #3
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    21,352
    Yes, this circuit should work well.



    You could even use just 1 set of resistors for all 4 switches, but soldering 4 sets of resistors might be easier. Resistors are cheap!

    Each rotary switch each will need to connect to a separate analog input pin.

  4. #4
    Member
    Join Date
    Aug 2016
    Location
    Raleigh, NC
    Posts
    21
    Thanks, Paul! That helps.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •