https://github.com/amid68/dimmable-led-with-potentiometer
This Arduino project reads an analog value from pin A5 and converts it into a voltage value between 0 and 5 volts. The voltage is then printed to the serial monitor every 500 milliseconds.
https://github.com/amid68/dimmable-led-with-potentiometer
arduino led potentiometer
Last synced: 2 months ago
JSON representation
This Arduino project reads an analog value from pin A5 and converts it into a voltage value between 0 and 5 volts. The voltage is then printed to the serial monitor every 500 milliseconds.
- Host: GitHub
- URL: https://github.com/amid68/dimmable-led-with-potentiometer
- Owner: Amid68
- License: mit
- Created: 2024-09-07T20:44:56.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-09-07T21:00:34.000Z (almost 2 years ago)
- Last Synced: 2025-01-07T00:38:05.233Z (over 1 year ago)
- Topics: arduino, led, potentiometer
- Language: C++
- Homepage:
- Size: 1.08 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Dimmable-LED-with-Potentiometer
This Arduino project reads an analog value from pin A5 and converts it into a voltage value between 0 and 5 volts. The voltage is then printed to the serial monitor every 500 milliseconds.
## Hardware Setup

## Hardware Requirements
- Arduino board (e.g., Uno, Mega)
- Potentiometer connected to pin A5
- LED
- Resistor (appropriate value to limit current to the LED)
- USB cable for connecting the Arduino to a computer
## Software Requirements
- Arduino IDE
## How it Works
1. The `analogRead()` function reads the voltage value from the analog pin A5.
2. The value is scaled from a 10-bit (0-1023) range to a voltage range (0-5V) using the formula:
```
Voltage = (5.0 / 1023.0) * analogRead(ReadPin)
```
3. The calculated voltage is sent to the serial monitor for display.
4. The reading is repeated every 500 milliseconds.
## **Warning**
When using a potentiometer in this setup, **do not reduce the resistance too much**, as this could cause too much current to flow through the LED, potentially **burning it out**. Always ensure a proper current-limiting resistor is used in series with the LED to protect it.
## Usage
1. Upload the code to your Arduino board using the Arduino IDE.
2. Open the serial monitor to view the real-time voltage readings from pin A5.
## License
This project is open-source and available for personal or educational use.