Can the Orangutan be used to interface with clinometer?

Hello All,

I am currently working on a laser alignment project. I have a ceramic tilt sensor that measures the angle with respect to the Y-axis. The tilt sensor is fed into a small interface board. The interface board outputs the data in RS232 format. With the use of HyperTerminal, one can view the realtime measurement data. I am trying to develop a way to output the measurement data to an LCD so as to have a self-contained unit w/o a PC. I would need to format the RS232 output to make it look nice. To do this, I would most likely need to send the data to a micro-controller, format the data there, then send to an LCD display. It has been suggested that I use the Orangutan controller since it has a 2-line 8 char. LCD and can be programmed using the highly recommended AVR/gcc C language programming environment (free of charge). I am looking to get comments/suggestions on my application. Ideally, I would need to program the Orangutan through an RS232/USB interface, then be able to plug my tilt sensor RS232 cable into the Orangutan and have the program run continuously. The Orangutan would be programmed accordingly to continually display the data from the tilt sensor. I appreciate the feedback. Thank you.

Yeah, one of the reasons the Orangutan caught my eye originally was the nice compact integrated LCD, which is at best an optional peripheral on most other microcontroller boards.

Do you have a make/model you could post of your tilt sensor and interface board? The ATMega168 chip on the Orangutan has serial hardware which could receive the data from your board, but it is expecting voltages from 0 to 5 volts, and the RS-232 standard voltages are much higher than that. There may be a simple way to connect them (i.e. if the interface board has other output possibilities). Depending on the way your board generates RS-232 you could also build a level shifter or inverter circuit to connect them with a transistor and a couple of resistors. I’m assuming here that you only need one way communication, from your sensor to the Orangutan.

In addition to the Orangutan you will also need an AVR programmer, like the AVRISP mkII from Atmel, or the Pololu Orangutan Programmer (or you could maybe borrow a programmer from the friend who suggested the Orangutan to you).

-Adam

Adam,

Thanks for the questions and comments. I have posted two links below, one for the datasheet on the tilt sensor and one for the datasheet on the tilt sensor controller.

https://share.adobe.com/adc/document.do?docid=cd83363c-e62c-11dc-90d1-1949ef310714
https://share.adobe.com/adc/document.do?docid=cfb6b84a-e62c-11dc-90d1-1949ef310714

I also just measured the voltages at the RS232 output on the tilt sensor controller. I measured 10.1V on the TxD line and 4.3-5.3V on the RxD line. And yes, with everything properly programmed, the Orangutan would only be receiving data from the tilt sensor controller. I planned on purchasing the USB programmer along with the LV-168 controller. Thanks again.

Yes, to interface an Orangutan with that board you would need a level shifter chip, or to build your own level shifter circuit, like the one on page 7 of this document (connecting the 10K resistor to your tilt sensor TX line, and the 4.7K resistor to a 5V source on your Orangutan, resistor values don’t need to be precise).

Is there a reason you’re looking at the LV-168 (2V to 5V input) rather than the normal Orangutan (5V to 10V input, not to mention a little cheaper)? What do you plan on using for your portable power source?

-Adam

I selected the LV-168 because of the voltage requirement (2V to 5V). Pololu.com has a nice battery pack (3 AA) that can power the LV-168 and which also has a form-factor that fits the LV-168 footprint. Either Orangutan board would need a level shifter circuit, correct?

Once the Orangutan is properly programmed with the USB controller, the circuit would be as follows:

tilt sensor --> tilt sensor controller --> RS232 --> MAX220 level shifter --> RS232 --> Orangutan controller

Will I encounter any BAUD issues? The tilt sensor controller runs at a set BAUD of 9600. Thanks again Adam.

I guess I’m just curious why you wouldn’t want to run your Orangutan off of the power source for your sensor/interface board, but yes, either would work just fine, and will handle 9600 baud easily (either will also provide regulated 5V for your level shifter).

A MAX-type level shifter would work, but is somewhat overkill. I was actually thinking more of the circuit described lower on that page. Since you only need one-way communication, from a high voltage device to a low voltage device, a single transistor circuit would be a lot simpler (and very similar to the circuit internal to the MAX chips). If you do go with a MAX chip, you might be able to skip the external capacitors, since they are only used to boost and invert voltage to send signals from the low voltage device to the high voltage device (I haven’t tried this so I’m not 100% sure the chip would operate, it might check for the resistors or something).

Just a terminology difference though, what comes out of the level shifter (whatever you use) on the Orangutan side should be TTL level serial (0V to 5V), not RS-232 serial.

-Adam

The tilt sensor interface board is powered (via ribbon cable) through a series of integrated electronics. I wanted to minimize wiring time by isolating the display portion of this project. That is the reason I selected the LV-168/AA battery pack combo.

I see your point on how the MAX-type level shifter is overkill for my application. The terminology I used came from a datasheet on the MAX220 chip. I understand your explanation though. On the Orangutan side the input would be TTL level and not RS232.

I wanted to get your thoughts on this 28-Pin PIC Terminal Development Board I came across on sparkfun.com. This board has an integrated RS232/TTL level shifter ciruit (see schematic) and is cheap as well. The only issue with this dev. board is finding a cost-effective compiler for programming PICs. Thanks again for your comments.

