P0340 on 2004-2008 Toyota Yaris: Camshaft Sensor Circuit Causes and Fixes
On a 2004-2008 Toyota Yaris, code P0340 is most often caused by a failing camshaft position sensor. However, a Toyota Technical Service Bulletin (T-TT-0010-10 Rev) points to low battery voltage (below 11V during cranking) as a key cause. Always check the battery's health before replacing the sensor, which costs about $40-$110 for the part.
- Before buying any parts for a P0340 code on a 2004-2008 Yaris, test the battery and charging system. A weak battery is a known cause of this code on this car.
- The most common part to fail is the camshaft position sensor itself, which is a relatively inexpensive and accessible part for a DIY repair.
- Symptoms can be severe, including the engine stalling or refusing to start, so it's best to address this code promptly.
- Always inspect the wiring and connector to the sensor for damage before replacing the part.
- If a new sensor and healthy battery don't fix the issue, the problem could be more complex, such as a timing chain issue, and may require a professional mechanic.
What's Unique About the 2004-2008 Toyota YARIS

For this generation of Toyota Yaris and its platform-mates, there is a specific manufacturer-issued Technical Service Bulletin (TSB T-TT-0010-10 Rev) that mechanics must be aware of. The TSB notes that low battery voltage can cause a P0340 code, sometimes along with a P0335 for the crankshaft sensor. This happens because a weak battery can lead to inconsistent engine cranking speed, which confuses the sensors. The TSB specifically advises checking the freeze-frame data to see if battery voltage dropped below 11 volts when the code was set. Therefore, checking the battery and charging system is a crucial first step on this vehicle, potentially saving you from unnecessarily replacing a good sensor.
Diagnostic Flowchart

Tap your situation to follow the diagnostic path that matches what you're seeing on this vehicle.
Generation note: This range covers two generations of the Yaris: the first generation (XP10, 2004-2005) and the second generation (XP90, 2006-2008). The primary engines were the 1.0L 1SZ-FE, 1.3L 2SZ-FE, and 1.5L 1NZ-FE. While the fundamental causes of P0340 are the same, the exact location and part number for the sensor may differ slightly between engines and generations. The issue is also prevalent on the predecessor, the Toyota Echo, and the sibling Scions (xA, xB) which share the 1NZ-FE engine.
Symptoms You May Notice
- Check Engine Light is on
- Engine is hard to start or cranks but won't start
- Engine takes longer than usual to start, or requires multiple key turns.
- Engine stalls, hesitates, or runs rough, especially at idle.
- Noticeable loss of engine power and sluggish acceleration.
- Poor fuel economy due to the engine running in a default (less efficient) mode.
- In some cases, the car starts and runs with the faulty sensor but will not start at all with a new aftermarket sensor.
- Replacing the camshaft position sensor when the actual problem is a weak battery or failing alternator, a known issue per TSB T-TT-0010-10 Rev.
- Replacing the crankshaft position sensor (for code P0335) instead of the camshaft sensor (for P0340).
- Immediately assuming the sensor is bad without first inspecting the wiring harness and connector for damage.
Most Likely Causes

