• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

General GPIO Question

Q&A Forum › Category: Questions › General GPIO Question
0 Vote Up Vote Down
Charles Phillips asked 4 years ago

Hi all… I’ve been wondering about this scenario for some time. I think it’s a valid concern  no matter what board you are experimenting with. 
Here it is. Currently the board is running a sketch that configures Pin 5 as an OUPUT and sets its’ value to HIGH.
All is well. We change to another project where the sketch configures Pin 5 as an INPUT and the pin is connected to the data out pin of a sensor. The question is… if we assemble the new circuit and power up the board with the old sketch still loaded, will the sensor or the board be damaged? The 30+ years I spent working as an Electronics tech tells me this is asking for trouble.
Is there some sort of protocol for doing this safely, or does it not matter? 
Maybe uploading the new code before circuit assembly?
thanks charlie

3 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 4 years ago

Hi Charlie.
 
To be honest, I usually don’t think about that. I’m not sure if it doesn’t matter or if I was just lucky until now. 
 
But, in theory, yes, we should have careful with that. It might damage the board or the sensor, even though nothing happened to my boards or sensors until now.
 
However, the best practice is to upload the new code before assembling the circuit. Not only because of that but also because some GPIOs, when connected, might cause issues uploading code to the board.
 
The best procedure to follow would be:

  1. Upload the new code
  2. Disconnect power from the board
  3. Assemble the circuit
  4. Power the board again
  5. Press the RST button to restart the board

 
Regards,
Sara

0 Vote Up Vote Down
Steve Mercer answered 4 years ago

I don’t see how that could hurt the board or the sensor unless there is a major difference in voltage between the two. These boards and sensors tend to be 5V tolerant. If both are 5V then setting the output of a sensor to 5V shouldn’t hurt it as this would be the max it would send anyway.

0 Vote Up Vote Down
Joe Margevicius answered 4 years ago

… not if the sensor is sending out 5 Volts and the board is outputting 0 volts. …. think of the “upper” transistor on the sensor being active (i.e. effectively shorted to its power rail of 5 volts), and the “lower” transistor on the board being active (i.e. effectively shorted to its ground rail) …. isn’t that a way to blow one or the other transistors?  Maybe best to figure out what the sensor is doing (e.g. sending out a “1”), and have the board’s initial output be the same.

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [eBook Updated] Learn Raspberry Pi Pico/Pico W with MicroPython eBook – Version 1.2 May 26, 2025
  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.