{"id":629,"date":"2023-03-17T22:26:21","date_gmt":"2023-03-17T22:26:21","guid":{"rendered":"http:\/\/bussigel.com\/newinstruments\/?page_id=629"},"modified":"2025-10-24T01:32:29","modified_gmt":"2025-10-24T05:32:29","slug":"analog-inputs","status":"publish","type":"page","link":"https:\/\/bussigel.com\/sonicarts\/analog-inputs\/","title":{"rendered":"analog inputs"},"content":{"rendered":"\n<div style=\"height:50px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">Unlike Digital Inputs which only transmit two values (On and Off, or High and Low), Analog Inputs are continuous sensors that&nbsp;send&nbsp;a range of values.&nbsp;Analog inputs are great for variable control of parameters like speed, volume, or saturation.&nbsp; The pictures below show how to connect a potentiometer and a photocell, typical Analog Inputs. There are a ton of different types of analog inputs. Some&nbsp;of the more complicated sensors are difficult to connect and use over MIDI, but the majority of analog sensors will work. For more detail, see the&nbsp;<a rel=\"noreferrer noopener\" href=\"https:\/\/www.pjrc.com\/teensy\/tutorial4.html\" target=\"_blank\">Analog Input tutorial<\/a>&nbsp;on the Teensy website (or search for any of the million arduino resources on the topic).<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"716\" src=\"http:\/\/bussigel.com\/sonicarts\/wp-content\/uploads\/2025\/09\/3.png\" alt=\"\" class=\"wp-image-746\" style=\"width:398px;height:auto\" srcset=\"https:\/\/bussigel.com\/sonicarts\/wp-content\/uploads\/2025\/09\/3.png 1024w, https:\/\/bussigel.com\/sonicarts\/wp-content\/uploads\/2025\/09\/3-300x210.png 300w, https:\/\/bussigel.com\/sonicarts\/wp-content\/uploads\/2025\/09\/3-768x537.png 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A potentiometer is a variable resistor that usually has three legs. Connect one outer leg to power and the other to ground. The middle leg connects to an Analog Input Pin, in this case A0. Here is the code for using an Analog input\u2026<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ Instantiate an array of CCPotentiometer objects that send \n\/\/ MIDI CC messages when an analog sensor is changed (0-127) \nCCPotentiometer potentiometers&#91;]{ \n{ A0, 16}, \/\/ Analog pin (A0) connected to potentiometer, midi controller number (16) \n{ A1, 17}, \/\/ Analog pin (A1)connected to light dependant resistor (LDR), midi ontroller number (17)} \n};<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Once again, we start by creating an object, this time it\u2019s called CCPotentiometer and then we create a bunch of them by creating an array of potentiometers. Again, this initial code will stay the same, regardless of how many analog inputs you add! On the next line we specify a pin number, A0, and then tell the arduino what channel to send information on, in this case 16. So the arduino will send Midi control messages\u2013 a range of messages between 0-127, on channel 16.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"778\" src=\"http:\/\/bussigel.com\/sonicarts\/wp-content\/uploads\/2025\/09\/4.png\" alt=\"\" class=\"wp-image-747\" style=\"width:424px;height:auto\" srcset=\"https:\/\/bussigel.com\/sonicarts\/wp-content\/uploads\/2025\/09\/4.png 1024w, https:\/\/bussigel.com\/sonicarts\/wp-content\/uploads\/2025\/09\/4-300x228.png 300w, https:\/\/bussigel.com\/sonicarts\/wp-content\/uploads\/2025\/09\/4-768x584.png 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The photocell does require a 10K resistor, which connects one of the legs to ground. The other leg is connected to&nbsp; power&nbsp; and the leg with the resistor is also connected to an Analog Input Pin, in this case A1. <em>Now both of them together\u2026<\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"723\" src=\"http:\/\/bussigel.com\/sonicarts\/wp-content\/uploads\/2025\/09\/5.png\" alt=\"\" class=\"wp-image-748\" style=\"width:406px;height:auto\" srcset=\"https:\/\/bussigel.com\/sonicarts\/wp-content\/uploads\/2025\/09\/5.png 1024w, https:\/\/bussigel.com\/sonicarts\/wp-content\/uploads\/2025\/09\/5-300x212.png 300w, https:\/\/bussigel.com\/sonicarts\/wp-content\/uploads\/2025\/09\/5-768x542.png 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Expanding Analog Sensing<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">There are various analog sensor types with a variety of applications in electronics design, interactive installations and objects, instrument building, and automation.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\" id=\"environmentalsensors\">Environmental Sensors<\/h5>\n\n\n\n<p class=\"wp-block-paragraph\">Environmental sensors monitor physical conditions such as light, temperature, motion, and humidity. These sensors are great for making real-time monitoring systems.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Sensor Type<\/th><th>Example<\/th><th>Function<\/th><\/tr><\/thead><tbody><tr><td><a href=\"https:\/\/stevezafeiriou.com\/esp32-dht22-sensor-setup\/\" target=\"_blank\" rel=\"noreferrer noopener\">Temperature Sensor &amp; Humidity Sensor<\/a><\/td><td>DHT22<\/td><td>Measures temperature and humidity<\/td><\/tr><tr><td>Light Sensor<\/td><td>LDR<\/td><td>Monitors ambient brightness<\/td><\/tr><tr><td>Pressure Sensor<\/td><td>BMP280<\/td><td>Detects air pressure changes<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"motionandproximitysensors\">Motion and Proximity Sensors<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Motion and proximity sensors detect movement and spatial presence, making them ideal for systems that react to human interaction or object detection.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Sensor Type<\/th><th>Example<\/th><th>Function<\/th><\/tr><\/thead><tbody><tr><td>PIR Sensor<\/td><td>HC-SR501<\/td><td>Detects human movement<\/td><\/tr><tr><td><a href=\"https:\/\/stevezafeiriou.com\/hc-sr04-ultrasonic-sensor-setup\/\" target=\"_blank\" rel=\"noreferrer noopener\">Ultrasonic Sensor<\/a><\/td><td>HC-SR04<\/td><td>Measures distance using sound waves<\/td><\/tr><tr><td>IR Sensor<\/td><td>Sharp GP2Y0A21YK<\/td><td>Senses nearby objects<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">These sensors are frequently used in security systems, interactive installations, and robotics.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"touchandforcesensors\">Touch and Force Sensors<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Touch and force sensors detect physical contact or pressure, providing input for interactive installations, responsive displays, and haptic feedback systems.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Sensor Type<\/th><th>Example<\/th><th>Function<\/th><\/tr><\/thead><tbody><tr><td>Touch Sensor<\/td><td>Grove \u2013 Touch Sensor<\/td><td>Detects contact and near-touch interactions<\/td><\/tr><tr><td>Force Sensor<\/td><td>FSR<\/td><td>Measures applied pressure<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"soundandvibrationsensors\">Sound and Vibration Sensors<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Sound and vibration sensors respond to audio levels and physical motion, allowing for the creation of projects that react to sound or movement.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Sensor Type<\/th><th>Example<\/th><th>What It Does<\/th><\/tr><\/thead><tbody><tr><td>Microphone Sensor<\/td><td>KY-037<\/td><td>Detects sound intensity<\/td><\/tr><tr><td><a href=\"https:\/\/stevezafeiriou.com\/arduino-haptic-feedback-art\/\" target=\"_blank\" rel=\"noreferrer noopener\">Vibration Sensor<\/a><\/td><td>SW-18020P<\/td><td>Captures vibrations and movement<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">These sensors are frequently used in audio-responsive installations, musical interfaces, and motion-sensitive systems.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"positionandnavigationsensors\">Position and Navigation Sensors<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Position and navigation sensors track location, orientation, and movement, making them valuable for motion tracking, robotics, and interactive installations.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Sensor Type<\/th><th>Example<\/th><th>Function<\/th><\/tr><\/thead><tbody><tr><td><a href=\"https:\/\/stevezafeiriou.com\/esp32-gps-module-setup\/\" target=\"_blank\" rel=\"noreferrer noopener\">GPS Sensor<\/a><\/td><td>NEO-6M<\/td><td>Provides geolocation data<\/td><\/tr><tr><td><a href=\"https:\/\/stevezafeiriou.com\/mpu6050-sensor-setup\/\" target=\"_blank\" rel=\"noreferrer noopener\">Gyroscope &amp; Accelerometer<\/a><\/td><td>MPU6050<\/td><td>Measures movement across six axes<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">For further applications, see how these integrate with <a href=\"https:\/\/stevezafeiriou.com\/arduino-nano\/\" target=\"_blank\" rel=\"noreferrer noopener\">Arduino Nano<\/a> or an <a href=\"https:\/\/stevezafeiriou.com\/esp32-pinout\/\" target=\"_blank\" rel=\"noreferrer noopener\">esp32<\/a> for compact, location-based projects.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"specializedsensors\">Other Sensors<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">There are other sensors that serve specific functions, from detecting gases to thermal imaging, expanding the scope to near infinite potentials.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Sensor Type<\/th><th>Example<\/th><th>Function<\/th><\/tr><\/thead><tbody><tr><td>Infrared Sensor<\/td><td>MLX90614<\/td><td>Measures infrared radiation for heat detection<\/td><\/tr><tr><td>Gas Sensor<\/td><td>MQ-135<\/td><td>Detects gas concentrations<\/td><\/tr><tr><td><a href=\"https:\/\/stevezafeiriou.com\/dfrobot-max30102-heart-rate-and-oximeter-sensor-setup\/\" target=\"_blank\" rel=\"noreferrer noopener\">Heart rate &amp; Oxymeter<\/a><\/td><td>MAX30102<\/td><td>Detects heart rate and oxygen levels<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">These sensors are commonly used in environmental monitoring, industrial applications, and safety systems.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Unlike Digital Inputs which only transmit two values (On and Off, or High and Low), Analog Inputs are continuous sensors that&nbsp;send&nbsp;a range of values.&nbsp;Analog inputs are great for variable control of parameters like speed, volume, or saturation.&nbsp; The pictures below show how to connect a potentiometer and a photocell, typical Analog Inputs. There are a &hellip; <a href=\"https:\/\/bussigel.com\/sonicarts\/analog-inputs\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">analog inputs<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-629","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/bussigel.com\/sonicarts\/wp-json\/wp\/v2\/pages\/629","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bussigel.com\/sonicarts\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/bussigel.com\/sonicarts\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/bussigel.com\/sonicarts\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bussigel.com\/sonicarts\/wp-json\/wp\/v2\/comments?post=629"}],"version-history":[{"count":2,"href":"https:\/\/bussigel.com\/sonicarts\/wp-json\/wp\/v2\/pages\/629\/revisions"}],"predecessor-version":[{"id":859,"href":"https:\/\/bussigel.com\/sonicarts\/wp-json\/wp\/v2\/pages\/629\/revisions\/859"}],"wp:attachment":[{"href":"https:\/\/bussigel.com\/sonicarts\/wp-json\/wp\/v2\/media?parent=629"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}