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.
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).
With an external clock you can drive the ADC and use it without the EOC pin:
If you use the library please give me some feedback and I welcome all pull requests on github for improvements to it.