Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino Nano-Based Adjustable Power Supply with Bluetooth and LED Indicators

View and Edit Project In Cirkit DesignerImage of Arduino Nano-Based Adjustable Power Supply with Bluetooth and LED Indicators

Circuit Documentation

Summary

This circuit is an adjustable power supply system built around an Arduino Nano microcontroller. It includes various components such as LEDs, a loudspeaker, a vibration motor, a pushbutton, a Bluetooth module (HC-05), a battery charging module (TP4056), and a Polymer Lithium Ion Battery. The system allows for setting and displaying desired voltage and current values on a TFT screen, and it also displays the actual voltage, current, and power drawn by the connected load.

Component List

  1. LED: Four Pin (Common Cathode)

    • Pins: red anode, common cathode, green anode, blue anode
    • Description: RGB LED with a common cathode configuration.
  2. Loudspeaker

    • Pins: pin1, pin2
    • Description: Standard loudspeaker for audio output.
  3. Vibration Motor

    • Pins: POS, NEG
    • Description: Small vibration motor for haptic feedback.
  4. Arduino Nano

    • Pins: D1/TX, D0/RX, RESET, GND, D2, D3, D4, D5, D6, D7, D8, D9, D10, D11/MOSI, D12/MISO, VIN, 5V, A7, A6, A5, A4, A3, A2, A1, A0, AREF, 3V3, D13/SCK
    • Description: Microcontroller board based on the ATmega328P.
  5. Resistor (220 Ohms)

    • Pins: pin1, pin2
    • Description: Resistor with a resistance of 220 Ohms.
  6. Pushbutton

    • Pins: Pin 2, Pin 1, Pin 3, Pin 4
    • Description: Standard pushbutton for user input.
  7. HC-05 Bluetooth Module

    • Pins: EN, VCC, GND, TXD, RXD, STATE
    • Description: Bluetooth module for wireless communication.
  8. TP4056 Battery Charging Module

    • Pins: OUT-, B-, B+, OUT+, IN-, IN+
    • Description: Lithium-ion battery charging module.
  9. Polymer Lithium Ion Battery - 850mAh

    • Pins: GND, VCC
    • Description: Rechargeable lithium-ion battery with a capacity of 850mAh.
  10. Resistor (10k Ohms)

    • Pins: pin1, pin2
    • Description: Resistor with a resistance of 10k Ohms.
  11. Arduino UNO

    • Pins: UNUSED, IOREF, Reset, 3.3V, 5V, GND, Vin, A0, A1, A2, A3, A4, A5, SCL, SDA, AREF, D13, D12, D11, D10, D9, D8, D7, D6, D5, D4, D3, D2, D1, D0
    • Description: Microcontroller board based on the ATmega328P.

Wiring Details

LED: Four Pin (Common Cathode)

Loudspeaker

Vibration Motor

Arduino Nano

Resistor (220 Ohms)

Pushbutton

HC-05 Bluetooth Module

TP4056 Battery Charging Module

Polymer Lithium Ion Battery - 850mAh

Resistor (10k Ohms)

Code Documentation

Arduino Nano Code

/*
 * Adjustable Power Supply with Arduino Nano
 * Components:
 * - Arduino Nano
 * - 2 Buttons (for adjusting voltage and current)
 * - 1.8-inch TFT LCD Screen
 * - XL4016 Module
 * - Current Sensor
 * - Voltage Sensor
 *
 * This code allows you to set and display the desired voltage and current
 * values on the TFT screen. It also displays the actual voltage, current,
 * and power drawn by the connected load.
 */

#include <Adafruit_GFX.h>
#include <Adafruit_TFTLCD.h>
#include <TouchScreen.h>

// Pin definitions
#define BUTTON1_PIN 2
#define BUTTON2_PIN 3
#define VOLTAGE_SENSOR_PIN A0
#define CURRENT_SENSOR_PIN A1
#define TFT_CS 10
#define TFT_CD 9
#define TFT_WR 8
#define TFT_RD 7
#define TFT_RESET 6

// TFT display
Adafruit_TFTLCD tft(TFT_CS, TFT_CD, TFT_WR, TFT_RD, TFT_RESET);

// Variables
float setVoltage = 0.0;
float setCurrent = 0.0;
float actualVoltage = 0.0;
float actualCurrent = 0.0;
float power = 0.0;

void setup() {
  // Initialize serial communication
  Serial.begin(9600);

  // Initialize pins
  pinMode(BUTTON1_PIN, INPUT_PULLUP);
  pinMode(BUTTON2_PIN, INPUT_PULLUP);

  // Initialize TFT display
  tft.begin(0x9341);
  tft.setRotation(1);
  tft.fillScreen(BLACK);
  tft.setTextColor(WHITE);
  tft.setTextSize(2);

  // Display initial values
  updateDisplay();
}

void loop() {
  // Read button states
  if (digitalRead(BUTTON1_PIN) == LOW) {
    setVoltage += 0.1;
    delay(200);
  }
  if (digitalRead(BUTTON2_PIN) == LOW) {
    setCurrent += 0.1;
    delay(200);
  }

  // Read sensors
  actualVoltage = analogRead(VOLTAGE_SENSOR_PIN) * (5.0 / 1023.0) * 11.0;
  actualCurrent = analogRead(CURRENT_SENSOR_PIN) * (5.0 / 1023.0) * 5.0;
  power = actualVoltage * actualCurrent;

  // Update display
  updateDisplay();

  // Delay for stability
  delay(500);
}

void updateDisplay() {
  tft.fillScreen(BLACK);
  tft.setCursor(0, 0);
  tft.print("Set Voltage: ");
  tft.print(setVoltage);
  tft.print(" V");
  tft.setCursor(0, 30);
  tft.print("Set Current: ");
  tft.print(setCurrent);
  tft.print(" A");
  tft.setCursor(0, 60);
  tft.print("Actual Voltage: ");
  tft.print(actualVoltage);
  tft.print(" V");
  tft.setCursor(0,