There are good (free) compilers/environments for PICs to be sure, but since there are so many of them (both pay and free) there isn’t as much development standardization. I’m often amazed not just that Atmel gives away a great assembly compiler/programmer/simulator environment, but also in how well they cooperate with the WinAVR guys, both in integrating the WinAVR GCC compiler into AVRStudio, and in little things like providing both assembly and C example code in every datasheet. I’m biased to be sure, but I used PICs before I got started with AVRs, and for that and other reasons I’m glad I switched.

You might want to look instead at a slightly different version of that board from SparkFun, the 20 Pin AVR Development Terminal. It’s almost the same board, for the same price, but wired for a 20 pin AVR instead. It has a 10 pin programming header, which isn’t standard any more, but you could make an adapter for the more modern 6 pin programmers (it’s the same pins with extra grounds and an optional activity LED line). Also, you could probably adapt the Orangutan-Lib LCD code to drive this one by changing the pin definitions to match its wiring.

It doesn’t come with a CPU (nor does the PIC version, although they are both pictured with chips, NAUGHTY!), and some of the recommended ones are oldies, but it’s pin-compatible with the ATTiny2313. ATTiny’s are what they sound like, ATMega cores with less memory and fewer hardware peripherals (for less money), and the 2313 is the ATTiny model with serial hardware. You can get it from SparkFun here for $2.88, which is a little more than elsewhere, but you might as well save on the shipping. The 2313’s are fantastic for little single-purpose sensor/controllers on a serial bus, and should be enough to format serial data and display it on an LCD (not much more though). I used one here to sample a photo-gate tachometer, drive a 7 segment LCD display with the RPM speed, and send the data back to a laptop for logging, which used about half the flash memory.

If you want this board though you better decide quickly though, there’s only one in stock!

-Adam

P.S. If you just want to display numbers the kit I made that 4 digit 7 segment LCD board from retails for $20. It’s meant for an older 20 pin AVR, but with a few minor kludges you can free up the serial pins on a ATTiny2313, and permanently turn on one of the decimal points or hook it to a free pin to make it software selectable. You would also need to build your level shifter circuit, and wire up a programming header (or program the chip off-board in a socket, or my personal favorite, the clip-on programmer!).

That cable looks like it would work fine. I didn’t realize your inclinometer had a actual DB9 port on it, but if you want port and level converter chip together you could also use the Pololu Serial Adapter, which is a bit cheaper, but has no shell/cable to speak of.

I would go with the Orangutan + Pololu programmer too for the reasons you’ve come up with, but just so you know, you can mix and match your compiler/programmer/target board.

You can use AVR Studio to write a program for any of the 8-Bit AVR devices (ATMega168 and ATTiny2313 included), and compile that code into a .hex file.

You can then use an AVRISP programmer, or the Pololu USB programmer (which emulates the AVRISP mkI) to download this .hex file to an AVR directly from AVR Studio. Alternatively you could use PonyProg to download the .hex file generated by AVR Studio to an AVR over a serial port dongle.

I’ve only seen the serial port dongles with 10 pin programming headers, which matches the SparkFun AVR development board. As you would expect, the Pololu USB programmer (like the AVRISP mkII) has a six pin programming header, which matches the Orangutan. The funny thing is that these headers use exactly the same pins and programming protocol to communicate with the target AVRs.

So, in any case you can write code in AVR studio, then you could use the serial dongle with an Orangutan, or the Pololu programmer with the SparkFun AVR development board, you’d just need to rewire the programming header. It’s quite unnecessary, but SparkFun even makes an adapter board for this exact purpose.

-Adam

Have there been problems with the forums lately? I wasn’t able to access forum.pololu.com from about 7am to 11am CST. Just curious because the same thing happened on Mon. (3/3) as well.

So I basically had my options narrowed down to the Orangutan setup I showed you. But then I came across the AVR Butterfly which is a very inexpensive ($19.95) option for my application. The Butterfly basically has everything I need including the RS232 to TTL level conversion. The unit has its own power supply and is equipped with the ATmega169PV which can be programmed with AVRStudio. The only issue with this option the limitation of the 6-character alphanumeric display. I can probably work with this since the only thing I plan to display is the angle offset 0 on the order of 0.01 degrees. The overall footprint of the board (credit card size) is nice too. Any thoughts on this?

I can’t believe I didn’t think of the Butterfly before! I guess it didn’t occur to me since you were looking at bigger, multi-line LCD screens, but if you’re happy with the display I think it’s a great option, especially since you won’t even need a programmer for it (it comes pre-loaded with a serial bootloader). The only problem I can think of is that this forum won’t be much help with it (I don’t have any real butterfly experience at least), but there is plenty of Butterfly support out there.

Or, if you want one place to look to figure everything out, you might take some of the money you saved on the butterfly and pick up a book called “C Programming for Microcontrollers” (from smileymicros.com/) which is an awesome book specifically about AVR programming in C, using the Butterfly for all the examples. It’s even available with a butterfly, and a few other parts you’d want anyway.

And yes, the forums seem to have been a little wonky lately (see the announcements).

-Adam