{"id":380,"date":"2026-07-13T09:23:37","date_gmt":"2026-07-13T08:23:37","guid":{"rendered":"https:\/\/myjetsonnano.perseus314.com\/?p=380"},"modified":"2026-07-13T09:28:12","modified_gmt":"2026-07-13T08:28:12","slug":"6-pin-atoms3u-header-for-2-analogue-input","status":"publish","type":"post","link":"https:\/\/myjetsonnano.perseus314.com\/index.php\/2026\/07\/13\/6-pin-atoms3u-header-for-2-analogue-input\/","title":{"rendered":"6 pin AtomS3U header for 2 analogue input"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code>#include &lt;Arduino.h&gt;\n\n\/\/ Define Header Pin Numbers (GPIO)\nconst int POT_PIN_A = 40;  \/\/ ADC1 (Safe to use with Wi-Fi)\nconst int POT_PIN_B = 42;  \/\/ ADC1 (Safe to use with Wi-Fi)\nconst int POT_PIN_C = 14;  \/\/ ADC2 (Disabled if Wi-Fi is actively running)\nconst int POT_PIN_D = 17;  \/\/ ADC2 (Disabled if Wi-Fi is actively running)\n\nvoid setup() {\n    Serial.begin(115200);\n\n    \/\/ 1. Configure the ADC resolution.\n    \/\/ ESP32-S3 supports up to 12-bit depth, which outputs digital values from 0 to 4095.\n    analogReadResolution(12);\n\n    \/\/ 2. Configure Attenuation (Required for 0 - 3.3V measurement range)\n    \/\/ By default, ESP32 ADCs only read up to ~1V. 11dB expands this to the full 3.3V scale.\n    analogSetPinAttenuation(POT_PIN_A, ADC_ATTEN_DB_11);\n    analogSetPinAttenuation(POT_PIN_B, ADC_ATTEN_DB_11);\n    analogSetPinAttenuation(POT_PIN_C, ADC_ATTEN_DB_11);\n    analogSetPinAttenuation(POT_PIN_D, ADC_ATTEN_DB_11);\n}\n\nvoid loop() {\n    \/\/ 3. Perform the conversion using the exact same function for all pins\n    int rawValueA = analogRead(POT_PIN_A);\n    int rawValueB = analogRead(POT_PIN_B);\n    int rawValueC = analogRead(POT_PIN_C);\n    int rawValueD = analogRead(POT_PIN_D);\n\n    \/\/ 4. Calculate actual voltage (Assuming VCC max reading drops to ~3.3V via your 10k\/20k trick)\n    float voltageA = (rawValueA * 3.3) \/ 4095.0;\n    float voltageB = (rawValueB * 3.3) \/ 4095.0;\n\n    \/\/ Print values out to the serial plotter\/monitor\n    Serial.printf(\"G40: %d (%.2fV) | G42: %d (%.2fV) | G14: %d | G17: %d\\n\", \n                  rawValueA, voltageA, rawValueB, voltageB, rawValueC, rawValueD);\n\n    delay(200); \/\/ Sample 5 times a second\n}\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":384,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,27],"tags":[],"class_list":["post-380","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-atoms3u","category-c-c"],"_links":{"self":[{"href":"https:\/\/myjetsonnano.perseus314.com\/index.php\/wp-json\/wp\/v2\/posts\/380","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/myjetsonnano.perseus314.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/myjetsonnano.perseus314.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/myjetsonnano.perseus314.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/myjetsonnano.perseus314.com\/index.php\/wp-json\/wp\/v2\/comments?post=380"}],"version-history":[{"count":3,"href":"https:\/\/myjetsonnano.perseus314.com\/index.php\/wp-json\/wp\/v2\/posts\/380\/revisions"}],"predecessor-version":[{"id":383,"href":"https:\/\/myjetsonnano.perseus314.com\/index.php\/wp-json\/wp\/v2\/posts\/380\/revisions\/383"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/myjetsonnano.perseus314.com\/index.php\/wp-json\/wp\/v2\/media\/384"}],"wp:attachment":[{"href":"https:\/\/myjetsonnano.perseus314.com\/index.php\/wp-json\/wp\/v2\/media?parent=380"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/myjetsonnano.perseus314.com\/index.php\/wp-json\/wp\/v2\/categories?post=380"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/myjetsonnano.perseus314.com\/index.php\/wp-json\/wp\/v2\/tags?post=380"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}