{"id":143,"date":"2014-09-27T01:35:15","date_gmt":"2014-09-27T01:35:15","guid":{"rendered":"http:\/\/itp.fromjia.com\/?p=143"},"modified":"2014-09-27T01:35:15","modified_gmt":"2014-09-27T01:35:15","slug":"lab-3-analog-output","status":"publish","type":"post","link":"http:\/\/itp.fromjia.com\/?p=143","title":{"rendered":"Lab 3: Analog Output"},"content":{"rendered":"<p>This week&#8217;s lab was about analog output. An example of an analog output is the change of brightness in a lamp. A digital output would merely turn the lamp on or off in this instance. A micro-controller such as an Arduino is digital and can only take digital inputs and produce digital outputs. Last week we learned that micro-controllers use an <em>analog-to-digital converter <\/em>(ADC) to take analog inputs.<\/p>\n<p>For analog output, the micro-controller creates pseudo-analog voltage with <em>pulse width modulation<\/em> (PWM). This means that the micro-controller basically fakes an analog voltage by producing a series of digital voltage pulses at regular intervals that are so fast (at micro or even nano seconds) it would be perceived as a varying voltage by the output device and humans. \u00a0What is really varying is the<em> effective\u00a0voltage<\/em> produced by these pulses. The effective\u00a0voltage changes depending on the ratio between the <em>pulse width &#8211;\u00a0<\/em>the period of high pulse &#8211; and the period of low pulse.<\/p>\n<div id=\"attachment_145\" style=\"width: 810px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/itp.fromjia.com\/wp-content\/uploads\/2014\/09\/pwm.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-145\" class=\"size-full wp-image-145\" src=\"http:\/\/itp.fromjia.com\/wp-content\/uploads\/2014\/09\/pwm.jpg\" alt=\"Pulse width modulation.\" width=\"800\" height=\"200\" srcset=\"http:\/\/itp.fromjia.com\/wp-content\/uploads\/2014\/09\/pwm.jpg 800w, http:\/\/itp.fromjia.com\/wp-content\/uploads\/2014\/09\/pwm-300x75.jpg 300w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/a><p id=\"caption-attachment-145\" class=\"wp-caption-text\">Pulse width modulation.<\/p><\/div>\n<p>For the lab, we changed the state of a servo motor and the tone produced by a\u00a0<a class=\"urllink\" href=\"http:\/\/arduino.cc\/documents\/datasheets\/PIEZO-PKM22EPPH4001-BO.pdf\" rel=\"nofollow\">Piezo capsule<\/a>\u00a0through analog output from the Arduino. The servo motor output was done through PWM, turning the motor 180 degrees each time. The tone change was through change in frequency. This is different from PWM in that the series of digital voltage pulses are not produced in regular intervals; instead the total width from low pulse to high pulse back to low changes, resulting in\u00a0differing frequencies which in turn is perceived as changing\u00a0tones to our ears.<\/p>\n<div id=\"attachment_146\" style=\"width: 522px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/itp.fromjia.com\/wp-content\/uploads\/2014\/09\/frequency.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-146\" class=\"size-full wp-image-146\" src=\"http:\/\/itp.fromjia.com\/wp-content\/uploads\/2014\/09\/frequency.jpg\" alt=\"Left: PWM. Right: Frequency. \" width=\"512\" height=\"200\" srcset=\"http:\/\/itp.fromjia.com\/wp-content\/uploads\/2014\/09\/frequency.jpg 512w, http:\/\/itp.fromjia.com\/wp-content\/uploads\/2014\/09\/frequency-300x117.jpg 300w\" sizes=\"auto, (max-width: 512px) 100vw, 512px\" \/><\/a><p id=\"caption-attachment-146\" class=\"wp-caption-text\">Left: PWM. Right: Frequency.<\/p><\/div>\n<div id=\"attachment_147\" style=\"width: 740px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/itp.fromjia.com\/wp-content\/uploads\/2014\/09\/Screen-Shot-2014-09-26-at-8.18.02-PM.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-147\" class=\"wp-image-147 size-large\" src=\"http:\/\/itp.fromjia.com\/wp-content\/uploads\/2014\/09\/Screen-Shot-2014-09-26-at-8.18.02-PM-1024x414.png\" alt=\"Servo motor analog output.\" width=\"730\" height=\"295\" srcset=\"http:\/\/itp.fromjia.com\/wp-content\/uploads\/2014\/09\/Screen-Shot-2014-09-26-at-8.18.02-PM-1024x414.png 1024w, http:\/\/itp.fromjia.com\/wp-content\/uploads\/2014\/09\/Screen-Shot-2014-09-26-at-8.18.02-PM-300x121.png 300w, http:\/\/itp.fromjia.com\/wp-content\/uploads\/2014\/09\/Screen-Shot-2014-09-26-at-8.18.02-PM-1200x485.png 1200w, http:\/\/itp.fromjia.com\/wp-content\/uploads\/2014\/09\/Screen-Shot-2014-09-26-at-8.18.02-PM.png 1390w\" sizes=\"auto, (max-width: 730px) 100vw, 730px\" \/><\/a><p id=\"caption-attachment-147\" class=\"wp-caption-text\">Servo motor analog output.<\/p><\/div>\n<p><iframe loading=\"lazy\" src=\"\/\/player.vimeo.com\/video\/107306460\" width=\"500\" height=\"281\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n<p><a href=\"http:\/\/vimeo.com\/107306460\">Analog output: servo motor<\/a> from <a href=\"http:\/\/vimeo.com\/user3471662\">Jiashan Wu<\/a> on <a href=\"https:\/\/vimeo.com\">Vimeo<\/a>.<\/p>\n<div id=\"attachment_149\" style=\"width: 740px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/itp.fromjia.com\/wp-content\/uploads\/2014\/09\/Screen-Shot-2014-09-26-at-8.46.15-PM.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-149\" class=\"size-large wp-image-149\" src=\"http:\/\/itp.fromjia.com\/wp-content\/uploads\/2014\/09\/Screen-Shot-2014-09-26-at-8.46.15-PM-1024x410.png\" alt=\"Controlling the tone with photo sensors.\" width=\"730\" height=\"292\" srcset=\"http:\/\/itp.fromjia.com\/wp-content\/uploads\/2014\/09\/Screen-Shot-2014-09-26-at-8.46.15-PM-1024x410.png 1024w, http:\/\/itp.fromjia.com\/wp-content\/uploads\/2014\/09\/Screen-Shot-2014-09-26-at-8.46.15-PM-300x120.png 300w, http:\/\/itp.fromjia.com\/wp-content\/uploads\/2014\/09\/Screen-Shot-2014-09-26-at-8.46.15-PM-1200x481.png 1200w, http:\/\/itp.fromjia.com\/wp-content\/uploads\/2014\/09\/Screen-Shot-2014-09-26-at-8.46.15-PM.png 1372w\" sizes=\"auto, (max-width: 730px) 100vw, 730px\" \/><\/a><p id=\"caption-attachment-149\" class=\"wp-caption-text\">Controlling the tone with photo sensors.<\/p><\/div>\n<p><iframe loading=\"lazy\" src=\"\/\/player.vimeo.com\/video\/107307041\" width=\"500\" height=\"281\" frameborder=\"0\" webkitallowfullscreen mozallowfullscreen allowfullscreen><\/iframe> <\/p>\n<p><a href=\"http:\/\/vimeo.com\/107307041\">Analog output: tones<\/a> from <a href=\"http:\/\/vimeo.com\/user3471662\">Jiashan Wu<\/a> on <a href=\"https:\/\/vimeo.com\">Vimeo<\/a>.<\/p>\n<p><div id=\"attachment_150\" style=\"width: 740px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/itp.fromjia.com\/wp-content\/uploads\/2014\/09\/Screen-Shot-2014-09-26-at-8.47.34-PM.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-150\" class=\"size-large wp-image-150\" src=\"http:\/\/itp.fromjia.com\/wp-content\/uploads\/2014\/09\/Screen-Shot-2014-09-26-at-8.47.34-PM-1024x417.png\" alt=\"Using the note constants to make a simple keyboard.\" width=\"730\" height=\"297\" srcset=\"http:\/\/itp.fromjia.com\/wp-content\/uploads\/2014\/09\/Screen-Shot-2014-09-26-at-8.47.34-PM-1024x417.png 1024w, http:\/\/itp.fromjia.com\/wp-content\/uploads\/2014\/09\/Screen-Shot-2014-09-26-at-8.47.34-PM-300x122.png 300w, http:\/\/itp.fromjia.com\/wp-content\/uploads\/2014\/09\/Screen-Shot-2014-09-26-at-8.47.34-PM-1200x489.png 1200w, http:\/\/itp.fromjia.com\/wp-content\/uploads\/2014\/09\/Screen-Shot-2014-09-26-at-8.47.34-PM.png 1364w\" sizes=\"auto, (max-width: 730px) 100vw, 730px\" \/><\/a><p id=\"caption-attachment-150\" class=\"wp-caption-text\">Using the note constants to make a simple keyboard.<\/p><\/div><br \/>\n<iframe loading=\"lazy\" src=\"\/\/player.vimeo.com\/video\/107307174\" width=\"500\" height=\"281\" frameborder=\"0\" webkitallowfullscreen mozallowfullscreen allowfullscreen><\/iframe> <\/p>\n<p><a href=\"http:\/\/vimeo.com\/107307174\">Analog output: tones2<\/a> from <a href=\"http:\/\/vimeo.com\/user3471662\">Jiashan Wu<\/a> on <a href=\"https:\/\/vimeo.com\">Vimeo<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This week&#8217;s lab was about analog output. An example of an analog output is the change of brightness in a lamp. A digital output would merely turn the lamp on or off in this instance. A micro-controller such as an Arduino is digital and can only take digital inputs and produce digital outputs. Last week [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-143","post","type-post","status-publish","format-standard","hentry","category-physical-computing"],"_links":{"self":[{"href":"http:\/\/itp.fromjia.com\/index.php?rest_route=\/wp\/v2\/posts\/143","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/itp.fromjia.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/itp.fromjia.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/itp.fromjia.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/itp.fromjia.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=143"}],"version-history":[{"count":4,"href":"http:\/\/itp.fromjia.com\/index.php?rest_route=\/wp\/v2\/posts\/143\/revisions"}],"predecessor-version":[{"id":164,"href":"http:\/\/itp.fromjia.com\/index.php?rest_route=\/wp\/v2\/posts\/143\/revisions\/164"}],"wp:attachment":[{"href":"http:\/\/itp.fromjia.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=143"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/itp.fromjia.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=143"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/itp.fromjia.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=143"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}