π Tire Pressure Calculator
Calculate and convert tire pressure between PSI, Bar, kPa, and other units. Find optimal pressure for your vehicle type and ensure safe driving.
π€ What Is Tire Pressure?
Think of a balloon - that's tire pressure!
Your tires need the right amount of air pressure to grip the road safely and last longer.
Proper tire pressure saves fuel, prevents accidents, and extends tire life!
π
Vehicle Safety
Proper pressure prevents blowouts and improves braking distance
β½
Fuel Economy
Correct pressure can improve gas mileage by up to 3%
π§
Tire Longevity
Proper inflation extends tire life by preventing irregular wear
π£οΈ
Road Grip
Optimal pressure maximizes contact patch for better traction
π
Racing Performance
Fine-tuned pressure improves lap times and handling
π
Commercial Vehicles
Heavy loads require precise pressure calculations for safety
π― Choose Your Learning Mode
Choose Your Experience Level
Start with Beginner for simple pressure conversion!
π’
Beginner
Simple conversions - perfect to start!
π‘
Intermediate
Vehicle-specific recommendations
π΄
Expert
Advanced calculations and adjustments!
π Quick Conversion
Enter the pressure value you want to convert
Select the unit you're converting from
π Vehicle Information
Choose your vehicle type for recommendations
e.g., 225/60R16 (found on tire sidewall)
π Your tire pressure results will appear here
π Try Sample Vehicles
π Compact Car
Honda Civic
Recommended: 32 PSI
Recommended: 32 PSI
π Mid-Size Sedan
Toyota Camry
Recommended: 35 PSI
Recommended: 35 PSI
π SUV
Ford Explorer
Recommended: 38 PSI
Recommended: 38 PSI
π Pickup Truck
Chevrolet Silverado
Recommended: 40 PSI
Recommended: 40 PSI
ποΈ Motorcycle
Yamaha R6
Front: 36 PSI, Rear: 42 PSI
Front: 36 PSI, Rear: 42 PSI
π΄ Road Bike
Racing Bike
Recommended: 80-120 PSI
Recommended: 80-120 PSI
${safetyMessage}
Recommended Range: ${recommendations.min} - ${recommendations.max} PSI
Optimal: ${recommendedPSI.toFixed(1)} PSI ${OnboardingManager.currentDifficulty !== 'beginner' ? `
Adjusted for your driving conditions` : ''}
`;
}
// Copy results to clipboard
function copyResults() {
const pressureValue = parseFloat(document.getElementById('pressureInput').value);
const fromUnit = document.getElementById('fromUnit').value;
const vehicleType = document.getElementById('vehicleType').value;
const conversions = {};
for (const unit in PRESSURE_CONVERSIONS.psi) {
conversions[unit] = pressureValue * PRESSURE_CONVERSIONS[fromUnit][unit];
}
const copyText = `Tire Pressure Conversion Results:
PSI: ${conversions.psi.toFixed(1)}
Bar: ${conversions.bar.toFixed(2)}
kPa: ${conversions.kpa.toFixed(0)}
ATM: ${conversions.atm.toFixed(2)}
Vehicle: ${vehicleType}
Generated by WIA Pin Code Tire Pressure Calculator`;
copyToClipboard(copyText);
}
// Sample usage function
function useSample(sampleId) {
const samples = {
'compact': {
pressure: 32,
unit: 'psi',
vehicle: 'passenger'
},
'sedan': {
pressure: 35,
unit: 'psi',
vehicle: 'passenger'
},
'suv': {
pressure: 38,
unit: 'psi',
vehicle: 'suv'
},
'truck': {
pressure: 40,
unit: 'psi',
vehicle: 'truck'
},
'motorcycle': {
pressure: 36,
unit: 'psi',
vehicle: 'motorcycle'
},
'bicycle': {
pressure: 100,
unit: 'psi',
vehicle: 'bicycle'
}
};
const sample = samples[sampleId];
if (sample) {
document.getElementById('pressureInput').value = sample.pressure;
document.getElementById('fromUnit').value = sample.unit;
document.getElementById('vehicleType').value = sample.vehicle;
// Smooth scroll to calculate button
document.getElementById('calculateBtn').scrollIntoView({
behavior: 'smooth',
block: 'center'
});
// Highlight button
const btn = document.getElementById('calculateBtn');
btn.style.animation = 'pulse 0.5s ease-in-out';
setTimeout(() => btn.style.animation = '', 500);
OnboardingManager.unlockAchievement('sample_user', 'π Vehicle Explorer', 'Tried a sample vehicle!');
}
}
// Difficulty setter
function setDifficulty(level) {
OnboardingManager.setDifficulty(level);
}
// Onboarding functions
function startTutorial() {
OnboardingManager.startTutorial();
}
function skipOnboarding() {
document.getElementById('onboardingOverlay').classList.remove('show');
localStorage.setItem('tire_pressure_visited', 'true');
}
// ========== UTILITY FUNCTIONS ==========
// Copy to clipboard
function copyToClipboard(text) {
navigator.clipboard.writeText(text).then(() => {
showNotification('Results copied to clipboard!', 'success');
OnboardingManager.unlockAchievement('copier', 'π Copy Master', 'Copied results to clipboard!');
}).catch(() => {
// Fallback for older browsers
const textArea = document.createElement('textarea');
textArea.value = text;
document.body.appendChild(textArea);
textArea.select();
document.execCommand('copy');
document.body.removeChild(textArea);
showNotification('Results copied to clipboard!', 'success');
});
}
// Show error
function showError(elementId, message) {
const errorElement = document.getElementById(elementId);
if (errorElement) {
errorElement.textContent = message;
}
}
// Clear errors
function clearErrors() {
document.querySelectorAll('.error').forEach(el => el.textContent = '');
}
// Show notification toast
function showNotification(message, type = 'success', description = '') {
const toast = document.createElement('div');
toast.className = `toast ${type}`;
if (description) {
toast.innerHTML = `
Optimal: ${recommendedPSI.toFixed(1)} PSI ${OnboardingManager.currentDifficulty !== 'beginner' ? `
Adjusted for your driving conditions` : ''}
${message}
${description}
`;
} else {
toast.textContent = message;
}
document.body.appendChild(toast);
setTimeout(() => {
toast.remove();
}, 4000);
}
// Show OTA section (dynamic)
function showOTA() {
const otaContainer = document.getElementById('otaContainer');
if (otaContainer && (otaContainer.style.display === 'none' || !otaContainer.style.display)) {
otaContainer.style.display = 'block';
// Attention-grabbing pulse effect
setTimeout(() => {
const otaHeader = document.querySelector('.ota-header h3');
if (otaHeader) {
otaHeader.style.animation = 'pulse 1s ease-in-out';
}
}, 100);
}
}
// Analytics tracking
function trackEvent(eventName, data = {}) {
if (typeof gtag !== 'undefined') {
gtag('event', eventName, {
'event_category': TOOL_CONFIG.category,
'event_label': TOOL_CONFIG.name,
...data
});
}
}
// ========== AI ASSISTANT FUNCTIONS ==========
// AI λͺ¨λ¬ μ΄κΈ°
function openAIModal() {
const modal = document.getElementById('aiModal');
if(modal) modal.classList.add('show');
// νμ¬ μνμ λ°λΌ μ μ ν νλ©΄ νμ
if (aiModalState.apiKey && aiModalState.currentView === 'gemini') {
showGeminiChat();
} else {
showAISelector();
}
updateAPIKeyStatus();
}
// AI λͺ¨λ¬ λ«κΈ°
function closeAIModal() {
const modal = document.getElementById('aiModal');
if(modal) modal.classList.remove('show');
setTimeout(() => {
aiModalState.currentView = 'selector';
showAISelector();
}, 300);
}
// AI μ ν νλ©΄ νμ
function showAISelector() {
document.getElementById('aiModalTitle').textContent = 'Choose Your AI Assistant';
document.getElementById('aiSelector').style.display = 'flex';
document.getElementById('geminiChat').style.display = 'none';
document.getElementById('apiKeySetup').style.display = 'none';
aiModalState.currentView = 'selector';
}
// Gemini μ±ν
νλ©΄ νμ
function showGeminiChat() {
document.getElementById('aiModalTitle').innerHTML = 'β¨ Gemini AI Assistant';
document.getElementById('aiSelector').style.display = 'none';
document.getElementById('geminiChat').style.display = 'flex';
document.getElementById('apiKeySetup').style.display = 'none';
aiModalState.currentView = 'gemini';
// μ΄κΈ° λ©μμ§κ° μμΌλ©΄ μΆκ°
const chatMessages = document.getElementById('chatMessages');
if (!chatMessages.innerHTML.trim()) {
addMessage('assistant', `Hello! I can help you with:
β’ Tire pressure calculations and conversions
β’ Vehicle-specific pressure recommendations
β’ Safety guidelines for tire maintenance
β’ Understanding pressure units (PSI, Bar, kPa)
β’ Troubleshooting tire pressure issues
What would you like to know about tire pressure?`);
}
}
// API ν€ μ€μ νλ©΄ νμ
function showAPIKeySetup() {
document.getElementById('aiModalTitle').textContent = 'Setup Gemini API';
document.getElementById('aiSelector').style.display = 'none';
document.getElementById('geminiChat').style.display = 'none';
document.getElementById('apiKeySetup').style.display = 'block';
aiModalState.currentView = 'setup';
}
// AI μ ν μ²λ¦¬
function selectAI(aiType) {
switch(aiType) {
case 'chatgpt':
const toolContext = `I need help with ${TOOL_CONFIG.name}. This is a safety utility on WIA Pin Code platform for calculating tire pressure.`;
const chatUrl = `https://chat.openai.com/?q=${encodeURIComponent(toolContext)}`;
window.open(chatUrl, '_blank');
closeAIModal();
trackEvent('ai_selection', { ai_type: 'chatgpt' });
break;
case 'claude':
const claudeContext = `I need help with ${TOOL_CONFIG.name}. This is a safety utility on WIA Pin Code platform for calculating tire pressure.`;
const claudeUrl = `https://claude.ai/chat?q=${encodeURIComponent(claudeContext)}`;
window.open(claudeUrl, '_blank');
closeAIModal();
trackEvent('ai_selection', { ai_type: 'claude' });
break;
case 'gemini':
if (!aiModalState.apiKey) {
showAPIKeySetup();
} else {
showGeminiChat();
}
trackEvent('ai_selection', { ai_type: 'gemini' });
break;
}
}
// API ν€ μ μ₯
function saveGeminiApiKey() {
const apiKey = document.getElementById('geminiApiKeyInput').value.trim();
if (apiKey) {
localStorage.setItem('geminiApiKey', apiKey);
aiModalState.apiKey = apiKey;
showGeminiChat();
updateAPIKeyStatus();
} else {
alert('Please enter a valid API key');
}
}
// API ν€ μν μ
λ°μ΄νΈ
function updateAPIKeyStatus() {
const statusEl = document.getElementById('apiKeyStatus');
if (aiModalState.apiKey) {
statusEl.innerHTML = 'Change API Key';
} else {
statusEl.textContent = 'No API key set';
}
}
// μ±ν
λ©μμ§ μΆκ°
function addMessage(type, content) {
const chatMessages = document.getElementById('chatMessages');
const messageDiv = document.createElement('div');
messageDiv.className = `message ${type}`;
if (type === 'user') {
messageDiv.innerHTML = `You: ${content}`;
} else {
messageDiv.innerHTML = `β¨ Gemini:${content.replace(/\n/g, '
')}`; } chatMessages.appendChild(messageDiv); chatMessages.scrollTop = chatMessages.scrollHeight; } // Geminiμ λ©μμ§ μ μ‘ async function sendToGemini() { const input = document.getElementById('geminiInput'); const message = input.value.trim(); if (!message) return; // μ¬μ©μ λ©μμ§ μΆκ° addMessage('user', message); input.value = ''; // λ‘λ© νμ const loadingMsg = document.createElement('div'); loadingMsg.className = 'message assistant'; loadingMsg.innerHTML = 'β¨ Gemini:
Thinking...'; loadingMsg.id = 'loading-message'; document.getElementById('chatMessages').appendChild(loadingMsg); try { const response = await fetch(`https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent?key=${aiModalState.apiKey}`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ contents: [{ parts: [{ text: `Context: User is using Tire Pressure Calculator on WIA Pin Code platform. This tool helps calculate optimal tire pressure and convert between units. User question: ${message}` }] }], generationConfig: { temperature: 0.7, maxOutputTokens: 1000 } }) }); const data = await response.json(); // λ‘λ© λ©μμ§ μ κ±° document.getElementById('loading-message').remove(); if (data.candidates && data.candidates[0] && data.candidates[0].content) { const reply = data.candidates[0].content.parts[0].text; addMessage('assistant', reply); } else { addMessage('assistant', 'Sorry, I could not generate a response. Please try again.'); } } catch (error) { // λ‘λ© λ©μμ§ μ κ±° document.getElementById('loading-message')?.remove(); if (error.message.includes('API key')) { addMessage('error', 'Invalid API key. Please check your API key and try again.'); showAPIKeySetup(); } else { addMessage('error', 'Failed to connect to Gemini. Please check your internet connection and try again.'); } } } // ========== EVENT LISTENERS ========== document.addEventListener('DOMContentLoaded', function() { // Initialize onboarding OnboardingManager.showOnboarding(); // Enter key support for pressure input const pressureInput = document.getElementById('pressureInput'); if (pressureInput) { pressureInput.addEventListener('keypress', function(e) { if (e.key === 'Enter') { calculatePressure(); } }); pressureInput.addEventListener('input', clearErrors); } // Pressure adjustment slider update (expert mode) const pressureSlider = document.getElementById('pressureAdjustment'); if (pressureSlider) { pressureSlider.addEventListener('input', function() { document.getElementById('adjustmentValue').textContent = this.value; }); } // AI λ²νΌ μ΄λ²€νΈ document.getElementById('aiBtn').addEventListener('click', openAIModal); // λͺ¨λ¬ μΈλΆ ν΄λ¦μ λ«κΈ° document.getElementById('aiModal').addEventListener('click', function(e) { if (e.target === this) { closeAIModal(); } }); // ν€λ³΄λ μ΄λ²€νΈ document.addEventListener('keydown', function(e) { if (e.key === 'Enter') { const geminiInput = document.getElementById('geminiInput'); if (document.activeElement === geminiInput) { sendToGemini(); } } // ESC ν€λ‘ λͺ¨λ¬ λ«κΈ° if (e.key === 'Escape') { closeAIModal(); OnboardingManager.skipTutorial(); skipOnboarding(); } }); // μ΄κΈ° API ν€ μν μ λ°μ΄νΈ updateAPIKeyStatus(); updateCurrentYear(); updateToolCount(); }); // Track WIA Pin Code clicks for analytics document.querySelectorAll('a[href*="wia"]').forEach(link => { link.addEventListener('click', function() { trackEvent('wia_link_click', { link: link.textContent }); }); }); // ========== DYNAMIC TOOL COUNT ========== // Update tool count dynamically async function updateToolCount() { try { const response = await fetch('/api/tool-count.php'); const data = await response.json(); // Update dynamic tools description document.querySelectorAll('.dynamic-tools-count').forEach(el => { el.textContent = `${data.count}+ free online tools in 211 languages. No signup, no fees, just tools that work.`; }); // Update "All X+ Tools" links document.querySelectorAll('.dynamic-count').forEach(el => { const prefix = el.getAttribute('data-text') || ''; const suffix = el.getAttribute('data-suffix') || ''; const icon = el.textContent.split(' ')[0] || ''; el.textContent = `${icon} ${prefix} ${data.count}+ ${suffix}`; }); } catch (error) { // Fallback: use current actual count from server const fallbackCount = 333; document.querySelectorAll('.dynamic-tools-count').forEach(el => { el.textContent = `${fallbackCount}+ free online tools in 211 languages. No signup, no fees, just tools that work.`; }); document.querySelectorAll('.dynamic-count').forEach(el => { const prefix = el.getAttribute('data-text') || ''; const suffix = el.getAttribute('data-suffix') || ''; const icon = el.textContent.split(' ')[0] || ''; el.textContent = `${icon} ${prefix} ${fallbackCount}+ ${suffix}`; }); console.log('Tool count API not available, using current count:', fallbackCount); } } // Update current year dynamically function updateCurrentYear() { const currentYear = new Date().getFullYear(); document.querySelectorAll('.current-year').forEach(el => { el.textContent = currentYear; }); } // ========== ANALYTICS ========== // Google Analytics window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-XXXXXXXXX'); // Track page view trackEvent('page_view', { tool: TOOL_CONFIG.name, category: TOOL_CONFIG.category });