Interrupts pins triggering unexpectedly

Hi,

So I have a project using a Teensy 3.5. I am measuring light inputs through some analog light sensors. The light sensors trigger an the interrupt and start the interrupt service routine. The routine records the time of the pulse and sets a corresponding LED HIGH for one second. The teensy is controlling several other things. Solenoids, external ADC's, mosfets, LCD... etc.

While trouble shooting different parts of the project, sometimes when I connect or connect components (some powered some not) some or all of the interrupt pins will trigger. Even with nothing connected to the interrupt pin.

any suggestions?

Since it still happens when I disconnect all wires from the interrupt pins, I figured it must noise on the ground plane from connecting as connecting components. I have smoothing capacitors between Vcc and GND.

You should not be connecting and disconnecting sensors, etc to a powered device. That puts you on the fast track to a dead processor.

All inputs must be terminated in some manner. Pull-ups, pull-downs, actively driven, something but never just a bare pin which will trigger due to noise and static. A floating pin is in an unknown state, otherwise known as a predictably unpredictable pin.

I have all my used INPUT pins pulled down but not my unused pins or OUTPUT pins. Could that possibly be the issue?

I connect and disconnect devices to powered microcontrollers all the time - it's not good practice, but you can usually get away with it - I've never had it actually damage the board, except in cases where (due to miswiring) it would have had the same result if I'd turned it off, connected it, and then turned it back on.

All pins that have an interrupt on them should either be pulled up, pulled down, or connected to something that is actively driving them. Output pins don't require any special treatment, as the processor is already driving them to a defined state. It's good practice for unused pins to be pulled up or down (among other things, it ever so slightly reduces power consumption), but unless they've got interrupts set on them, this isn't the problem.

Are the pins that are giving unexpected interrupts connected to the thing you're connecting? This should not be surprising, as you're connecting power and these pins at the same time, and during the startup of the newly connected device, the pins may not behave the way they do during operation. If you look at a device that's meant to be "hot-swapped" you'll notice that some pins on the connector are longer than others (usually power and ground), so that they make contact first (this is also why the third prong (earth-ground) on a 3-prong power cord is longer).