<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>i2c &#8211; Quality RC Parts</title>
	<atom:link href="https://qualityrcparts.com/tag/i2c/feed/" rel="self" type="application/rss+xml" />
	<link>https://qualityrcparts.com</link>
	<description>SHIPS FAST FROM NY, USA</description>
	<lastBuildDate>Sat, 21 Nov 2026 21:17:18 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1.5</generator>

<image>
	<url>https://i0.wp.com/qualityrcparts.com/wp-content/uploads/2026/09/qrc-logo-6-com-inside-short-512x512-1.png?fit=32%2C32&#038;ssl=1</url>
	<title>i2c &#8211; Quality RC Parts</title>
	<link>https://qualityrcparts.com</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">257527959</site>	<item>
		<title>Pull-Up Pull-Down Resistors: Why Floating Pins Misbehave</title>
		<link>https://qualityrcparts.com/pull-up-pull-down-resistors-explained/</link>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Sat, 21 Nov 2026 21:02:10 +0000</pubDate>
				<category><![CDATA[Drone Guides]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[esp32]]></category>
		<category><![CDATA[i2c]]></category>
		<category><![CDATA[pwm]]></category>
		<category><![CDATA[raspberry-pi-pico]]></category>
		<guid isPermaLink="false">https://qualityrcparts.com/pull-up-pull-down-resistors-explained/</guid>

					<description><![CDATA[Pull-up and pull-down resistors explained: why a floating pin reads randomly, when 10k is the right value, and how INPUT_PULLUP works.]]></description>
										<content:encoded><![CDATA[<h1>Pull-Up Pull-Down Resistors: Why Floating Pins Misbehave</h1>
<p>A floating pin reads randomly because nothing drives it, and the fix is one resistor. A pull-up resistor ties the pin to the supply voltage, so it reads high. A pull-down resistor ties the pin to ground, so it reads low. The value for a button is 10 kOhm, and microcontrollers have a pull-up you can turn on with INPUT_PULLUP.</p>
<h2>What is a floating pin?</h2>
<p>A digital input pin has a very high input impedance, in the range of hundreds of megaohms, so it draws almost no current and only senses voltage. When nothing is connected to the pin, or when a button connected to it is open, the pin voltage is undefined. That state is called floating. The pin acts like a small antenna: it picks up noise from nearby wires, the mains field and your hand as it approaches, and the reading flips between high and low dozens of times per second.</p>
<p>On an Arduino Uno at 5 V, the ATmega328P treats anything above 3.0 V, or 60 percent of VCC, as a definite high, and anything below 1.5 V, or 30 percent of VCC, as a definite low. The region between 1.5 V and 3.0 V is undefined, and a floating pin wanders through it. The result is an LED that lights without a button press, a counter that increases randomly, or an interrupt that fires constantly. None of that means the board is broken. It means the pin has no default level.</p>
<p>You can see it yourself. Connect a loose jumper wire to digital pin 2 with no button, upload a sketch that prints digitalRead to the serial monitor, and touch the end of the wire. The readings flicker. That flicker is the floating pin picking up your body as an antenna.</p>
<h2>Pull-up pull-down resistors: how does a pull-up resistor work?</h2>
<p>A pull-up resistor connects the input pin to the supply voltage, VCC, through a resistor, typically 10 kOhm, while the button connects the pin to ground. With the button open, almost no current flows through the pin, so there is no voltage drop across the resistor, and the pin sees VCC, which reads high. When you press the button, the pin connects directly to ground, which reads low. A small current flows through the resistor at that moment: by Ohm law, current equals voltage divided by resistance, so 5 V divided by 10 kOhm is 0.5 mA.</p>
<p>The resistor also prevents a short circuit. If you connected the pin directly to VCC instead of through a resistor, pressing the button would short the supply to ground. The resistor limits that current to 0.5 mA, which is safe. A pull-up makes the logic active low: released reads high, pressed reads low. That trips beginners up at first, but it is the most common arrangement, because most microcontrollers have built in pull-ups and a button to ground is the simplest wiring.</p>
<h2>How does a pull-down resistor work?</h2>
<p>A pull-down resistor is the mirror image. The resistor connects the pin to ground, and the button connects the pin to VCC. With the button open, the pin is tied to ground through the resistor and reads low. When you press the button, the pin connects directly to VCC and reads high. The same 10 kOhm value applies, and the same 0.5 mA flows while the button is held at 5 V.</p>
<p>Pull-down logic is active high: released reads low, pressed reads high. That reads more naturally in code, because pressed equals true. The trade off is that most microcontrollers have built in pull-ups but no built in pull-downs, so a pull-down usually needs an external resistor, while a pull-up often needs only one line of code. The ESP32 is an exception: most of its GPIO pins have both internal pull-ups and internal pull-downs.</p>
<h2>Why is 10 kOhm the standard value?</h2>
<p>The value is a trade off between current waste and noise rejection. Too low a value wastes current: a 100 Ohm pull-up at 5 V draws 50 mA while the button is held, which is wasteful and can exceed the resistor rating. Too high a value is too weak: a 1 MOhm pull-up lets noise overcome it, and the pin is slow to return to high because of its own capacitance. The range of 4.7 kOhm to 10 kOhm is the sweet spot for buttons: 5 V divided by 10 kOhm is 0.5 mA when pressed, and the pull is strong enough to reject noise.</p>
<p>A CMOS input pin draws almost no current, so the pull-up value is set by noise and speed, not by the pin impedance: a stronger pull rejects more noise and pulls the line high faster, at the cost of more current while the button is held. For I2C buses, the value is lower, typically 4.7 kOhm, because the bus must rise fast enough for the clock speed. For a long wire or a noisy environment, use 4.7 kOhm instead of 10 kOhm for a stronger pull.</p>
<h2>How do internal pull-ups work?</h2>
<p>Most microcontrollers include switchable pull-up resistors inside the chip. On an Arduino, you turn one on with a single line in setup: pinMode with INPUT_PULLUP. The ATmega328P internal pull-up is 20 kOhm to 50 kOhm, which is weaker than an external 10 kOhm resistor but strong enough for a button on a short wire. The ESP32 internal pull-ups are similar, and the ESP32 also offers INPUT_PULLDOWN on most GPIO pins. The Raspberry Pi Pico offers both pull-up and pull-down through its GPIO configuration.</p>
<p>Internal pull-ups have two limits. First, GPIO 34 to 39 on the original ESP32 are input only and have no internal pull resistors at all, so a button on those pins needs an external resistor. Second, a long wire picks up more noise than a weak internal pull-up can reject, so a button at the end of a 3 foot cable needs an external 4.7 kOhm or 10 kOhm resistor. Use the internal pull-up for a button on the breadboard next to the board, and an external resistor for a button on a long cable or in a noisy robot.</p>
<h2>What about I2C pull-ups?</h2>
<p>I2C needs pull-up resistors on both lines, SDA and SCL, because the bus is open drain: devices pull the line low, and only the resistor pulls it high. Without pull-ups, the bus floats and no device answers. The typical value is 4.7 kOhm to the logic voltage, and many breakout boards include them already. If two boards on the same bus each include pull-ups, the parallel combination halves the resistance, which is usually still fine, but three or more boards with pull-ups can make the pull too strong for a weak device to pull low.</p>
<p>The same rule applies to any open drain signal, including a one wire bus and some interrupt lines. A push pull output, such as a normal GPIO output or an SPI line, does not need a pull-up, because the driver actively drives the line high and low. When in doubt, read the device datasheet: it states whether the output is open drain or push pull, and what pull-up value it expects.</p>
<h2>How do you debounce a button?</h2>
<p>A mechanical button bounces: its contacts open and close several times in a few milliseconds when pressed, and each bounce looks like a separate press to a fast microcontroller. A pull-up resistor does not fix bounce. Debouncing does, and the simplest fix is a short delay in code: when the pin changes, wait 20 ms to 50 ms and read it again. If it still reads the same value, accept the press.</p>
<p>A hardware debounce uses a capacitor across the button, typically 0.1 uF, which smooths the bounces into one transition. A software debounce is cheaper and more common in Arduino code, and the Bounce2 library implements it cleanly. Debounce after you fix the floating pin: a floating pin with a debounce delay still reads randomly, because the pin never settles.</p>
<h2>Code: button with internal pull-up</h2>
<p>The sketch below reads a button on digital pin 2 with the internal pull-up, and it prints the state to the serial monitor. It uses the Arduino core and it runs on an Uno, a Nano or an ESP32 with the pin number changed. It was not compiled in this draft, and the compile result is logged as code not compiled in the header.</p>
<pre>
// Button with internal pull-up, active low
// Wiring: button between digital pin 2 and ground. No external resistor.
const int buttonPin = 2;
const int ledPin = 13;

void setup() {
  pinMode(buttonPin, INPUT_PULLUP); // Enable the internal pull-up resistor
  pinMode(ledPin, OUTPUT);
  Serial.begin(115200);
}

void loop() {
  bool pressed = digitalRead(buttonPin) == LOW; // Pressed reads LOW with a pull-up
  digitalWrite(ledPin, pressed ? HIGH : LOW);
  Serial.println(pressed ? "Pressed" : "Released");
  delay(100);
}
</pre>
<p>For the UNO pins in these examples, see the <a href="https://qualityrcparts.com/arduino-uno-r3-pinout/">Arduino UNO R3 pinout guide</a>.</p>
<h2>FAQ</h2>
<h3>What value resistor do I need for a pull-up?</h3>
<p>10 kOhm is the standard value for a button. Use 4.7 kOhm for a stronger pull on a long wire or a noisy environment, and for I2C buses. The range of 4.7 kOhm to 10 kOhm covers most button and sensor work.</p>
<h3>Can I use INPUT_PULLUP instead of a resistor?</h3>
<p>Yes, for a button on a short wire. The internal pull-up on an Arduino is 20 kOhm to 50 kOhm, which is strong enough for a bench test. Use an external 10 kOhm resistor for a long wire, a noisy environment, or a pin with no internal pull-up, such as GPIO 34 to 39 on the ESP32.</p>
<h3>Why does my button read pressed when nobody touches it?</h3>
<p>The pin is floating. Nothing drives it when the button is open, so noise flips the reading. Add a pull-up resistor, or enable INPUT_PULLUP, and the pin reads a stable high when released.</p>
<h3>Should I use a pull-up or a pull-down?</h3>
<p>Use a pull-up when your microcontroller has a built in pull-up, which most do, and when a button to ground is the simplest wiring. Use a pull-down when you need pressed to read high, or when the sensor output is open drain to ground.</p>
<h3>Do I need a pull-up on every input pin?</h3>
<p>Every input pin that can float needs a default level, either from a pull-up, a pull-down, or a device that always drives it. A pin connected to a sensor output that always drives the line does not need one. A pin connected to a button or a switch always does.</p>
<h2>Parts used</h2>
<p><a href="https://qualityrcparts.com/product/elegoo-uno-r3-microcontroller-board-atmega328p-atmega16u2-with-usb-cable/">ELEGOO UNO R3 Microcontroller Board</a>: the Arduino board used in the button examples. <a href="https://qualityrcparts.com/product/elegoo-dupont-jumper-wire-set-120-piece/">ELEGOO Dupont Jumper Wire Set, 120-Piece</a>: the jumper wires for the breadboard button wiring.</p>
<h2>Sources</h2>
<ul>
<li><a href="https://learn.sparkfun.com/tutorials/pull-up-resistors/what-is-a-pull-up-resistor" target="_blank" rel="noopener">SparkFun pull-up resistor tutorial, 10 kOhm value, internal pull-ups</a></li>
<li><a href="https://bluegrays.com/en/blog/pull-up-pull-down-resistor" target="_blank" rel="noopener">Pull-up and pull-down guide, floating input, 10 kOhm value, ATmega328P thresholds</a></li>
<li><a href="https://www.electronicsinfoline.com/parts/atmega328p" target="_blank" rel="noopener">ATmega328P pinout and limits, Microchip datasheet DS40002061B</a></li>
<li><a href="https://documentation.espressif.com/esp32_datasheet_en.html" target="_blank" rel="noopener">Espressif ESP32 Series Datasheet v5.3</a></li>
</ul>
<p>Last updated: 2026-11-21. Search volume: not verified. Product links use the store short link form with the product ID; confirm the product slug at publish time.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">23392</post-id>	</item>
		<item>
		<title>ADC Explained: Resolution, Reference Voltage, and ESP32 Limits</title>
		<link>https://qualityrcparts.com/adc-explained-esp32-arduino/</link>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Sat, 21 Nov 2026 21:01:33 +0000</pubDate>
				<category><![CDATA[Drone Guides]]></category>
		<category><![CDATA[adc]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[esp32]]></category>
		<category><![CDATA[i2c]]></category>
		<category><![CDATA[raspberry-pi-pico]]></category>
		<guid isPermaLink="false">https://qualityrcparts.com/adc-explained-esp32-arduino/</guid>

					<description><![CDATA[ADC explained: 10-bit vs 12-bit resolution, reference voltage, attenuation, and the ESP32 ADC2 and Wi-Fi conflict, with Arduino, ESP32, and Pico examples.]]></description>
										<content:encoded><![CDATA[<h1>ADC Explained: Resolution, Reference Voltage, and ESP32 Limits</h1>
<p>An ADC, or analog to digital converter, turns a voltage into a number. A 12-bit ADC divides its input range into 4,096 steps, numbered 0 to 4,095. A 10-bit ADC divides the range into 1,024 steps, numbered 0 to 1,023. The reference voltage sets the top of that range, and on the ESP32 ADC2 pins stop working while Wi-Fi runs.</p>
<h2>ADC explained: what is an ADC?</h2>
<p>An ADC measures a voltage on a pin and returns a digital number. The number is proportional to the input voltage divided by the reference voltage, times the number of steps. A sensor that outputs a voltage, such as a temperature sensor, a light sensor or a potentiometer, needs an ADC to turn its signal into a number your code can use. A sensor that outputs a digital signal, such as an I2C temperature sensor, does not need an ADC, because the sensor chip does the conversion itself.</p>
<p>Most microcontroller ADCs use successive approximation, or SAR. The ADC samples the pin voltage, compares it against an internal reference in a series of steps, and writes a digital value. The conversion takes microseconds, and the result is a single number per read. That number is not a voltage until your code converts it, using the resolution and the reference voltage.</p>
<h2>What is resolution and why does it matter?</h2>
<p>Resolution is the number of bits in the ADC result, and it decides the smallest voltage change the ADC can see. A 10-bit ADC has 1,024 steps. A 12-bit ADC has 4,096 steps. On a 3.3 V range, a 10-bit step is 3.3 V divided by 1,024, or about 3.22 mV per step. A 12-bit step is 3.3 V divided by 4,096, or about 0.81 mV per step. The 12-bit ADC sees a change four times smaller than the 10-bit ADC.</p>
<table>
<tr>
<th>ADC resolution (bits)</th>
<th>Steps (count)</th>
<th>Step size on 3.3 V (mV)</th>
<th>Boards</th>
</tr>
<tr>
<td>10</td>
<td>1,024</td>
<td>3.22</td>
<td>Arduino Uno, Nano, ESP8266</td>
</tr>
<tr>
<td>12</td>
<td>4,096</td>
<td>0.81</td>
<td>ESP32, ESP32-S3, Raspberry Pi Pico, RP2040</td>
</tr>
</table>
<p>More bits do not always mean more accuracy. The ESP32 ADC is 12-bit, but its effective resolution is about 10 to 11 bits, because noise and nonlinearity eat the last bits. Averaging 16 to 64 readings gives a steadier result than chasing the last bit of a single read. A 10-bit ADC on an Arduino Uno with a clean supply and a short wire can beat a noisy 12-bit reading on a long wire next to a Wi-Fi antenna.</p>
<h2>What is reference voltage?</h2>
<p>The reference voltage is the voltage that maps to the top ADC value. On an Arduino Uno, the default reference is the 5 V supply, so a 5 V input reads 1,023 and a 2.5 V input reads about 511. On the Raspberry Pi Pico, the reference is 3.3 V, so a 3.3 V input reads 4,095. On the ESP32, the reference voltage is about 1.1 V at the ADC itself, not 3.3 V, and the chip applies attenuation to scale the input before it reaches the ADC.</p>
<p>That ESP32 detail causes the most confusion. A 3.3 V signal on an ESP32 ADC pin does not damage the pin, because the attenuation scales it down before the converter, but the raw reading does not map linearly to 3.3 V without the attenuation setting. Use analogReadMilliVolts on the ESP32 Arduino core, which applies the factory calibration and returns millivolts, instead of converting the raw count yourself with a 3.3 V assumption.</p>
<h2>What is attenuation on the ESP32?</h2>
<p>Attenuation reduces the input voltage before it reaches the ADC, which widens the measurable range. The ESP32 Arduino core offers four settings: 0 dB, 2.5 dB, 6 dB and 11 dB. At 0 dB, the measurable range is about 0 mV to 950 mV. At 2.5 dB, it is about 100 mV to 1,250 mV. At 6 dB, it is about 150 mV to 1,750 mV. At 11 dB, it is about 150 mV to 2,450 mV, which is the widest range and the default in the Arduino core.</p>
<p>Set the attenuation per pin for your sensor range. A sensor that outputs 0 V to 1 V needs 2.5 dB attenuation. A sensor that outputs 0 V to 3.3 V needs 11 dB attenuation, and even then the top of the range saturates at about 3.1 V. The ESP32 ADC is also nonlinear near the ends of its range, so readings near 0 mV and near the top are compressed. For a battery voltage measurement, use a voltage divider that keeps the ADC input in the middle of its range, and average many readings.</p>
<h2>Why does ADC2 stop working with Wi-Fi on the ESP32?</h2>
<p>The original ESP32 has two ADC units. ADC1 has 8 channels on GPIO 32 to 39. ADC2 has 10 channels on GPIO 0, 2, 4, 12 to 15 and 25 to 27. The Wi-Fi driver uses ADC2 internally, so ADC2 cannot be read while Wi-Fi is active. The Espressif ESP-IDF ADC guide states this directly: the application can only use ADC2 when the Wi-Fi driver has not started, and a read on ADC2 fails between Wi-Fi start and Wi-Fi stop.</p>
<p>The symptom is a sensor that reads correctly before WiFi.begin and returns zero or a stale value after the connection starts. The fix is to move the sensor to an ADC1 pin, GPIO 32 to 39. Remember that GPIO 34 to 39 are input only, so they read a sensor but cannot drive an output. The S3 also restricts ADC2 while Wi-Fi runs. The C3 has only one ADC unit, so it has no ADC2 conflict at all. Check the ADC section of your chip datasheet before you wire a sensor.</p>
<p>Some ADC2 pins carry extra traps. GPIO 0, 2 and 15 are strapping pins, so a sensor on those pins can stop the board from booting. On the ESP32 DevKitC, GPIO 0 cannot be used freely because of the auto program circuit. Prefer ADC1 pins for any sensor in a Wi-Fi project, and keep ADC2 for projects with no Wi-Fi at all.</p>
<h2>How do Arduino, ESP32 and Pico ADCs compare?</h2>
<table>
<tr>
<th>Spec (unit)</th>
<th>Arduino Uno ATmega328P</th>
<th>ESP32</th>
<th>Raspberry Pi Pico RP2040</th>
</tr>
<tr>
<td>Resolution (bits)</td>
<td>10</td>
<td>12</td>
<td>12</td>
</tr>
<tr>
<td>Steps (count)</td>
<td>1,024</td>
<td>4,096</td>
<td>4,096</td>
</tr>
<tr>
<td>ADC channels (count)</td>
<td>6 on DIP, 8 on TQFP</td>
<td>18 across two units</td>
<td>4 external plus temperature</td>
</tr>
<tr>
<td>Reference voltage (V)</td>
<td>5, supply by default</td>
<td>About 1.1 before attenuation</td>
<td>3.3</td>
</tr>
<tr>
<td>Max sample rate</td>
<td>About 10 ksps</td>
<td>Up to 2 Msps with DMA</td>
<td>500 ksps</td>
</tr>
<tr>
<td>Wi-Fi conflict</td>
<td>None</td>
<td>ADC2 blocked by Wi-Fi</td>
<td>None on base Pico</td>
</tr>
</table>
<p>The Pico ADC is the simplest to use: a 3.3 V reference, 12-bit resolution, and no Wi-Fi conflict on the base board. The Arduino ADC is the simplest to understand: a 5 V reference and a direct count to voltage conversion. The ESP32 ADC is the most capable and the most confusing, because of its attenuation settings and its ADC2 conflict, so read the ADC section of the ESP-IDF guide before you trust a reading.</p>
<h2>How do you get an accurate reading?</h2>
<p>Follow five steps. First, pick an ADC1 pin on the ESP32, or any ADC pin on the Pico or Arduino. Second, set the attenuation for your sensor range on the ESP32, or set the reference on the Arduino. Third, keep the wires short and add a 0.1 uF capacitor from the ADC pin to ground to filter noise. Fourth, average 16 to 64 readings instead of trusting one. Fifth, use the calibrated millivolt function where the core provides one, such as analogReadMilliVolts on the ESP32, instead of converting the raw count with an assumed reference.</p>
<p>Never exceed the ADC input voltage. On the ESP32, the pin tolerates 3.3 V, but the measurable range tops out near 3.1 V at 11 dB attenuation. On the Pico, the pin tolerates 3.3 V and the ADC input must stay below the 3.3 V supply plus a small margin. On the Arduino Uno, the pin tolerates 5 V. A sensor that outputs more than the ADC range needs a voltage divider, and the divider ratio must be included in your conversion math.</p>
<h2>Code: read an ESP32 ADC pin with averaging</h2>
<p>The sketch below reads an ESP32 ADC1 pin with 11 dB attenuation and averages 32 readings. It uses the ESP32 Arduino core. It was not compiled in this draft, and the compile result is logged as code not compiled in the header.</p>
<pre>
// ESP32 ADC read with averaging on an ADC1 pin
// Board: ESP32 DevKit V1. Sensor on GPIO 34, which is ADC1 channel 6.
const int adcPin = 34; // ADC1 only, so Wi-Fi can run at the same time

void setup() {
  Serial.begin(115200);
  analogSetPinAttenuation(adcPin, ADC_11db); // Widest range, about 0 to 3.1 V
  analogReadResolution(12); // 12-bit result, 0 to 4095
}

void loop() {
  long total = 0;
  for (int i = 0; i &lt; 32; i++) {
    total += analogReadMilliVolts(adcPin); // Calibrated millivolts, not raw counts
    delay(2);
  }
  long averageMilliVolts = total / 32;
  Serial.print("Sensor voltage (mV): ");
  Serial.println(averageMilliVolts);
  delay(500);
}
</pre>
<p>For the Pico ADC pins in this guide, see the <a href="https://qualityrcparts.com/raspberry-pi-pico-pinout/">Raspberry Pi Pico pinout guide</a>.</p>
<h2>FAQ</h2>
<h3>Why does my ESP32 analogRead return 0 when Wi-Fi is on?</h3>
<p>Your sensor is on an ADC2 pin, and the Wi-Fi driver uses ADC2. Move the sensor to an ADC1 pin, GPIO 32 to 39, and the readings return.</p>
<h3>Is a 12-bit ADC always better than a 10-bit ADC?</h3>
<p>No. A 12-bit ADC has finer steps, but noise and nonlinearity limit its effective resolution to about 10 to 11 bits on the ESP32. A clean 10-bit reading beats a noisy 12-bit reading, so average many samples and keep wires short.</p>
<h3>What voltage can I put on an ESP32 ADC pin?</h3>
<p>Up to 3.3 V on the pin. The measurable range tops out near 3.1 V at 11 dB attenuation, so a sensor above that needs a voltage divider.</p>
<h3>How many ADC pins does the ESP32 have?</h3>
<p>18 channels across two ADC units: 8 on ADC1 at GPIO 32 to 39, and 10 on ADC2 at GPIO 0, 2, 4, 12 to 15 and 25 to 27. A 30-pin board exposes 16 of them, because GPIO 37 and 38 are not broken out.</p>
<h3>What is the ADC reference voltage on an Arduino Uno?</h3>
<p>5 V by default, from the supply. A 5 V input reads 1,023 and a 2.5 V input reads about 511. The reference can be changed to the internal 1.1 V bandgap or an external AREF voltage.</p>
<h2>Parts used</h2>
<p><a href="https://qualityrcparts.com/product/esp32-devkit-v1-development-board-30-pin-wroom-32-wifi-bluetooth-dual-core/">ESP32 DevKit V1 Development Board, 30-Pin WROOM-32</a>: the ESP32 board for the ADC examples, with 18 ADC channels. <a href="https://qualityrcparts.com/product/elegoo-uno-r3-microcontroller-board-atmega328p-atmega16u2-with-usb-cable/">ELEGOO UNO R3 Microcontroller Board</a>: the Arduino board for the 10-bit ADC comparison.</p>
<h2>Sources</h2>
<ul>
<li><a href="https://docs.espressif.com/projects/esp-idf/en/v4.3.1/esp32/api-reference/peripherals/adc.html" target="_blank" rel="noopener">Espressif ESP-IDF ADC guide, ADC1 and ADC2 channels, Wi-Fi conflict, attenuation</a></li>
<li><a href="https://documentation.espressif.com/esp32_datasheet_en.html" target="_blank" rel="noopener">Espressif ESP32 Series Datasheet v5.3</a></li>
<li><a href="https://pip.raspberrypi.com/documents/RP-008371-DS" target="_blank" rel="noopener">Raspberry Pi RP2040 Datasheet, build date 2025-02-20, 12-bit ADC, 500 ksps</a></li>
<li><a href="https://www.electronicsinfoline.com/parts/atmega328p" target="_blank" rel="noopener">ATmega328P pinout and limits, Microchip datasheet DS40002061B</a></li>
</ul>
<p>Last updated: 2026-11-21. Search volume: not verified. Product links use the store short link form with the product ID; confirm the product slug at publish time.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">23391</post-id>	</item>
		<item>
		<title>Joystick Robot Arm: 4-Axis Control with PCA9685</title>
		<link>https://qualityrcparts.com/joystick-robot-arm-pca9685/</link>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Sat, 21 Nov 2026 20:59:19 +0000</pubDate>
				<category><![CDATA[Drone Guides]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[arduino-uno]]></category>
		<category><![CDATA[i2c]]></category>
		<category><![CDATA[pca9685]]></category>
		<category><![CDATA[servo]]></category>
		<guid isPermaLink="false">https://qualityrcparts.com/joystick-robot-arm-pca9685/</guid>

					<description><![CDATA[Control a 4-DOF robot arm with a 4-axis joystick and a PCA9685 driver: analog mapping, gripper control, servo power, and a complete sketch.]]></description>
										<content:encoded><![CDATA[<h1>Joystick Robot Arm: 4-Axis Control with PCA9685</h1>
<p>Control a joystick robot arm with a 4-axis joystick and a PCA9685 servo driver. The joystick gives three analog axes, X tilt, Y tilt, and Z twist, plus a momentary button on top, which the listing counts as the fourth axis. X maps to base rotation, Y maps to the shoulder, and Z twist maps to the elbow.</p>
<h2>Quick facts</h2>
<table>
<tr>
<th>Item</th>
<th>Value</th>
</tr>
<tr>
<td>Arm</td>
<td>4-DOF acrylic arm kit with claw, 4 SG90 servos in the With SG90 option</td>
</tr>
<tr>
<td>Joystick</td>
<td>4-axis potentiometer, 10 k, X Y tilt plus Z twist, top button; 3 analog outputs plus the button</td>
</tr>
<tr>
<td>Driver</td>
<td>PCA9685, 16 channels, I2C address 0x40</td>
</tr>
<tr>
<td>Controller</td>
<td>Arduino Uno R3, 5 V logic</td>
</tr>
<tr>
<td>Joints</td>
<td>Base, shoulder, elbow, plus claw; 4 servos, no wrist joint</td>
</tr>
<tr>
<td>Servo supply</td>
<td>Separate 5 to 6 V, sized for stall current</td>
</tr>
</table>
<h2>Joystick robot arm: what does each joystick axis control?</h2>
<p>The joystick gives three analog signals, one per potentiometer, plus the top button. The X tilt controls the base rotation, so pushing the stick left and right spins the arm around its vertical axis. The Y tilt controls the shoulder, so pushing forward and back raises and lowers the upper arm. The Z twist controls the elbow, so twisting the stick bends the forearm. There is no fourth analog output on this joystick: the fourth axis in the product name is the momentary top button, and this arm kit has no wrist joint, so no wrist mapping exists. The button toggles the claw instead.</p>
<p>That mapping is a choice, not a law. If the twist feels wrong for the elbow, swap the elbow and shoulder assignments in the code. The mapping lives in three lines, one per joint, so changing it takes a minute. Keep the mapping you choose written on a card next to the joystick until it becomes habit.</p>
<p>The top button toggles the claw. Press once and the claw closes, press again and it opens. A toggle suits a claw, because holding a button down while the arm moves is awkward. The sketch debounces the button with a 200 ms debounce interval, so one press never registers as two.</p>
<h2>How do you map a joystick reading to a servo angle?</h2>
<p>Each joystick axis is a 10 k potentiometer, so the Uno analog pin reads 0 to 1023. Center is near 512. The sketch reads the pin, subtracts the center, and applies a dead zone of about 30 counts so a resting stick sends no motion. Outside the dead zone, the reading maps to a small angle step per loop, not to an absolute angle.</p>
<p>Relative control suits an arm. The stick sets the speed and direction of each joint, and the joint holds its position when the stick centers. Absolute control, where the stick position equals the joint angle, is simpler to code but twitchy in practice, because a small stick move swings the joint a long way.</p>
<p>Each joint has a safe angle range in the sketch. The base runs 0 to 180 degrees, the shoulder 30 to 150 degrees, and the elbow 30 to 150 degrees. The claw runs 20 to 160 degrees. Those limits keep the arm from driving its own joints into the table or past the servo end stops. Adjust them for your arm after the first test, and write the final numbers down.</p>
<h2>How do you wire the joystick and the PCA9685?</h2>
<p>The joystick has three analog outputs, one per potentiometer, plus a button output. The X and Y potentiometers end in solder tabs on the sides of the base, so solder wires to them and meter each wire before you connect it. The Z potentiometer comes prewired: red and white are the reference ends and black is the wiper. Wire each potentiometer as a voltage divider across the 5 V supply and read the wiper on an ADC pin: X wiper to A0, Y wiper to A1, and Z wiper (black wire) to A2. The top button has two blue wires: connect one to digital pin 2 and the other to ground, and use INPUT_PULLUP, so a press reads LOW.</p>
<p>The PCA9685 connects over I2C. Connect its VCC to the Uno 5 V pin, its GND to ground, its SDA to A4, and its SCL to A5. Connect the separate 5 to 6 V servo supply to the V+ screw terminal, and join the supply ground to the Uno ground. The servo plugs go on channels 0 to 3: base, shoulder, elbow, and claw.</p>
<p>Keep the joystick wires short and away from the servo power wires. Servo current spikes can couple into long analog wires and make the joints jitter. If a joint trembles with the stick centered, widen the dead zone from 30 to 50 counts before you change anything else.</p>
<h2>How do you tune the arm so it moves smoothly?</h2>
<p>Start with slow steps. The sketch moves each joint by at most 1 degree per 20 ms loop, which is about 50 degrees per second at full stick deflection. That is fast enough to feel responsive and slow enough to stay controllable. Raise the step to 2 degrees only after the arm tracks well at 1 degree.</p>
<p>Load changes everything. An empty claw moves freely, but a loaded claw sags the shoulder and elbow servos. Test with the load you plan to lift, not empty. If the shoulder sags under load, raise the servo supply from 5 V to 6 V, which adds torque, or reduce the load. Do not raise the supply above the servo 6 V rating for SG90 servos.</p>
<p>If the arm oscillates, the steps are too large or the dead zone is too small. Lower the step size first. If one joint alone oscillates, check its pulse calibration, because a pulse past the servo end stop makes the servo fight its own gears and buzz.</p>
<h2>Wiring</h2>
<p>Wire the build with the power off. Check every connection in the table before you connect any battery or USB cable.</p>
<table>
<tr>
<th>From</th>
<th>To</th>
<th>Notes</th>
</tr>
<tr>
<td>Joystick VCC</td>
<td>Uno 5 V</td>
<td>10 k potentiometers, 5 V logic</td>
</tr>
<tr>
<td>Joystick GND</td>
<td>Uno GND</td>
<td>Common ground</td>
</tr>
<tr>
<td>Joystick X wiper</td>
<td>Uno A0</td>
<td>Base rotation, analog 0 to 1023; solder tabs on the base, meter before soldering</td>
</tr>
<tr>
<td>Joystick Y wiper</td>
<td>Uno A1</td>
<td>Shoulder, analog 0 to 1023; solder tabs on the base, meter before soldering</td>
</tr>
<tr>
<td>Joystick Z wiper, black wire</td>
<td>Uno A2</td>
<td>Elbow, analog 0 to 1023; red and white are the reference ends</td>
</tr>
<tr>
<td>Joystick top button, blue wires</td>
<td>Uno digital pin 2 and GND</td>
<td>Claw toggle; INPUT_PULLUP, press reads LOW</td>
</tr>
<tr>
<td>PCA9685 VCC</td>
<td>Uno 5 V</td>
<td>Logic only, a few milliamps</td>
</tr>
<tr>
<td>PCA9685 GND</td>
<td>Uno GND and servo supply negative</td>
<td>Common ground for all three</td>
</tr>
<tr>
<td>PCA9685 SDA</td>
<td>Uno A4</td>
<td>I2C data</td>
</tr>
<tr>
<td>PCA9685 SCL</td>
<td>Uno A5</td>
<td>I2C clock</td>
</tr>
<tr>
<td>PCA9685 V+ screw terminal</td>
<td>Separate 5 to 6 V supply positive</td>
<td>Servo power only; size for stall current</td>
</tr>
<tr>
<td>PCA9685 channel 0</td>
<td>Base servo</td>
<td>Signal, V+, GND</td>
</tr>
<tr>
<td>PCA9685 channel 1</td>
<td>Shoulder servo</td>
<td>Signal, V+, GND</td>
</tr>
<tr>
<td>PCA9685 channel 2</td>
<td>Elbow servo</td>
<td>Signal, V+, GND</td>
</tr>
<tr>
<td>PCA9685 channel 3</td>
<td>Claw servo</td>
<td>Signal, V+, GND; toggled by the top button</td>
</tr>
</table>
<h2>Power budget</h2>
<p>The logic side draws only a few milliamps from the Uno 5 V pin: the joystick potentiometers and the PCA9685 chip. The servo side draws whatever the servos demand. Four micro servos moving together draw on the order of 1 A under light load, and far more when they start or stall together.</p>
<p>Use a separate 5 to 6 V supply rated at 3 A or more for the V+ terminal. Never power the servos from the Uno 5 V pin. The Uno regulator supplies about 500 mA from USB, and a single stalled micro servo can exceed that. The board will reset and the arm will drop. No authoritative TowerPro datasheet publishes an SG90 stall current, so do not size the supply from a single stall number: the 3 A rating above is a planning rating with headroom, and meter your own servos if you need an exact figure.</p>
<p>Add a 470 to 1000 microfarad capacitor across V+ and ground at the terminal. The servos draw sharp spikes when they start moving, and the capacitor absorbs them. Without it, the rail sags and every joint jitters at once.</p>
<h2>Build steps</h2>
<ol>
<li>Assemble the 4-DOF acrylic arm kit with the claw. Fit the 4 SG90 servos and confirm each joint moves freely by hand before you power anything. Buy the With SG90 option: the Arm Only option ships as acrylic parts and screws with no servos.</li>
<li>Mount the PCA9685 near the arm base. Connect the four servos to channels 0 to 3 in base, shoulder, elbow, and claw order.</li>
<li>Wire the joystick to the Uno analog pins and the button to digital pin 2 from the wiring table.</li>
<li>Wire the PCA9685 I2C pins and the separate servo supply. Join the supply ground to the Uno ground. Leave the servo supply off for now.</li>
<li>Install the Adafruit PWM Servo Driver library. Upload the sketch below with the servo supply still off.</li>
<li>Switch the servo supply on. The arm should park at its home position: base 90, shoulder 90, elbow 90, claw open.</li>
<li>Push the stick in each direction and confirm the right joint moves. Press the top button and confirm the claw toggles. Calibrate the pulse limits per joint until no servo buzzes at its ends.</li>
</ol>
<h2>Code</h2>
<p>Library: Adafruit PWM Servo Driver library. Board: Arduino Uno R3. Each joystick axis drives one joint in relative steps, and the top button toggles the claw. The joystick has three analog axes, so the claw is the only joint on the button; the kit has no wrist joint.</p>
<pre><code>// Joystick robot arm: 4-axis joystick + PCA9685, 4 servos
// Board: Arduino Uno R3. Library: Adafruit PWM Servo Driver.
#include <Wire.h>
#include <Adafruit_PWMServoDriver.h>

Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver(0x40);

#define SERVOMIN 150   // About 730 microseconds at 50 Hz; calibrate per servo
#define SERVOMAX 600   // About 2930 microseconds at 50 Hz; calibrate per servo
#define SERVO_FREQ 50

const int JOY_X = A0;  // Base
const int JOY_Y = A1;  // Shoulder
const int JOY_Z = A2;  // Elbow
const int BTN_PIN = 2; // Claw toggle, INPUT_PULLUP

const uint8_t CH_BASE = 0, CH_SHOULDER = 1, CH_ELBOW = 2;
const uint8_t CH_CLAW = 3;

// Safe joint ranges in degrees. Adjust for your arm after testing.
const int LIM[4][2] = {{0, 180}, {30, 150}, {30, 150}, {20, 160}};
int angle[4] = {90, 90, 90, 20};  // Start parked, claw open
bool clawClosed = false;
unsigned long lastBtnMs = 0;

uint16_t angleToPulse(int a) {
  return map(constrain(a, 0, 180), 0, 180, SERVOMIN, SERVOMAX);
}

void setServo(uint8_t ch, int a) {
  pwm.setPWM(ch, 0, angleToPulse(a));
}

// Read one joystick axis and return a step of -1, 0, or +1.
int readStep(int pin) {
  int v = analogRead(pin) - 512;  // Center is near 512
  if (v > 30) return 1;           // Dead zone of 30 counts
  if (v < -30) return -1;
  return 0;
}

void moveJoint(uint8_t ch, int step) {
  if (step == 0) return;
  angle[ch] = constrain(angle[ch] + step, LIM[ch][0], LIM[ch][1]);
  setServo(ch, angle[ch]);
}

void setup() {
  Serial.begin(115200);
  pinMode(BTN_PIN, INPUT_PULLUP);
  pwm.begin();
  pwm.setOscillatorFrequency(27000000);
  pwm.setPWMFreq(SERVO_FREQ);
  delay(10);
  for (uint8_t ch = 0; ch < 4; ch++) setServo(ch, angle[ch]);
}

void loop() {
  moveJoint(CH_BASE, readStep(JOY_X));
  moveJoint(CH_SHOULDER, readStep(JOY_Y));
  moveJoint(CH_ELBOW, readStep(JOY_Z));

  // Top button toggles the claw, debounced by 200 ms.
  if (digitalRead(BTN_PIN) == LOW &#038;&#038; millis() - lastBtnMs > 200) {
    lastBtnMs = millis();
    clawClosed = !clawClosed;
    angle[CH_CLAW] = clawClosed ? LIM[CH_CLAW][1] : LIM[CH_CLAW][0];
    setServo(CH_CLAW, angle[CH_CLAW]);
  }
  delay(20);  // About 1 degree per 20 ms at full deflection
}
</code></pre>
<h2>Test and tune it</h2>
<p>Center the stick and confirm all joints hold still. A joint that creeps with a centered stick has a joystick reading outside the dead zone. Widen the dead zone from 30 to 50 counts.</p>
<p>Move each joint to both ends of its range. A servo that buzzes at an end is past its mechanical limit. Lower the limit in the LIM table for that joint until the buzz stops.</p>
<p>Pick up a light object with the claw and hold it for 30 seconds. If the shoulder sags, raise the servo supply from 5 V to 6 V or reduce the load. Do not exceed the SG90 6 V rating.</p>
<h2>FAQ</h2>
<h3>Which joystick axis controls which joint?</h3>
<p>X controls the base, Y controls the shoulder, and Z twist controls the elbow. The top button toggles the claw. There is no fourth analog axis and no wrist joint on this kit: the fourth axis in the product name is the top button. Swap the assignments in the code if another mapping feels better.</p>
<h3>Why does the arm jitter when the stick is centered?</h3>
<p>The joystick reading sits outside the dead zone, or servo current spikes are coupling into the analog wires. Widen the dead zone to 50 counts and keep the joystick wires away from the servo power wires.</p>
<h3>Why does the arm drop when I power it on?</h3>
<p>The servos have no holding torque until the sketch parks them, and the Uno 5 V pin cannot hold them under load. Power the servos from the separate V+ supply and let the sketch park the arm at startup.</p>
<h3>Can I use MG996R servos on this arm?</h3>
<p>Only if the arm frame and the supply suit them. An MG996R draws up to 2.5 A at stall on 6 V, so four of them need a far larger supply than four SG90 servos. Check the arm kit servo mounts first.</p>
<h3>How do I stop a joint from hitting the table?</h3>
<p>Set its safe range in the LIM table in the sketch. The shoulder and elbow limits of 30 to 150 degrees keep the arm from driving its joints into the table or past the servo end stops.</p>
<h2>Parts used</h2>
<p>Build it with the <a href="https://qualityrcparts.com/product/4-axis-joystick-potentiometer-momentary-top-button-10k-x-y/">4-Axis Joystick Potentiometer with Momentary Top Button, 10K, X Y Tilt plus Z Twist, for Arduino, ESP32, and Robot Projects</a>, the <a href="https://qualityrcparts.com/product/pca9685-16-channel-pwm-servo-driver-board-12-bit-iic-arduino-raspberry-pi-2-pack/">PCA9685 16-Channel PWM Servo Driver Board, 12-Bit IIC Interface, Arduino + Raspberry Pi, 2-Pack</a>, and the <a href="https://qualityrcparts.com/product/4-dof-acrylic-robot-arm-kit-claw-arduino-sg90-uno/">4-DOF Acrylic Robot Arm Kit with Claw for Arduino, Unassembled, SG90 / UNO / Rocker Options</a>. For a servo arm build without the driver board, see <a href="https://qualityrcparts.com/robot-arm-esp32-servo-build/">How to Build a Robot Arm with ESP32 and Servo Motors</a>, and the servo signal behind the positions is <a href="https://qualityrcparts.com/digital-vs-analog-micro-servos/">Digital vs Analog Servo Guide: Which Servo Holds Center</a>.</p>
<h2>Sources</h2>
<ul>
<li><a href="https://learn.adafruit.com/16-channel-pwm-servo-driver" target="_blank" rel="noopener">Adafruit 16-Channel PWM Servo Driver guide</a></li>
<li><a href="https://cdn-learn.adafruit.com/downloads/pdf/16-channel-pwm-servo-driver.pdf" target="_blank" rel="noopener">Adafruit PCA9685 guide PDF</a></li>
<li><a href="https://courses.ece.cornell.edu/ece5990/ECE5725_Spring2020_Projects/May_15_Demo/Smart%20Lock/W_pp445_yl656/datasheet/MG996R_Tower-Pro.pdf" target="_blank" rel="noopener">TowerPro MG996R datasheet</a></li>
</ul>
<p>Last updated: 2026-11-21. Search volume: not verified. Product links use the store short link form with the product ID; confirm the product slug at publish time.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">23386</post-id>	</item>
		<item>
		<title>ESP32 Sensor Data Logger: Flash Logging and WiFi Download</title>
		<link>https://qualityrcparts.com/esp32-sensor-data-logger-flash/</link>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Sat, 21 Nov 2026 20:57:51 +0000</pubDate>
				<category><![CDATA[Drone Guides]]></category>
		<category><![CDATA[arduino-ide]]></category>
		<category><![CDATA[esp32]]></category>
		<category><![CDATA[i2c]]></category>
		<guid isPermaLink="false">https://qualityrcparts.com/esp32-sensor-data-logger-flash/</guid>

					<description><![CDATA[Log BME280 readings to ESP32 onboard flash with LittleFS, then download the CSV over WiFi, with wiring, code, and log format.]]></description>
										<content:encoded><![CDATA[<h1>ESP32 Sensor Data Logger: Flash Logging and WiFi Download</h1>
<p>This ESP32 sensor data logger logs BME280 readings to onboard flash with LittleFS, then downloads the CSV file over Wi-Fi. No SD card module is needed, because the ESP32 DevKit V1 has megabytes of flash to spare. The logger records a timestamped row every minute, and a web page at the board IP address offers the file for download.</p>
<h2>Quick facts</h2>
<table>
<tr>
<th>Item</th>
<th>Value</th>
</tr>
<tr>
<td>Storage</td>
<td>LittleFS on onboard flash, no SD card module</td>
</tr>
<tr>
<td>Sensor</td>
<td>BME280, temperature, humidity, pressure</td>
</tr>
<tr>
<td>Log format</td>
<td>CSV, one row per minute</td>
</tr>
<tr>
<td>Download</td>
<td>Web page at the board IP address, /download</td>
</tr>
<tr>
<td>Display</td>
<td>0.96 inch SSD1306 OLED shows the latest reading</td>
</tr>
<tr>
<td>Flash wear</td>
<td>LittleFS spreads writes; log once per minute, not once per second</td>
</tr>
</table>
<h2>ESP32 sensor data logger: why log to onboard flash instead of an SD card?</h2>
<p>LittleFS replaced SPIFFS as the filesystem in the Arduino ESP32 core. SPIFFS was deprecated in core 2.x and removed in core 3.x, so new sketches use LittleFS throughout. The ESP32 DevKit V1 ships with 4 MB of flash, and the sketch uses only part of it. LittleFS carves a filesystem out of the spare flash, so the board can store weeks of one-per-minute readings with no extra hardware. A CSV row is about 40 bytes, so one day of minute readings is about 58 KB.</p>
<p>No SD card module is stocked for this build, so the design uses what the board already has. That also removes a failure point: no card socket, no card formatting, and no card to shake loose on a robot. The trade is capacity. Flash holds far less than a card, so this logger suits weeks of data, not years.</p>
<p>LittleFS also handles wear. Flash cells wear out after many writes, and LittleFS spreads writes across the filesystem instead of hammering one spot. Logging once per minute keeps the write count low. Logging once per second would wear the flash far faster for no benefit in a room weather log.</p>
<h2>What does each log row hold?</h2>
<p>Each row holds the uptime in seconds, the temperature in degrees C, the humidity in percent, and the pressure in hPa. The ESP32 has no real-time clock, so uptime is the timestamp. If you need wall-clock time, note the download time and count back, or add an NTP sync step when Wi-Fi connects.</p>
<p>The file is plain CSV with a header row: uptime_s,temperature_c,humidity_pct,pressure_hpa. Any spreadsheet opens it, and any script can parse it. Keep the format fixed. Changing column order between firmware versions breaks every script that reads the file.</p>
<p>The logger appends one row per minute. It opens the file, writes the row, and closes it. Closing after every write protects the data if power fails. An open file with unwritten data is lost on a reset, but a closed file survives.</p>
<h2>How do you download the log over Wi-Fi?</h2>
<p>The ESP32 runs a web server with three routes. The root route returns a small status page with the latest reading and a download link. The /data route returns the latest reading as JSON. The /download route streams the CSV file with a download header, so the browser saves it instead of showing it.</p>
<p>Connect the ESP32 to your Wi-Fi network, read its IP address from the serial monitor, and open it in a browser on the same network. The page shows the latest values and a link labeled Download log. Click it and the CSV lands in your downloads folder.</p>
<p>The download reads the file in chunks, so a large log does not need to fit in RAM. The file is closed between writes, so a download started between writes reads a complete file. A download that overlaps a write can catch a partial last row, so download between samples when the data must be exact. In practice the one-per-minute write takes milliseconds, so overlaps are rare.</p>
<h2>How do you keep the log from filling the flash?</h2>
<p>LittleFS on a 4 MB board gives roughly 1.5 MB of filesystem space, depending on the partition scheme. At 58 KB per day, that is about 26 days of minute readings. The sketch checks the file size on every write. When the file passes 1 MB, it renames the old file to log_old.csv and starts a fresh log.csv.</p>
<p>That rotation keeps one current file and one old file. Download both before they rotate again, or the oldest data is lost. If you need longer retention, lower the sample rate to once per 5 minutes, which stretches the same space to about 4 months.</p>
<p>Check the free space with LittleFS.totalBytes() and LittleFS.usedBytes() at startup and print both to the serial monitor. If used space grows faster than your estimate, a bug is writing too often. Fix the sample interval before the flash fills.</p>
<h2>Wiring</h2>
<p>Wire the build with the power off. Check every connection in the table before you connect any battery or USB cable.</p>
<table>
<tr>
<th>From</th>
<th>To</th>
<th>Notes</th>
</tr>
<tr>
<td>BME280 VCC</td>
<td>ESP32 3V3</td>
<td>3.3 V; bare chip maximum is 3.6 V</td>
</tr>
<tr>
<td>BME280 GND</td>
<td>ESP32 GND</td>
<td>Common ground</td>
</tr>
<tr>
<td>BME280 SDA</td>
<td>ESP32 GPIO 21</td>
<td>Default I2C data pin</td>
</tr>
<tr>
<td>BME280 SCL</td>
<td>ESP32 GPIO 22</td>
<td>Default I2C clock pin</td>
</tr>
<tr>
<td>BME280 SDO</td>
<td>GND</td>
<td>Sets I2C address 0x76; tie to 3V3 for 0x77</td>
</tr>
<tr>
<td>BME280 CSB</td>
<td>3V3</td>
<td>Tie high for I2C mode</td>
</tr>
<tr>
<td>OLED VCC</td>
<td>ESP32 3V3</td>
<td>3.3 V logic</td>
</tr>
<tr>
<td>OLED GND</td>
<td>ESP32 GND</td>
<td>Common ground</td>
</tr>
<tr>
<td>OLED SDA</td>
<td>ESP32 GPIO 21</td>
<td>Shared I2C bus with the BME280</td>
</tr>
<tr>
<td>OLED SCL</td>
<td>ESP32 GPIO 22</td>
<td>Shared I2C bus with the BME280</td>
</tr>
</table>
<h2>Power budget</h2>
<p>The ESP32 draws about 80 to 160 mA with Wi-Fi on, and peaks near 240 mA while transmitting. The BME280 draws only a few microamps between readings, and the OLED draws about 20 mA lit. A USB 5 V supply at 500 mA covers the build.</p>
<p>Flash writes add a short current spike, but the spike lasts milliseconds and the supply capacitor on the board absorbs it. The real power cost is Wi-Fi staying on so the download page is always available. If you need battery life, use the deep sleep node build instead, which wakes, logs, sends, and sleeps.</p>
<p>Do not power this logger from a laptop USB port that sleeps. When the laptop sleeps, the USB port may cut power and the log stops. Use a wall USB supply for any unattended logging run.</p>
<h2>Build steps</h2>
<ol>
<li>Install the Adafruit BME280 Library and Adafruit Unified Sensor, plus the Adafruit SSD1306 and GFX libraries.</li>
<li>Wire the BME280 and the OLED to the ESP32 from the wiring table.</li>
<li>Edit the Wi-Fi name and password in the sketch, then upload it to the ESP32 DevKit V1.</li>
<li>Open the serial monitor at 115200 baud and confirm the BME280 is found and LittleFS mounts. Copy the IP address.</li>
<li>Open the IP address in a browser. The status page should show the latest reading and a download link.</li>
<li>Leave the logger running for an hour, then download the CSV. Open it in a spreadsheet and confirm one row per minute.</li>
<li>Check the file size after a day. At 58 KB per day, the 1 MB rotation should not trigger for about 17 days.</li>
</ol>
<h2>Code</h2>
<p>Libraries: Adafruit BME280 Library, Adafruit Unified Sensor, Adafruit SSD1306, Adafruit GFX Library. LittleFS and WebServer ship with the ESP32 Arduino core. Board: ESP32 DevKit V1.</p>
<pre><code>// ESP32 sensor data logger: BME280 to LittleFS, CSV download over WiFi
// Board: ESP32 DevKit V1. No SD card module is used.
#include <WiFi.h>
#include <WebServer.h>
#include <Wire.h>
#include <LittleFS.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

const char* WIFI_SSID = "YOUR_WIFI_NAME";      // Replace with your network
const char* WIFI_PASS = "YOUR_WIFI_PASSWORD";  // Replace with your password

Adafruit_BME280 bme;  // I2C, address 0x76 or 0x77
Adafruit_SSD1306 display(128, 64, &Wire, -1);
WebServer server(80);

const char* LOG_PATH = "/log.csv";
const char* OLD_PATH = "/log_old.csv";
const size_t MAX_LOG_BYTES = 1000000;  // Rotate at 1 MB
const unsigned long SAMPLE_MS = 60000; // One row per minute

void logReading() {
  float t = bme.readTemperature();
  float h = bme.readHumidity();
  float p = bme.readPressure() / 100.0F;
  File f = LittleFS.open(LOG_PATH, FILE_APPEND);
  if (!f) {
    Serial.println("Failed to open log file");
    return;
  }
  // Uptime seconds; the ESP32 has no real-time clock.
  f.printf("%lu,%.1f,%.1f,%.1f\n", millis() / 1000, t, h, p);
  // Read the size while the file is still open; size() after close() returns 0.
  size_t logSize = f.size();
  f.close();
  if (logSize > MAX_LOG_BYTES) {
    LittleFS.remove(OLD_PATH);
    LittleFS.rename(LOG_PATH, OLD_PATH);
  }
}

void handleRoot() {
  float t = bme.readTemperature();
  float h = bme.readHumidity();
  float p = bme.readPressure() / 100.0F;
  String html = "<!DOCTYPE html><html><head><meta charset='utf-8'>"
    "<title>ESP32 Data Logger</title></head><body>"
    "<h1>ESP32 Data Logger</h1>"
    "<p>Temperature: " + String(t, 1) + " C</p>"
    "<p>Humidity: " + String(h, 1) + " %</p>"
    "<p>Pressure: " + String(p, 1) + " hPa</p>"
    "<p><a href='/download'>Download log.csv</a></p>"
    "</body></html>";
  server.send(200, "text/html", html);
}

void handleDownload() {
  File f = LittleFS.open(LOG_PATH, FILE_READ);
  if (!f) {
    server.send(404, "text/plain", "No log file yet");
    return;
  }
  server.sendHeader("Content-Disposition", "attachment; filename=log.csv");
  server.streamFile(f, "text/csv");
  f.close();
}

void setup() {
  Serial.begin(115200);
  Wire.begin(21, 22);
  if (!LittleFS.begin(true)) {
    Serial.println("LittleFS mount failed");
    while (1) delay(100);
  }
  Serial.print("LittleFS free bytes: ");
  Serial.println(LittleFS.totalBytes() - LittleFS.usedBytes());
  if (!bme.begin(0x76) && !bme.begin(0x77)) {
    Serial.println("BME280 not found. Check wiring and address.");
    while (1) delay(100);
  }
  if (!LittleFS.exists(LOG_PATH)) {
    File f = LittleFS.open(LOG_PATH, FILE_WRITE);
    f.println("uptime_s,temperature_c,humidity_pct,pressure_hpa");
    f.close();
  }
  display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
  WiFi.begin(WIFI_SSID, WIFI_PASS);
  while (WiFi.status() != WL_CONNECTED) delay(500);
  Serial.print("Logger at http://");
  Serial.println(WiFi.localIP());
  server.on("/", handleRoot);
  server.on("/download", handleDownload);
  server.begin();
}

void loop() {
  server.handleClient();
  static unsigned long lastSample = 0;
  if (millis() - lastSample >= SAMPLE_MS) {
    lastSample = millis();
    logReading();
    display.clearDisplay();
    display.setTextSize(1);
    display.setTextColor(SSD1306_WHITE);
    display.setCursor(0, 0);
    display.print("Logged: ");
    display.print(millis() / 1000);
    display.println(" s");
    display.display();
  }
}
</code></pre>
<h2>Test and tune it</h2>
<p>Download the CSV after one hour and count the rows. You should see about 60 rows plus the header. Fewer rows means the sample timer is wrong or the board reset. Check the serial monitor for reboot messages.</p>
<p>Open the CSV in a spreadsheet and plot temperature against uptime. The line should be smooth. A jump of several degrees in one minute means the sensor moved, the sun hit it, or the board heat reached it.</p>
<p>If the download returns 404, the log file does not exist yet. Wait one minute for the first sample, then retry. If it still fails, check the LittleFS free space printed at startup.</p>
<h2>FAQ</h2>
<h3>Does this logger need an SD card?</h3>
<p>No. It logs to the ESP32 onboard flash with LittleFS. A CSV row is about 40 bytes, so one day of minute readings is about 58 KB, and the filesystem holds about 26 days before rotation.</p>
<h3>How long will the log last before it rotates?</h3>
<p>About 17 days at one row per minute before the 1 MB rotation renames the file. Lower the sample rate to once per 5 minutes to stretch the same space to about 4 months.</p>
<h3>Why is the timestamp in uptime seconds?</h3>
<p>The ESP32 has no real-time clock, so uptime is the only clock it has without network time. Note the download time and count back, or add an NTP sync step when Wi-Fi connects.</p>
<h3>What happens if power fails during a write?</h3>
<p>The sketch closes the file after every row, so at most one row is lost. Rows already written survive a reset because LittleFS commits them on close.</p>
<h3>Can I log faster than once per minute?</h3>
<p>Yes, but flash wear rises with write count. Once per minute is ample for room weather. Log faster only when the signal changes fast, and rotate the file sooner.</p>
<h2>Parts used</h2>
<p>Build it with the <a href="https://qualityrcparts.com/product/esp32-devkit-v1-development-board-30-pin-wroom-32-wifi-bluetooth-dual-core/">ESP32 DevKit V1 Development Board, 30-Pin WROOM-32</a>, the <a href="https://qualityrcparts.com/product/bme280-temperature-humidity-pressure-sensor-module-5v/">BME280 Temperature, Humidity and Barometric Pressure Sensor Module, 5V, I2C and SPI</a>, and the <a href="https://qualityrcparts.com/product/0-96-inch-oled-display-module-ssd1306-i2c-128x64-for-arduino-esp32-esp8266/">0.96 Inch OLED Display Module, SSD1306, I2C, 128&#215;64, for Arduino / ESP32 / ESP8266</a>. The live dashboard version is <a href="https://qualityrcparts.com/esp32-wifi-sensor-telemetry/">ESP32 WiFi Sensor Telemetry: Live Dashboard with BME280</a>, and the battery version is <a href="https://qualityrcparts.com/esp32-battery-sensor-node-deep-sleep/">Battery-Powered ESP32 Sensor Node: Deep Sleep and Power Budget</a>. For the protocol behind the wiring, see <a href="https://qualityrcparts.com/i2c-vs-spi-vs-uart/">I2C vs SPI vs UART: Which Protocol for Your Sensor or Display</a>.</p>
<h2>Sources</h2>
<ul>
<li><a href="https://learn.adafruit.com/adafruit-bme280-humidity-barometric-pressure-temperature-sensor-breakout?view=all" target="_blank" rel="noopener">Adafruit BME280 breakout guide</a></li>
<li><a href="https://www.mouser.kr/datasheet/2/813/BST_BME280_DS002-2488527.pdf" target="_blank" rel="noopener">Bosch BME280 datasheet BST-BME280-DS002, revision 1.6, September 2018 (VDD 1.71 to 3.6 V, sleep 0.1 uA, I2C addresses 0x76/0x77)</a></li>
<li><a href="https://github.com/espressif/arduino-esp32/blob/master/libraries/LittleFS/examples/LITTLEFS_test/LITTLEFS_test.ino" target="_blank" rel="noopener">Arduino-ESP32 official LittleFS example (begin, FILE_WRITE, FILE_APPEND, rename, remove, exists)</a></li>
<li><a href="https://docs.espressif.com/projects/arduino-esp32/en/latest/" target="_blank" rel="noopener">Espressif Arduino-ESP32 documentation</a></li>
</ul>
<p>Last updated: 2026-11-21. Search volume: not verified. Product links use the store short link form with the product ID; confirm the product slug at publish time.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">23383</post-id>	</item>
		<item>
		<title>ESP32 WiFi Sensor Telemetry: Live Dashboard with BME280</title>
		<link>https://qualityrcparts.com/esp32-wifi-sensor-telemetry/</link>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Sat, 21 Nov 2026 20:56:51 +0000</pubDate>
				<category><![CDATA[Drone Guides]]></category>
		<category><![CDATA[arduino-ide]]></category>
		<category><![CDATA[esp32]]></category>
		<category><![CDATA[i2c]]></category>
		<guid isPermaLink="false">https://qualityrcparts.com/esp32-wifi-sensor-telemetry/</guid>

					<description><![CDATA[Build an ESP32 WiFi sensor telemetry dashboard with a BME280: live temperature, humidity, and pressure on a web page, with wiring and code.]]></description>
										<content:encoded><![CDATA[<h1>ESP32 WiFi Sensor Telemetry: Live Dashboard with BME280</h1>
<p>This ESP32 WiFi sensor telemetry build uses an ESP32 DevKit V1 with a BME280 sensor to serve a live temperature, humidity and pressure dashboard on your local Wi-Fi network. The sensor connects over I2C on GPIO 21 and GPIO 22, the ESP32 runs a small web server, and any phone or laptop on the same network opens the page.</p>
<h2>Quick facts</h2>
<table>
<tr>
<th>Item</th>
<th>Value</th>
</tr>
<tr>
<td>Sensor</td>
<td>BME280, temperature, humidity, pressure</td>
</tr>
<tr>
<td>Interface</td>
<td>I2C, address 0x76 or 0x77</td>
</tr>
<tr>
<td>Supply</td>
<td>3.3 V from the ESP32; bare chip maximum is 3.6 V</td>
</tr>
<tr>
<td>Accuracy</td>
<td>Temperature plus or minus 0.5 C, humidity plus or minus 3 percent, pressure plus or minus 1 hPa</td>
</tr>
<tr>
<td>Update rate</td>
<td>Page refreshes every 5 seconds</td>
</tr>
<tr>
<td>Display</td>
<td>0.96 inch SSD1306 OLED mirrors the readings locally</td>
</tr>
</table>
<h2>ESP32 WiFi sensor telemetry: how does the dashboard work?</h2>
<p>The BME280 measures temperature, relative humidity and barometric pressure in one chip. The ESP32 reads it over I2C, then serves the values as a web page and as a small JSON endpoint. Your browser fetches the JSON every 5 seconds and updates the numbers without reloading the page.</p>
<p>The dashboard runs on your local network only. The ESP32 joins your Wi-Fi as a station, prints its IP address to the serial monitor, and serves the page at that address. Anyone on the same network can open it. Nothing leaves your network, and no account is needed.</p>
<p>The OLED display mirrors the readings on the bench. It is optional, but it helps when the network is down. The OLED uses the same I2C bus as the BME280, with its own address, so no extra pins are needed.</p>
<h2>What does the BME280 measure, and how accurate is it?</h2>
<p>The BME280 measures temperature from -40 to +85 C, relative humidity from 0 to 100 percent, and pressure from 300 to 1100 hPa. Bosch rates temperature accuracy at plus or minus 0.5 C from 0 to 65 C, humidity at plus or minus 3 percent, and pressure at plus or minus 1 hPa. Those figures come from the Bosch BME280 datasheet, revision 1.24, February 2024 (BST-BME280-DS001-24).</p>
<p>Pressure also works as an altimeter, because pressure falls with altitude. The sensor relative accuracy is plus or minus 0.12 hPa from 700 to 900 hPa at 25 to 40 C, which is about 3 feet of altitude. Do not expect survey accuracy from a bench sensor, but it is ample for weather trends and room monitoring.</p>
<p>Keep the sensor away from heat sources. The ESP32 board warms the air around it, and a BME280 mounted tight against the board reads high. Mount it on short jumper wires away from the board and out of direct sun.</p>
<h2>How do you wire the BME280 and the OLED?</h2>
<p>Both parts use I2C. Connect the BME280 VCC to the ESP32 3V3 pin and its GND to ground. Connect SDA to GPIO 21 and SCL to GPIO 22, which are the default I2C pins on the ESP32 DevKit V1. Connect the OLED the same way, on the same two wires.</p>
<p>The bare BME280 chip runs on 1.71 to 3.6 V and is not 5 V tolerant, so power it from 3.3 V on an ESP32. The stocked module lists 5 V support, which means it carries a regulator, but 3.3 V is safe for every version of the board. The OLED module also runs on 3.3 V.</p>
<p>The BME280 I2C address is 0x76 or 0x77, set by the SDO pin. Most small breakout boards default to 0x76. The code below tries 0x76 first and falls back to 0x77, so either board works. If the sensor is not found, run an I2C scanner sketch and read the address it reports.</p>
<h2>How do you read the sensor in code?</h2>
<p>Install the Adafruit BME280 Library and the Adafruit Unified Sensor library from the Arduino Library Manager. The sketch creates an Adafruit_BME280 object, starts it with begin(0x76), and reads temperature, humidity and pressure with readTemperature(), readHumidity() and readPressure(). Pressure comes back in Pascals, so divide by 100 to get hPa.</p>
<p>The web server is the ESP32 WebServer library, which ships with the core. The root handler returns an HTML page. The /data handler returns JSON with the three readings. A small JavaScript timer in the page fetches /data every 5 seconds and writes the values into the page.</p>
<p>The OLED uses the Adafruit SSD1306 library. It draws the same three values on the 128 by 64 display. If you skip the OLED, delete the display code and the sketch still works.</p>
<h2>Wiring</h2>
<p>Wire the build with the power off. Check every connection in the table before you connect any battery or USB cable.</p>
<table>
<tr>
<th>From</th>
<th>To</th>
<th>Notes</th>
</tr>
<tr>
<td>BME280 VCC</td>
<td>ESP32 3V3</td>
<td>3.3 V; bare chip maximum is 3.6 V, never use 5 V on a bare chip</td>
</tr>
<tr>
<td>BME280 GND</td>
<td>ESP32 GND</td>
<td>Common ground</td>
</tr>
<tr>
<td>BME280 SDA</td>
<td>ESP32 GPIO 21</td>
<td>Default I2C data pin</td>
</tr>
<tr>
<td>BME280 SCL</td>
<td>ESP32 GPIO 22</td>
<td>Default I2C clock pin</td>
</tr>
<tr>
<td>BME280 SDO</td>
<td>GND</td>
<td>Sets I2C address 0x76; tie to 3V3 for 0x77</td>
</tr>
<tr>
<td>BME280 CSB</td>
<td>3V3</td>
<td>Tie high for I2C mode</td>
</tr>
<tr>
<td>OLED VCC</td>
<td>ESP32 3V3</td>
<td>3.3 V logic</td>
</tr>
<tr>
<td>OLED GND</td>
<td>ESP32 GND</td>
<td>Common ground</td>
</tr>
<tr>
<td>OLED SDA</td>
<td>ESP32 GPIO 21</td>
<td>Shared I2C bus with the BME280</td>
</tr>
<tr>
<td>OLED SCL</td>
<td>ESP32 GPIO 22</td>
<td>Shared I2C bus with the BME280</td>
</tr>
</table>
<h2>Power budget</h2>
<p>The ESP32 draws about 80 to 160 mA with Wi-Fi on, and peaks near 240 mA while transmitting. The BME280 draws only a few microamps between readings, and the OLED draws about 20 mA with the display lit. A USB 5 V supply at 500 mA covers the whole build with margin.</p>
<p>Do not run this build from a small battery and expect days of life. Wi-Fi on, all the time, is the expensive part. If you need battery life, read the deep sleep sensor node build in <a href="https://qualityrcparts.com/esp32-battery-sensor-node-deep-sleep/">Battery-Powered ESP32 Sensor Node: Deep Sleep and Power Budget</a>, which wakes, reads, sends, and sleeps again.</p>
<p>Keep the USB cable short and the supply stable. A weak cable drops voltage when Wi-Fi transmits, and the ESP32 resets. That reset looks like a code fault, but it is a power fault. The troubleshooting post on brownout resets covers the symptoms.</p>
<h2>Build steps</h2>
<ol>
<li>Install the Adafruit BME280 Library, Adafruit Unified Sensor, and Adafruit SSD1306 libraries from the Library Manager.</li>
<li>Wire the BME280 and the OLED to the ESP32 from the wiring table. Keep the sensor away from the board heat.</li>
<li>Edit the Wi-Fi name and password in the sketch, then upload it to the ESP32 DevKit V1.</li>
<li>Open the serial monitor at 115200 baud and copy the IP address the board prints after it connects.</li>
<li>Open that IP address in a browser on the same network. The dashboard should show live temperature, humidity and pressure.</li>
<li>Check the OLED. It should mirror the same three values. If the OLED is blank, check its I2C address with a scanner sketch.</li>
<li>Leave the board running for an hour and watch the readings. Temperature should track the room, and pressure should drift slowly with the weather.</li>
</ol>
<h2>Code</h2>
<p>Libraries: Adafruit BME280 Library, Adafruit Unified Sensor, Adafruit SSD1306, Adafruit GFX Library (all from the Arduino Library Manager). Board: ESP32 DevKit V1. The sketch tries BME280 address 0x76 first, then 0x77.</p>
<pre><code>// ESP32 WiFi sensor telemetry with BME280 + SSD1306 OLED
// Board: ESP32 DevKit V1. Libraries: Adafruit BME280, Adafruit SSD1306.
#include <WiFi.h>
#include <WebServer.h>
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

const char* WIFI_SSID = "YOUR_WIFI_NAME";      // Replace with your network
const char* WIFI_PASS = "YOUR_WIFI_PASSWORD";  // Replace with your password

Adafruit_BME280 bme;  // I2C, address 0x76 or 0x77
Adafruit_SSD1306 display(128, 64, &Wire, -1);
WebServer server(80);

float temperatureC = 0, humidityPct = 0, pressureHpa = 0;

void readSensor() {
  temperatureC = bme.readTemperature();       // Degrees C
  humidityPct = bme.readHumidity();           // Percent relative humidity
  pressureHpa = bme.readPressure() / 100.0F;  // Pascals to hPa
}

void handleRoot() {
  // Simple page; JavaScript fetches /data every 5 seconds.
  String html = "<!DOCTYPE html><html><head><meta charset='utf-8'>"
    "<title>ESP32 Sensor Telemetry</title></head><body>"
    "<h1>ESP32 Sensor Telemetry</h1>"
    "<p>Temperature: <span id='t'>--</span> C</p>"
    "<p>Humidity: <span id='h'>--</span> %</p>"
    "<p>Pressure: <span id='p'>--</span> hPa</p>"
    "<script>setInterval(async () => {"
    "const r = await fetch('/data'); const d = await r.json();"
    "document.getElementById('t').textContent = d.t.toFixed(1);"
    "document.getElementById('h').textContent = d.h.toFixed(1);"
    "document.getElementById('p').textContent = d.p.toFixed(1);"
    "}, 5000);</script></body></html>";
  server.send(200, "text/html", html);
}

void handleData() {
  readSensor();
  String json = "{\"t\":" + String(temperatureC, 1)
    + ",\"h\":" + String(humidityPct, 1)
    + ",\"p\":" + String(pressureHpa, 1) + "}";
  server.send(200, "application/json", json);
}

void setup() {
  Serial.begin(115200);
  Wire.begin(21, 22);  // SDA, SCL on ESP32 DevKit V1
  if (!bme.begin(0x76)) {
    if (!bme.begin(0x77)) {
      Serial.println("BME280 not found. Check wiring and address.");
      while (1) delay(100);
    }
  }
  if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
    Serial.println("OLED not found. Check wiring and address.");
  }
  WiFi.begin(WIFI_SSID, WIFI_PASS);
  while (WiFi.status() != WL_CONNECTED) delay(500);
  Serial.print("Dashboard at http://");
  Serial.println(WiFi.localIP());
  server.on("/", handleRoot);
  server.on("/data", handleData);
  server.begin();
}

void loop() {
  server.handleClient();
  static unsigned long lastDisplay = 0;
  if (millis() - lastDisplay > 5000) {
    lastDisplay = millis();
    readSensor();
    display.clearDisplay();
    display.setTextSize(1);
    display.setTextColor(SSD1306_WHITE);
    display.setCursor(0, 0);
    display.print("Temp: "); display.print(temperatureC, 1); display.println(" C");
    display.print("Hum:  "); display.print(humidityPct, 1); display.println(" %");
    display.print("Pres: "); display.print(pressureHpa, 1); display.println(" hPa");
    display.display();
  }
}
</code></pre>
<h2>Test and tune it</h2>
<p>Open the dashboard on two devices at once. Both should update every 5 seconds. If one stalls, the Wi-Fi signal at the board is weak. Move the board closer to the router or raise the antenna area clear of metal.</p>
<p>Compare the temperature against a room thermometer. A reading 2 to 3 C high usually means the sensor sits too close to the ESP32 board. Move it onto longer jumper wires and retest.</p>
<p>If the page loads but the numbers stay at dashes, open the /data address directly in the browser. It should return JSON such as {&#8220;t&#8221;:21.5,&#8221;h&#8221;:44.0,&#8221;p&#8221;:1013.2}. If it returns an error, the BME280 read failed, so check the I2C address with a scanner sketch.</p>
<h2>FAQ</h2>
<h3>Why does the BME280 show 0x76 on one board and 0x77 on another?</h3>
<p>The SDO pin sets the address. Tied to ground it is 0x76, tied to the supply it is 0x77. Different breakout boards ship with different defaults. The code tries 0x76 first, then 0x77.</p>
<h3>Can I view the dashboard from outside my home?</h3>
<p>Not as built. The ESP32 serves the page on your local network only. Remote access needs port forwarding or a cloud service, which adds security risk. Keep it local unless you know how to secure it.</p>
<h3>How often should the sensor read?</h3>
<p>Every 5 seconds is ample for room weather. The BME280 itself draws almost nothing, but the Wi-Fi radio dominates power. Faster reads do not improve accuracy.</p>
<h3>Why is the temperature higher than the room thermometer?</h3>
<p>The ESP32 board warms the air around it. Mount the BME280 away from the board on short wires, out of direct sun, and the reading will track the room.</p>
<h3>What is the difference between this build and a weather station?</h3>
<p>A weather station shows readings on a local display. This build adds Wi-Fi, so any device on the network sees live data. The local weather station post on this site covers the display-only version.</p>
<h2>Parts used</h2>
<p>Build it with the <a href="https://qualityrcparts.com/product/esp32-devkit-v1-development-board-30-pin-wroom-32-wifi-bluetooth-dual-core/">ESP32 DevKit V1 Development Board, 30-Pin WROOM-32</a>, the <a href="https://qualityrcparts.com/product/bme280-temperature-humidity-pressure-sensor-module-5v/">BME280 Temperature, Humidity and Barometric Pressure Sensor Module, 5V, I2C and SPI</a>, and the <a href="https://qualityrcparts.com/product/0-96-inch-oled-display-module-ssd1306-i2c-128x64-for-arduino-esp32-esp8266/">0.96 Inch OLED Display Module, SSD1306, I2C, 128&#215;64, for Arduino / ESP32 / ESP8266</a>. For the protocol behind the wiring, see <a href="https://qualityrcparts.com/i2c-vs-spi-vs-uart/">I2C vs SPI vs UART: Which Protocol for Your Sensor or Display</a>, and for the battery version of this node see <a href="https://qualityrcparts.com/esp32-battery-sensor-node-deep-sleep/">Battery-Powered ESP32 Sensor Node: Deep Sleep and Power Budget</a>.</p>
<h2>Sources</h2>
<ul>
<li><a href="https://www.bosch-sensortec.com/media/boschsensortec/downloads/datasheets/bst-bme280-ds002.pdf" target="_blank" rel="noopener">Bosch BME280 datasheet, revision 1.24, February 2024 (BST-BME280-DS001-24)</a></li>
<li><a href="https://learn.adafruit.com/adafruit-bme280-humidity-barometric-pressure-temperature-sensor-breakout?view=all" target="_blank" rel="noopener">Adafruit BME280 breakout guide</a></li>
<li><a href="https://docs.espressif.com/projects/arduino-esp32/en/latest/" target="_blank" rel="noopener">Espressif Arduino-ESP32 documentation</a></li>
<li><a href="https://documentation.espressif.com/esp32_datasheet_en.html" target="_blank" rel="noopener">Espressif ESP32 Series Datasheet</a></li>
</ul>
<p>Last updated: 2026-11-21. Search volume: not verified. Product links use the store short link form with the product ID; confirm the product slug at publish time.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">23381</post-id>	</item>
		<item>
		<title>Raspberry Pi Pico Pinout: RP2040 GPIO, ADC, and Power</title>
		<link>https://qualityrcparts.com/raspberry-pi-pico-pinout/</link>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Sat, 21 Nov 2026 20:51:52 +0000</pubDate>
				<category><![CDATA[Drone Guides]]></category>
		<category><![CDATA[adc]]></category>
		<category><![CDATA[i2c]]></category>
		<category><![CDATA[micropython]]></category>
		<category><![CDATA[pinout]]></category>
		<category><![CDATA[pwm]]></category>
		<category><![CDATA[raspberry-pi-pico]]></category>
		<category><![CDATA[rp2040]]></category>
		<category><![CDATA[spi]]></category>
		<guid isPermaLink="false">https://qualityrcparts.com/raspberry-pi-pico-pinout-2/</guid>

					<description><![CDATA[This Raspberry Pi Pico pinout guide maps all 26 GPIO pins, 3 ADC inputs, PWM, I2C, SPI, UART, and the VSYS, VBUS, and 3V3 power pins.]]></description>
										<content:encoded><![CDATA[<h1>Raspberry Pi Pico Pinout: RP2040 GPIO, ADC, and Power</h1>
<p><strong>Answer in brief:</strong> The Raspberry Pi Pico has 26 GPIO pins, 3 ADC inputs, and PWM on every GPIO pin. It runs the RP2040 chip at a 133 megahertz clock and 3.3 volt logic. This guide maps each pin, the power pins, and the debug pins. It also covers the pins that are not general GPIO.</p>
<h2>Quick Facts</h2>
<table>
<tr>
<th>Item</th>
<th>Detail</th>
<th>Source</th>
</tr>
<tr>
<td>Chip</td>
<td>RP2040, dual-core Cortex-M0+</td>
<td>Raspberry Pi Pico Datasheet</td>
</tr>
<tr>
<td>Clock speed</td>
<td>133 megahertz</td>
<td>Raspberry Pi Pico Datasheet</td>
</tr>
<tr>
<td>Logic voltage</td>
<td>3.3 volts, not 5 volt tolerant</td>
<td>Raspberry Pi Pico Datasheet</td>
</tr>
<tr>
<td>Board edge</td>
<td>40 pins</td>
<td>Raspberry Pi Pico Datasheet</td>
</tr>
<tr>
<td>GPIO pins</td>
<td>26 pins: GP0 to GP22 and GP26 to GP28</td>
<td>Raspberry Pi Pico Datasheet</td>
</tr>
<tr>
<td>ADC inputs</td>
<td>3 inputs: GP26, GP27, GP28, 12-bit</td>
<td>RP2040 Datasheet</td>
</tr>
<tr>
<td>ADC range</td>
<td>0 counts to 4095 counts, 0 volts to 3.3 volts</td>
<td>RP2040 Datasheet</td>
</tr>
<tr>
<td>Onboard LED</td>
<td>GP25</td>
<td>Raspberry Pi Pico Datasheet</td>
</tr>
<tr>
<td>VSYS input range</td>
<td>1.8 volts to 5.5 volts</td>
<td>Raspberry Pi Pico Datasheet</td>
</tr>
<tr>
<td>VBUS pin</td>
<td>Pin 40, USB 5 volt input</td>
<td>Raspberry Pi Pico Datasheet</td>
</tr>
<tr>
<td>3V3 output, max</td>
<td>300 milliamperes</td>
<td>Raspberry Pi Pico Datasheet</td>
</tr>
<tr>
<td>PWM</td>
<td>Every GPIO pin, 8 slices</td>
<td>RP2040 Datasheet</td>
</tr>
</table>
<h2>Raspberry Pi Pico Pinout Table</h2>
<p>This table is an original pinout table built from the Raspberry Pi Pico Datasheet. It is not a copied image. The GP names are the printed pin names on the board. The pin numbers are the board edge numbers.</p>
<table>
<tr>
<th>Edge pin</th>
<th>GP name</th>
<th>Main function</th>
<th>Notes</th>
</tr>
<tr>
<td>1</td>
<td>GP0</td>
<td>GPIO</td>
<td>UART0 TX default</td>
</tr>
<tr>
<td>2</td>
<td>GP1</td>
<td>GPIO</td>
<td>UART0 RX default</td>
</tr>
<tr>
<td>3</td>
<td>GND</td>
<td>Ground</td>
<td>Common ground</td>
</tr>
<tr>
<td>4</td>
<td>GP2</td>
<td>GPIO</td>
<td>I2C1 SDA option</td>
</tr>
<tr>
<td>5</td>
<td>GP3</td>
<td>GPIO</td>
<td>I2C1 SCL option</td>
</tr>
<tr>
<td>6</td>
<td>GP4</td>
<td>GPIO</td>
<td>UART1 TX, I2C0 SDA default</td>
</tr>
<tr>
<td>7</td>
<td>GP5</td>
<td>GPIO</td>
<td>UART1 RX, I2C0 SCL default</td>
</tr>
<tr>
<td>8</td>
<td>GND</td>
<td>Ground</td>
<td>Common ground</td>
</tr>
<tr>
<td>9</td>
<td>GP6</td>
<td>GPIO</td>
<td>I2C1 SDA default</td>
</tr>
<tr>
<td>10</td>
<td>GP7</td>
<td>GPIO</td>
<td>I2C1 SCL default</td>
</tr>
<tr>
<td>11</td>
<td>GP8</td>
<td>GPIO</td>
<td>SPI1 RX default</td>
</tr>
<tr>
<td>12</td>
<td>GP9</td>
<td>GPIO</td>
<td>SPI1 CSn default</td>
</tr>
<tr>
<td>13</td>
<td>GND</td>
<td>Ground</td>
<td>Common ground</td>
</tr>
<tr>
<td>14</td>
<td>GP10</td>
<td>GPIO</td>
<td>SPI1 SCK default</td>
</tr>
<tr>
<td>15</td>
<td>GP11</td>
<td>GPIO</td>
<td>SPI1 TX default</td>
</tr>
<tr>
<td>16</td>
<td>GP12</td>
<td>GPIO</td>
<td>General use</td>
</tr>
<tr>
<td>17</td>
<td>GP13</td>
<td>GPIO</td>
<td>General use</td>
</tr>
<tr>
<td>18</td>
<td>GND</td>
<td>Ground</td>
<td>Common ground</td>
</tr>
<tr>
<td>19</td>
<td>GP14</td>
<td>GPIO</td>
<td>General use</td>
</tr>
<tr>
<td>20</td>
<td>GP15</td>
<td>GPIO</td>
<td>General use</td>
</tr>
<tr>
<td>21</td>
<td>GP16</td>
<td>GPIO</td>
<td>SPI0 RX default</td>
</tr>
<tr>
<td>22</td>
<td>GP17</td>
<td>GPIO</td>
<td>SPI0 CSn default</td>
</tr>
<tr>
<td>23</td>
<td>GND</td>
<td>Ground</td>
<td>Common ground</td>
</tr>
<tr>
<td>24</td>
<td>GP18</td>
<td>GPIO</td>
<td>SPI0 SCK default</td>
</tr>
<tr>
<td>25</td>
<td>GP19</td>
<td>GPIO</td>
<td>SPI0 TX default</td>
</tr>
<tr>
<td>26</td>
<td>GP20</td>
<td>GPIO</td>
<td>General use</td>
</tr>
<tr>
<td>27</td>
<td>GP21</td>
<td>GPIO</td>
<td>General use</td>
</tr>
<tr>
<td>28</td>
<td>GND</td>
<td>Ground</td>
<td>Common ground</td>
</tr>
<tr>
<td>29</td>
<td>GP22</td>
<td>GPIO</td>
<td>General use</td>
</tr>
<tr>
<td>30</td>
<td>RUN</td>
<td>Reset</td>
<td>Active low, pull low to reset</td>
</tr>
<tr>
<td>31</td>
<td>GP26</td>
<td>ADC0</td>
<td>Analog input, 12-bit</td>
</tr>
<tr>
<td>32</td>
<td>GP27</td>
<td>ADC1</td>
<td>Analog input, 12-bit</td>
</tr>
<tr>
<td>33</td>
<td>AGND</td>
<td>Analog ground</td>
<td>Ground for ADC use</td>
</tr>
<tr>
<td>34</td>
<td>GP28</td>
<td>ADC2</td>
<td>Analog input, 12-bit</td>
</tr>
<tr>
<td>35</td>
<td>ADC_VREF</td>
<td>ADC reference</td>
<td>3.3 volt reference input</td>
</tr>
<tr>
<td>36</td>
<td>3V3(OUT)</td>
<td>3.3 volt output</td>
<td>300 milliamperes max</td>
</tr>
<tr>
<td>37</td>
<td>3V3_EN</td>
<td>3.3 volt enable</td>
<td>Pull low to disable the regulator</td>
</tr>
<tr>
<td>38</td>
<td>GND</td>
<td>Ground</td>
<td>Common ground</td>
</tr>
<tr>
<td>39</td>
<td>VSYS</td>
<td>Power input</td>
<td>1.8 volts to 5.5 volts input</td>
</tr>
<tr>
<td>40</td>
<td>VBUS</td>
<td>Power input</td>
<td>USB 5 volt input</td>
</tr>
</table>
<h2>Power Pins</h2>
<p>Power the Pico through USB, the VBUS pin, or the VSYS pin. USB gives 5 volts to VBUS. VBUS is pin 40 on the board edge. VSYS is pin 39 on the board edge. VSYS accepts 1.8 volts to 5.5 volts. That range covers a battery pack and a 5 volt supply.</p>
<p>Use VSYS for battery power. A 3-cell pack or a single lithium cell with a boost stage can feed VSYS. Check the Pico Datasheet power section before you pick a battery. A battery above 5.5 volts can damage the board. A battery below 1.8 volts will not run the regulator.</p>
<p>The 3V3(OUT) pin is pin 36. It gives 3.3 volts at a max of 300 milliamperes. That value comes from the Raspberry Pi Pico Datasheet. Use it for sensors and small loads. A part that needs more current needs its own regulator.</p>
<p>Pin 37 is 3V3_EN. It enables the 3.3 volt regulator. Leave it alone for normal use. Pull it low only when you want to shut the regulator down. Pin 35 is ADC_VREF. It sets the ADC reference. Leave it at 3.3 volts for normal use.</p>
<h2>Boot and Reset Pins</h2>
<p>The Pico has a BOOTSEL button for firmware loading. Hold BOOTSEL while you plug in USB. The board then appears as a USB drive. Drag a UF2 file onto that drive to load new firmware. Release BOOTSEL after the drive appears. That path loads MicroPython, CircuitPython, or a C build.</p>
<p>Pin 30 is RUN. It resets the chip when pulled low. It is active low. Connect a button from RUN to ground for a manual reset. Release the button to let the chip run again. Do not hold RUN low for normal use.</p>
<h2>ADC Pins</h2>
<p>The Pico has 3 ADC inputs on the board edge: GP26, GP27, and GP28. They are ADC0, ADC1, and ADC2. Each input reads 12-bit values from 0 counts to 4095 counts. A 0 volt input reads 0 counts. A 3.3 volt input reads 4095 counts. That step size is about 0.8 millivolts per count at the default reference.</p>
<p>ADC3 is an internal channel. It reads VSYS through GP29. It does not appear on the board edge. Use ADC3 in code to check the supply voltage. That read helps a battery project track its own power.</p>
<h2>PWM Pins</h2>
<p>PWM works on every GPIO pin on the Pico. The RP2040 chip has 8 PWM slices. Each slice drives 2 pins. That gives 16 PWM channels across the 26 GPIO pins. The Pico Datasheet and the RP2040 Datasheet both list this layout.</p>
<p>PWM drives a signal, not a load. Use a transistor or a driver for a motor. Use a series resistor for an LED. RP2040 GPIO pins have four drive-strength settings, nominally 2, 4, 8, and 12 mA, per the RP2040 Datasheet, section 5.5.3.5. The highest setting is 12 mA per pin. The total current sourced by all GPIO and QSPI pins together must not exceed 50 mA, and the total sunk must not exceed 50 mA, per the same datasheet (IIOVDD_MAX and IIOVSS_MAX). Those are drive-strength modes, not hard per-pin limits, and the pin voltage sags as the load rises. Keep LED current low with a resistor.</p>
<h2>I2C Pins</h2>
<p>I2C0 uses GP4 for SDA and GP5 for SCL by default. I2C1 uses GP6 for SDA and GP7 for SCL by default. Those defaults are the common pin choices in Pico examples. The RP2040 chip can route I2C to many other pins. Check the RP2040 Datasheet pin function table before you move the bus.</p>
<p>I2C runs at 3.3 volt logic on this board. Check the device voltage before you connect it. A 5 volt I2C device needs a level shifter. A direct 5 volt connection can damage the Pico.</p>
<h2>SPI Pins</h2>
<p>SPI0 uses GP16 for RX, GP17 for CSn, GP18 for SCK, and GP19 for TX by default. SPI1 uses GP8 for RX, GP9 for CSn, GP10 for SCK, and GP11 for TX by default. Those defaults are the common pin choices in Pico examples. The RP2040 chip can route SPI to many other pins.</p>
<p>SPI runs at 3.3 volt logic on this board. Check the device voltage before you connect it. A 3.3 volt SPI device connects directly. A 5 volt SPI device needs a level shifter.</p>
<h2>UART Pins</h2>
<p>UART0 uses GP0 for TX and GP1 for RX by default. UART1 uses GP4 for TX and GP5 for RX by default. Those defaults are the common pin choices in Pico examples. The RP2040 chip can route UART to many other pins. Check the RP2040 Datasheet pin function table before you move the port.</p>
<p>The USB port carries a separate serial link for MicroPython and for debug output. That link does not use GP0 or GP1. You can use GP0 and GP1 for a device while the USB console stays open. That split is handy for GPS logging.</p>
<h2>USB and SWD Debug Pins</h2>
<p>For a Pico comparison, see the live post <a href="https://qualityrcparts.com/raspberry-pi-pico-vs-pico-w-vs-pico-2/">Raspberry Pi Pico vs Pico W vs Pico 2: Chip, Wireless, and Headers</a> (live post #20577). For starter kit options, see the live post <a href="https://qualityrcparts.com/raspberry-pi-pico-starter-kits-compared/">Raspberry Pi Pico Starter Kits Compared: SunFounder, LAFVIN, and More</a> (live post #20579).</p>
<h2>Pins to Avoid</h2>
<p>Avoid GP23, GP24, GP25, and GP29 as general GPIO. They are internal pins. GP25 is the onboard LED on the Pico. Use it only for the LED. GP24 senses VBUS. GP29 monitors VSYS. GP23 controls power save.</p>
<p>On the Pico WH, GP23, GP24, GP25, and GP29 are used by the onboard wireless chip instead, per the Raspberry Pi Pico W Datasheet. The onboard LED on the Pico WH is driven by the wireless chip, not by GP25, so the GP25 LED blink in the sketch below works on the Pico only, not on the Pico WH. In MicroPython, use Pin(&#8220;LED&#8221;, Pin.OUT) on the Pico WH.</p>
<p>Avoid 5 volt logic on any GPIO pin. This board uses 3.3 volt logic only. It is not 5 volt tolerant. A 5 volt signal needs a level shifter. A direct 5 volt input can damage the pin.</p>
<h2>Max Current and Logic Voltage</h2>
<p>Logic voltage is 3.3 volts on every GPIO pin. That value comes from the Raspberry Pi Pico Datasheet. Treat 3.3 volts as the high level. Treat 0 volts as the low level. The board is not 5 volt tolerant. That warning is in the datasheet.</p>
<p>The 3V3(OUT) pin gives 3.3 volts at a max of 300 milliamperes. That value comes from the Raspberry Pi Pico Datasheet. Treat 300 milliamperes as the working limit for that pin. A larger load needs its own regulator.</p>
<p>The RP2040 GPIO pins have four drive-strength settings, nominally 2, 4, 8, and 12 mA, per the RP2040 Datasheet, section 5.5.3.5. The highest setting is 12 mA per pin. The total current sourced by all GPIO and QSPI pins together must not exceed 50 mA, and the total sunk must not exceed 50 mA (IIOVDD_MAX and IIOVSS_MAX). Treat 12 mA per pin and 50 mA total as the working limits.</p>
<p>Use a driver for any load above a small LED. Keep LED current low with a series resistor. A 220 ohm resistor is a common bench value for a 3.3 volt LED test. Check the LED datasheet for its own forward voltage before you pick a resistor.</p>
<h2>Wiring and Power Warnings</h2>
<p>Power the board before you connect a sensor. Keep the USB cable short. Use a cable under 3 feet for bench tests when you can. Long wires pick up noise. Noise causes ADC jitter and I2C errors.</p>
<p>Do not feed 5 volts into a GPIO pin. Do not feed 5 volts into the 3V3(OUT) pin. Do not feed more than 5.5 volts into VSYS. Each of those mistakes can damage the board. Check the pin labels before every connection.</p>
<h2>Pin Test Sketch</h2>
<p>Language: MicroPython. Firmware: MicroPython version 1.22.2 for RP2040. No extra library install is needed for this test. Load the firmware with the BOOTSEL drive method. Code status: code not compiled. No arduino-cli or PlatformIO is installed in this environment.</p>
<pre><code># Raspberry Pi Pico pin test script
# Language: MicroPython version 1.22.2 for RP2040
# Board: Raspberry Pi Pico, RP2040
# Code status: code not compiled

from machine import Pin, ADC, PWM
import time

# Onboard LED is GP25 on the Pico. On the Pico WH the LED is on the wireless chip, not GP25.
led = Pin(25, Pin.OUT)

# ADC test uses GP26, which is ADC0.
adc = ADC(Pin(26))

# PWM test uses GP15 at 1000 hertz.
pwm = PWM(Pin(15))
pwm.freq(1000)  # Set PWM frequency to 1000 hertz.
pwm.duty_u16(0)  # Start with the output off.

# UART test uses UART0 on GP0 TX and GP1 RX.
# The USB console stays free for print output.
from machine import UART
uart = UART(0, baudrate=9600, tx=Pin(0), rx=Pin(1))

print("Pico pin test started")

while True:
    # Read the ADC value on GP26.
    # ADC range is 0 to 65535 counts in MicroPython.
    value = adc.read_u16()
    print("GP26 ADC value:", value)

    # Convert the ADC value to a voltage from 0 to 3.3 volts.
    volts = value * 3.3 / 65535
    print("GP26 volts:", volts)

    # Fade the PWM output on GP15 from off to full.
    for level in range(0, 65536, 4096):
        pwm.duty_u16(level)
        time.sleep(0.05)  # Wait 50 milliseconds per step.

    # Blink the onboard LED on GP25 once per loop.
    led.on()
    time.sleep(0.5)  # Wait 500 milliseconds.
    led.off()
    time.sleep(0.5)  # Wait 500 milliseconds.
</code></pre>
<p>Expected result: the console shows a GP26 ADC value and a voltage each loop. The value changes with the voltage on GP26. The PWM output on GP15 fades up in steps. The onboard LED blinks once per loop. If no console output appears, check the MicroPython firmware load and the serial port selection.</p>
<h2>Frequently Asked Questions</h2>
<h3>How many GPIO pins does the Pico have?</h3>
<p>It has 26 GPIO pins: GP0 through GP22, plus GP26, GP27, and GP28. GP23, GP24, GP25, and GP29 are internal pins. They do not appear on the board edge as general GPIO.</p>
<h3>Which pins are ADC on the Pico?</h3>
<p>GP26 is ADC0, GP27 is ADC1, and GP28 is ADC2. Each input reads 12-bit values from 0 counts to 4095 counts. ADC3 is an internal channel that reads VSYS.</p>
<h3>Is the Pico 5 volt tolerant?</h3>
<p>No, the Pico is not 5 volt tolerant. It uses 3.3 volt logic only. A 5 volt signal needs a level shifter. A direct 5 volt input can damage the pin.</p>
<h3>How do I load MicroPython on the Pico?</h3>
<p>Hold BOOTSEL while you plug in USB. The board appears as a USB drive. Drag the MicroPython UF2 file onto that drive. The board reboots with MicroPython running.</p>
<h2>Boards That Match This Pinout</h2>
<p>These boards use the pinout in this guide. Check the product page for current stock before you order. Stock changes over time.</p>
<ul>
<li><a href="https://qualityrcparts.com/product/raspberry-pi-pico-development-board-2-pack/">Raspberry Pi Pico Development Board, 2-Pack</a> (product #20323)</li>
<li><a href="https://qualityrcparts.com/product/raspberry-pi-pico-pre-soldered-header/">Raspberry Pi Pico Board with Pre-Soldered Header</a> (product #20329)</li>
<li><a href="https://qualityrcparts.com/product/raspberry-pi-pico-wh-pre-soldered-headers/">Raspberry Pi Pico WH</a> (product #20325)</li>
</ul>
<p>Related reading: compare this board with ESP32 boards in the staged pillar <a href="https://qualityrcparts.com/rp2040-vs-esp32/">RP2040 vs ESP32</a> (row 24, staged). For sibling pinouts, see <a href="https://qualityrcparts.com/arduino-uno-r3-pinout/">Arduino UNO R3 Pinout</a> and <a href="https://qualityrcparts.com/nano-v3-usb-c-arduino-projects-guide/">Nano V3.0 USB-C Guide: ATmega328P Board for Arduino IDE</a>.</p>
<h2>Sources</h2>
<ul>
<li>Raspberry Pi Pico Datasheet, https://datasheets.raspberrypi.com/pico/pico-datasheet.pdf</li>
<li>RP2040 Datasheet, https://datasheets.raspberrypi.com/rp2040/rp2040-datasheet.pdf</li>
<li>Raspberry Pi Pico W Datasheet, https://pip.raspberrypi.com/documents/RP-008312-DS-pico-w-datasheet.pdf</li>
<li>Raspberry Pi Pico pinout guide, https://www.raspberrypi.com/documentation/microcontrollers/raspberry-pi-pico.html</li>
</ul>
<p>Last updated 2026-11-21.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">23365</post-id>	</item>
		<item>
		<title>Arduino UNO R3 Pinout: Digital, Analog, PWM, and Power</title>
		<link>https://qualityrcparts.com/arduino-uno-r3-pinout/</link>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Sat, 21 Nov 2026 20:51:17 +0000</pubDate>
				<category><![CDATA[Drone Guides]]></category>
		<category><![CDATA[adc]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[arduino-uno]]></category>
		<category><![CDATA[i2c]]></category>
		<category><![CDATA[pinout]]></category>
		<category><![CDATA[pwm]]></category>
		<category><![CDATA[spi]]></category>
		<category><![CDATA[uart]]></category>
		<guid isPermaLink="false">https://qualityrcparts.com/arduino-uno-r3-pinout-2/</guid>

					<description><![CDATA[This Arduino UNO R3 pinout guide maps all 14 digital pins, 6 analog inputs, 6 PWM pins, and the power pins, with current limits and wiring rules.]]></description>
										<content:encoded><![CDATA[<h1>Arduino UNO R3 Pinout: Digital, Analog, PWM, and Power</h1>
<p><strong>Answer in brief:</strong> The Arduino UNO R3 has 14 digital pins, 6 analog inputs, and 6 PWM pins. It runs on 5 volt logic at a 16 megahertz clock. This guide maps each pin, the power pins, and the current limits. It also covers I2C, SPI, UART, and the pins to avoid.</p>
<h2>Quick Facts</h2>
<table>
<tr>
<th>Item</th>
<th>Detail</th>
<th>Source</th>
</tr>
<tr>
<td>Chip</td>
<td>ATmega328P</td>
<td>Arduino UNO R3 documentation</td>
</tr>
<tr>
<td>Clock speed</td>
<td>16 megahertz</td>
<td>Arduino UNO R3 documentation</td>
</tr>
<tr>
<td>Logic voltage</td>
<td>5 volts</td>
<td>Arduino UNO R3 documentation</td>
</tr>
<tr>
<td>Digital pins</td>
<td>14 pins, D0 to D13</td>
<td>Arduino UNO R3 documentation</td>
</tr>
<tr>
<td>PWM pins</td>
<td>6 pins: D3, D5, D6, D9, D10, D11</td>
<td>Arduino UNO R3 documentation</td>
</tr>
<tr>
<td>Analog inputs</td>
<td>6 inputs, A0 to A5, 10-bit</td>
<td>Microchip ATmega328P datasheet DS40002061B</td>
</tr>
<tr>
<td>Analog range</td>
<td>0 counts to 1023 counts</td>
<td>Microchip ATmega328P datasheet DS40002061B</td>
</tr>
<tr>
<td>Per-pin current, recommended</td>
<td>20 milliamperes</td>
<td>Microchip ATmega328P datasheet DS40002061B</td>
</tr>
<tr>
<td>Per-pin current, absolute max</td>
<td>40 milliamperes</td>
<td>Microchip ATmega328P datasheet DS40002061B</td>
</tr>
<tr>
<td>Chip total current</td>
<td>200 milliamperes</td>
<td>Microchip ATmega328P datasheet DS40002061B</td>
</tr>
<tr>
<td>3V3 output, max</td>
<td>About 50 milliamperes</td>
<td>Arduino UNO R3 documentation</td>
</tr>
<tr>
<td>VIN range, recommended</td>
<td>7 volts to 12 volts</td>
<td>Arduino UNO R3 documentation</td>
</tr>
</table>
<h2>Arduino UNO R3 Pinout Table</h2>
<p>This table is an original pinout table built from the Arduino UNO R3 documentation. It is not a copied image. The D names are the printed header names on the board. Use the table with the board in front of you.</p>
<table>
<tr>
<th>Pin</th>
<th>Function</th>
<th>Shared functions</th>
</tr>
<tr>
<td>D0</td>
<td>Digital I/O</td>
<td>UART RX</td>
</tr>
<tr>
<td>D1</td>
<td>Digital I/O</td>
<td>UART TX</td>
</tr>
<tr>
<td>D2</td>
<td>Digital I/O</td>
<td>Interrupt INT0</td>
</tr>
<tr>
<td>D3</td>
<td>Digital I/O, PWM</td>
<td>Interrupt INT1, PWM at 490 hertz</td>
</tr>
<tr>
<td>D4</td>
<td>Digital I/O</td>
<td>None</td>
</tr>
<tr>
<td>D5</td>
<td>Digital I/O, PWM</td>
<td>PWM at 980 hertz</td>
</tr>
<tr>
<td>D6</td>
<td>Digital I/O, PWM</td>
<td>PWM at 980 hertz</td>
</tr>
<tr>
<td>D7</td>
<td>Digital I/O</td>
<td>None</td>
</tr>
<tr>
<td>D8</td>
<td>Digital I/O</td>
<td>None</td>
</tr>
<tr>
<td>D9</td>
<td>Digital I/O, PWM</td>
<td>PWM at 490 hertz</td>
</tr>
<tr>
<td>D10</td>
<td>Digital I/O, PWM</td>
<td>SPI SS, PWM at 490 hertz</td>
</tr>
<tr>
<td>D11</td>
<td>Digital I/O, PWM</td>
<td>SPI MOSI, PWM at 490 hertz</td>
</tr>
<tr>
<td>D12</td>
<td>Digital I/O</td>
<td>SPI MISO</td>
</tr>
<tr>
<td>D13</td>
<td>Digital I/O</td>
<td>SPI SCK, onboard LED</td>
</tr>
<tr>
<td>A0</td>
<td>Analog input</td>
<td>Digital pin D14</td>
</tr>
<tr>
<td>A1</td>
<td>Analog input</td>
<td>Digital pin D15</td>
</tr>
<tr>
<td>A2</td>
<td>Analog input</td>
<td>Digital pin D16</td>
</tr>
<tr>
<td>A3</td>
<td>Analog input</td>
<td>Digital pin D17</td>
</tr>
<tr>
<td>A4</td>
<td>Analog input</td>
<td>Digital pin D18, I2C SDA</td>
</tr>
<tr>
<td>A5</td>
<td>Analog input</td>
<td>Digital pin D19, I2C SCL</td>
</tr>
<tr>
<td>VIN</td>
<td>Power input</td>
<td>7 volts to 12 volts recommended</td>
</tr>
<tr>
<td>5V</td>
<td>Power output</td>
<td>5 volt rail from USB or regulator</td>
</tr>
<tr>
<td>3V3</td>
<td>Power output</td>
<td>3.3 volt output, about 50 milliamperes max</td>
</tr>
<tr>
<td>GND</td>
<td>Ground</td>
<td>Common ground for all wiring</td>
</tr>
<tr>
<td>IOREF</td>
<td>Reference</td>
<td>Board logic voltage, 5 volts</td>
</tr>
<tr>
<td>AREF</td>
<td>Reference</td>
<td>Analog reference input</td>
</tr>
<tr>
<td>RESET</td>
<td>Reset</td>
<td>Pull low to restart the chip</td>
</tr>
</table>
<h2>Power Pins</h2>
<p>Power the UNO R3 through USB, the barrel jack, or the VIN pin. The barrel jack and VIN accept 7 volts to 12 volts. The on-board regulator drops that input to 5 volts. A higher input makes the regulator run hotter. Keep the input near 9 volts for bench work when you can.</p>
<p>The 5V pin is a 5 volt output when USB or the jack powers the board. It can also act as a 5 volt input. Feed it only with a clean, regulated 5 volt supply. Do not feed it with a higher voltage. The 3V3 pin gives 3.3 volts at about 50 milliamperes max. Use it only for small 3.3 volt parts.</p>
<p>IOREF tells a shield the board logic voltage. On this board, IOREF is 5 volts. AREF sets the top of the analog range. Leave AREF unconnected for normal use. The default reference is 5 volts. Ground pins appear on both headers. Use the nearest ground for each part.</p>
<h2>Boot and Reset Pins</h2>
<p>The UNO R3 has no strapping pins like an ESP32 board. It starts code on power-up or reset. The RESET pin restarts the chip when pulled low. The on-board RESET button does the same job. A shield can also pull RESET low.</p>
<p>Uploads use the USB port and the on-board USB-to-serial chip. The IDE resets the board through the serial link. No jumper is needed for normal uploads. If an upload fails, press RESET once and try again. Check the board and port selection in the IDE first.</p>
<p>The ICSP header near the chip carries SPI and reset for direct programming. Most users never need it. Leave it alone unless you program the chip with an external programmer. A wrong ICSP connection can erase the bootloader.</p>
<h2>ADC Pins</h2>
<p>The UNO R3 has 6 analog inputs, A0 through A5. Each input reads 10-bit values from 0 counts to 1023 counts. A 0 volt input reads 0 counts. A 5 volt input reads 1023 counts. That step size is about 4.9 millivolts per count at the default reference.</p>
<p>A0 through A5 also work as digital pins D14 through D19. Use them as digital outputs when you run out of digital pins. Set the pin mode in code. A pin cannot read analog and drive digital at the same time.</p>
<h2>PWM Pins</h2>
<p>PWM is available on 6 pins: D3, D5, D6, D9, D10, and D11. The PWM frequency is 490 hertz on D3, D9, D10, and D11. It is 980 hertz on D5 and D6. That split matters for some loads. A motor driver may buzz at one frequency and run smooth at the other.</p>
<p>PWM drives a signal, not a load. Use a transistor or a driver for a motor. Use a series resistor for an LED. A PWM pin still follows the 20 milliampere recommended limit. Do not connect a motor directly to a PWM pin.</p>
<h2>I2C Pins</h2>
<p>I2C uses A4 for SDA and A5 for SCL. Those two analog pins carry the bus. Connect a display or a sensor to those two pins. Share the bus with more than one device when each device has a different address.</p>
<p>A4 and A5 cannot read analog while they run the I2C bus. Plan the pin budget when you need both I2C and analog reads. Use A0 through A3 for analog in that case. That leaves A4 and A5 free for the bus.</p>
<h2>SPI Pins</h2>
<p>SPI uses D10 for SS, D11 for MOSI, D12 for MISO, and D13 for SCK. Those four pins carry the bus. Pick a different digital pin for a second chip select when you add a second SPI device. D10 must stay an output for the board to act as SPI master.</p>
<p>SPI runs at 5 volt logic on this board. Check the device voltage before you connect it. A 3.3 volt SPI device needs a level shifter. A direct 5 volt connection can damage a 3.3 volt part.</p>
<h2>UART Pins</h2>
<p>UART uses D0 for RX and D1 for TX. Those pins connect to the USB-to-serial chip. They carry the serial monitor link. They also carry uploads. Do not connect a GPS module to D0 and D1 while you debug over USB. The two uses clash.</p>
<p>Keep the baud rate the same on both ends of a UART link. A mismatch gives garbled text. Start at 9600 baud for a new device. Raise the rate only after the link works.</p>
<h2>USB Pins</h2>
<p>The UNO R3 has a USB port for power and programming. The product in this guide uses a USB cable in the box. Check the product page for the cable type in your pack. The USB link powers the board at 5 volts. It also carries uploads and serial debug output.</p>
<p>The USB port does not expose D0 and D1 as separate pads. Those pins are the UART lines behind the USB chip. Treat D0 and D1 as busy during uploads. Free them only after the upload ends.</p>
<h2>Pins to Avoid</h2>
<p>Avoid D0 and D1 for sensors while you debug over USB. Avoid A4 and A5 for analog reads while I2C is active. Avoid D10 as a general input when SPI runs as master. It must stay an output in that mode.</p>
<p>Avoid AREF as a power output. It is a reference input only. Avoid feeding 5 volts into the 3V3 pin. Avoid feeding more than 5 volts into the 5V pin. Both mistakes can damage the regulator or the chip.</p>
<p>Avoid a load above 20 milliamperes on any single pin. Avoid a total load above 200 milliamperes across the chip. Those limits come from the Microchip ATmega328P datasheet DS40002061B. Stay under them for a long board life.</p>
<h2>Max Current and Logic Voltage</h2>
<p>Logic voltage is 5 volts on every digital pin. That value comes from the Arduino UNO R3 documentation. Treat 5 volts as the high level. Treat 0 volts as the low level. A 3.3 volt sensor output may read as high on a 5 volt input, but check the sensor datasheet first.</p>
<p>The recommended current per pin is 20 milliamperes. The absolute max per pin is 40 milliamperes. The chip total is 200 milliamperes. Those three numbers come from the Microchip ATmega328P datasheet DS40002061B. Treat 20 milliamperes as the working limit. Treat 40 milliamperes as a damage threshold, not a target.</p>
<p>The 3V3 output gives about 50 milliamperes max. That value comes from the Arduino UNO R3 documentation. Use it only for small 3.3 volt parts. A WiFi module or a large display needs its own regulator.</p>
<h2>Wiring and Power Warnings</h2>
<p>Power the board before you connect a sensor. Keep the USB cable short. Use a cable under 3 feet for bench tests when you can. Long wires pick up noise. Noise causes analog jitter and I2C errors.</p>
<p>Use a series resistor for every LED. A 220 ohm resistor is a common bench value for a 5 volt LED test. Check the LED datasheet for its own forward voltage before you pick a resistor. A LED with no resistor can draw too much current from the pin.</p>
<p>Use a driver for any motor, relay, or solenoid. The GPIO pin only signals the driver. The driver handles the load current. A direct motor connection can damage the pin and reset the board.</p>
<h2>Pin Test Sketch</h2>
<p>Language: Arduino. Library: Arduino AVR core version 1.8.6, with no extra library install. Code status: code not compiled. No arduino-cli or PlatformIO is installed in this environment.</p>
<pre><code>// Arduino UNO R3 pin test sketch
// Board: UNO R3, ATmega328P
// Arduino AVR core version 1.8.6
// Code status: code not compiled

// PWM test pin is D9. It runs at 490 hertz.
const int pwmPin = 9;
// Analog test pin is A0. It reads 0 to 1023 counts.
const int analogPin = A0;
// Onboard LED pin is D13.
const int ledPin = 13;

void setup() {
  // Start serial at 9600 baud for debug output.
  Serial.begin(9600);
  delay(500); // Wait 500 milliseconds for the monitor.

  // Set the PWM pin and the LED pin as outputs.
  pinMode(pwmPin, OUTPUT);
  pinMode(ledPin, OUTPUT);

  Serial.println("UNO R3 pin test started");
}

void loop() {
  // Read the analog value on A0.
  int adcValue = analogRead(analogPin);
  Serial.print("A0 value: ");
  Serial.println(adcValue);

  // Fade the PWM output on D9 from off to full.
  for (int level = 0; level &lt;= 255; level += 5) {
    analogWrite(pwmPin, level);
    delay(20); // Wait 20 milliseconds per step.
  }

  // Blink the onboard LED on D13 once per loop.
  digitalWrite(ledPin, HIGH);
  delay(500); // Wait 500 milliseconds.
  digitalWrite(ledPin, LOW);
  delay(500); // Wait 500 milliseconds.
}
</code></pre>
<p>Expected result: the serial monitor shows an A0 value each loop. The value changes with the voltage on A0. The PWM output on D9 fades up in steps. The onboard LED blinks once per loop. If no serial output appears, check the board and port selection in the IDE.</p>
<h2>Frequently Asked Questions</h2>
<h3>How many digital pins does the UNO R3 have?</h3>
<p>It has 14 digital pins, D0 through D13. Six of those pins support PWM. The analog pins A0 through A5 can also work as digital pins D14 through D19.</p>
<h3>Which pins are PWM on the UNO R3?</h3>
<p>PWM pins are D3, D5, D6, D9, D10, and D11. D5 and D6 run at 980 hertz. The other four PWM pins run at 490 hertz.</p>
<h3>What is the current limit per pin?</h3>
<p>The recommended limit is 20 milliamperes per pin. The absolute max is 40 milliamperes per pin. The chip total is 200 milliamperes. Stay under the recommended limit for normal use.</p>
<h3>Can I power the UNO R3 from the VIN pin?</h3>
<p>Yes, feed VIN with 7 volts to 12 volts. The on-board regulator drops that input to 5 volts. Keep the input near 9 volts for bench work. A higher input makes the regulator run hotter.</p>
<h2>Boards That Match This Pinout</h2>
<p>These boards use the pinout in this guide. Check the product page for current stock before you order. Stock changes over time.</p>
<ul>
<li><a href="https://qualityrcparts.com/product/elegoo-uno-r3-microcontroller-board-atmega328p-atmega16u2-with-usb-cable/">UNO R3 Microcontroller Board</a> (product #17891)</li>
<li><a href="https://qualityrcparts.com/product/r3-development-board-atmega328p-16u2-usb-cable/">R3 Development Board ATmega328P</a> (product #23113)</li>
</ul>
<p>Related reading: compare this board with other microcontroller families in the staged pillar <a href="https://qualityrcparts.com/rp2040-vs-esp32/">RP2040 vs ESP32</a> (row 24, staged). For a first project, see the live post <a href="https://qualityrcparts.com/uno-r3-compatible-board-guide/">How to Start with a UNO R3 Board for Arduino Projects</a> (live post #15177) and the live post <a href="https://qualityrcparts.com/first-arduino-project-uno-oled-temperature/">How to Build Your First Arduino Project with UNO and OLED</a> (live post #15203). For sibling pinouts, see <a href="https://qualityrcparts.com/nano-v3-usb-c-arduino-projects-guide/">Nano V3.0 USB-C Guide: ATmega328P Board for Arduino IDE</a> and <a href="https://qualityrcparts.com/raspberry-pi-pico-pinout/">Raspberry Pi Pico Pinout</a>.</p>
<h2>Sources</h2>
<ul>
<li>Arduino UNO R3 documentation, https://docs.arduino.cc/hardware/uno-rev3/</li>
<li>Microchip ATmega328P datasheet DS40002061B, https://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-7810-Automotive-Microcontrollers-ATmega328P_Datasheet.pdf</li>
<li>Arduino UNO R3 schematic, https://docs.arduino.cc/hardware/uno-rev3/</li>
</ul>
<p>Last updated 2026-11-21.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">23364</post-id>	</item>
		<item>
		<title>Seeed XIAO ESP32S3 Pinout: GPIO, Camera, and Power</title>
		<link>https://qualityrcparts.com/xiao-esp32s3-pinout/</link>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Sat, 21 Nov 2026 20:50:41 +0000</pubDate>
				<category><![CDATA[Drone Guides]]></category>
		<category><![CDATA[adc]]></category>
		<category><![CDATA[esp32-cam]]></category>
		<category><![CDATA[esp32-s3]]></category>
		<category><![CDATA[i2c]]></category>
		<category><![CDATA[pinout]]></category>
		<category><![CDATA[spi]]></category>
		<category><![CDATA[uart]]></category>
		<category><![CDATA[xiao]]></category>
		<guid isPermaLink="false">https://qualityrcparts.com/xiao-esp32s3-pinout/</guid>

					<description><![CDATA[This XIAO ESP32S3 pinout guide maps all 11 GPIO pins, the native USB pins, the Sense camera and SD card, and the power pins.]]></description>
										<content:encoded><![CDATA[<h1>XIAO ESP32S3 Pinout: GPIO, Camera, and Power Pins</h1>
<p><strong>Answer in brief:</strong> The XIAO ESP32S3 gives you 11 GPIO pins, named D0 through D10. It also gives you native USB, I2C, SPI, UART, and ADC on those same pins. The Sense version adds a camera and a microSD card on a rear connector. This guide maps each pin and its shared uses.</p>
<h2>Quick Facts</h2>
<table>
<tr>
<th>Item</th>
<th>Detail</th>
<th>Source</th>
</tr>
<tr>
<td>Board</td>
<td>XIAO ESP32S3</td>
<td>Seeed Studio XIAO ESP32S3 wiki</td>
</tr>
<tr>
<td>GPIO pins</td>
<td>11 pins, D0 to D10</td>
<td>Seeed Studio XIAO ESP32S3 wiki</td>
</tr>
<tr>
<td>Logic voltage</td>
<td>3.3 volts</td>
<td>Seeed Studio XIAO ESP32S3 wiki</td>
</tr>
<tr>
<td>USB port</td>
<td>USB-C, native USB</td>
<td>Seeed Studio XIAO ESP32S3 wiki</td>
</tr>
<tr>
<td>Native USB pins</td>
<td>GPIO19 D- and GPIO20 D+</td>
<td>Seeed Studio XIAO ESP32S3 wiki</td>
</tr>
<tr>
<td>Boot pin</td>
<td>GPIO0</td>
<td>Seeed Studio XIAO ESP32S3 wiki</td>
</tr>
<tr>
<td>I2C pins</td>
<td>D4 SDA and D5 SCL</td>
<td>Seeed Studio XIAO ESP32S3 wiki</td>
</tr>
<tr>
<td>SPI pins</td>
<td>D8 SCK, D9 MISO, D10 MOSI</td>
<td>Seeed Studio XIAO ESP32S3 wiki</td>
</tr>
<tr>
<td>UART pins</td>
<td>D6 TX and D7 RX</td>
<td>Seeed Studio XIAO ESP32S3 wiki</td>
</tr>
<tr>
<td>Sense SD chip select</td>
<td>GPIO21</td>
<td>Seeed Studio XIAO ESP32S3 wiki</td>
</tr>
</table>
<h2>XIAO ESP32S3 Pinout Table</h2>
<p>This table is an original pinout table built from the Seeed wiki pin multiplexing page. It is not a copied image. The D names are the printed pad names on the board. The GPIO numbers are the chip pin numbers in code.</p>
<table>
<tr>
<th>Pad</th>
<th>GPIO</th>
<th>Main function</th>
<th>Shared functions</th>
</tr>
<tr>
<td>D0</td>
<td>GPIO1</td>
<td>ADC input</td>
<td>Touch input</td>
</tr>
<tr>
<td>D1</td>
<td>GPIO2</td>
<td>ADC input</td>
<td>Touch input</td>
</tr>
<tr>
<td>D2</td>
<td>GPIO3</td>
<td>ADC input</td>
<td>Touch input, strapping pin</td>
</tr>
<tr>
<td>D3</td>
<td>GPIO4</td>
<td>ADC input</td>
<td>Touch input</td>
</tr>
<tr>
<td>D4</td>
<td>GPIO5</td>
<td>I2C SDA</td>
<td>ADC input, touch input</td>
</tr>
<tr>
<td>D5</td>
<td>GPIO6</td>
<td>I2C SCL</td>
<td>ADC input, touch input</td>
</tr>
<tr>
<td>D6</td>
<td>GPIO43</td>
<td>UART TX</td>
<td>UART transmit only</td>
</tr>
<tr>
<td>D7</td>
<td>GPIO44</td>
<td>UART RX</td>
<td>UART receive only</td>
</tr>
<tr>
<td>D8</td>
<td>GPIO7</td>
<td>SPI SCK</td>
<td>ADC input, touch input</td>
</tr>
<tr>
<td>D9</td>
<td>GPIO8</td>
<td>SPI MISO</td>
<td>ADC input, touch input</td>
</tr>
<tr>
<td>D10</td>
<td>GPIO9</td>
<td>SPI MOSI</td>
<td>ADC input, touch input</td>
</tr>
<tr>
<td>BOOT</td>
<td>GPIO0</td>
<td>Boot button</td>
<td>Hold low at reset for download mode</td>
</tr>
<tr>
<td>5V</td>
<td>Power</td>
<td>5 volt input</td>
<td>USB 5 volt rail when USB is connected</td>
</tr>
<tr>
<td>3V3</td>
<td>Power</td>
<td>3.3 volt output</td>
<td>Power for low-current 3.3 volt parts</td>
</tr>
<tr>
<td>GND</td>
<td>Power</td>
<td>Ground</td>
<td>Common ground for all wiring</td>
</tr>
</table>
<h2>Power Pins</h2>
<p>Power the board through the USB-C port or the 5V pad. The USB-C port supplies 5 volts from the host. The 5V pad accepts 5 volts from an external supply. Use one 5 volt source at a time. Do not feed 5 volts into the 3V3 pad.</p>
<p>The 3V3 pad is a 3.3 volt output from the SGM6029 buck converter on the board. The schematic v1.3 marks that converter Imax 600 mA, so keep external 3.3 volt loads under 600 mA in total. The Seeed wiki says 700 mA can be drawn from the 3V3 pad, which is above the schematic Imax, so the 600 mA schematic figure is the safe limit to plan on. The 5V pad is the USB VBUS rail. No separate 5V input current limit is published in schematic v1.3, so the USB source and cable set that limit in practice.</p>
<h2>Strapping and Boot Pins</h2>
<p>GPIO0 is the BOOT pin. The board has a BOOT button tied to GPIO0. Hold BOOT low at reset to enter download mode. The Arduino IDE and esptool handle this step in most cases. Press BOOT only when an upload fails to start.</p>
<p>GPIO3 on pad D2 is also a strapping pin. Keep D2 free of strong pull-downs at boot. A wrong level at boot can change the boot mode. Check the Seeed wiki strapping notes before you wire a sensor to D2.</p>
<h2>ADC and Touch Pins</h2>
<p>ADC input is available on D0, D1, D2, D3, D4, D5, D8, D9, and D10. That is 9 ADC pins in total. Each ADC pin reads a voltage from 0 volts to 3.3 volts. Use a voltage divider for any higher voltage. Never feed 5 volts into an ADC pin.</p>
<p>D11 is GPIO42 and D12 is GPIO41 on Sense and Plus variants. Those two pins serve the PDM microphone on the Sense board. Note that D11 and D12 do not support ADC on the S3 chip. Do not plan an analog read on those two pins. Use them only for their Sense roles unless the wiki for your variant says otherwise.</p>
<h2>PWM Pins</h2>
<p>PWM output works on the GPIO pins through the LEDC peripheral. Use PWM for a dim LED, a small buzzer, or a servo signal. The servo signal is a control signal only. It does not power the servo. Power the servo from a separate supply.</p>
<p>Every D pad can carry a PWM signal in code. The limit is the pin count, not the PWM peripheral. Pick a free D pad for each PWM output. Keep I2C and SPI pins free when those buses are in use. A PWM output on D4 would clash with I2C SDA.</p>
<h2>I2C Pins</h2>
<p>I2C uses D4 for SDA and D5 for SCL. The chip GPIO numbers are GPIO5 and GPIO6. Those two pins are the default I2C pair in most XIAO examples. Use them for an OLED display, a sensor, or a real-time clock.</p>
<p>Both I2C pins also support ADC and touch. That sharing means a choice. A pin on the I2C bus cannot read an analog voltage at the same time. Plan the pin budget before you add a second sensor.</p>
<h2>SPI Pins</h2>
<p>SPI uses D8 for SCK, D9 for MISO, and D10 for MOSI. The chip GPIO numbers are GPIO7, GPIO8, and GPIO9. Pick any free GPIO pin for the SPI chip select. D0 is a common chip select choice when it is free.</p>
<p>All three SPI pins also support ADC and touch. That sharing is the same trade as I2C. A SPI device claims all three pins. Plan for that claim before you add an analog sensor to D8, D9, or D10.</p>
<h2>UART Pins</h2>
<p>UART uses D6 for TX and D7 for RX. The chip GPIO numbers are GPIO43 and GPIO44. Those two pins carry the hardware serial port on the board pads. Use them for a GPS module, a serial sensor, or a second microcontroller.</p>
<p>The USB-C port carries a separate native USB serial link. That link is the programming and debug console. It does not use D6 or D7. You can use D6 and D7 for a device while the USB console stays open. That split is handy for GPS logging.</p>
<h2>USB Pins</h2>
<p>Native USB uses GPIO19 for D- and GPIO20 for D+. Those pins are internal. They do not appear on the D pads. The USB-C connector ties to them on the board. You cannot reassign them to other uses.</p>
<p>Native USB supports serial, HID, and mass storage modes in code. The Arduino core exposes USB serial by default. Use the USB link for uploads and debug output. Use D6 and D7 when you need a separate hardware UART.</p>
<h2>Sense Camera and SD Card</h2>
<p>The Sense version adds an OV2640 camera and a microSD card slot. Both sit on a rear board-to-board connector. The standard XIAO ESP32S3 has no camera and no SD slot. Check which version you hold before you follow the Sense wiring.</p>
<table>
<tr>
<th>Sense feature</th>
<th>Detail</th>
<th>Source</th>
</tr>
<tr>
<td>Camera</td>
<td>OV2640 on rear connector</td>
<td>Seeed Studio XIAO ESP32S3 wiki</td>
</tr>
<tr>
<td>SD card chip select</td>
<td>GPIO21</td>
<td>Seeed Studio XIAO ESP32S3 wiki</td>
</tr>
<tr>
<td>PDM microphone pins</td>
<td>GPIO42 and GPIO41</td>
<td>Seeed Studio XIAO ESP32S3 wiki</td>
</tr>
<tr>
<td>Standard board camera</td>
<td>None fitted</td>
<td>Seeed Studio XIAO ESP32S3 wiki</td>
</tr>
</table>
<p>The Sense camera uses the rear connector, not the D pads. That design keeps D0 through D10 free for your own wiring, except for the SD card sharing below. The SD card chip select is GPIO21. The SD card shares the SPI lines D8, D9, and D10, which are GPIO7, GPIO8, and GPIO9, with chip select on GPIO21. Do not put a second SPI device on D8, D9, and D10 while the SD card is mounted unless it has its own chip select pin. GPIO21 is also the user LED, so the LED flickers with card access.</p>
<p>For the Sense board guide, see the live post <a href="https://qualityrcparts.com/seeed-xiao-esp32s3-sense-boards-guide/">Seeed XIAO ESP32S3 Guide: Standard Board vs Sense Board</a> (live post #18362). That guide compares the standard board and the Sense board in full.</p>
<h2>Pins to Avoid</h2>
<p>Avoid GPIO19 and GPIO20 for general wiring. They are the native USB pins. Avoid GPIO0 as a permanent output. It is the BOOT pin. Avoid D2 as a boot-time output. It is a strapping pin.</p>
<p>Avoid D11 and D12 for ADC reads. Those pins do not support ADC on the S3 chip. Avoid 5 volt logic on any D pad. This board uses 3.3 volt logic. A 5 volt signal needs a level shifter.</p>
<p>Avoid using D4 and D5 for other roles when I2C is active. Avoid D8, D9, and D10 for other roles when SPI is active. A shared pin causes a clash that is hard to trace in code.</p>
<h2>Max Current and Logic Voltage</h2>
<p>Logic voltage is 3.3 volts on every D pad. That value comes from the Seeed Studio XIAO ESP32S3 wiki. Treat 3.3 volts as the high level. Treat 0 volts as the low level. Keep sensor outputs at 3.3 volts or below.</p>
<p>At the strongest drive setting, a GPIO pin sources about 40 mA (IOH) and sinks about 28 mA (IOL), per the Espressif ESP32-S3 Series Datasheet v2.2, Table 5-4. Those are drive-strength values at 3.3 volts, not a recommended continuous load. Cumulative IO output current for the chip is 1500 mA at absolute maximum, per section 5.1 of the same datasheet. Treat a small LED through a resistor as the practical per-pin load, not 40 mA.</p>
<p>Use a driver for any load above a small LED. Keep LED current low with a series resistor. A 220 ohm resistor is a common bench value for a 3.3 volt LED test. Check the LED datasheet for its own forward voltage before you pick a resistor.</p>
<h2>Wiring and Power Warnings</h2>
<p>Power the board at 5 volts through USB-C or the 5V pad. Do not feed 5 volts into the 3V3 pad. Double-check the pad labels before you connect power. The pads are small and close together.</p>
<p>Keep wires short. Use a cable under 3 feet for bench tests when you can. Long wires pick up noise. Noise causes I2C errors and ADC jitter. Twist power and ground wires together when the run is long.</p>
<p>Solder the header pins with care. A solder bridge between two small pads shorts the board. Check each joint with a magnifier. Test for shorts with a meter before first power-up. A short on the 5 volt rail can damage the USB host.</p>
<h2>Pin Test Sketch</h2>
<p>Language: Arduino. Library: Arduino ESP32 core version 2.0.14. No extra library install is needed for this test. Code status: code not compiled. No arduino-cli or PlatformIO is installed in this environment.</p>
<pre><code>// XIAO ESP32S3 pin test sketch
// Board: XIAO ESP32S3
// Arduino ESP32 core version 2.0.14
// Code status: code not compiled

// D pad to GPIO map from the Seeed wiki.
const int pinD0 = 1;  // ADC and touch.
const int pinD1 = 2;  // ADC and touch.
const int pinD4 = 5;  // I2C SDA, ADC, touch.
const int pinD5 = 6;  // I2C SCL, ADC, touch.
const int pinD6 = 43; // UART TX.
const int pinD7 = 44; // UART RX.
const int pinD8 = 7;  // SPI SCK, ADC, touch.

void setup() {
  // Start USB serial at 115200 baud for debug output.
  Serial.begin(115200);
  delay(1000); // Wait 1 second for the monitor to open.

  // Set D0 as an output for the blink test.
  pinMode(pinD0, OUTPUT);

  // Set the ADC pins as inputs.
  pinMode(pinD1, INPUT);
  pinMode(pinD4, INPUT);
  pinMode(pinD5, INPUT);

  Serial.println("XIAO ESP32S3 pin test started");
}

void loop() {
  // Read the ADC value on D1.
  // ADC range is 0 to 4095 counts on the ESP32-S3.
  int adcValue = analogRead(pinD1);
  Serial.print("D1 ADC value: ");
  Serial.println(adcValue);

  // Blink D0 for 500 milliseconds on and 500 milliseconds off.
  digitalWrite(pinD0, HIGH);
  delay(500); // Wait 500 milliseconds.
  digitalWrite(pinD0, LOW);
  delay(500); // Wait 500 milliseconds.
}
</code></pre>
<p>Expected result: the serial monitor shows a D1 ADC value each 1 second. The value changes when you touch a wire on D1 or feed it a voltage below 3.3 volts. The D0 output blinks at a 1 second period. If no serial output appears, check the USB cable and the board selection in the IDE.</p>
<h2>Frequently Asked Questions</h2>
<h3>How many GPIO pins does the XIAO ESP32S3 have?</h3>
<p>It has 11 GPIO pins on the pads, named D0 through D10. The GPIO numbers run from GPIO1 to GPIO9, plus GPIO43 and GPIO44. Native USB uses GPIO19 and GPIO20 internally.</p>
<h3>Which pins are I2C on the XIAO ESP32S3?</h3>
<p>D4 is SDA and D5 is SCL. The chip numbers are GPIO5 and GPIO6. Both pins also support ADC and touch. They cannot serve two roles at once.</p>
<h3>Does the standard XIAO ESP32S3 have a camera?</h3>
<p>No, the standard board has no camera. The Sense version adds an OV2640 camera and a microSD slot on a rear connector. The SD chip select is GPIO21 on the Sense board.</p>
<h3>Can I use 5 volt sensors with this board?</h3>
<p>No, not directly. The board uses 3.3 volt logic. A 5 volt sensor output needs a level shifter. A direct 5 volt input can damage the pin.</p>
<h2>Boards That Match This Pinout</h2>
<p>These boards use the pinout in this guide. Check the product page for current stock before you order. Stock changes over time.</p>
<ul>
<li><a href="https://qualityrcparts.com/product/seeed-studio-xiao-esp32s3-development-board-1-pack/">XIAO ESP32S3 Development Board, 1-Pack</a> (product #17839)</li>
<li><a href="https://qualityrcparts.com/product/seeed-studio-xiao-esp32s3-development-board-3-pack/">XIAO ESP32S3 Development Board, 3-Pack</a> (product #17841)</li>
<li><a href="https://qualityrcparts.com/product/seeed-studio-xiao-esp32s3-sense-development-board-1-pack/">XIAO ESP32S3 Sense Development Board, 1-Pack</a> (product #17842)</li>
</ul>
<p>Related reading: compare this board with the wider ESP32 family in the staged pillar <a href="https://qualityrcparts.com/esp32-vs-esp32-s3-vs-c3/">ESP32 vs ESP32-S3 vs ESP32-C3 vs ESP32-C6</a> (row 22, staged). For sibling pinouts, see <a href="https://qualityrcparts.com/esp32-cam-pinout/">ESP32-CAM Pinout</a> and <a href="https://qualityrcparts.com/esp32-38-pin-boards-compared/">ESP32 38-Pin Boards Compared: Narrow, DevKitC, and 32E</a>.</p>
<h2>Sources</h2>
<ul>
<li>Seeed Studio XIAO ESP32S3 pin multiplexing, https://wiki.seeedstudio.com/xiao_esp32s3_pin_multiplexing/</li>
<li>Seeed Studio XIAO ESP32S3 wiki, https://wiki.seeedstudio.com/xiao_esp32s3_getting_started/</li>
<li>Seeed Studio XIAO ESP32S3 schematic version 1.3, https://wiki.seeedstudio.com/xiao_esp32s3_getting_started/</li>
<li>Espressif ESP32-S3 Datasheet v2.2, https://www.espressif.com/sites/default/files/documentation/esp32-s3_datasheet_en.pdf</li>
</ul>
<p>Last updated 2026-11-21.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">23363</post-id>	</item>
		<item>
		<title>ESP32-CAM Pinout: Camera, SD Card, and Free GPIO Pins</title>
		<link>https://qualityrcparts.com/esp32-cam-pinout/</link>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Sat, 21 Nov 2026 20:50:05 +0000</pubDate>
				<category><![CDATA[Drone Guides]]></category>
		<category><![CDATA[adc]]></category>
		<category><![CDATA[esp32]]></category>
		<category><![CDATA[esp32-cam]]></category>
		<category><![CDATA[i2c]]></category>
		<category><![CDATA[pinout]]></category>
		<category><![CDATA[pwm]]></category>
		<category><![CDATA[spi]]></category>
		<category><![CDATA[uart]]></category>
		<guid isPermaLink="false">https://qualityrcparts.com/esp32-cam-pinout/</guid>

					<description><![CDATA[This ESP32-CAM pinout guide maps every camera pin, microSD pin, and free GPIO pin on the AI-Thinker board, plus power, boot, and wiring rules.]]></description>
										<content:encoded><![CDATA[<h1>ESP32-CAM Pinout: Camera, SD Card, and Free GPIO Pins</h1>
<p><strong>Answer in brief:</strong> The ESP32-CAM uses most of its GPIO pins for the camera and the microSD card. Only a small set of pins stays free for sensors and outputs. This guide maps the camera pins, the SD card pins, and the free pins. It also covers power, boot mode, and safe wiring.</p>
<h2>Quick Facts</h2>
<table>
<tr>
<th>Item</th>
<th>Detail</th>
<th>Source</th>
</tr>
<tr>
<td>Board</td>
<td>AI-Thinker ESP32-CAM</td>
<td>Espressif ESP32 Series Datasheet</td>
</tr>
<tr>
<td>Logic voltage</td>
<td>3.3 volts</td>
<td>Espressif ESP32 Series Datasheet</td>
</tr>
<tr>
<td>USB port</td>
<td>None on board</td>
<td>ESP32-CAM camera driver pin map</td>
</tr>
<tr>
<td>Programming pins</td>
<td>GPIO1 TX and GPIO3 RX</td>
<td>ESP32-CAM camera driver pin map</td>
</tr>
<tr>
<td>Flash mode pin</td>
<td>GPIO0 held low at reset</td>
<td>ESP32-CAM camera driver pin map</td>
</tr>
<tr>
<td>Camera pins used</td>
<td>15 pins</td>
<td>ESP32-CAM camera driver pin map</td>
</tr>
<tr>
<td>SD card pins in 4-bit mode</td>
<td>6 pins</td>
<td>ESP32-CAM camera driver pin map</td>
</tr>
<tr>
<td>SD card pins in 1-bit mode</td>
<td>3 pins</td>
<td>ESP32-CAM camera driver pin map</td>
</tr>
<tr>
<td>Free pins with no SD card</td>
<td>6 pins</td>
<td>ESP32-CAM camera driver pin map</td>
</tr>
</table>
<h2>ESP32-CAM Pinout Table</h2>
<p>This table is an original pinout table built from the source data listed below. It is not a copied image. Check the board print against this table before you wire anything. Some boards print VCC on one header and 5V on the other header.</p>
<table>
<tr>
<th>Header pin label</th>
<th>GPIO</th>
<th>Function</th>
<th>Notes</th>
</tr>
<tr>
<td>5V</td>
<td>Power</td>
<td>5 volt input</td>
<td>Use a stable 5 volt supply</td>
</tr>
<tr>
<td>GND</td>
<td>Power</td>
<td>Ground</td>
<td>Common ground for all wiring</td>
</tr>
<tr>
<td>GPIO12</td>
<td>GPIO12</td>
<td>SD DATA2, ADC, touch</td>
<td>Free only when SD card is not used</td>
</tr>
<tr>
<td>GPIO13</td>
<td>GPIO13</td>
<td>SD DATA3, ADC, touch</td>
<td>Free only when SD card is not used</td>
</tr>
<tr>
<td>GPIO15</td>
<td>GPIO15</td>
<td>SD CMD, ADC, touch, strapping</td>
<td>Free only when SD card is not used</td>
</tr>
<tr>
<td>GPIO14</td>
<td>GPIO14</td>
<td>SD CLK, ADC, touch</td>
<td>Free only when SD card is not used</td>
</tr>
<tr>
<td>GPIO2</td>
<td>GPIO2</td>
<td>SD DATA0, ADC, touch, strapping</td>
<td>Free only when SD card is not used</td>
</tr>
<tr>
<td>GPIO4</td>
<td>GPIO4</td>
<td>SD DATA1, ADC, touch</td>
<td>Free only when SD card is not used</td>
</tr>
<tr>
<td>3V3</td>
<td>Power</td>
<td>3.3 volt output</td>
<td>Do not use as a 5 volt input</td>
</tr>
<tr>
<td>GPIO16</td>
<td>GPIO16</td>
<td>PSRAM chip select</td>
<td>Do not use for other wiring</td>
</tr>
<tr>
<td>GPIO0</td>
<td>GPIO0</td>
<td>Camera XCLK, strapping, boot</td>
<td>Hold low at reset for flash mode</td>
</tr>
<tr>
<td>GND</td>
<td>Power</td>
<td>Ground</td>
<td>Common ground for all wiring</td>
</tr>
<tr>
<td>VCC</td>
<td>Power</td>
<td>5 volt input</td>
<td>Same 5 volt rail as the 5V pin</td>
</tr>
<tr>
<td>U0R</td>
<td>GPIO3</td>
<td>UART receive</td>
<td>Connect to adapter TX for programming</td>
</tr>
<tr>
<td>U0T</td>
<td>GPIO1</td>
<td>UART transmit</td>
<td>Connect to adapter RX for programming</td>
</tr>
<tr>
<td>GND</td>
<td>Power</td>
<td>Ground</td>
<td>Common ground for all wiring</td>
</tr>
</table>
<h2>Power Pins</h2>
<p>The board takes 5 volts through the 5V pin or the VCC pin. Both pins sit on the same 5 volt rail on this board. Use one 5 volt input at a time. Do not feed 5 volts into the 3V3 pin. That mistake can damage the board.</p>
<h2>Strapping and Boot Pins</h2>
<p>GPIO0 controls flash mode. Hold GPIO0 low at reset to enter flash mode. Release it after programming starts. Normal run mode needs GPIO0 high or floating at reset. A jumper wire to ground works for this step. Remove the jumper after the upload.</p>
<p>GPIO0 also carries the camera clock, XCLK. That dual role is normal on this board. Do not add a permanent pull-down to GPIO0. A permanent pull-down would force flash mode at every reset. Use a temporary jumper only during programming.</p>
<p>GPIO2 and GPIO15 are also strapping pins. They share SD card duties on this board. Keep them free of strong pull-downs at boot when the SD card is in use. Check the Espressif ESP32 Series Datasheet for the full strapping table before you add boot-time wiring.</p>
<h2>Camera Pins</h2>
<p>The camera uses 15 pins on this board. Those pins are fixed. Do not reassign them to other parts. The list below is the camera driver pin map for the AI-Thinker board.</p>
<table>
<tr>
<th>Camera signal</th>
<th>GPIO</th>
<th>Notes</th>
</tr>
<tr>
<td>Data D0</td>
<td>GPIO5</td>
<td>Camera data line</td>
</tr>
<tr>
<td>Data D1</td>
<td>GPIO18</td>
<td>Camera data line</td>
</tr>
<tr>
<td>Data D2</td>
<td>GPIO19</td>
<td>Camera data line</td>
</tr>
<tr>
<td>Data D3</td>
<td>GPIO21</td>
<td>Camera data line</td>
</tr>
<tr>
<td>Data D4</td>
<td>GPIO36</td>
<td>Camera data line, input only</td>
</tr>
<tr>
<td>Data D5</td>
<td>GPIO39</td>
<td>Camera data line, input only</td>
</tr>
<tr>
<td>Data D6</td>
<td>GPIO34</td>
<td>Camera data line, input only</td>
</tr>
<tr>
<td>Data D7</td>
<td>GPIO35</td>
<td>Camera data line, input only</td>
</tr>
<tr>
<td>XCLK</td>
<td>GPIO0</td>
<td>Camera clock, also boot pin</td>
</tr>
<tr>
<td>PCLK</td>
<td>GPIO22</td>
<td>Camera pixel clock</td>
</tr>
<tr>
<td>VSYNC</td>
<td>GPIO25</td>
<td>Camera vertical sync</td>
</tr>
<tr>
<td>HREF</td>
<td>GPIO23</td>
<td>Camera horizontal reference</td>
</tr>
<tr>
<td>SDA</td>
<td>GPIO26</td>
<td>Camera control bus data</td>
</tr>
<tr>
<td>SCL</td>
<td>GPIO27</td>
<td>Camera control bus clock</td>
</tr>
<tr>
<td>PWDN</td>
<td>GPIO32</td>
<td>Camera power down control</td>
</tr>
</table>
<h2>SD Card Pins</h2>
<p>The microSD slot uses 6 pins in 4-bit mode. That mode gives the fastest SD writes on this board. The 6 pins are GPIO14, GPIO15, GPIO2, GPIO4, GPIO12, and GPIO13. All 6 pins are then busy. No free GPIO remains from that set while 4-bit mode runs.</p>
<table>
<tr>
<th>SD signal</th>
<th>GPIO</th>
<th>Mode</th>
</tr>
<tr>
<td>CLK</td>
<td>GPIO14</td>
<td>4-bit and 1-bit</td>
</tr>
<tr>
<td>CMD</td>
<td>GPIO15</td>
<td>4-bit and 1-bit</td>
</tr>
<tr>
<td>DATA0</td>
<td>GPIO2</td>
<td>4-bit and 1-bit</td>
</tr>
<tr>
<td>DATA1</td>
<td>GPIO4</td>
<td>4-bit only</td>
</tr>
<tr>
<td>DATA2</td>
<td>GPIO12</td>
<td>4-bit only</td>
</tr>
<tr>
<td>DATA3</td>
<td>GPIO13</td>
<td>4-bit only</td>
</tr>
</table>
<h2>Free GPIO Pins</h2>
<p>Free pins depend on SD card use. With no SD card, 6 pins are free. Those pins are GPIO2, GPIO4, GPIO12, GPIO13, GPIO14, and GPIO15. With 1-bit SD mode, 3 pins are free. Those pins are GPIO4, GPIO12, and GPIO13. With 4-bit SD mode, none of those 6 pins are free.</p>
<p>GPIO33 is the red LED pin. You can blink it in code. It is not a good general output for a load. GPIO16 is the PSRAM chip select. Leave GPIO16 alone. GPIO32 is the camera power-down pin. Leave it under camera driver control.</p>
<h2>ADC, Touch, and PWM</h2>
<p>GPIO2, GPIO4, GPIO12, GPIO13, GPIO14, and GPIO15 all support ADC input. They also support touch input on the ESP32 chip. That overlap is useful. It is also a limit. A pin in SD use cannot serve as an ADC input at the same time.</p>
<h2>I2C, SPI, and UART</h2>
<p>The camera control bus uses GPIO26 for SDA and GPIO27 for SCL. Those pins are busy. Do not add a second I2C device on the same two pins without checking the camera driver first. A shared bus can clash with camera control.</p>
<h2>USB and Programming</h2>
<p>This board has no USB port. Program it with a 3.3 volt USB-to-serial adapter. Set the adapter to 3.3 volts. A 5 volt adapter setting can damage the 3.3 volt logic. Check the adapter jumper before every upload.</p>
<p>Connect adapter TX to board U0R, which is GPIO3. Connect adapter RX to board U0T, which is GPIO1. Connect ground to ground. Connect adapter 3.3 volt output only if the adapter can supply enough current. A separate 5 volt supply on the 5V pin is often more stable.</p>
<p>Hold GPIO0 low. Press reset. Start the upload. Release GPIO0 after the upload starts. Remove the GPIO0 jumper after the upload ends. Press reset once more to run the new code. For a full setup walkthrough, see the live post <a href="https://qualityrcparts.com/esp32-cam-getting-started/">How to Start with ESP32-CAM for WiFi Camera Projects</a> (live post #15173). For the flash steps in detail, see the live post <a href="https://qualityrcparts.com/esp32-cam-flashing-first-camera-stream/">ESP32-CAM Flashing and First Camera Stream: From Unboxing to WiFi Video</a> (live post #22720).</p>
<h2>Pins to Avoid</h2>
<p>Avoid GPIO16 for any new wiring. It is the PSRAM chip select. Avoid GPIO32 for general use. It controls camera power down. Avoid GPIO0 as a permanent output. It is the boot pin and the camera clock.</p>
<p>Avoid GPIO36, GPIO39, GPIO34, and GPIO35 as outputs. They are input-only pins. Avoid GPIO6 through GPIO11. Those pins connect to the on-board flash memory. They do not appear on the headers. Do not try to use them.</p>
<p>Avoid 5 volt logic on any GPIO pin. This board uses 3.3 volt logic. A 5 volt signal needs a level shifter. A direct 5 volt input can damage the pin.</p>
<h2>Max Current and Logic Voltage</h2>
<p>Logic voltage is 3.3 volts on every GPIO pin. That value comes from the Espressif ESP32 Series Datasheet. Treat 3.3 volts as the high level. Treat 0 volts as the low level. Keep sensor outputs at 3.3 volts or below.</p>
<p>At the strongest drive setting, a GPIO pin sources about 40 mA (IOH) and sinks about 28 mA (IOL), per Table 5-4 of the Espressif ESP32 Series Datasheet v5.3. Those are drive-strength values at 3.3 volts, not a recommended continuous load. Cumulative IO output current for the chip is 1200 mA at absolute maximum, per section 5.1 of the same datasheet. Treat a small LED through a resistor as the practical per-pin load, not 40 mA.</p>
<p>Use a transistor or a driver for any load above a small LED. Keep LED current low with a series resistor. A 220 ohm resistor is a common bench value for a 3.3 volt LED test. Check the LED datasheet for its own forward voltage before you pick a resistor.</p>
<h2>Wiring and Power Warnings</h2>
<p>Power the board before you connect a 5 volt sensor. Keep the USB-to-serial adapter at 3.3 volts. Double-check the adapter jumper. A wrong jumper is a fast way to damage the board.</p>
<p>Keep wires short. Use a cable under 3 feet for bench tests when you can. Long wires pick up noise. Noise causes SD errors and camera glitches. Twist power and ground wires together when the run is long.</p>
<h2>Pin Test Sketch</h2>
<p>Language: Arduino. Library: Arduino ESP32 core version 2.0.14, with the built-in esp_camera driver. No extra library install is needed for this test. Code status: code not compiled. No arduino-cli or PlatformIO is installed in this environment.</p>
<pre><code>// ESP32-CAM pin test sketch
// Board: AI-Thinker ESP32-CAM
// Arduino ESP32 core version 2.0.14
// Code status: code not compiled

#include "esp_camera.h"

// Camera pin map for the AI-Thinker board.
#define PWDN_GPIO_NUM 32
#define RESET_GPIO_NUM -1
#define XCLK_GPIO_NUM 0
#define SIOD_GPIO_NUM 26
#define SIOC_GPIO_NUM 27
#define Y9_GPIO_NUM 35
#define Y8_GPIO_NUM 34
#define Y7_GPIO_NUM 39
#define Y6_GPIO_NUM 36
#define Y5_GPIO_NUM 21
#define Y4_GPIO_NUM 19
#define Y3_GPIO_NUM 18
#define Y2_GPIO_NUM 5
#define VSYNC_GPIO_NUM 25
#define HREF_GPIO_NUM 23
#define PCLK_GPIO_NUM 22

// Free pin test uses GPIO4 when no SD card is fitted.
// GPIO4 is SD DATA1 in 4-bit mode, so remove the card first.
const int testPin = 4;

void setup() {
  // Start serial at 115200 baud for debug output.
  Serial.begin(115200);
  delay(1000); // Wait 1 second for the monitor to open.

  // Set the test pin as an output and blink the red LED pin.
  pinMode(testPin, OUTPUT);
  pinMode(33, OUTPUT);

  // Start the camera with a small frame size for the test.
  camera_config_t config;
  config.ledc_channel = LEDC_CHANNEL_0;
  config.ledc_timer = LEDC_TIMER_0;
  config.pin_d0 = Y2_GPIO_NUM;
  config.pin_d1 = Y3_GPIO_NUM;
  config.pin_d2 = Y4_GPIO_NUM;
  config.pin_d3 = Y5_GPIO_NUM;
  config.pin_d4 = Y6_GPIO_NUM;
  config.pin_d5 = Y7_GPIO_NUM;
  config.pin_d6 = Y8_GPIO_NUM;
  config.pin_d7 = Y9_GPIO_NUM;
  config.pin_xclk = XCLK_GPIO_NUM;
  config.pin_pclk = PCLK_GPIO_NUM;
  config.pin_vsync = VSYNC_GPIO_NUM;
  config.pin_href = HREF_GPIO_NUM;
  config.pin_sccb_sda = SIOD_GPIO_NUM;
  config.pin_sccb_scl = SIOC_GPIO_NUM;
  config.pin_pwdn = PWDN_GPIO_NUM;
  config.pin_reset = RESET_GPIO_NUM;
  config.xclk_freq_hz = 20000000; // 20 megahertz camera clock.
  config.pixel_format = PIXFORMAT_JPEG;
  config.frame_size = FRAMESIZE_QVGA; // Small size for a fast test.
  config.jpeg_quality = 12; // Lower number means higher quality.
  config.fb_count = 1;

  // Report the camera start result on serial.
  esp_err_t err = esp_camera_init(&amp;config);
  if (err != ESP_OK) {
    Serial.printf("Camera init failed, error 0x%x\n", err);
    return;
  }
  Serial.println("Camera init OK");
}

void loop() {
  // Blink the test pin and the red LED pin in turn.
  digitalWrite(testPin, HIGH);
  digitalWrite(33, LOW);
  delay(500); // Wait 500 milliseconds.
  digitalWrite(testPin, LOW);
  digitalWrite(33, HIGH);
  delay(500); // Wait 500 milliseconds.
  Serial.println("Pin test tick");
}
</code></pre>
<p>Expected result: the serial monitor shows &#8220;Camera init OK&#8221; and then a tick line each 1 second. The red LED blinks in turn with the test pin. If camera init fails, check the ribbon cable seating first. Then check the 5 volt supply.</p>
<h2>Frequently Asked Questions</h2>
<h3>How many free GPIO pins does the ESP32-CAM have?</h3>
<p>It has 6 free pins with no SD card. The pins are GPIO2, GPIO4, GPIO12, GPIO13, GPIO14, and GPIO15. The count drops to 3 pins in 1-bit SD mode. It drops to 0 pins from that set in 4-bit SD mode.</p>
<h3>Can I use GPIO0 as a normal output?</h3>
<p>No, not as a normal output. GPIO0 is the boot pin and the camera clock. It must be high at reset for normal run mode. Use a free pin from the SD set instead.</p>
<h3>Why does my ESP32-CAM reset when WiFi starts?</h3>
<p>A weak 5 volt supply is the most common cause. WiFi draws a current spike at start. Use a stable 5 volt supply rated at 1 ampere or more. Keep wires short and check the ground.</p>
<h3>Does the ESP32-CAM have a USB port?</h3>
<p>No, it has no USB port. Program it with a 3.3 volt USB-to-serial adapter. Connect adapter TX to U0R and adapter RX to U0T. Hold GPIO0 low at reset for flash mode.</p>
<h2>Boards That Match This Pinout</h2>
<p>These boards use the pinout in this guide. Check the product page for current stock before you order. Stock changes over time.</p>
<ul>
<li><a href="https://qualityrcparts.com/product/esp32-cam-development-board-with-ov2640-camera-module-4mb-psram/">ESP32-CAM Development Board with OV2640</a> (product #13473)</li>
<li><a href="https://qualityrcparts.com/product/esp32-cam-development-board-ov-camera-module-wifi-bluetooth-single/">ESP32-CAM Development Board, Single</a> (product #23161)</li>
<li><a href="https://qualityrcparts.com/product/esp32-cam-camera-module-2-pack/">ESP32-CAM Camera Module, 2-Pack</a> (product #21643)</li>
</ul>
<p>Related reading: compare this board with the wider ESP32 family in the staged pillar <a href="https://qualityrcparts.com/esp32-vs-esp32-s3-vs-c3/">ESP32 vs ESP32-S3 vs ESP32-C3 vs ESP32-C6</a> (row 22, staged). For sibling pinouts, see <a href="https://qualityrcparts.com/esp32-devkit-v1-guide/">How to Use the ESP32 DevKit V1 Board for WiFi Projects</a> and <a href="https://qualityrcparts.com/xiao-esp32s3-pinout/">XIAO ESP32S3 Pinout</a>.</p>
<h2>Sources</h2>
<ul>
<li>Espressif ESP32 Series Datasheet v5.3, https://www.espressif.com/sites/default/files/documentation/esp32_datasheet_en.pdf</li>
<li>ESP32-CAM camera driver pin map, Espressif Arduino ESP32 core, https://github.com/espressif/arduino-esp32/blob/master/libraries/ESP32/examples/Camera/CameraWebServer/camera_pins.h</li>
</ul>
<p>Last updated 2026-11-21.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">23362</post-id>	</item>
		<item>
		<title>I2C vs SPI vs UART: Which Protocol for Your Sensor or Display</title>
		<link>https://qualityrcparts.com/i2c-vs-spi-vs-uart/</link>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Sat, 21 Nov 2026 20:48:26 +0000</pubDate>
				<category><![CDATA[Drone Guides]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[esp32]]></category>
		<category><![CDATA[i2c]]></category>
		<category><![CDATA[spi]]></category>
		<category><![CDATA[uart]]></category>
		<guid isPermaLink="false">https://qualityrcparts.com/i2c-vs-spi-vs-uart/</guid>

					<description><![CDATA[Compare I2C, SPI, and UART on wires, speed, addressing, and distance, with wiring rules, debug steps, and a pick for sensors, displays, and GPS.]]></description>
										<content:encoded><![CDATA[<h1>I2C vs SPI vs UART: Which Protocol for Your Sensor or Display</h1>
<p>Use I2C when several slow sensors share two wires. Use SPI when a display or a fast sensor needs speed. Use UART when two devices need a simple point to point link, such as a GPS module or a debug console. The right pick depends on how many devices you have and how fast they must talk.</p>
<h2>I2C vs SPI vs UART at a glance</h2>
<p>The table below gives the practical numbers. Speeds are typical for Arduino and ESP32 boards, not theoretical maximums, and distances are for breadboard and short cable runs.</p>
<table>
<tr>
<th>Spec (unit)</th>
<th>I2C</th>
<th>SPI</th>
<th>UART</th>
</tr>
<tr>
<td>Signal wires (count)</td>
<td>2, SDA plus SCL</td>
<td>4 minimum, MOSI plus MISO plus SCK plus CS</td>
<td>2, TX plus RX</td>
</tr>
<tr>
<td>Clock</td>
<td>Shared, from controller</td>
<td>Shared, from controller</td>
<td>None, agreed baud rate</td>
</tr>
<tr>
<td>Typical speed</td>
<td>100 kHz standard, 400 kHz fast</td>
<td>1 to 20 MHz on ESP32 and Arduino</td>
<td>9,600 to 115,200 baud common</td>
</tr>
<tr>
<td>Devices on one bus (count)</td>
<td>Up to 127 by 7-bit address, 112 usable</td>
<td>One per chip select pin</td>
<td>1 per UART port</td>
</tr>
<tr>
<td>Duplex</td>
<td>Half duplex</td>
<td>Full duplex</td>
<td>Full duplex</td>
</tr>
<tr>
<td>Addressing</td>
<td>7-bit address per device</td>
<td>Chip select line per device</td>
<td>None</td>
</tr>
<tr>
<td>Pull-up resistors</td>
<td>Required on SDA and SCL</td>
<td>Not needed</td>
<td>Not needed</td>
</tr>
<tr>
<td>Reliable distance</td>
<td>Under 1 m</td>
<td>Under 0.5 m at high speed</td>
<td>Under 1 m (TTL); 15 m is RS-232, not TTL UART</td>
</tr>
<tr>
<td>Best for</td>
<td>Sensors, small displays, RTC, IO expanders</td>
<td>Graphic displays, SD cards, fast sensors</td>
<td>GPS, debug console, board to board links</td>
</tr>
</table>
<h2>What is I2C and when should you use it?</h2>
<p>I2C, or Inter-Integrated Circuit, is a two wire bus created by Philips in 1982. It uses one line for data, called SDA, and one line for the clock, called SCL. Every device on the bus has a unique 7-bit address, so the controller can talk to up to 127 devices on the same two wires. The controller drives the clock, and the devices follow it. Data moves in 8-bit bytes with an acknowledge bit after each byte.</p>
<p>I2C is the right pick when you have several slow sensors and few pins to spare. A BME280 temperature sensor, an SSD1306 OLED display and an MPU6050 motion sensor can all share the same SDA and SCL pins on an ESP32 or an Arduino. Ten sensors still need only two signal pins, plus power and ground. That pin saving is why I2C dominates sensor projects.</p>
<p>I2C has two rules that cause most failures. First, SDA and SCL need pull-up resistors to the logic voltage, typically 4.7 kOhm, and many breakout boards include them already. Without pull-ups, the bus floats and no device answers. Second, two devices with the same address cannot share a bus. The SSD1306 OLED commonly uses address 0x3C, and the BME280 commonly uses 0x76 or 0x77, so check each device address before you wire a second identical sensor. When two identical sensors share an address, use an I2C multiplexer or a second I2C bus.</p>
<p>I2C speed is 100 kHz in standard mode and 400 kHz in fast mode, with faster modes up to 1 MHz and beyond on modern controllers. That is plenty for a sensor that reports a few times per second, and too slow for a large graphic display that needs a full frame many times per second.</p>
<h2>What is SPI and when should you use it?</h2>
<p>SPI, or Serial Peripheral Interface, is a four wire bus developed by Motorola in the 1980s. It uses MOSI for data from the controller to the device, MISO for data from the device to the controller, SCK for the clock, and one chip select line, called CS, per device. The controller pulls one CS line low to talk to that device, clocks data out on MOSI and in on MISO at the same time, then releases CS.</p>
<p>SPI is the right pick when speed matters. It has no addressing overhead and it moves data in both directions at once, so it runs many times faster than I2C. An Arduino Uno runs SPI up to about 8 MHz. An ESP32 or a Raspberry Pi Pico can push SPI to 80 MHz or higher on short traces. That speed is why graphic TFT displays, SD cards, flash memory and fast sensors use SPI.</p>
<p>The cost of SPI is pins. Devices share MOSI, MISO and SCK, but each device needs its own CS line, so three SPI devices need six signal pins against two for three I2C devices. SPI also has no built in error checking and no addressing, so a wiring fault on one CS line silences one device without affecting the others, which is both a strength and a debugging trap.</p>
<h2>What is UART and when should you use it?</h2>
<p>UART, or Universal Asynchronous Receiver-Transmitter, is the simplest of the three protocols. It uses two wires, TX for transmit and RX for receive, and it has no shared clock. The two devices agree in advance on a baud rate, such as 9,600 or 115,200, plus data bits, parity and stop bits. Each side sends when it is ready, and the other side samples the line at the agreed rate.</p>
<p>UART is the right pick for a point to point link between two intelligent devices: a GPS module, a second microcontroller, a Bluetooth module, or the USB serial debug console on your board. Wiring is crossed: one device TX goes to the other device RX, and the other way round. A straight TX to TX connection never works, and it is the most common UART wiring fault.</p>
<p>UART has no addressing and no clock line, so it connects exactly two devices per port. It also has no built in error correction beyond an optional parity bit. Its strength is simplicity and distance: at 9,600 baud, UART runs reliably over several feet of wire, and with an RS-485 transceiver it reaches hundreds of feet. That makes it the pick for a sensor on a long cable or a link between two boards.</p>
<h2>How do you choose between them?</h2>
<p>Ask three questions in order. First, how many devices? Several slow sensors on few pins points to I2C. One fast device points to SPI. Two intelligent devices points to UART. Second, how fast? A display that redraws many times per second needs SPI. A sensor that reports once a second is happy on I2C. A GPS that sends a sentence once a second is happy on UART. Third, how far? A sensor on the same board or a short breadboard run suits I2C or SPI. A sensor at the end of a long cable suits UART.</p>
<p>Many real projects use all three at once. A weather station reads a BME280 over I2C, draws the result on a TFT display over SPI, and logs to a computer over UART USB serial. That is normal, and it is why a board with two I2C buses, two SPI buses and three UARTs, such as the ESP32, is so useful. The ESP32 has two I2C buses, two usable SPI buses and three UARTs, while the Arduino Uno has one of each.</p>
<h2>What wiring mistakes cause most failures?</h2>
<p>The first mistake is missing pull-up resistors on I2C. SDA and SCL are open drain lines, so they float high only through the pull-up resistor. Many breakout boards include 4.7 kOhm or 10 kOhm pull-ups, but a bare sensor chip does not. If the bus is silent, check the pull-ups first, then the address.</p>
<p>The second mistake is crossed or uncrossed UART wires. UART needs TX to RX. I2C and SPI need like to like: SDA to SDA, SCL to SCL, MOSI to MOSI, MISO to MISO, SCK to SCK. A single crossed SPI wire gives garbage data, and a single crossed I2C wire gives silence.</p>
<p>The third mistake is a missing shared ground. All three protocols need a common ground between the devices, even when each device has its own power supply. Without it, the signal voltages have no reference, and the data is noise. The fourth mistake is a voltage mismatch: a 5 V Arduino talking to a 3.3 V sensor needs a level shifter on the signal lines, or the sensor input is overdriven.</p>
<h2>How do you debug a dead bus?</h2>
<p>Start with an I2C scanner sketch, which lists every address that answers on the bus. If the scanner finds nothing, check power, ground and pull-ups, then check the address jumpers on the board. If the scanner finds the device at the wrong address, change the address jumper or the code to match.</p>
<p>For SPI, check the CS line first. A device that never sees its CS line go low never answers, and the bus looks dead. For UART, check the baud rate on both sides first, then the crossed wiring, then the ground. A baud mismatch gives garbage characters in the serial monitor, while a wiring fault gives silence.</p>
<p>For these protocols in a live build, see the <a href="https://qualityrcparts.com/esp32-wifi-sensor-telemetry/">ESP32 WiFi sensor telemetry build</a>.</p>
<h2>FAQ</h2>
<h3>How many devices can I put on one I2C bus?</h3>
<p>Up to 127 devices by 7-bit address, with 112 usable addresses in practice. The limit in a real build is bus capacitance and address conflicts, not the address count, so keep the bus short and check for duplicate addresses.</p>
<h3>Is SPI faster than I2C?</h3>
<p>Yes. SPI typically runs at 1 MHz to 20 MHz on Arduino and ESP32 boards, while I2C typically runs at 100 kHz or 400 kHz. SPI is the pick for displays and fast sensors.</p>
<h3>Can I use I2C and SPI at the same time?</h3>
<p>Yes. They are separate buses with separate pins, and many projects use both: I2C for sensors and SPI for a display. They share only power and ground.</p>
<h3>Why does my I2C device not show up in a scanner?</h3>
<p>Check power and ground first, then the pull-up resistors on SDA and SCL, then the device address jumpers. A device with no pull-ups or with the wrong address will not answer a scan.</p>
<h3>Do I cross TX and RX on UART?</h3>
<p>Yes. One device TX goes to the other device RX, and the other way round. TX to TX never works. Both sides must also agree on the same baud rate.</p>
<h2>Parts used</h2>
<p><a href="https://qualityrcparts.com/product/0-96-inch-oled-display-module-ssd1306-i2c-128x64-for-arduino-esp32-esp8266/">0.96 Inch OLED SSD1306 Display Module</a>: the I2C display used in the examples, commonly at address 0x3C. <a href="https://qualityrcparts.com/product/bme280-temperature-humidity-pressure-sensor-module-5v/">BME280 Sensor Module</a>: the I2C temperature, humidity and pressure sensor, commonly at 0x76 or 0x77. <a href="https://qualityrcparts.com/product/2-0-inch-tft-lcd-display-module-240x320-full-color-ips-st7789-spi-for-arduino-esp32-stm32/">2.0 Inch TFT LCD ST7789 Display</a>: the SPI display for projects that need speed and colour.</p>
<h2>Sources</h2>
<ul>
<li><a href="https://www.smashingrobotics.com/i2c-vs-spi-vs-uart-explained/" target="_blank" rel="noopener">I2C vs SPI vs UART guide, wiring, speed and addressing</a></li>
<li><a href="https://soldered.com/blogs/learn/i2c-vs-spi-vs-uart" target="_blank" rel="noopener">I2C vs SPI vs UART, sensor and display picks</a></li>
<li><a href="https://projectech.in/guides/i2c-vs-spi-vs-uart-protocols-explained/" target="_blank" rel="noopener">I2C vs SPI vs UART protocols explained, with Arduino and ESP32 examples</a></li>
<li><a href="https://documentation.espressif.com/esp32_datasheet_en.html" target="_blank" rel="noopener">Espressif ESP32 Series Datasheet v5.3</a></li>
</ul>
<p>Last updated: 2026-11-21. Search volume: not verified. Product links use the store short link form with the product ID; confirm the product slug at publish time.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">23359</post-id>	</item>
	</channel>
</rss>
