Circuit Documentation
Summary
This circuit is designed to interface an Arduino Nano with multiple LEDs, a Hall sensor (magnetic), resistors, a polymer lithium-ion battery, a toggle switch, and utilizes embedded code for control. The primary function of the circuit is to create a propeller LED pendulum clock, which displays time using LEDs while responding to magnetic sensor inputs and serial commands for time adjustments.
Component List
Microcontroller
- Arduino Nano: A compact microcontroller board based on the ATmega328P, featuring digital and analog I/O pins.
Sensors
- Hall sensor (magnetic): A sensor that detects magnetic fields and outputs a digital or analog signal.
Power Supply
- Polymer Lithium Ion Battery - 850mAh: Provides power to the circuit.
Switches
- Toggle Switch: A switch that can connect or disconnect the circuit, controlling the power flow.
LEDs
- LED: Two Pin (red): Red light-emitting diodes.
- LED: Two Pin (blue): Blue light-emitting diode.
- LED: Two Pin (yellow): Yellow light-emitting diodes.
- LED: Two Pin (green): Green light-emitting diodes.
Resistors
- Resistor (270 Ohms): Limits current to protect components in the circuit.
- Resistor (2200 Ohms): Provides a higher level of current limitation.
Wiring Details
Arduino Nano
- Digital pins D2 to D13 are connected to various resistors and the Hall sensor.
- Analog pins A0 to A5 are connected to resistors.
- The GND pin is connected to the cathodes of all LEDs, the GND of the Hall sensor, and the GND of the battery.
- The 5V pin is connected to a 2200 Ohm resistor, the VCC of the Hall sensor, and one leg of the toggle switch.
Hall sensor (magnetic)
- VCC (5V) connected to Arduino Nano 5V through a toggle switch.
- GND connected to Arduino Nano GND.
- D0 (Digital) connected to Arduino Nano D2.
Polymer Lithium Ion Battery - 850mAh
- VCC connected to the COM pin of the toggle switch.
- GND connected to the Arduino Nano GND.
Toggle Switch
- L1 not connected.
- COM connected to the battery VCC.
- L2 connected to the Arduino Nano 5V and the VCC of the Hall sensor through a 2200 Ohm resistor.
LEDs
- The anodes of all LEDs are connected to their respective resistors.
- The cathodes of all LEDs are connected to the Arduino Nano GND.
Resistors
- One leg (pin2) of each resistor is connected to a specific pin on the Arduino Nano (D3 to D13 and A0 to A5).
- The other leg (pin1) of each resistor is connected to the anode of a corresponding LED.
Documented Code
char ch;
int sensorPin = 2;
unsigned int i,n,c,nc,k,d,y,bn,mp,m = 0;
float dl;
unsigned long timecurr,timeold,previousTime = 0;
int hours = 5;
int minutes = 45;
int seconds = 00;
uint16_t timer_count_A=0;
byte number,t,a,temp,data = 0;
int val;
const PROGMEM unsigned char data1[]={};
void setup()
{
}
void loop()
{
}
void update_time()
{
}
void us_time()
{
}
ISR(USART_RX_vect)
{
}
Note: The code provided is a snippet and does not include the entire code for brevity. The full code would include the omitted data and function implementations. The code is responsible for controlling the LEDs to display the time and respond to serial commands for time adjustments. It uses interrupts for timing and USART for serial communication.