Home made 9 DOF IMU

Inertial measurement units (IMU) are commonly used where position, motion information must be processed. It is commonly 9 degrees of freedom (DOF) modules used that include LSM303 3 axis accelerometer and 3 axis magnetometer, ITG-3200 3 axis gyro. These are considered enough for precisely calculating position of board carrying all sensors. Amandaghassaei was working on project where orientation information was needed. So instead of purchasing available board, he built one which saved a bit of money, but mos importantly had all he needed.

He included Atmega328p microcontroller which reads all sensor data and then can send it through I serial interface. He made 6 pin header to accept standard FTDI interface module. PCB was fabricated by using milling machine. Milling and soldering was a bit challenging since footprints of both sensor chips are really tiny.

Compiling Arduino code for PIC32

Programming PIC microcontrollers using Arduino code style isn’t something new. We are already familiar with ChipKit development boards from Digilent and their Arduino like development environment called mpide. Tom Kibalo suggests using MPLAB IDE to develop and use Arduino code for PIC32 microcontrollers. He has been developing Arduino library code for PIC32.


Most agree that Arduino IDE environment sucks for making more serious projects, so different options are always welcome. For instance by using MPLAB X IDE you can be way more productive with all tools it provides. Arduino library for PIC provides most of Arduino specific functions and there fore most of Arduino code can be executed on PIC same way using simple wrapper code.

Extend Your DAC Resolution

IF you have used any of the microcontroller, you must have gone through the pain of limited DAC resolution which at some point of time must have forced you to use an external DAC, which is a little complicated to code. You can obviously extend the range of the DAC by using a sigma-delta converter on the software side but it can be a bit slowly. To extend the DAC, a LTC1665 8-bit 8-channel DAC and a 8-bit 6-channel digital potentiometer with a nominal resistance of 10K is used. Since the current flowing through the potentiometer is in the sub-µA range, a precision rail-to-rail opamp (AD8603) is added as a voltage follower to ensure the accuracy of the voltage divider.


The resolution is extended by using two DAC with a potentiometer using which we can adjust the output voltage continuously. If the potentiometer is replaced by a digital one the number of bits at the output is effectively the sum of the DAC resolution and that of the digital potentiometer. The effective output is that we have a 16 bit resolution at a cheaper cost. For those interested, a circuit diagram along with the schematic has been provided with the project.

Resetting Arduino via serial line

Normally Arduino boards are reset by using additional DTR line of serial interface. This becomes a problem when USB-UART adapter doesn’t support DDR line. And you probably read many cases were one or another particular cable won’t work for programming, but can be used for simple serial data transfers. Ralph thought that there should be another solution that would allow using any serial cable for programming. He thought that TXD and RXD lines are always available since they are used for data receive and transmit. So why not to use one of those to reset microcontroller.


With three additional discretes he created a simple circuit that would stand between RXD data line and RST pin. This is simply an RC circuit that would discharge cap during some time. So when data line works in normal operation – RSTin isn’t affected due to slow cap discharge. But when RST signal is held down for longer time – cap is discharged and then RST signal is sent. Since he’s done modifications, he also had to do changes in AVRDude configs. That turned out to be fairly easy. Overall this is quit smart solution that could be considered as option on any Arduino board, so we wouldn’t need to hunt for specific serial adapter cables.