{"id":17826,"date":"2016-12-09T10:37:48","date_gmt":"2016-12-09T18:37:48","guid":{"rendered":"https:\/\/blog.digilentinc.com\/?p=17826"},"modified":"2021-06-11T11:00:39","modified_gmt":"2021-06-11T18:00:39","slug":"custom-function-generator-community-project","status":"publish","type":"post","link":"https:\/\/digilent.com\/blog\/custom-function-generator-community-project\/","title":{"rendered":"Custom Function Generator- Community Project"},"content":{"rendered":"<p>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.<\/p>\n<p>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\u00a0<a href=\"https:\/\/digilent.com\/shop\/nexys-4-ddr-artix-7-fpga-trainer-board-recommended-for-ece-curriculum\/\">Nexys 4 DDR<\/a>!<\/p>\n<p>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.<\/p>\n<p>Going into the project his design criteria were as follows:<\/p>\n<ul>\n<li>The future function generator must be driven by the PC (Matlab specifically), to provide an\u00a0option to synchronize the camera and the galvo-mirror;<\/li>\n<li>To convert a digital command into the analog one, I will need a digital-to-analog converter;<\/li>\n<li>To get the galvo-mirror position feedback signal, I will need an analog-to-digital converter;<\/li>\n<li>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.<\/li>\n<\/ul>\n<p>As far as the choice between a microcontroller or and FPGA he quoted:<\/p>\n<blockquote><p>&#8220;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\u2019s simply a programmable hardware, capable of executing a few operations in parallel.&#8221;<\/p><\/blockquote>\n<p>In addition to his established criteria, he had the following materials at his disposal for this project:<\/p>\n<ul>\n<li>PC with Matlab and USB port (DTE \u2013 Data Terminal Equipment);<\/li>\n<li>FPGA board <a href=\"https:\/\/digilent.com\/shop\/nexys-4-ddr-artix-7-fpga-trainer-board-recommended-for-ece-curriculum\/\">Nexys 4 DDR board<\/a> (with UART\/JTAG USB port and couple of Pmod ports);<\/li>\n<li>DAC PmodDA4;<\/li>\n<li>ADC PmodAD2;<\/li>\n<li>USB A to micro-B cable; * 2&#215;6 Pin cable; * 2 2&#215;6 headers.<\/li>\n<\/ul>\n<figure id=\"attachment_17969\" aria-describedby=\"caption-attachment-17969\" style=\"width: 600px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-17969 size-medium\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/12\/fgen-600x288.png\" width=\"600\" height=\"288\" data-wp-pid=\"17969\" srcset=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/12\/fgen-600x288.png 600w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/12\/fgen-768x369.png 768w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/12\/fgen-1024x492.png 1024w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/12\/fgen-702x336.png 702w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/12\/fgen-800x384.png 800w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/12\/fgen.png 1057w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><figcaption id=\"caption-attachment-17969\" class=\"wp-caption-text\">The Finite State Machine diagram for the Custom Function Generator.<\/figcaption><\/figure>\n<p>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.<\/p>\n<p>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!<\/p>\n<figure id=\"attachment_17971\" aria-describedby=\"caption-attachment-17971\" style=\"width: 600px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-17971 size-medium\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/12\/30-600x437.jpg\" width=\"600\" height=\"437\" data-wp-pid=\"17971\" srcset=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/12\/30-600x437.jpg 600w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/12\/30.jpg 624w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><figcaption id=\"caption-attachment-17971\" class=\"wp-caption-text\">Figure 30.<\/figcaption><\/figure>\n<blockquote><p>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 <a href=\"http:\/\/www.analog.com\/media\/en\/technical-documentation\/data-sheets\/AD7991_7995_7999.pdf\">datasheet<\/a>), but unfortunately I didn\u2019t 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\u2019s concept and implement it using the \u201cbigger\u201d data converters with a very few modifications.<\/p><\/blockquote>\n<p>Make sure to check out the entire page project report, which can be found on our reference site on the <a href=\"https:\/\/digilent.com\/reference\/programmable-logic\/nexys-4-ddr\/start?redirect=1\">Nexys 4 DDR page<\/a>!<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-17973\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/12\/snip-600x135.png\" alt=\"\" width=\"724\" height=\"163\" data-wp-pid=\"17973\" srcset=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/12\/snip-600x135.png 600w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/12\/snip-768x173.png 768w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/12\/snip-800x180.png 800w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/12\/snip.png 823w\" sizes=\"auto, (max-width: 724px) 100vw, 724px\" \/><\/p>\n<div class='watch-action'><div class='watch-position align-left'><div class='action-like'><a class='lbg-style6 like-17826 jlk' data-task='like' data-post_id='17826' data-nonce='ac068a413b' rel='nofollow'><img src='https:\/\/digilent.com\/blog\/wp-content\/plugins\/wti-like-post-pro\/images\/pixel.gif' title='Like' \/><span class='lc-17826 lc'>0<\/span><\/a><\/div><div class='action-unlike'><a class='unlbg-style6 unlike-17826 jlk' data-task='unlike' data-post_id='17826' data-nonce='ac068a413b' rel='nofollow'><img src='https:\/\/digilent.com\/blog\/wp-content\/plugins\/wti-like-post-pro\/images\/pixel.gif' title='Unlike' \/><span class='unlc-17826 unlc'>0<\/span><\/a><\/div><\/div> <div class='status-17826 status align-left'>Be the 1st to vote.<\/div><\/div><div class='wti-clear'><\/div>","protected":false},"excerpt":{"rendered":"<p>A Digilent community member shares his Custom Function Generator project!<\/p>\n","protected":false},"author":36,"featured_media":17971,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4327,35,1561],"tags":[1662,95],"ppma_author":[4485],"class_list":["post-17826","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-projects","category-fpga","category-applications","tag-fpga","tag-projects"],"jetpack_featured_media_url":"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/12\/30.jpg","jetpack_sharing_enabled":true,"authors":[{"term_id":4485,"user_id":36,"is_guest":0,"slug":"mirandamay7","display_name":"Miranda Hansen","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/bcab037c32924b9f9b3ca4898e179f2764cb7d9a82aa2bd475170c8aaa884e1c?s=96&d=mm&r=g","1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":"","9":"","10":""}],"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/posts\/17826","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/users\/36"}],"replies":[{"embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/comments?post=17826"}],"version-history":[{"count":0,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/posts\/17826\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/media\/17971"}],"wp:attachment":[{"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/media?parent=17826"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/categories?post=17826"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/tags?post=17826"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/ppma_author?post=17826"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}