Orangutan X2 multiple devices serial or PWM?

Hi,

I am currently working with an Orangutan X2 and am wondering if it is possible to connect more than one serial device to it.

I have interfaced a uMMC Serial Data Module from Rogue Robotics on PD0 (RXD) PD1 (TXD). But now I would like to add another device like the TMP102 is it possible ??

I was originally looking into using this temperature sensor MLX90614 but I cant use it since the LCD screen is connected to the PC0 (SCL) and PC1 (SDA) ports :confused:

I read some posts that it is possible to free up the ports by using the lcd in 4bit mode but…
Any advice would be apreciated.

Thanks

Hello.

If your Orangutan X2 has an ATmega644P, it has two hardware UART modules (PD0 and PD1 are UART0 and PD1 and PD2 are UART1). If it is an older Orangutan X2 with an ATmega644, it only has one hardware UART module. Can you read the part number on the microcontroller? The Pololu AVR library makes it easy to use both UARTs on the Orangutan X2 if you have one with the ATmega644P.

You can free up the I2C lines (PC0 and PC1) by using the LCD in 4-bit mode. You can use the Orangutan SVP LCD code from the Pololu AVR library as a reference. You should also note that the MLX90614 can be configured to output a PWM signal representing the temperature reading, which lets you use it without I2C.

- Ben

Hi Ben,

Sorry for the lag in my reply, this project got pushed aside by “life” :slight_smile:

After taking my modules apart my controller is an ATmega644… Boo.
Yes I saw that the sensor can be setup with PWM, but I skimmed over it since I have never done this. The SMBus method seemed easier and had some example code. pololu.com/docs/0J33/all

Any tips or example code for setup of this sensor in PWM mode?

Thanks in advance.
Chris

We don’t have any example code for setting the sensor to PWM mode, but the details are covered in the documentation. If you have any questions about the documentation, please ask. Another option is for you to go with a serial sensor and use software serial to communicate with it. There are a number of software serial libraries out there for the AVR if you google around (you could probably port the NewSoftSerial Arduino library pretty easily).

- Ben

I think I found some stuff to read and mess with.

Possible working example of PWM read.
lynxmotion.net/viewtopic.php … 8&start=15

Serial option
arduiniana.org/libraries/NewSoftSerial/

Will keep you posted of my progress.
Thanks Ben for all your help.
Chris

Good luck. If you run into any trouble, please let us know.

- Ben

Well here is an update…

I received the sensors, modified the libraries so the lcd is in 4 bit mode.
I copied the code from the help page:
pololu.com/docs/0J33/all

Modified the port numbers for my Orangutan X2
PORTC = (1 << PORTC1) | (1 << PORTC0);

I connected my sensor to JP8
Pin7 (db0) => PC0 (SCL)
Pin8 (db1) => PC1 (SDA)
Pin1 => Vss (ground)
Pin2 => Vdd (+5v)

But the program stays stuck in an infinite loop in the function:
void i2c_start() {
TWCR = (1 << TWINT) | (1 << TWSTA) | (1 << TWEN); // send start condition
while (!(TWCR & (1 << TWINT))); //<-- stays stuck here!
}

Any Ideas why?
Seems to be waiting for a reply and not getting any…arrgg. Tried flipping the wires other pins etc… Not working. :frowning:

I will try the PWM mode, maybe I will have better luck with it.

Thanks for your help in advance.
Chris