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

Arduino Nano-Based Pulse Pattern Generator with DIP Switch Control and Potentiometer Adjustment

View and Edit Project In Cirkit DesignerImage of Arduino Nano-Based Pulse Pattern Generator with DIP Switch Control and Potentiometer Adjustment

Circuit Documentation

Summary

This circuit is designed to control a set of LEDs and read input from DIP switches and a rotary potentiometer using an Arduino Nano. The Arduino Nano reads the state of the DIP switches to determine pulse patterns and uses the potentiometer to adjust the delay time between pulses. The circuit also includes resistors and diodes for current limiting and protection.

Component List

  1. Arduino Nano

    • Description: Microcontroller board based on the ATmega328P.
    • 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
  2. DIP Switch (8 Position)

    • Description: 8-position DIP switch for selecting pulse patterns.
    • Pins: 1, 2, 7, 8, 3, 4, 6, 5, 9, 10, 11, 12, 13, 14, 15, 16
  3. DIP Switch (2 Position)

    • Description: 2-position DIP switch for mode selection.
    • Pins: 1, 2, 3, 4
  4. LED: Two Pin (yellow)

    • Description: Yellow LED.
    • Pins: cathode, anode
  5. LED: Two Pin (red)

    • Description: Red LED.
    • Pins: cathode, anode
  6. LED: Two Pin (green)

    • Description: Green LED.
    • Pins: cathode, anode
  7. Resistor (3300 Ohms)

    • Description: Resistor with a resistance of 3300 Ohms.
    • Pins: pin1, pin2
  8. Rotary Potentiometer (10k Ohms)

    • Description: Potentiometer with a resistance of 10k Ohms.
    • Pins: leg1, wiper, leg2
  9. Diode

    • Description: General-purpose diode.
    • Pins: cathode, anode

Wiring Details

Arduino Nano

DIP Switch (8 Position)

DIP Switch (2 Position)

LED: Two Pin (yellow)

LED: Two Pin (red)

LED: Two Pin (green)

Resistors

Rotary Potentiometer

Diodes

Code Documentation

// Beat selectors
const int P1 = 12;
const int P2 = 11;
const int P3 = 10;
const int P4 = 9;
const int P5 = 8;
const int P6 = 7;
const int P7 = 6;
const int P8 = 5;

// Mode select
const int INx0 = 2; // IN bit 0
const int IN0x = 3; // IN bit 1

// Output pins
const int Pulse01 = 15; // Pulse for mode 01
const int Pulse10 = 16; // Pulse for mode 10
const int Pulse11 = 17; // Pulse for mode 11

// Potentiometer pin
const int POT_PIN = A0;

// Variables
int delayTime;
int pulsePattern01 = 0;
int pulsePattern10 = 0;
int pulsePattern11 = 0;

// For tracking time for each pulse
unsigned long lastPulseTime01 = 0;
unsigned long lastPulseTime10 = 0;
unsigned long lastPulseTime11 = 0;
int currentStep01 = 0;
int currentStep10 = 0;
int currentStep11 = 0;

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

  // Input pins
  pinMode(P1, INPUT);
  pinMode(P2, INPUT);
  pinMode(P3, INPUT);
  pinMode(P4, INPUT);
  pinMode(P5, INPUT);
  pinMode(P6, INPUT);
  pinMode(P7, INPUT);
  pinMode(P8, INPUT);
  pinMode(INx0, INPUT);
  pinMode(IN0x, INPUT