Categories
Electronics

Arduino Problem (Response Delay)

Introduction

Hi guys I don’t know if you encounter this problem with arduino, but I want to share this problem and the things I’ve done to solve this it.

Problem:

I upload one of the example program(02.Digital / Button) to “arduino UNO”. Base on the program when  port 2 receives 5v port 13 must release 5v and when port 2 receives 0v, port 13 must release 0v. When I try to put 5v to port 2, port 13 releases 5v but when I remove the 5v supply to port 2, port 13 is still “ON” and it turns “OFF” after a few seconds. The question here is “ the program doesn’t contain any timer to delay port 13 to turn “OFF”, then  why port 13 is delayed?”, I also try to change the ports on the program, but the response of the program is still the same.

The program below is one of the example program of arduino, and base on this program if port 2 is “ON” port 13 must turn “ON”, and if Port 2 is “OFF” port 13 must turn “OFF”.

The Picture below shows the circuit diagram that I created for the program above. When I press the button at port 2, LED will turn “ON” and when I release the button at Port 2 LED must turn “OFF” but instead of turning “OFF” immediately it will turn “OFF” after a few seconds.

Solution:

I try to research on the forums but I didn’t find any answer, my theory about this circuit is “there might be some voltage on port 2 that remains after releasing the button”, it sounds crazy because there is no component connected in port 2 that can store voltage like capacitor, but I still try my theory, I put a resistor and LED in parallel with port 2 (see the picture bellow), the purpose of these resistor and LED is to discharge the excess voltage on port 2 after releasing the button. I never expect it but I works, there is no delay on response anymore.

I hope my article is helpful thank you.

Note: the picture of arduino program above is not mine, it is one of the example program of arduino software.

 

 

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *