Go Down

Topic: Rising edge writing on digital outputs- ANOMALY (Read 276 times) previous topic - next topic

Wonsz

Hey guys!  :)
At first I would like to greet everyone on the forum, as this is my first post.
I found some anomaly during the work on my project, impossible for me to understand.

I was making my furnace controller project. I was playing with connecting of RTC to I2C bus, but then I got idea to check work of square wave generator output attached to the clock.

I prepared the software, using library bounce.h and function of it- fallingEdge().

Before even I connected the SQW to the digital output, amazing thing happened.
I don't even had to plug the the wire, clock was working and measuring the rising edges!

What was even more suprising, rising edges are couting when I touch the output, with any wire. Even unplugged. Or even when I put that wire close to output. Or even, when instead of wire I put my hand close to output. Without touching it.
When I take my hand away, it just stops.

There is around (hardly measuring) 12 rising edges per second. Anyway, 10 rising edges are visible faster then second.

Can somebody light for me that issue? Thank you very much for any help. I'm very fresh at Arduino. This destroyed my mind.

sterretje

#1
Jan 02, 2017, 04:13 pm Last Edit: Jan 02, 2017, 04:15 pm by sterretje
Quote
What was even more suprising, rising edges are couting when I touch the output, with any wire.
Which output? One of the pins on the Arduino? Configured as output?

Or one of the pins of the Arduino that is configured as input.

In which case I guess you're talking about an effect caused by a floating input.

A floating input is an input that is not connected to anything. Inputs are high impedance and pickup noise and when your read those, you just read random values.

Nothing to worry about if you have something connected to it like the output of the clock module (mechanical contacts don't count).
If you understand an example, use it.
If you don't understand an example, don't use it.

Electronics engineer by trade, software engineer by profession. Trying to get back into electronics after 15 years absence.

spycatcher2k

Place a 10K pull-up resistor from the pin to 5V. This will fix the voltage when there is no connected device to 5V. You may need to remove this if the output from your SQW fails to pull it to ground.
Drew.
http://www.uk-pcb.co.uk - My UK Based PCB Fab & Assembly Company
Design & Assembly work undertaken - Arduino repairs & testing - PM for details. PM me for non repair or testing, 1 to 1 support and I will charge you - beware!

sterretje

OOPS, might have forgotten that that output might be open drain; in which case a pull-up is required.

Check the datasheet of the rtc chip.
If you understand an example, use it.
If you don't understand an example, don't use it.

Electronics engineer by trade, software engineer by profession. Trying to get back into electronics after 15 years absence.

Go Up