Welcome to Microcontrollers (PICs) and Robotics
Welcome to one of the most exciting areas of your GCSE Technology and Design course! Have you ever wondered how a modern washing machine decides when to spin, how an automated robotic arm paints a car without missing a single spot, or how a smart heating system keeps a room at the exact temperature you want? The secret behind all these modern inventions is the Microcontroller (PIC).
Don't worry if electronics or programming sounds intimidating at first. In this chapter, we will break down everything step-by-step—from the brain of the chip to the sensors, driver circuits, and robotic systems tested in your Unit 2 Option A exam.
---1. Microcontroller (PIC) Fundamentals
A Microcontroller (often referred to as a PIC, which stands for Peripheral Interface Controller or Programmable Interface Controller) is a complete mini-computer built onto a single Integrated Circuit (IC) chip.
What is Inside a PIC?
Unlike a standard computer where components are spread out across a large motherboard, a PIC packs everything into one tiny silicon package:
• Central Processing Unit (CPU): The "brain" that executes program instructions and performs calculations.
• Memory:
- ROM / Flash / EEPROM: Non-volatile memory used to store your written program (it stays saved even when power is turned off).
- RAM: Temporary working memory used to store variables and data while the program runs.
• Clock Oscillator Circuitry: Provides precise timing pulses that dictate how fast instructions are processed.
• Programmable Input/Output (I/O) Ports: Pins that can be configured by your software to read input signals from sensors or send output control signals to actuators and indicators.
PICs vs. Dedicated / Hardwired Logic
Before microcontrollers, electronic control circuits had to be built using individual logic gates (AND, OR, NOT gates), discrete timers (such as 555 timers), and counters wired together on a circuit board.
1. Flexibility: With a hardwired logic circuit, changing how the circuit behaves requires physically desoldering components and rewiring the board. With a PIC, you simply change a few lines in your flowchart software and download the new code.
2. Component Count and PCB Size: A single PIC chip replaces dozens of separate logic gates and timing chips. This dramatically reduces the physical size of the Printed Circuit Board (PCB), requires fewer components, and speeds up factory assembly.
3. Cost and Manufacturing: Lower component counts mean lower production and assembly costs for manufacturers.
4. Reprogrammability: Thanks to Flash/EEPROM memory, PICs can be erased and reprogrammed hundreds of times, making them ideal for rapid prototyping and firmware upgrades.
Analogy: Think of a hardwired circuit like a mechanical music box that can only ever play one tune because its metal pins are fixed. A PIC is like an MP3 player—if you want a new song (behaviour), you just load a new file into memory!
Key Takeaway: A PIC integrates the CPU, memory, clock, and I/O ports onto a single IC chip. It is cheaper, smaller, and vastly more flexible than hardwired logic because its function is determined by software rather than physical wiring.
---2. Flowchart Programming Standards & Conventions
In your CCEA examination, microcontroller programs are designed and analysed using standard British / ISO flowchart symbols. Flowcharts provide a clear visual map of how your program makes decisions and controls hardware.
Standard Flowchart Symbols
1. Start / Stop (Terminator):
• Shape: Oval / stadium shape (rectangle with rounded ends).
• Function: Marks where the program begins or ends.
2. Process / Output:
• Shape: Standard Rectangle.
• Function: Used to turn outputs ON or OFF (e.g., Motor A ON, Pin 2 = HIGH, LED = OFF) or perform calculations/variable updates.
3. Decision / Conditional:
• Shape: Diamond (Rhombus).
• Function: Tests an input sensor condition (e.g., Is Switch Pressed? or Is Temp > \(25^\circ\text{C}\)?).
• Rule: Must ALWAYS have two clearly labeled exit paths: YES and NO (or TRUE and FALSE).
4. Delay / Wait (Time Delay):
• Shape: Rectangle (or labeled process block).
• Function: Pauses the program for an exact duration (e.g., Wait 3s or Pause 500ms) before moving to the next step.
5. Subroutine / Macro:
• Shape: Rectangle with double vertical lines on the left and right edges.
• Function: Calls a separate, reusable block of code, keeping main flowcharts tidy.
6. Flow Lines & Directional Arrows:
• Shape: Connecting lines with clear arrowheads.
• Function: Shows the exact sequence of execution. Arrowheads are strictly required so the reader knows which way the program flows.
Closed Loops and Continuous Polling
Most industrial control systems do not simply run once and stop; they monitor sensors constantly. This is called a continuous polling loop. In your flowchart, you achieve this by drawing a return flow line from the end of the sequence back to the start of the sensing cycle, creating an infinite loop.
Key Takeaway: Always draw sharp standard symbols, include directional arrowheads on every flow line, label both YES and NO branches on decision diamonds, and ensure continuous systems loop back rather than terminating.
---3. Microcontroller Interfacing (Inputs and Outputs)
A PIC cannot do much on its own without connecting to the outside world. It receives data through input interfaces and controls devices using output interfaces.
A. Digital Inputs
Digital inputs provide only two distinct states: Logic \(1\) (HIGH, approximately \(+5\text{ V}\)) or Logic \(0\) (LOW, approximately \(0\text{ V}\)). Examples include push-to-make (PTM) switches, microswitches, and tilt switches.
Preventing Floating Inputs:
When a mechanical switch is open (unpressed), an input pin can act like a tiny antenna, picking up electrical noise and rapidly jumping unpredictably between \(1\) and \(0\). This unstable state is called a floating input.
To prevent this, we connect a pull-up or pull-down resistor:
• A pull-down resistor ties the pin securely to \(0\text{ V}\) when the switch is open (giving a clean Logic \(0\)), and connects to \(+5\text{ V}\) when pressed (Logic \(1\)).
• A pull-up resistor holds the pin at \(+5\text{ V}\) when open (Logic \(1\)), and pulls it to \(0\text{ V}\) when pressed (Logic \(0\)).
B. Analogue Inputs & Potential Dividers
Real-world environmental conditions (like light levels and temperature) change smoothly and continuously rather than switching instantly ON or OFF.
• Analogue Sensors: An LDR (Light Dependent Resistor) detects light; a Thermistor detects temperature.
• Potential Divider Network: The sensor is placed in series with a fixed resistor to convert changes in resistance into a varying analogue voltage.
• Analogue-to-Digital Converter (ADC): The PIC’s internal ADC measures this variable voltage (from \(0\text{ V}\) to \(5\text{ V}\)) and converts it into a digital number scale, typically an 8-bit scale ranging from \(0\) to \(255\). The flowchart can then test conditions like: Is Light Level < 100?
C. Output Drivers and Inductive Protection
Microcontrollers are delicate processing chips designed for low-current signaling. A standard PIC output pin can typically supply a maximum of only \(20\text{ to }25\text{ mA}\) at \(5\text{ V}\).
1. Transistor / Darlington Drivers:
Heavy loads such as DC motors, solenoids, and high-power LEDs require hundreds or thousands of milliamps. A Bipolar Junction Transistor (BJT) or a Darlington Pair acts as an electronic switch. The low current from the PIC pin switches the transistor ON, which allows a much larger current from a separate power supply to drive the load safely.
2. Relays:
When a PIC needs to switch a high-voltage or high-current AC/DC circuit, a relay is used. The relay provides complete electrical isolation between the sensitive low-voltage PIC circuit and the high-power load circuit.
3. The Flyback (Protective) Diode:
Inductive components like relay coils, solenoids, and DC motors store energy in a magnetic field. When the transistor switches off, this magnetic field collapses suddenly, generating a massive reverse voltage surge called back-EMF (Electro-Motive Force) that can easily destroy the driver transistor and PIC.
To prevent damage, a protective diode is connected in parallel across the inductive load in reverse bias. Under normal operation, the diode does nothing. But when the load turns off, the diode safely absorbs and dissipates the high-voltage spike.
Key Takeaway: PIC pins provide small currents (\(\approx 20\text{–}25\text{ mA}\)). Always use a transistor/relay to drive larger loads, use pull-up/pull-down resistors to stop inputs floating, and connect a reverse-biased diode across inductive coils to protect against back-EMF spikes.
---4. Robotics and Automation
Robotics combines microcontrollers, sensors, and mechanical hardware to carry out complex automated tasks with speed, power, and precision.
Key Components of a Robotic System
Every industrial robot is built from four fundamental building blocks:
1. Sensors: Provide feedback about the surrounding environment (e.g., ultrasonic and infrared distance sensors for obstacle detection, light sensors, bump/limit switches for mechanical boundaries).
2. Controller: The microcontroller or microprocessor that executes the algorithm, processes sensor inputs, and calculates output actions (feedback loop).
3. Actuators: The "muscles" that produce movement:
• Continuous DC Motors: For driving wheels or continuous rotation.
• Stepper Motors: Rotate in precise angular steps for exact positioning.
• Servo Motors: Provide controlled angular movement with position feedback.
• Pneumatic Cylinders: Provide fast, powerful linear motion using compressed air.
4. End Effectors: The "hands" or tools attached to the end of a robotic arm, tailored to specific jobs (e.g., mechanical grippers, vacuum suction cups, spot-welding guns, paint spray nozzles, surgical tools).
Industrial & Societal Applications
• Automotive & Heavy Manufacturing: Robotic arms perform precision spot welding, consistent spray painting in toxic booths, pick-and-place component transfer, and windscreen assembly.
• Pneumatic / Food Production Lines: High-speed pick-and-place sorting of items, automated packaging, sealing, and continuous bottling lines.
• Medical & Healthcare: Robotic surgery (minimally invasive tele-manipulators allowing surgeons to operate with sub-millimetre precision) and advanced prosthetic limbs.
• Domestic & Commercial Logistics: Automated Guided Vehicles (AGVs) transporting stock across modern fulfillment warehouses, as well as autonomous robotic vacuum cleaners and lawn mowers.
Advantages and Disadvantages of Industrial Robotics
Advantages:
• High Precision & Repeatability: Robots perform the exact same action identically thousands of times without human error.
• Continuous Operation (24/7): Robots do not suffer from fatigue, need breaks, or lose concentration.
• Safety in Hazardous Environments: Robots can operate in dangerous conditions (toxic paint fumes, extreme welding heat, radiation, heavy chemical handling) keeping humans safe.
• Speed and Reduced Long-Term Costs: Higher cycle speeds increase productivity and lower long-term labour costs per unit.
Disadvantages:
• High Initial Capital Cost: Purchasing, installing, and setting up industrial robots requires huge financial investment.
• Cost of Breakdown & Downtime: If a robot fails mechanically or encounters software bugs, an entire assembly line may grind to a halt.
• Specialised Maintenance Staff: Highly skilled engineers and technicians are needed for programming and regular servicing.
• Social Impact: Can lead to the displacement or redundancy of traditional manual factory workers.
Key Takeaway: Robots combine sensors, controllers, actuators, and end effectors. They provide outstanding repeatability, 24/7 productivity, and worker safety in harsh environments, but require high initial investment and specialised engineering support.
---5. Quick Summary & Top Exam Pitfalls
Quick Review Checklist
• PIC Definition: Single chip with CPU, memory (RAM/ROM/Flash), clock, and programmable I/O.
• Inputs: Use pull-up/pull-down resistors for digital switches; use potential dividers + ADC (\(0\text{–}255\)) for analogue sensors.
• Output Protection: Transistors/relays boost current; reverse-biased diodes suppress back-EMF spikes from coils.
• Robotics: Sensors \(\rightarrow\) Controller \(\rightarrow\) Actuators \(\rightarrow\) End Effectors.
Common Exam Mistakes to Avoid
1. Unlabeled Decision Diamonds: Forgetting to write YES and NO on the exit arrows of decision diamonds will cost you easy marks.
2. Forgetting Flowchart Loop-Backs: For continuous monitoring tasks, remember to draw an arrow looping back to the start of the sensing process.
3. Direct Driving: Never state that a PIC pin directly powers a motor or relay coil. PIC pins only supply \(\approx 20\text{–}25\text{ mA}\); mention a transistor driver.
4. Back-EMF Diode Orientation: Never draw the protection diode in forward bias across a coil (this causes a dead short circuit!). It must always be connected in reverse bias.
5. Vague Robotics Answers: Avoid writing "robots are just faster." Use precise technical terminology like high repeatability, elimination of human fatigue, reduced cycle times, and working safely in hazardous environments (e.g., toxic paint fumes).