2 x AAA Battery Holder with Cover and On/Off Switch
2 x AAA Battery Holder with Cover and On/Off Switch
The 2 x AAA Battery Holder with Cover and On/Off Switch is a compact and versatile component designed to securely hold two AAA batteries and provide a convenient on/off switching mechanism. This component is ideal for use in a wide range of IoT projects, prototyping, and proof-of-concept designs.
The primary function of this component is to provide a reliable and efficient way to power small electronic devices using two AAA batteries. The battery holder ensures stable connections and protects the batteries from accidental short-circuits. The integrated on/off switch allows users to easily control the power supply to their device, making it an essential feature for many applications.
2 x AAA
3V (nominal)
1A (max)
SPST (Single Pole Single Throw)
1A @ 3V
30 x 20 x 15 mm (approx.)
10 grams (approx.)
ABS (Acrylonitrile Butadiene Styrene)
-20C to 80C
| The 2 x AAA Battery Holder with Cover and On/Off Switch is suitable for use in a wide range of IoT projects, including |
Robotics and automation
Sensing and monitoring applications
Wearable devices
IoT prototyping and proof-of-concept designs
Battery-powered devices and gadgets
The component complies with relevant safety and regulatory standards, including CE, RoHS, and FCC.
2 x AAA Battery Holder with Cover and On/Off SwitchOverviewThe 2 x AAA Battery Holder with Cover and On/Off Switch is a convenient and compact component designed to hold two AAA batteries and provide a simple on/off switching mechanism. This component is ideal for IoT projects that require a reliable and easy-to-use power supply.FeaturesHolds two AAA batteries
Includes an on/off switch for easy power control
Cover protects batteries from accidental contact or exposure
Compact design for easy integration into IoT projectsPinoutThe 2 x AAA Battery Holder with Cover and On/Off Switch does not have any pins. The power output is provided through two terminals, marked as `VCC` and `GND`, which can be connected to the positive and negative terminals of a microcontroller or other electronic components.Examples### Example 1: Using with Arduino UnoIn this example, we will connect the 2 x AAA Battery Holder with Cover and On/Off Switch to an Arduino Uno board and use it to power an LED.Hardware Requirements2 x AAA Battery Holder with Cover and On/Off Switch
Arduino Uno board
LED
Resistor (220)
Breadboard and jumper wiresCode
```c
const int ledPin = 13; // LED connected to digital pin 13void setup() {
pinMode(ledPin, OUTPUT);
}void loop() {
if (digitalRead(SWITCH_PIN) == HIGH) { // Read the switch state
digitalWrite(ledPin, HIGH); // Turn on the LED
} else {
digitalWrite(ledPin, LOW); // Turn off the LED
}
delay(50);
}
```
Notes`SWITCH_PIN` is not a physical pin on the battery holder, but rather a digital pin on the Arduino Uno board that is connected to the on/off switch.
The `digitalRead()` function reads the state of the switch, and the `digitalWrite()` function sets the state of the LED.### Example 2: Using with ESP32 DevKitCIn this example, we will connect the 2 x AAA Battery Holder with Cover and On/Off Switch to an ESP32 DevKitC board and use it to power a simple Wi-Fi enabled device.Hardware Requirements2 x AAA Battery Holder with Cover and On/Off Switch
ESP32 DevKitC board
Breadboard and jumper wiresCode
```c
#include <WiFi.h>const char ssid = "your_wifi_ssid";
const char password = "your_wifi_password";void setup() {
Serial.begin(115200);
WiFi.begin(ssid, password);while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.println("Connecting to WiFi...");
}Serial.println("Connected to WiFi");
Serial.println("Starting device...");
}void loop() {
if (digitalRead(GPIO_NUM_0) == HIGH) { // Read the switch state
Serial.println("Switch is ON");
} else {
Serial.println("Switch is OFF");
}
delay(500);
}
```
Notes`GPIO_NUM_0` is a digital pin on the ESP32 DevKitC board that is connected to the on/off switch.
The `digitalRead()` function reads the state of the switch, and the `Serial.println()` function prints messages to the serial console.By using the 2 x AAA Battery Holder with Cover and On/Off Switch, you can easily power your IoT projects and add a convenient on/off switching mechanism.