Arduino Input reading high randomly

Hello,

I am working on an LED notification system for my college radio station.

The goal is to trigger different LEDs for different events, but I'm having some issues with an input.

For some reason, I have a digital input (Pin 9) reading high values when my connection is unplugged.

If I remove the wire all together this issue goes away. While the room I'm in has very little RF, I suppose the wire may be functioning as an antennae?

Does anybody have suggestions on how to fix this, or ideas on what is causing it?

Also, in the case that the wire may be functioning as an antennae, does anyone have suggestions for counteracting invalid high reads while in the radio studio? I figure I can throw a large cap on it and be good.

A input flaots so it acts as a antenna. Use pinMode(pin, INPUT_PULLUP); to pull the input high. Connect the switch between the pin and GND and your good to go.

Btw, it's very very Arduno/microcontroller 101. Maybe check the basic programs or find a course?

I've worked with the arduino pretty extensively and also MSP430s without running into this. I think it just happened to be the way I was testing it right now, so it seemed odd to me.

I was planning to use a GPIO port to automate LED functionality based off of microphone status and board bypass so I had it in my mind that it had to be high for input but I suppose I can reverse the GPIO functionality and have it always output unless certain conditions arise.

Also, considering in 3 microcontroller courses in my computer engineering major in college never discussed the topic I think it's fair to consider it to not be 101 knowledge for a typical arduino user.
And even if it is, using the term "very very 101" is extremely insulting. Your answer without condescension would have been satisfactory.

No, I still think it's 101. And yeay, it's a error a lot of newbies make. An microcontroller input is high impedance. So like anything can change it. If a book does not mention this (which I doubt) I think that book is a piece of crap... And in a course,, yeay, it's easy to forget to mention as a teacher but I think it's a must. It's 101. It's been the same for ages, logic gates etc. That's why a ATmega has internal pullups and some other micro's even have pull downs.

septillion:
A input flaots so it acts as a antenna. ... Btw, it's very very Arduno/microcontroller 101.

And yeay, it's a error a lot of newbies make.

No one was born knowing that. Not even you @septillion. At some point in your life someone provided you with that information so you too would know that.

Maybe check the basic programs or find a course?

Or ask on an internet forum where some kind soul will provide help?

jgbowers:
I've worked with the arduino pretty extensively and also MSP430s without running into this.

That is amazing luck.

Also, considering in 3 microcontroller courses in my computer engineering major in college never discussed the topic...

@septillion nailed it. Your instructors failed you. Especially in a "microcontroller course".

And even if it is, using the term "very very 101" is extremely insulting. Your answer without condescension would have been satisfactory.

While it is possible @septillion meant to be condescending and insulting to you personally, given the fact that he did help you, it is more likely that English is not his native language and he is unable to accurately communicate his thoughts.

In other words, no one is born knowing how to communicate in English. Not even you, @jgbowers. Those who do learn, even professionals, struggle because it is a language riddled with subtlety and nuance.

That is very true. But with the "micro controller 101" part I meant that it is very basic, not that it is common knowledge. But when a micro controller book/lecture starts talking about inputs it should already be in that first chapter/lecture, inputs are high impedance and thus float.

And yes, I would like to help :slight_smile: Otherwise I would not respond. But I also would like to point out Google does as well and is a whole lot faster and more resource efficient then we people at a forum are :wink:

No one was born knowing that. Not even you @septillion. At some point in your life someone provided you with that information so you too would know that.

While I was not born with that information no body told me. Like a lot of things about micro controllers and logic in the 70s I had to work it out from first principals myself.

The fact that there is little RF in the room is incorrect, it is coming out of every mains AC outlet.

I think if you profess to have more experience than you actually have you are opening your self to abuse.

jgbowers:
it had to be high for input but I suppose I can reverse the GPIO functionality and have it always output unless certain conditions arise.

If you do need high input then you can add a pull down resistor instead of using the internal pull up.

pert:
If you do need high input then you can add a pull down resistor instead of using the internal pull up.

Correct but nobody needs a logic input to default to any specific value, you just compensate for what you have with code.
There seems to be a beginners obsession with having a reading of zero correspond to nothing connected, there is simply no need.

When I did my first course in digital electronics in the 1960s we used Mullard Combi Blocks which were RTL logic and the inputs defaulted to low if left floating. Later came TTL and the inputs defaulted to high. Then came CMOS with high impedance inputs which needed pull up (or down) resistors if use with switches. We quickly learned the effects of static discharges as well!

My point is that, no matter what you learn at school/college/university, everything can change. Just keep learning and, where you can, teaching.

Russell.