We recently received an email from a PhD student at Hong Kong Polytechnic University. His name is Alexandr, and his primary area of research is 3D Imaging in optical microscopy. He is currently working on developing and validating optical microscope configuration and data processing techniques so as to allow fast and reliable 3D imaging for label-free intracellular studies. He is also working on making design instrumentation accessible to a wide range of research laboratories.
Despite his optical engineering work, he describes himself as an electrical engineer with some experience in radio frequency electronics and hardware design. He reached out to us to tell us about his new project, a Custom Function Generator with the Nexys 4 DDR!
The project idea came about when he realized that a standard function generator could not be used as a driver for a galvo-mirror in a different project of his and that he needed to look for another solution to get an accurate experimental result.
Going into the project his design criteria were as follows:
- The future function generator must be driven by the PC (Matlab specifically), to provide an option to synchronize the camera and the galvo-mirror;
- To convert a digital command into the analog one, I will need a digital-to-analog converter;
- To get the galvo-mirror position feedback signal, I will need an analog-to-digital converter;
- To effectively transfer command signal from Matlab into the code acceptable for DAC and ADC, I will need a programmable device, either a microcontroller or an FPGA board.
As far as the choice between a microcontroller or and FPGA he quoted:
“The choice between a microcontroller and an FPGA was an easy one for me. Compared to any microcontroller an FPGA board will always have a definite advantage of being faster and more flexible design option, since it’s simply a programmable hardware, capable of executing a few operations in parallel.”
In addition to his established criteria, he had the following materials at his disposal for this project:
- PC with Matlab and USB port (DTE – Data Terminal Equipment);
- FPGA board Nexys 4 DDR board (with UART/JTAG USB port and couple of Pmod ports);
- DAC PmodDA4;
- ADC PmodAD2;
- USB A to micro-B cable; * 2×6 Pin cable; * 2 2×6 headers.
Since it is necessary to synchronize the image capturing with the galvo-mirror positioning for his application, all operations in DTE and DCE are going to be executed sequentially, in the fashion similar to the one shown above.
The whole report includes comprehensive details about his design process and the project. Unfortunately due to its length (19 pages!) we cannot include it in its entirely here. But (spoiler ahead) after an extensive amount of work and experimentation, he finally got the project to behave in the way he intended!
From Figure 30 it can be seen that the error patterns repeats itself continuously, which means that the system is very stable. On the other hand, the error value is not the same for the different command signals, which is, in fact, the result of loading effect from the DAC. Since ADC must be driven by a low impedance source, it will be beneficial to place an input buffer amplifier (see datasheet), but unfortunately I didn’t have any low-power one on hands to do so.However, this little project can be considered successful, since it allowed me to verify the Function Generator’s concept and implement it using the “bigger” data converters with a very few modifications.
Make sure to check out the entire page project report, which can be found on our reference site on the Nexys 4 DDR page!