Arduino Stack Exchange is a question and answer site for developers of open-source hardware and software that is compatible with Arduino. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to build a small personal weather station. The rain sensor, and wind speed sensor use interrupts. The barometric sensor uses i2c SDA and SCL.

Reading the Arduino Yun manual, it says there are 5 interrupt pins, but 2 of them are SCL/SDA (pins D2 and D3), and 2 of them are serial comms between Linio and the 32U4 (pins 0 and 1).

This leaves me with 1 interrupt pin left (pin 7).

Is there a work around to get my 2 digital sensors AND SDA SCL pins connected?

If I do use pins 0 and 1 (Linux serial), what do I risk? I will need to use the Bridge to relay information to the internet.

share|improve this question
up vote 2 down vote accepted

Any of the port B pins on the ATmega32u4 can interrupt on pin change. Unlike the external interrupts however, these pin change interrupts share the same interrupt vector. So in the interrupt routine you have to work out which one fired.

The port B pin change interrupt is not support by the Arduino core library so you have to download a third-party library. This one seems fairly recent:

https://code.google.com/p/arduino-pinchangeint/

Then you connect your two interrupt lines to spare Port B pins and monitor for pin changes.

share|improve this answer
    
Worked effortlessly after installing the library. Thanks! – Pat Sep 18 '14 at 2:52

OR the interrupt lines together so that you only need 1 external interrupt. Then when an interrupt is triggered, poll the devices until you find the one that triggered the interrupt. If the interrupt outputs are open-drain then you can wired-OR them together, otherwise you will need something like the 74LVC32 to OR the push-pull outputs together.

share|improve this answer
1  
And I was going to show you how to do it here, but there's no schematic button in the editor. – Ignacio Vazquez-Abrams Sep 18 '14 at 0:19

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.