- Failed Camshaft Position Sensor 🔴 High Probability Sensors are electronic components that fail over time due to heat cycles and internal degradation. Forum discussions and repair guides for the Yaris and its platform-mates frequently point to this as the primary culprit after ruling out battery issues.
How to confirm: After confirming battery and wiring are good, the most practical step for a DIYer is to replace the sensor. A professional can test the sensor's output signal with an oscilloscope or check its internal resistance with a multimeter against factory specs.
Typical fix: Replace the camshaft position sensor. It is typically located on the cylinder head (passenger side on the 1NZ-FE) and held in by a single 10mm bolt. 🎬 Watch this quick walkthrough for replacing the sensor on a Scion.
Est. part cost: $40-$110 - Low Battery Voltage or Failing Alternator 🟡 Medium Probability A specific Toyota TSB (T-TT-0010-10 Rev) states that low battery voltage can cause inconsistent crankshaft rotational speed during startup, triggering code P0340. The TSB suggests checking freeze frame data for voltage below 11V at the time the code was set.
How to confirm: Use a multimeter to test the battery. A healthy battery should read about 12.6V with the engine off and 13.7V-14.7V with the engine running (indicating a working alternator). Test under load if possible.
Typical fix: Charge or replace the battery. If the voltage doesn't increase when the engine is running, the alternator may need replacement.
Est. part cost: $100-$250 - Damaged Wiring or Loose Connector 🟡 Medium Probability The sensor's wiring is in the engine bay, exposed to heat, vibration, and oil. Over time, wires can become brittle and crack, or the connector can become loose or corroded. Rodents chewing wires is also a known issue.
How to confirm: Visually inspect the wiring harness leading to the camshaft position sensor for any signs of cracking, fraying, melting, or chew marks. Ensure the connector is securely plugged in and free of corrosion. Check for 5V reference and ground at the connector with the key on.
Typical fix: Repair the damaged section of wire or replace the connector pigtail.
Est. part cost: $10-$30
Rare But Worth Checking
- Stretched Timing Chain: While less common, a stretched timing chain can cause the camshaft and crankshaft signals to lose synchronization, which can trigger a P0340 code. This is a more serious mechanical issue, often accompanied by a rattling noise from the engine, especially on cold startups.
- Dirty or Clogged Oil Control Valve (OCV): On these VVT-i engines, dirty engine oil or sludge can clog the small filter screen for the OCV (VVT solenoid). This can cause the variable valve timing to respond slowly or get stuck, indirectly causing timing-related codes like P0340. This is more likely if oil changes have been neglected.
- Faulty Powertrain Control Module (PCM): This is the least likely cause and should only be considered after all other possibilities, including sensors, wiring, and mechanical timing, have been thoroughly ruled out.
Diagnosis Steps
- Read the code with an OBD-II scanner to confirm P0340 is present. Note any other codes.
- CRITICAL FIRST STEP: Check the battery and charging system. Test the battery voltage with the engine off (~12.6V) and running (~14V). If possible, check the freeze-frame data for battery voltage at the time the DTC was set, as recommended by TSB T-TT-0010-10 Rev.
- If the battery is weak, charge or replace it, clear the codes, and see if P0340 returns.
- Locate the camshaft position sensor on the cylinder head. On the 1NZ-FE, it's on the passenger side near the top of the engine. Inspect its electrical connector and wiring for any visible damage, corrosion, or loose connections.
- With the key on, engine off, check for a 5-volt reference signal and a good ground at the sensor's connector using a multimeter.
- If wiring and voltage are good, the most common repair is to replace the camshaft position sensor. It is highly recommended to use an OEM or Denso-branded sensor, 🎬 See how to swap a faulty sensor on a Toyota Yaris. as some aftermarket sensors have been reported to not work correctly.
- After replacing the sensor, clear the code and test drive the vehicle to ensure the problem is resolved.
- If the code persists, investigate less common causes like the timing chain (listen for rattles) or the Oil Control Valve (VVT solenoid), which may require professional diagnosis.
Parts You'll Likely Need
- Camshaft Position Sensor
(OEM #90919-05024)— This sensor is the most frequent point of failure for the P0340 code after electrical issues like a weak battery are ruled out. It is crucial for engine timing.
Trusted brands: Denso (OEM Supplier, Part No. 196-2010 or similar), Toyota (Genuine OEM), NGK/NTK, Bosch
OEM price range: $80-$110
Aftermarket price range: $40-$75 - Car Battery — A weak or failing battery is a documented cause of P0340 on this specific vehicle, as noted in a Toyota TSB (T-TT-0010-10 Rev).
Trusted brands: Interstate, DieHard, Duralast, Toyota TrueStart
OEM price range: $150-$250
Aftermarket price range: $100-$200
Related Codes That Often Appear With This One
- P0335 — This code is for the Crankshaft Position Sensor. The TSB T-TT-0010-10 Rev explicitly states that low battery voltage can cause both P0340 and P0335 to appear together due to inconsistent cranking speed.
- P0012 — This code indicates 'Camshaft Position 'A' - Timing Over-Retarded'. A faulty camshaft sensor can provide incorrect data that leads to this timing error code. It can also be caused by a dirty OCV/VVT solenoid.
- P1346 — This is a Toyota-specific code for 'VVT Sensor/Camshaft Position Sensor Circuit Range/Performance Problem'. It is often seen alongside or instead of P0340 and points to the same set of potential failures.
Technical Service Bulletins (TSBs) & Recalls
- T-TT-0010-10 Rev: States that low battery voltage can contribute to a MIL "ON" condition for P0335 (Crankshaft Position Sensor Circuit) and/or P0340 (Camshaft Position Sensor Circuit). It advises checking freeze frame data for voltage below 11V.
Platform-Specific Known Issues
- Per TSB T-TT-0010-10 Rev, low battery voltage (below 11V) is a known cause of code P0340 on this platform due to inconsistent engine rotational speed during cranking.
- Owners on forums report that some aftermarket camshaft position sensors may not work correctly, even when new. The engine may run with the old, faulty sensor but refuse to start with a new aftermarket one. Using an OEM or Denso part is strongly recommended.
Mechanic-Grade Diagnostic Values
- Camshaft Position Sensor (1NZ-FE) Internal Resistance — expected: 1,630 to 2,740 Ω when cold (-10 to 50°C / 14 to 122°F), or 2,065 to 3,225 Ω when hot (50 to 100°C / 122 to 212°F).. Failure: A resistance reading outside of the specified range for the sensor's temperature indicates a faulty sensor.
- Battery Voltage in Freeze Frame Data — expected: Above 11.0 Volts during engine cranking.. Failure: A voltage reading below 11.0V at the time the P0340 code was set points to a weak battery or charging system issue, as per TSB T-TT-0010-10 Rev.
Scan Tool Commands That Help
- Toyota Techstream: Read Freeze Frame Data — Crucial for diagnosing P0340 on this vehicle. Use this function to check the battery voltage recorded at the exact moment the fault code was stored. This is the primary method to confirm or rule out the low battery voltage issue described in TSB T-TT-0010-10 Rev.
- Oscilloscope: Waveform Analysis — To definitively test the sensor's output. Connect to the signal wire to observe the voltage waveform while cranking the engine. A good sensor will produce a consistent, repeating square or sine wave pattern. The 1NZ-FE should produce 3 signal pulses for every 2 crankshaft revolutions. An absent, erratic, or distorted waveform confirms a failed sensor or a problem with the reluctor wheel.
Wiring & Ground Locations

- Camshaft Sensor Connector (1NZ-FE) — On the cylinder head, typically on the passenger side of the engine. It is a 2-pin oval connector.. This is the primary point for testing. The two pins are for the sensor's signal (+ and -). Resistance should be measured across these two pins on the sensor side. On the harness side, you can check for continuity back to the ECM.
- ECM Connector E5 — The Engine Control Module (ECM) is typically located behind the glove box in the passenger cabin.. If a wiring issue is suspected, you would test for continuity between the pins at the camshaft sensor connector and the corresponding pins at the E5 ECM connector to find an open or short in the harness.
- Engine Bay Ground Points — Key ground points for the engine harness are typically located on the driver's side frame rail and on the engine block itself. A wiring diagram for the 2007 Yaris shows multiple ground points in the engine room.. A poor engine ground can introduce electrical noise or cause voltage drops that can affect sensor readings. While not a direct cause of a 'circuit malfunction' code, verifying main grounds are clean and tight is a good practice when diagnosing any electrical issue.
Real Owner Repair Stories
- YouTube video by 'aliMech' (Toyota Camry (similar VVT-i engine design)) — Check engine light with P0340.
✅ What actually fixed it The sensor was covered in a film of oil sludge due to poor quality oil or neglected oil changes. Cleaning the sensor with brake cleaner and changing the oil resolved the code. The video notes that if cleaning doesn't work, the sensor itself has likely failed. - YarisWorld Forum (2008 Toyota Yaris) — P0340 code, dim passenger headlight.
❌ Tried (didn't work) Replacing headlight bulbs.
✅ What actually fixed it The user traced a bad ground wire in the harness. The main harness ground was located on the driver's side frame rail. Although this user's primary symptom was a dim headlight, it highlights the importance of checking ground connections for any electrical fault in the engine bay.
When the Usual Fixes Don't Work
- While the most common fix is replacing the sensor, it's critical to acknowledge the TSB regarding low battery voltage. Multiple owners may replace the sensor only to have the code return because the root cause was a failing battery or alternator. Furthermore, forum reports of aftermarket sensors being dead-on-arrival or incompatible, causing a no-start condition, are common. This reinforces the recommendation to test thoroughly before replacing parts and to use OEM/Denso sensors when replacement is necessary.
OEM Part Supersession History
19300-BZ020→90919-05024— Part number consolidation and potential design update.
Heads up: The part 90919-05024 is the correct and current OEM replacement for the specified Yaris models and is also used on a wide range of other Toyota vehicles like the Echo, Prius, and Scion xA/xB.
Model Year Variations Within This Range
- 2004-2008: The engines used (1SZ-FE, 2SZ-FE, 1NZ-FE) all use a 2-pin inductive type camshaft position sensor. While the fundamental part and diagnosis are the same, the exact location of grounds and harness routing may have minor differences between the first generation (XP10, 2004-2005) and second generation (XP90, 2006-2008) chassis.
Helpful Videos
We Have This Part in Stock
The information in this article is provided for general reference and educational purposes only. Vehicle specifications, procedures, and part compatibility can vary by production date, trim level, and region. Always consult your vehicle's factory service manual and verify part numbers before purchasing or performing repairs. Safety-critical components such as airbags, seat belts, and braking systems should be installed by a qualified professional.
- Toyota YARIS:
- 🎬 Helpful Videos
- 🛍️ Shop This Part
- What's Unique About the 2004-2008 Toyota YARIS
- Diagnostic Flowchart
- Symptoms You May Notice
- Most Likely Causes
- Rare But Worth Checking
- Diagnosis Steps
- Parts You'll Likely Need
- Related Codes That Often Appear With This One
- Technical Service Bulletins (TSBs) & Recalls
- Platform-Specific Known Issues
- Mechanic-Grade Diagnostic Values
- Scan Tool Commands That Help
- Wiring & Ground Locations
- Real Owner Repair Stories
- When the Usual Fixes Don't Work
- OEM Part Supersession History
- Model Year Variations Within This Range
- 🎟️ Get 5% Off