Hello Everyone, This is Yuvraj Jain. I've recently graduated from my BTech in Electronics and Communication and I wanted to share what I did for my thesis with the community.
My thesis can be found on my Github (here). Further schematics and documentation are available in the previously linked repository, if members are interested. I designed a system of Arduino MKR Zeros communicating using IR pulses transferred using reflections inside a copper data pipe. The aim of the system was to provide a low cost, "expendable" data acquisition and backup system that could be used for ground testing of solid rocket motors. The PCBs for the Mother and Daughter Nodes were machined inhouse on a mini CNC mill.
While the range of the system was horrible because the pipes were not polished enough, there were multiple programming advancements I made with the microcontrollers. I wrote and optimized a custom SPI driver to augment the speed of the SdFat Library for Data Acquisition (DAQ) and Data Backup Applications. You can see some benchmarks below.
I hope that members of this forum can test the driver I wrote for other MKR series boards and let me know if there are issues. I might try to fix them. The library is hosted on Github (here). I used PlatformIO for its testing and incorporation into other sketches.
I believe that the MKR Zero is uniquely suited for DAQ applications due to its fast, differential and precise ADC. The onboard SDCard slot makes for a very compact package which can log a wide range of signals and store/process them. I'm posting Github links to the code because the sketches are lengthy. I have a repository of all the code that I used for my Thesis and there is a sketch dedicated to 4/6 Channel DAQ at 5KHz/Channel. It makes heavy use of DMA and Embedded C, along with using my HW SPI driver inside the SdFat Library. The generated binary files can be plotted and post processed in GNU Octave using the .m files supplied with the project. The image below shows logged waveforms during testing with a 5 KHz 200 mVpp Triangular Wave generated by signal generator in a laboratory.
I hope that the code I wrote during my Thesis for the DAQ, the Mother and Daughter Nodes and the HW SPI driver is of use to members of this community. I make extensive use of HW specific, register based coding to optimize system performance and I have made every effort to document the code in the different sketches.
Thank you for reading through this and if there are queries, I'm happy to help.
TLDR: New HW SPI driver for MKR Zero boosts SdFat Library performance. Multichannel Data Acquisition at 5KHz with good reproduction in post is reported. The ADC, DMA, SPI and Misc. peripherals are programmed using register based coding for maximum performance. The code for everything is freely available and linked above.