C8: Arduino Basic + Sensor Interfacing

Aim:
To debug a non-working Arduino project in Tinkercad by finding and correcting errors in wiring and code.

Requirements:

  • Computer with Internet

  • Tinkercad Circuits

  • Arduino Uno, LED, Resistor, Sensors (as per circuit)

  • A faulty preloaded circuit (teacher can prepare this in advance with errors)

Steps:

Step 1: Open the faulty circuit

  • In Tinkercad, load the “Broken Circuit” shared by your teacher.

  • The project might look fine, but it won’t work when you run it.

Step 2: Run the simulation

  • Click Start Simulation.

  • Observe carefully:

    • Does the LED light up?

    • Does the Serial Monitor print correct values?

    • Does the fan or buzzer respond to sensor input?

Step 3: Check the wiring

  • Trace each wire from sensor/device → Arduino pin.

  • Common wiring errors to look for:

    • Connected to the wrong pin (e.g., LED connected to pin 10 but code says pin 9).

    • Ground (GND) missing.

    • Resistor missing → LED burns too bright or doesn’t work.

    • Power not connected to VCC/5V.

Step 4: Check the code

  • Open the Code editor in Tinkercad.

  • Look for mistakes such as:

    • Wrong pin number in digitalWrite() or analogRead().

    • Missing semicolon ; at the end of a line.

    • Using = instead of == in an if condition.

    • Logic mistakes (threshold too high/low, so output never turns ON).

Example of faulty code:

int led = 9;

 

void setup() {

  pinMode(led, OUTPUT)

}

 

void loop() {

  digitalWrite(10, HIGH);

}

 

👉 Errors:

  1. Missing semicolon after pinMode.

  2. LED connected to pin 9, but code uses pin 10.

Corrected version:

int led = 9;

 

void setup() {

  pinMode(led, OUTPUT);

}

 

void loop() {

  digitalWrite(led, HIGH);

}

 

Step 5: Correct and test again

  • Fix the wiring and code.

  • Run simulation once more.

If it still doesn’t work → repeat the process until it works.

Fill in the form for S’O’A Fablab Orientation 2021.