Why connect a switch to 5v

Discussion in 'General Discussion' started by Maurice, Mar 28, 2016.

  1. Maurice

    Maurice Active Member

    Joined:
    Oct 13, 2015
    Messages:
    394
    Likes Received:
    87
    I'm creating a system that will detect whether the garage door is open or closed. In a previous version I used the Neo's internal compass to measure the door position, but I'm going to use a reed switch. I then control two leds to indicate the switch position, and I will use MQTT so send it to my MQTT broker.

    I'm no hardware designer, so I've based my design on designs I found on the internet. I noticed that when I see switch designs they connect the wire to 5v, even in the 'official' "Getting started with UDOO".

    I'd like to know why this is, why not the 3.3v?




    [​IMG]
     
  2. paulbearne

    paulbearne New Member

    Joined:
    Jan 5, 2016
    Messages:
    23
    Likes Received:
    7
    The uno has 5v logic io which is the reason they connect to 5v , using 3v3 will work fine for the udoo don't use 5v directly to a udoo io pin or you will damage the Udoo
     
  3. Maurice

    Maurice Active Member

    Joined:
    Oct 13, 2015
    Messages:
    394
    Likes Received:
    87
    The design above is mine, I used a Uno because the layout matches the Neo more than the Due Rev3. When I realized this design I connected it to the 5v too. I just noticed that it was in the UDOO book too, so I assumed there is a reason to do so.
     
  4. paulbearne

    paulbearne New Member

    Joined:
    Jan 5, 2016
    Messages:
    23
    Likes Received:
    7
    Hi Maurice not sure why it is in the udoo book as i'm pretty sure the i.mx6 devices aren't 5v tolerant and the udoo doesn't have a level shifter so your best to use the 3v3
     
  5. Maurice

    Maurice Active Member

    Joined:
    Oct 13, 2015
    Messages:
    394
    Likes Received:
    87
    From the book:
     
  6. paulbearne

    paulbearne New Member

    Joined:
    Jan 5, 2016
    Messages:
    23
    Likes Received:
    7
  7. Maurice

    Maurice Active Member

    Joined:
    Oct 13, 2015
    Messages:
    394
    Likes Received:
    87
    I know, that's why I was wondering. However in the schematics a 10k pull down resistor is used from the +5v to the ground. AFAIK the input pin will not get 5v.
     
  8. paulbearne

    paulbearne New Member

    Joined:
    Jan 5, 2016
    Messages:
    23
    Likes Received:
    7
    The input pin will see 5v when the switch is closed unless the switch has a high impedance which would make it a very poor switch. The weak pull down is just to ensure the input pin is not floating and will not effect the voltage at pin. you could put a resistor in series with the switch to make a potential divider if you want but the best solution is to use 3v3
     
  9. Maurice

    Maurice Active Member

    Joined:
    Oct 13, 2015
    Messages:
    394
    Likes Received:
    87
    I'm using the 3v3. Feels safer.
     
  10. Emanuele Palazzetti

    Emanuele Palazzetti New Member

    Joined:
    Mar 31, 2016
    Messages:
    1
    Likes Received:
    3
    Hello everyone! "Getting Started with UDOO" author here!
    I was reached by Maurice and I'm sorry if I can participate to this discussion only now.

    Anyway, as paulbearne said, there was an error in the book because UDOO is NOT 5v compliant in its pins, as described in the official page (this was the same in the old Arduino Due page when it was available). I'm sorry for this inconvenience but it seems an error during the review process and I couldn't do anything to change that (publisher constraints). What I suggest is to submit an errata at the Packt website: https://www.packtpub.com/books/content/errata.

    At least, new UDOOers (or in general people that read the book) will know the correct approach that is using the switch button with 3.3V without a 5V solution that is overcomplicated.
     
    delba, graugans and waltervl like this.

Share This Page