K'NEK-TEK

A webpage to document and share my open-source software/hardware projects.

Home » MAX1067 library for Arduino

MAX1067 library for Arduino

For the laser seismograph project, I had chosen the MAX1067 analog to digital converter (ADC) to convert the analog signals coming out of the photodiodes into a digital form which could be transmitted over SPI to the microcontroller. Although I knew how SPI worked and had studied it in school, I had never actually designed and implemented a system using SPI before so I had a short learning curve. There were no code examples anywhere on the web or at Maxim (the chip manufacturer) for using this chip or its sibling the MAX1068.

To address that lack I took the code I got working and made it in to a library for the Arduino, so that people can refer to this code example in the future. The code is available at https://github.com/Erik-k/MAX1067 . The repository includes sample code for the Arduino UNO which will run right out of the box. The only modifications necessary for running this on other devices are changing the SPI pins, most of which is handled by the Arduino libraries but you’ll need to choose a GPIO to use for the EOC (End of Calculation) pin.

This excerpt from the datasheet shows how to hook up the chip, using the same voltage level for both analog and digital supplies (the chip can handle different voltages for each, either 5V or 3V3 logic).

 

This is the configuration register, showing the position and meaning of each bit in the byte. Gotta send this anytime you want the chip to do anything!

 

And from the next page in the datasheet, this gives an explanation of what each bit in the opcode means and how to choose the opcode to do what you want.

The speed of the SPI communication can be increased up to a 4.8MHz clock in the SPI setup for higher data rates.

Remember that if you are using an internal clock (the ADC will use its onboard clock), you need to be careful about the timing on the EOC pin. This is handled in the library but I point it out here to make it clear that you will need more than the normal 4 SPI pins (MOSI, MISO, CLK, SS).

End-Of-Calculation pin behavior

With an external clock you can drive the ADC and use it without the EOC pin:

Timing with an external clock on the ADC. No EOC pin needed.

If you use the library please give me some feedback and I welcome all pull requests on github for improvements to it.

Leave a Reply

Your email address will not be published. Required fields are marked *