📘 CodingMarble Learn

Electronics, Robotics and Computer Interfacing

A control system has an input (sensor), a process (microcontroller or computer running a program) and an output (LED, buzzer, motor). We use Ohm's law to choose part values, for example an LED resistor R = (Vsupply − VLED) ÷ I. A chip pin gives only a small current, so a transistor or relay switches bigger loads. Microcontrollers are cheap, small and have pins built in; a desktop PC is powerful but needs an interface board. We draw circuits with standard symbols, simulate them, build them safely and test them with a multimeter.

🎬 Step-by-step story

  1. Every control system has three parts: input, process, output.
  2. Input devices turn the world into a voltage: switches, light sensors, distance sensors.
  3. Ohm's law chooses the parts: a 5 V supply and a 2 V LED need a 150 Ω resistor.
  4. A chip gives a tiny current. A transistor or relay lets it switch a big motor current.
  5. Desktop PC or microcontroller? Compare cost, size, power and pins.
  6. Try it: make it dark and watch the night-light switch on.

Tip: drag the 3D scene to turn it. Use two fingers to zoom.

🤔 Common doubts, cleared

Is every automatic machine a robot?

No. A robot senses, decides and acts, often with movement. A simple timer machine does not sense.

What is the difference between a digital and analogue input?

Digital has two levels (0 V or 5 V). Analogue can be any value in between, like the LDR voltage.

Why does an LED need a resistor but a bulb does not?

An LED's current rises very fast above its forward voltage. The resistor uses up the spare voltage and sets a safe current.

Why can't the chip power the motor directly?

Its pins give only a few milliamps. A transistor or relay lets that tiny signal control a big current from another supply.

When should I use a PC instead of a microcontroller?

When you need heavy computing, like video or AI. For simple sensing and motor control a microcontroller is better.

Why does the LED turn on when it gets dark?

The LDR's resistance rises in the dark, its voltage changes, and the program's IF rule turns the LED on.

Input, process, output: how a control system works

A control system watches something and reacts to it. It has three parts.

A robot is a control system that can move. Its sensors are the inputs, its controller is the brain, and its motors are the outputs.

Common input devices

Common output devices

Specification words

Data sheets describe parts with words like rated voltage, maximum current, power rating (watts), tolerance (how exact a resistor is, e.g. ±5%) and forward voltage (the voltage an LED or diode uses up).

Electronic components and how to choose their values

Using the laws

Ohm's law: V = I × R. Power: P = V × I. Series resistors: R = R1 + R2. Voltage divider: Vout = Vin × R2 ÷ (R1 + R2) (this is how an LDR gives a changing voltage).

LED resistor: R = (Vsupply − VLED) ÷ ILED. With 5 V, a red LED (2 V) and 20 mA: R = 3 ÷ 0.02 = 150 Ω. Pick the next standard value up (e.g. 150 Ω or 220 Ω). Check power: P = 3 × 0.02 = 0.06 W, so a 0.25 W resistor is fine.

Interfacing: desktop computer or microcontroller?

Interfacing means connecting a computer to the real world so a program can read sensors and drive outputs.

Desktop PCMicrocontroller
CostHighVery low
Size, power useLarge, needs mainsTiny, runs on batteries
Computing powerVery high (video, AI)Low but enough for control
I/O pinsNone direct; needs USB interface boardBuilt-in digital, analogue and PWM pins
Start-upSlow (boots an OS)Instant, runs one program

Many robots use both: a microcontroller handles motors and sensors, and a single-board computer or PC handles cameras and planning.

Discrete vs integrated: a circuit of separate resistors and transistors is easy to learn and repair. An IC packs thousands or billions of transistors into one chip, so it is smaller, cheaper and more reliable.

Why advances in electronics matter

Transistors keep getting smaller, so chips get faster and cheaper. That gives us phones, electric cars, medical implants and affordable robots. It also brings e-waste, so recycling and repair matter.

Design, draw, simulate, build and troubleshoot

Design process

  1. Define the problem and the requirements.
  2. Draw a block diagram (input → process → output).
  3. Draw the schematic with standard symbols and calculate values.
  4. Simulate in circuit software to check currents and voltages before buying parts.
  5. Build on a breadboard, then solder on a PCB or stripboard.
  6. Test, fix, and evaluate against the requirements.

Safety

Troubleshooting

  1. Look: loose wires, wrong polarity (LED, capacitor), solder bridges, burnt parts.
  2. Measure supply voltage with a multimeter.
  3. Follow the signal stage by stage from input to output.
  4. Check continuity (power off) to find broken tracks.
  5. Swap a suspect part with a known good one.

Try it: a night-light on paper or in 3D

In the 3D scene, move the light slider. When light falls below 40%, the program turns the LED on. At home: draw the block diagram of your room's automatic device (for example a fridge light or a water-tank alarm). Label input, process and output.

Key formulas and definitions

Worked examples

1. A 9 V battery lights a blue LED (3 V, 20 mA). Find the series resistor.

Spare voltage = 9 − 3 = 6 V. R = 6 ÷ 0.02 = 300 Ω. Use the next standard value, 330 Ω.

2. Find the power in that 300 Ω resistor and choose a power rating.

P = V × I = 6 × 0.02 = 0.12 W. A 0.25 W resistor is safe (about twice the need).

3. A voltage divider has R1 = 10 kΩ and an LDR as R2. In the dark the LDR is 90 kΩ. With 5 V in, find Vout.

Vout = 5 × 90 ÷ (10 + 90) = 5 × 0.9 = 4.5 V. In bright light (LDR 1 kΩ): Vout = 5 × 1 ÷ 11 ≈ 0.45 V. So the voltage rises in the dark.

4. A microcontroller pin gives up to 20 mA. A 12 V motor needs 0.5 A. Can the pin drive it?

No. 0.5 A = 500 mA, 25 times more than 20 mA, and the voltage is also too high. Use a transistor or relay with a separate 12 V supply.

5. An LED circuit does not light. The battery reads 5 V. What do you check next?

Check LED polarity (long leg to +), then measure voltage across the resistor and LED, then check continuity of each wire with power off.

Common mistakes

Practice quiz

1. In a control system, the microcontroller is the:
2. An LDR's resistance in bright light is:
3. 5 V supply, 2 V LED, 20 mA. The resistor is:
4. Which part lets a small current switch a big current?
5. A key advantage of a microcontroller over a PC for a small robot:

Practice: answer these yourself

Type or choose your answer, then press Check. Use a hint if you are stuck; the full solution appears after you answer.

Frequently asked questions

What is computer interfacing in electronics?

Connecting a computer or microcontroller to sensors and actuators so a program can read the real world and control devices.

How do I calculate the resistor for an LED?

R = (supply voltage − LED voltage) ÷ LED current. For 5 V, 2 V and 20 mA: R = 150 Ω.

Is Arduino a microcontroller or a computer?

An Arduino board is built around a microcontroller chip. It runs one program and has pins for sensors and motors.

Where this is taught

Canada (Ontario)Grade 11A. Computer Technology Fundamentals
Canada (Ontario)Grade 11B. Computer Technology Skills
Canada (Ontario)Grade 12A. Computer Technology Fundamentals
Canada (Ontario)Grade 12B. Computer Technology Skills

Learn first

Learn next

Related lessons

All Computer Science lessons