Help with Baby Orangutan

I´m using a baby orangutan of pololu. I know that the orangutan has an atmega328p with 2 interrupt´s pins, but I read in pololu´s page that orangutan has only 1 interrupt pin! Where is the other??


We moved your post to our A-Star and Orangutan subform, which seemed appropriate.

According to the “Pin Configuration” section in the ATmega328P’s data sheet, the second interrupt pin, INT1, is on pin PD3, which is also controlled by Timer 2. (You can find a link to the ATmega328P’s data sheet under the “Resources” tab on the Baby Orangutan’s product page.) The Baby Orangutan uses Timer 2 to control motor 2, which is why INT1 is not listed in the in the Baby Orangutan B User’s Guide.

- Amanda

My explanation on why INT1 is not listed in the Baby Orangutan B User’s Guide in my previous post is not correct. The ATmega328P’s second external interrupt pin (INT1) is on PD3, which is used internally by the board for motor control (M2) and is not accessible to the user.

By the way, if you need additional interrupt pins, you can use pin-change interrupts, which is supported on every ATmega328P I/O pin and are often good enough for applications that need interrupts.

- Amanda

Oh thank you for answer. Can you explain me more detailed how I have to do if I need an additional interrupt pin? For example to connect two pololu magnetic encoders in the Baby Orangutan?? Thanks You!

It sounds like you are just trying to get the Baby Orangutan to work with the Pololu magnetic encoders. If you are, you might consider using the PololuWheelEncoders class in our AVR C/C++ library. You can find more details in the “Pololu Wheel Encoder Functions” section of the Pololu AVR C/C++ Library User’s Guide. I suggest running the wheel-encoders1 test example to get a better understanding of how to use the PololuWheelEncoders class. That example uses pins PC2 and PC3 for one encoder and pins PC4 and PC5 for the other.

- Amanda

I dont know how to use the library in the Arduino IDE. Also I dont found any example to learn and look how it works.


I merged your two threads together to make it easier to follow since they are about the same issue.

We do not have an Arduino sketch that uses the PololuWheelEncoders library, but it should be easy to convert the wheel-encoders1 test example to work in the Arduino environment. First, you would need to create a new sketch and include the PololuWheelLibrary at the top (by selecting Sketch > Import LIbrary > PololuWheelEncoders), which will give you access to the class methods. You can call the PololuWheelEncoders’ functions one of two ways:

PololuWheelEncoders encoders; // instantiate an encoder object


PololuWheelEncoders::init(16,17,18,19); // call the method statically

(If you do not know, according to the Arduino numbering, pins 16, 17, 18, and 19 correspond to port C pins PC2, PC3, PC4, and PC5.)

I suggest looking at the “Wheel Encoders” section of the AVR Library Command Reference guide for documentation on the library’s C and C++ methods. From there, you can port the wheel-encoders1 code in to your Arduino sketch.

Alternatively, you might consider using an Arduino quadrature encoder library. You might find this Arduino page about rotary encoders helpful.

- Amanda

YEEESSSS!!! Thanks you so much! I can finally resolve the problem. Thanks you!