
This ATM (Automated Teller Machine) system is a comprehensive Python application that simulates real-world ATM functionality. It provides secure banking operations including account authentication, balance inquiries, cash withdrawals, deposits, fund transfers, and transaction history tracking.
Arbind Singh
Innovative educator and tech enthusiast dedicated to empowering students through robotics, programming, and digital tools.
Share on social media:
Step-by-step guide and implementation details
This ATM (Automated Teller Machine) system is a comprehensive Python application that simulates real-world ATM functionality. It provides secure banking operations including account authentication, balance inquiries, cash withdrawals, deposits, fund transfers, and transaction history tracking.
Database Manager (database_manager.py)
ATM Service (atm_service.py)
User Interface (ui.py)
Main Application (main.py)
Logging System (logging_config.py)
The system uses SQLite with the following tables:
Clone or Download the Project
# If using git
git clone <repository-url>
cd ATM
# Or simply extract the project files to a directory
Verify Python Installation
python --version
# Should show Python 3.7 or higher
Run the Application
python main.py
The system automatically creates the database and sample accounts on first run. No manual setup is required.
The system comes with several sample accounts for testing:
| Account Number | PIN | Initial Balance | Purpose |
|---|---|---|---|
| 123456 | 1234 | $1,000.00 | General testing |
| 654321 | 4321 | $2,500.00 | High balance testing |
| 111111 | 1111 | $500.00 | Low balance testing |
| 999999 | 9999 | $10,000.00 | Large amount testing |
You can create additional test accounts by modifying the database_setup.py file or by using the database manager directly:
from database_manager import DatabaseManager
db = DatabaseManager('data/atm_database.db')
db.create_user(account_number=888888, pin=8888, initial_balance=1500.00)
Basic Operations
Security Testing
Edge Cases
Login Process:
Security Features:
Usage:
Account Number: 123456
PIN: 1234
Function: Check current account balance
Process:
Output Example:
Current Balance: $1,000.00
Function: Withdraw cash from account
Features:
Process:
Usage:
Enter amount to withdraw: 100
Withdrawal successful! Amount: $100.00
New Balance: $900.00
Function: Deposit cash into account
Features:
Process:
Usage:
Enter amount to deposit: 250
Deposit successful! Amount: $250.00
New Balance: $1,150.00
Function: Transfer money between accounts
Features:
Process:
Usage:
Enter recipient account number: 654321
Enter amount to transfer: 200
Transfer successful! Amount: $200.00
New Balance: $950.00
Function: View recent transaction history
Features:
Output Example:
Transaction History:
1. 2024-01-15 14:30:25 - WITHDRAWAL - $100.00
2. 2024-01-15 14:25:10 - DEPOSIT - $250.00
3. 2024-01-15 14:20:05 - TRANSFER - $200.00 (to 654321)
Function: Securely end user session
Process:
After successful login, users see the main menu:
=<span class="highlight highlight-yellow"> ATM Main Menu </span>=
1. Check Balance
2. Withdraw Cash
3. Deposit Cash
4. Transfer Funds
5. Transaction History
6. Logout
Enter your choice (1-6):
Account Numbers:
PINs:
Amounts:
Check Balance
Withdraw Cash
Deposit Cash
Transfer Funds
Transaction History
Logout
PIN Validation
Account Locking
Session Management
Amount Validation
Account Number Validation
PIN Validation
Authentication Errors
Invalid account number or PIN
Account is locked due to multiple failed attempts
Transaction Errors
Insufficient funds
Invalid amount format
Amount exceeds daily limit
System Errors
Database connection error
System temporarily unavailable
User Input Errors
System Errors
Session Errors
The system creates several log files in the project directory:
atm_application.log
atm_errors.log
atm_security.log
atm_transactions.log
2024-01-15 14:30:25 - INFO - User 123456 logged in successfully
2024-01-15 14:30:30 - INFO - Transaction: WITHDRAWAL - Account: 123456 - Amount: $100.00
2024-01-15 14:30:35 - WARNING - Failed login attempt for account 123456
# View application logs
tail -f atm_application.log
# View security events
tail -f atm_security.log
# View recent transactions
tail -f atm_transactions.log
# View error logs
tail -f atm_errors.log
All Tests
python -m unittest discover tests -v
Specific Test Categories
# Unit tests
python -m unittest tests.test_atm_service -v
python -m unittest tests.test_database_manager -v
# Integration tests
python -m unittest tests.test_integration_workflows -v
# Performance and security tests
python -m unittest tests.test_performance_security -v
Individual Test Files
python -m unittest tests.test_ui -v
python -m unittest tests.test_exceptions -v
Unit Tests
Integration Tests
Performance Tests
Security Tests
Tests use separate test databases to avoid affecting production data:
Database Connection Errors
Error: Database connection failed
Solution: Check file permissions and disk space
Import Errors
ModuleNotFoundError: No module named 'database_manager'
Solution: Ensure you're running from the project root directory
Permission Errors
PermissionError: [Errno 13] Permission denied
Solution: Check file and directory permissions
SQLite Thread Errors
SQLite objects created in a thread can only be used in that same thread
Solution: Use separate database connections for each thread
Enable debug logging by modifying logging_config.py:
# Change log level to DEBUG
logging.getLogger().setLevel(logging.DEBUG)
Slow Response Times
Memory Issues
Database Corruption
# Backup current database
cp data/atm_database.db data/atm_database_backup.db
# Recreate database
python database_setup.py
Log File Issues
# Rotate log files
mv atm_application.log atm_application.log.old
touch atm_application.log
Session Issues
ATM/
├── main.py # Application entry point
├── atm_service.py # Core business logic
├── database_manager.py # Database operations
├── ui.py # User interface
├── exceptions.py # Custom exceptions
├── logging_config.py # Logging configuration
├── config.py # Configuration settings
├── data/ # Database and log files
│ └── atm_database.db
├── tests/ # Test suite
│ ├── test_atm_service.py
│ ├── test_database_manager.py
│ ├── test_integration_workflows.py
│ └── test_performance_security.py
└── requirements.txt # Dependencies
Python Style
Error Handling
Testing
Database Changes
database_manager.pyNew ATM Operations
atm_service.pyui.pySecurity Enhancements
Key configuration options in config.py:
# Database settings
DATABASE_PATH = "data/atm_database.db"
# Transaction limits
MAX_WITHDRAWAL_AMOUNT = 1000.00
MAX_TRANSFER_AMOUNT = 5000.00
# Security settings
MAX_LOGIN_ATTEMPTS = 3
SESSION_TIMEOUT_MINUTES = 30
# Logging settings
LOG_LEVEL = "INFO"
LOG_FILE_MAX_SIZE = 1024 * 1024 # 1MB
LOG_FILE_BACKUP_COUNT = 5
Production Setup
Security Hardening
Performance Optimization
# Start the application
python main.py
# Run all tests
python -m unittest discover tests -v
# Check logs
tail -f atm_application.log
# Backup database
cp data/atm_database.db data/backup_$(date +%Y%m%d_%H%M%S).db
| Account | PIN | Balance |
|---|---|---|
| 123456 | 1234 | $1,000.00 |
| 654321 | 4321 | $2,500.00 |
| 111111 | 1111 | $500.00 |
| 999999 | 9999 | $10,000.00 |
This comprehensive instruction manual covers all aspects of the ATM system, from basic usage to advanced development and troubleshooting. The system is designed to be robust, secure, and user-friendly while providing comprehensive logging and testing capabilities.
Share your thoughts and ask questions about this project
Be the first to share your thoughts about this project!