Overview
Home automation means making everyday devices — lights, fans, pumps, alarms — switch on and off by themselves when something in the surroundings changes. In this project you move step by step from noticing automation around you to building a small working system of your own. You first look for automatic things at home, in school, in trains and in markets, and record how you think each one works. You then get to know the parts of an electronics kit: breadboard, jumper wires, LEDs, resistors, buzzers, batteries, a digital multimeter and a microcontroller such as the Arduino Uno. You learn the symbols used in circuit diagrams, try circuits safely on a simulation platform such as Tinkercad, and then build them with real parts on a breadboard. The heart of the project is the automation cycle of input, processing and output: a sensor notices a change, the microcontroller decides what to do according to a programme you upload, and an output device acts. You write your first programme (Blink), build a motion-sensing smart light, and finally design a system of your own choice. Throughout, you work only with low-voltage battery or USB power under adult supervision, never with the 230 V mains supply. You also keep a project record — bill of materials with costs, circuit diagrams, test results and the time spent on each activity — exactly as a technician or engineer would.
हिंदी में पढ़ें
इस परियोजना में आप सीखेंगे कि उपकरण अपने-आप कैसे काम कर सकते हैं। हर स्वचालित प्रणाली किसी बदलाव को पहचानती है, तय करती है कि क्या करना है और फिर काम करती है — गति सेंसर आपको पहचानता है, माइक्रोकंट्रोलर निर्णय लेता है और बत्ती जल जाती है। आप इलेक्ट्रॉनिक पुर्ज़ों और सेंसरों को जानेंगे, सर्किट आरेख बनाएँगे, कंप्यूटर सिमुलेशन पर सर्किट जाँचेंगे, उन्हें ब्रेडबोर्ड पर बनाएँगे, अपना पहला Arduino प्रोग्राम लिखेंगे और अंत में अपनी स्वयं की स्वचालन प्रणाली तैयार करेंगे। आप केवल सुरक्षित कम वोल्टेज वाली बैटरी या USB बिजली से, किसी बड़े की देखरेख में काम करेंगे, और लागत, परीक्षणों तथा लगे समय का सावधानी से रिकॉर्ड रखेंगे।
Learning Objectives
- Explain automation as a cycle of sensing, deciding and acting, with examples from the home, school and nature.
- Identify common electronic components and sensors and state what each one does in a circuit.
- Read and draw simple circuit diagrams using standard symbols.
- Test a circuit on a simulation platform before building it with real components on a breadboard.
- Write, upload and modify a simple microcontroller programme such as Blink.
- Design, build and test a small automation system, such as a motion-sensing light, using a sensor, a microcontroller and an output device.
- Follow electrical safety rules: low-voltage DC only, no connection to the 230 V mains, safe soldering and tool handling, with adult supervision.
- Prepare a bill of materials with costs and keep a project log of diagrams, test results, problems fixed and time spent.
Topics in this chapter
12 topics · tap a topic title to jump straight to it.
What automation is: sense, decide, act
1Think first
2The idea, in plain words
Automation means using technology so that a device does its job by itself, without a person switching it on and off each time. An automatic system has three jobs: it senses a change around it, it decides what to do, and it acts. A person who switches on a fan when the room is hot is doing all three jobs by hand. An automatic system hands these jobs to a sensor, a controller and an output device.
Think of a school where the lights and fans of a classroom keep running long after everyone has gone home after the last bell. Nobody intends to waste electricity; people simply forget. If a motion sensor is fitted in that room, it notices that nobody has moved for some minutes and the controller switches the lights off. The bill comes down and nobody has to remember anything.
A second example is a kitchen garden or school garden with a soil moisture sensor pushed into the soil. When the soil dries out, the sensor reports it; the controller switches on a small pump; when the soil is moist enough, the pump is switched off again. Plants get water only when they need it, so water is saved as well as effort.
Automation is not new. Nature has always worked this way. Your heart beats, your lungs breathe and your stomach digests food without you deciding to do it. When you are hot, your body starts sweating to cool down. Your pupils become smaller in bright light. Signals such as nerve impulses and hormones play the part of the controller. Outside the body, day follows night, the water cycle keeps turning, and birds migrate thousands of kilometres without a map.
Human inventions often copy these ideas. A thermostat in a geyser, iron or refrigerator keeps the temperature within a set range, much as sweating keeps the body cool. A light that turns on when someone enters a corridor responds to a change, as the eye does. In this project you will learn to build simple systems of this kind yourself, using safe low-voltage electronics and a small programmable chip called a microcontroller.
- Automation: using sensors, controllers and programmes so that a device performs a task without constant human operation.
- Every automatic system does three jobs: sense (input), decide (processing) and act (output).
3Worked example
- Automatic classroom lights: a motion sensor (sense) tells a controller (decide) that nobody is present, and the lights switch off (act).
- Automatic garden watering: a soil moisture sensor reports dry soil, the controller switches a pump on, and switches it off once the soil is moist.
- An electric iron's thermostat cuts the current when the iron is hot enough and restores it when the iron cools, keeping the temperature steady.
- In the body, sweating when hot and pupils narrowing in bright light are natural automatic responses.
4Your turn
In an automatic street light, which part does the ‘deciding’?
5Remember this
A journey of automation and spotting it around you
1Think first
2The idea, in plain words
People have tried to make things work by themselves for thousands of years. Following this journey helps you see that automation grows step by step, each idea building on the last.
- Sundials and water clocks: the moving shadow of the sun, or water dripping steadily from one pot to another, showed the passing of time with no one counting. The ghati or sinking-bowl water clock was used in India to measure time.
- Mechanical clocks: gears and a wound spring or falling weight kept the hands moving on their own.
- Early automatic machines: the Jacquard loom (early 1800s) used punched cards to decide which threads to lift, so a complicated pattern could be woven again and again. The steam engine used a spinning ‘governor’ to control its own speed.
- Electricity and electronics: lifts that stop at the right floor, calculators, washing machines with programmes.
- Smart homes and robots: sensors, the Internet and small computers controlling lights, locks and appliances.
- Smart cities: traffic signals, water supply and power grids that adjust to demand using data and artificial intelligence.
Your first task is to become an automation spotter. Look carefully around your home, classroom, a car, bus or train, the local market and even films and television, and list things that work automatically. Good places to look are the refrigerator, the electric kettle or iron, an automatic sliding door at a mall or metro station, a hand dryer or tap with a sensor, a voltage stabiliser, a mobile phone screen that dims in the dark, and railway level-crossing signals.
For each item, record four things in a table: place, what is automated, what happens, and how you think it works (which sensor, what decision). Add a notes column for why it is useful. For example, many refrigerators and stabilisers cut off power when the voltage suddenly rises; a circuit senses the voltage and protects the compressor.
Do not worry if you cannot be sure how something works; write your best guess and mark it with a question mark to check later. Finish by writing two or three ideas of your own: tasks at home that are tiring or easily forgotten, and how a sensor might help.
3Worked example
- Metro or mall sliding doors open when a sensor detects a person approaching.
- A phone screen brightens in sunlight and dims at night using a built-in light sensor.
- A voltage stabiliser for a refrigerator switches the supply off during a surge to protect the compressor.
- The Jacquard loom read punched cards to weave the same pattern repeatedly without a weaver choosing each thread.
4Your turn
What did the Jacquard loom use to ‘remember’ a weaving pattern?
5Remember this
Components in the electronics kit
1Think first
2The idea, in plain words
Before building anything, learn the names and jobs of the parts. A good habit is to lay the kit out on a table and label each item.
| Part | What it does |
| Breadboard | A plastic board with hidden metal strips. Pushing component legs into its holes connects them without soldering, so circuits can be tried and changed quickly. |
| Jumper wires | Short insulated wires with pins at the ends to link points on the breadboard and the microcontroller. |
| LED | Light Emitting Diode. Glows when current flows in the right direction. The longer leg is positive (anode), the shorter leg negative (cathode). It always needs a resistor in series. |
| Resistor | Limits the current so that parts such as LEDs are not damaged. Its value is measured in ohms (Ω), shown by coloured bands. |
| Buzzer | Makes a beep when current flows; used in alarms and timers. |
| Battery | A portable source of direct current (DC), such as a 9 V battery or 1.5 V cells. |
| Microcontroller | A tiny programmable computer on a board, such as the Arduino Uno or Raspberry Pi Pico, that reads sensors and controls outputs. |
| LCD (16×2) | A small screen showing two rows of 16 characters, used to display readings and messages. A small potentiometer adjusts its contrast. |
| Adapter | Converts the 230 V AC from a wall socket into low-voltage DC (for example 9 V or 12 V) for the board. Only a ready-made, certified adapter is used; never open one. |
| USB (Arduino) cable | Connects the board to a computer to upload programmes and supply 5 V power. |
| Printed circuit board (PCB) | An insulating board with thin copper tracks. Parts are soldered on to make a permanent circuit after testing. |
| Digital multimeter (DMM) | Measures voltage, current and resistance; the main tool for checking and fault-finding. |
Tools you will also meet are a wire stripper, small screwdriver, wire cutter, and — only with a teacher present — a soldering iron, solder wire and flux. A laptop or desktop computer is needed for simulation and programming.
Store small parts in labelled boxes or an egg tray, and count them at the end of each period. Lost resistors and LEDs are the most common reason a group cannot finish a circuit on time.
- LED rule: longer leg = anode (+), shorter leg = cathode (−); always use a series resistor.
- Breadboard is for testing (prototyping); a PCB with soldered parts is for a permanent circuit.
- An adapter converts 230 V AC from the socket into low-voltage DC; students use only certified ready-made adapters.
3Worked example
- Identifying LED legs: a red LED has one long leg and one short leg; the long leg goes towards the positive side of the battery.
- Using a 16×2 LCD to display ‘Temp: 31 C’ from a temperature sensor.
- Using a DMM set to DC volts to check that a 9 V battery actually gives about 9 V before using it.
4Your turn
Which part lets you connect components without soldering so you can test a circuit quickly?
5Remember this
Sensors: the electronic sense organs
1Think first
2The idea, in plain words
Our eyes, ears, nose, tongue and skin tell the brain what is happening around us. An electronic circuit needs similar ‘sense organs’ before it can act on its own. These are called sensors. A sensor turns a change in the surroundings — light, heat, sound, movement, moisture — into an electrical signal that a microcontroller can read.
- PIR motion sensor (passive infrared, for example the HC-SR501 module): every warm body gives out invisible infrared radiation. The sensor notices when this pattern changes, such as when a person walks past, and its output pin goes ‘high’. It has three pins — power (usually 5 V), output and ground — and two small knobs to set sensitivity and how long the output stays on. It needs about half a minute to settle after power is switched on.
- Sound sensor: a small microphone with a circuit that converts sound vibrations into an electrical signal. It can be used to switch an LED with a clap or to warn when a room is too noisy.
- Temperature sensor: the popular DHT11 measures air temperature in degrees Celsius (roughly 0–50 °C, to within about 2 °C) and also humidity.
- LDR (light dependent resistor): its resistance falls when light falls on it and rises in the dark, so a circuit can tell day from night. It is used in automatic street lights.
- Soil moisture sensor: two metal prongs placed in soil; wet soil conducts better than dry soil, so the reading tells whether plants need water.
Choosing a sensor. Ask three questions: What change do I need to notice? (movement, light, heat, wetness), where will the sensor be? (indoors, in soil, near water), and what does it cost and what voltage does it need? Most beginner modules work on 5 V or 3.3 V from the microcontroller itself, which keeps the whole project safely low-voltage.
Sensors are not as clever as our senses. A PIR sensor cannot tell a person from a dog, and an LDR can be fooled by a torch or by the street light itself. Testing in the real place where the sensor will be used is therefore part of the job.
- Sensor: a device that converts a physical change (light, heat, sound, motion, moisture) into an electrical signal.
- LDR: more light → lower resistance; darkness → higher resistance.
3Worked example
- A PIR sensor in a staircase turns the light on when someone climbs and off a minute later.
- An LDR covered with your palm behaves as if night has come, switching on a test LED.
- A DHT11 shows the classroom temperature on an LCD and sounds a buzzer if it crosses 35 °C.
- A soil moisture sensor in a pot gives a low reading after watering and a high reading when the soil is dry (or the reverse, depending on the module).
4Your turn
Which sensor would you choose to switch on a lamp automatically when it gets dark?
5Remember this
Working safely with electricity and tools
1Think first
2The idea, in plain words
Safety comes before every activity in this project. The single most important rule is this: all your circuits run on low-voltage DC — batteries, solar cells, a USB cable or a certified adapter — and never on the 230 V AC mains supply.
The sockets in Indian homes and schools supply about 230 volts of alternating current. That voltage can push a deadly current through the human body. Electronic circuits and microcontrollers, on the other hand, work on 3.3 V, 5 V, 9 V or 12 V DC, which is safe to touch. Connecting a breadboard circuit to a wall socket would destroy the parts and could cause fire, burns or electric shock. So:
- Never cut, strip or join a wire that goes to a wall plug. Never open an adapter, charger or appliance.
- Do not use relay modules to switch fans, bulbs or pumps that run on mains. If a project idea needs this, the mains part is designed and installed only by a qualified electrician, and you work only on the low-voltage side.
- Work under the supervision of your teacher or another adult, especially when using the soldering iron or a new power source.
Avoid short circuits. A short circuit happens when the positive and negative of a supply are joined with almost no resistance in between. A battery can get hot, swell or leak. Check that bare wire ends do not touch, and disconnect power before changing any connection.
Soldering. A soldering iron tip is hotter than 300 °C. Always keep it in its stand, wear safety goggles, work in a ventilated room, do not breathe the fumes, use lead-free solder where possible, and wash your hands afterwards. Never test the tip with a finger.
Tools and workspace. Cut and strip wires away from your body and your partner. Keep the table tidy, with wires coiled and no drinks near the circuit. Keep water away from all electrical work.
Internet safety. You will search for tutorials and download software. Ask your teacher before downloading anything, use official websites (such as the Arduino site), and never share personal information online.
Before each session, run through a quick checklist: power source is low-voltage DC, an adult is present, tools are in place, and the area is dry.
- Safety rule 1: build circuits only on low-voltage DC (batteries, USB, solar cell or certified adapter); never connect to 230 V AC mains.
- Safety rule 2: switch off or disconnect power before changing any connection.
- Safety rule 3: soldering only with an adult present — iron in its stand, goggles on, room ventilated, hands washed afterwards.
- Safety rule 4: keep water, food and drinks away from the work table.
3Worked example
- Correct: powering an Arduino from a laptop's USB port (5 V DC) while testing a PIR light.
- Wrong and dangerous: trying to wire a breadboard LED circuit to a two-pin plug for a wall socket.
- A 9 V battery that becomes warm because a jumper wire is touching both of its terminals — a short circuit; disconnect it at once.
4Your turn
Which power source is NOT allowed for your breadboard circuits?
5Remember this
Circuit symbols and circuit diagrams
1Think first
2The idea, in plain words
Engineers do not draw a picture of every wire and battery. They use a circuit diagram, a neat drawing made of standard symbols joined by straight lines. Anyone in the world who knows the symbols can read it, just as anyone can read a road sign.
| Component | How the symbol looks | Job |
| Cell / battery | a long thin line (+) and a short thick line (−); a battery is two or more such pairs | supplies electrical energy |
| Switch | a break in the line with a small lever | opens or closes the circuit |
| Resistor | a small rectangle (or a zig-zag line) | limits current |
| Diode | a triangle pointing at a bar | lets current flow in one direction only |
| LED | the diode symbol with two small arrows pointing outward | gives light |
| Capacitor | two short parallel lines with a gap | stores charge for a short time |
| Earth / ground | a line with three shorter lines below it | gives a safe return path; the reference point of 0 V |
Rules for drawing. Use a pencil and ruler. Draw connecting wires as straight lines with right-angle corners. Mark the + side of the battery. Write the value next to each part (9 V, 220 Ω). Show a dot where wires are joined; wires that only cross without a dot are not connected.
Reading a diagram. Put your finger on the + terminal of the battery and trace the path. Does it pass through every part and come back to the − terminal? If the path is broken (switch open), no current flows. If two parts are on one path, one after the other, they are in series; if the path splits so that each part has its own branch, they are in parallel.
The simplest circuit in this project is: battery (+) → switch → resistor → LED (long leg first) → back to battery (−). Draw it first, then build it. A habit of ‘diagram first, build second’ saves a great deal of time spent searching for wrong connections.
- Circuit diagram: a drawing of a circuit using standard symbols joined by straight lines.
- Series: parts on one path, one after another; parallel: the path splits and each part has its own branch.
- A dot means wires are joined; crossing lines without a dot are not connected.
3Worked example
- Basic LED circuit: 9 V battery, switch, 470 Ω resistor and LED in series.
- Buzzer circuit: battery, push switch and buzzer in series — the buzzer sounds only while the switch is pressed.
- Two LEDs in parallel, each with its own resistor, both glowing when the switch is closed.
4Your turn
In a circuit diagram, what does a triangle pointing at a bar with two small arrows coming out of it stand for?
5Remember this
Trying circuits first on a simulation platform
1Think first
2The idea, in plain words
A pilot practises in a flight simulator before flying a real aeroplane, and a racing game lets you ‘drive’ without a real car. In the same way, a circuit simulation platform lets you build and test a circuit on a computer screen before touching real parts. If you connect something wrongly, nothing burns and nothing is wasted — you simply fix it and try again.
Tinkercad Circuits is a free, browser-based platform that many Indian schools use; there are others too. Your teacher will help you create a class account. You can also look for beginner tutorials by searching for words such as ‘simulation for building circuits for beginners’ together with the platform's name.
Steps to follow.
- Step 1 – Draw. Draw the circuit diagram in your notebook first, with values.
- Step 2 – Open. Open the platform and start a new circuit.
- Step 3 – Place. Drag the parts onto the workplane: a 9 V battery, a slide switch, a resistor and an LED. Click the resistor to set its value.
- Step 4 – Connect. Click from one terminal to another to draw wires. Use red wires for + and black for −.
- Step 5 – Simulate. Press ‘Start Simulation’, flip the switch and watch the LED.
Make two circuits to begin with: (1) LED, resistor, 9 V battery and switch; (2) buzzer, resistor, 9 V battery and switch. Then experiment: change the resistor to a bigger value and note that the LED becomes dimmer; use a smaller value and the platform may warn you that the LED is getting too much current. Try a 3 V coin cell instead of the 9 V battery. Turn the LED round and see that it no longer glows.
A useful idea for later classes: with a 9 V battery, a 220 Ω resistor lets roughly 30 milliamperes through a red LED, which is more than a typical LED's safe 20 mA, so 470 Ω is a better choice; on the 5 V pins of an Arduino, 220 Ω is about right.
For each trial, record the components, what you changed and what you observed, and draw the final working diagram. Screenshots of your simulations make good evidence in your project file.
- Simulation: testing a circuit on a computer model before building it with real parts.
- Larger series resistance → smaller current → dimmer LED.
3Worked example
- Increasing the resistor from 220 Ω to 1 kΩ in the simulation makes the LED visibly dimmer.
- Turning the LED around in the simulation stops it glowing, showing that an LED conducts in one direction only.
- A buzzer circuit with a push button sounds only while the button is held down.
4Your turn
What is the main advantage of trying a circuit on a simulation platform first?
5Remember this
Building physical circuits on a breadboard and testing them
1Think first
2The idea, in plain words
Once a circuit works on screen, build it with real parts. A breadboard makes this easy. Inside, metal strips join the holes in a fixed pattern: in the central area, each short column of five holes is connected, and the two halves are separated by a groove down the middle; along the edges run long power rails, usually marked red (+) and blue or black (−), connected along their whole length. Two legs pushed into the same connected group are joined; legs in different groups are not.
Steps to build the LED circuit.
- Place the LED across two different columns, noting which column has the long leg.
- Put one end of the resistor in the long-leg column and the other end in a new column.
- Use a jumper wire from that new column to the red rail, and another from the short-leg column to the blue rail.
- Add the switch in the path if you want one.
- Only now connect the battery clip: red wire to the red rail, black wire to the blue rail.
Testing with a digital multimeter. Set the DMM to DC volts (V with a straight line). Touch the black probe to the − rail and the red probe to the + rail; you should read close to the battery voltage. If the LED does not glow, measure across the LED and across the resistor to find where the voltage is lost. With power disconnected, the DMM's continuity (beep) setting tells you whether a wire or connection is complete.
Troubleshooting checklist: is the LED the right way round? Are both legs of a part in the same column by mistake (which bypasses it)? Is a leg not pushed fully in? Is the battery weak? Change one thing at a time and test again.
Ideas for physical circuits: a buzzer with battery and push switch (a doorbell model), a small 3 V DC motor run from a solar panel in sunlight, an ‘electronic rakhi’ with LEDs and a coin cell, or a dancing paper doll moved by a motor with LED eyes. When a circuit has been tested and works well, it can be soldered onto a PCB or perforated board to make it permanent — with your teacher present.
- Breadboard: holes in the same short column are connected; the central groove separates the two halves; each long power rail is connected along its length.
- DMM on DC volts: black probe to −, red probe to +.
- Fault-finding rule: change one thing at a time, then test again.
3Worked example
- A doorbell model: push switch and buzzer on a breadboard powered by a 9 V battery.
- A solar fan: a small solar panel connected directly to a 3 V DC motor with a paper blade, spinning faster in bright sun.
- An electronic rakhi: two LEDs, a resistor and a 3 V coin cell mounted on decorated card.
4Your turn
On a breadboard, which of these pairs of holes are connected to each other?
5Remember this
Input, processing, output and the microcontroller
1Think first
2The idea, in plain words
So far, a person has worked the switch. To make a circuit smart, it must switch itself on when it is dark, or warn when a tank is full. Recall what happens when you touch a hot pan: your skin senses heat (input), the brain decides the hand must move (processing), and the hand pulls away (output). An automatic system follows the same cycle.
- Input (sensing): a sensor notices a change — movement, temperature, light, sound or moisture.
- Processing (decision-making): a microcontroller reads the sensor and decides what to do, following instructions.
- Output (action): an output device carries out the decision. Examples are LEDs, buzzers, DC motors, servo motors, LCD screens, speakers and relays.
The cycle repeats continuously while the system is switched on.
The microcontroller is the brain of the circuit. It is a small computer on a single chip, mounted on a board with connection pins. The set of instructions we give it is called a programme (the Arduino world calls it a ‘sketch’). Beginners often use the Arduino Uno or the Raspberry Pi Pico; you choose one according to the job and the budget.
Parts of the Arduino Uno you must know:
- Digital pins 0–13: give or read on/off (HIGH/LOW) signals — to switch an LED or buzzer, or read a PIR sensor. Pin 13 also has a small LED built onto the board. Pins 0 and 1 are used for communication with the computer, so beginners avoid them.
- Analog pins A0–A5: read values that vary smoothly, such as from an LDR or soil moisture sensor, as a number from 0 to 1023.
- Power pins 5V and 3.3V: supply small sensors. GND (ground) is the common reference of 0 V; every part's negative must connect to it.
- USB port: to upload programmes and supply 5 V from the computer. A DC jack accepts a 7–12 V adapter or battery.
- Reset button: restarts the programme from the beginning.
Before connecting anything, look up the ‘pin configuration’ of your board and keep a printed copy beside you. Wrong pins are the most common beginner error.
- Automation cycle: Input (sensing) → Processing (decision-making) → Output (action), repeated continuously.
- Programme: the set of instructions given to a microcontroller.
- Arduino Uno: digital pins 0–13 (on/off), analog inputs A0–A5 (values 0–1023), 5V and 3.3V power pins, GND as common 0 V reference.
3Worked example
- Automatic street light: input — LDR senses falling light; processing — microcontroller compares the reading with a set level; output — LED lamp switches on.
- Water sprinkler: input — soil moisture sensor; processing — decide the soil is dry; output — small DC pump runs for a set time.
- Classroom heat alarm: input — DHT11; processing — is temperature above 35 °C?; output — buzzer and LCD message.
4Your turn
In an automatic system, what is the job of the microcontroller?
5Remember this
Your first programme: making an LED blink
1Think first
2The idea, in plain words
The traditional first programme for any microcontroller is Blink: it switches an LED on for one second, off for one second, and repeats for ever. It proves that your computer, cable, board and software are all working.
Steps.
- With your teacher's help, download and install the free Arduino IDE (the programming software) from the official Arduino website only.
- Open it and go to File → Examples → 01.Basics → Blink. A window opens with the Blink programme.
- Connect the Arduino Uno to the computer with its USB cable. In the Tools menu, choose the board (Arduino Uno) and the Port it is using (a COM number on Windows).
- Click the Upload button (the right-pointing arrow). After a few seconds the IDE says ‘Done uploading’ and the small LED on the board marked ‘L’ starts blinking once every second.
Understanding the code. Every Arduino programme has two parts. setup() runs once when the board starts; Blink uses it to say pinMode(LED_BUILTIN, OUTPUT), which means ‘this pin will send signals out’. loop() runs again and again: digitalWrite(LED_BUILTIN, HIGH) turns the LED on, delay(1000) waits 1000 milliseconds (1 second), digitalWrite(LED_BUILTIN, LOW) turns it off, and another delay(1000) waits. Every instruction ends with a semicolon, and capital and small letters must be typed exactly.
Now modify it. Change both delays to 200 and upload again — the LED blinks fast. Make it on for 2000 and off for 500. Next, connect an external LED with a 220 Ω resistor to digital pin 8 and GND on a breadboard, change the pin in the code to 8, and upload. Add a second LED on pin 9 and make the two blink alternately like a railway crossing signal.
Save every version with a clear name (blink_fast, blink_two_leds) and note in your log what you changed and what happened. If uploading fails, check the cable, the board and port selection, and that no other programme is using the port.
- setup() runs once at start; loop() repeats for ever.
- pinMode(pin, OUTPUT) sets a pin to send signals; digitalWrite(pin, HIGH) turns it on; digitalWrite(pin, LOW) turns it off.
- delay(n) waits n milliseconds; 1000 ms = 1 second.
3Worked example
- delay(1000) gives a 1-second wait; delay(250) gives a quarter-second wait.
- Two LEDs on pins 8 and 9 blinking alternately to model a level-crossing signal.
- An upload error ‘port not found’ fixed by choosing the correct COM port in the Tools menu.
4Your turn
What does delay(500) do in an Arduino programme?
5Remember this
Building a smart light with a motion sensor
1Think first
2The idea, in plain words
Now join input, processing and output into a real automatic system: a smart light that switches on when someone moves in the room.
Materials: Arduino Uno, PIR motion sensor module, 5 mm LED, 220 Ω resistor, breadboard, jumper wires, USB cable and a computer with the Arduino IDE.
Connections (draw the diagram first):
- PIR VCC → Arduino 5V; PIR GND → Arduino GND; PIR OUT → digital pin 2.
- Pin 13 → 220 Ω resistor → LED long leg; LED short leg → GND.
The logic of the programme in plain words: in setup(), make pin 2 an input and pin 13 an output. In loop(), read pin 2. If it is HIGH (movement seen), make pin 13 HIGH; else make pin 13 LOW. In code this is written with digitalRead(2) and an if … else statement. You will find similar sample code in beginner tutorials; type it yourself rather than pasting it, so that you understand each line, and note the website you learned from.
Testing. Upload, wait about a minute for the PIR to settle, then sit still — the LED should go off after the sensor's delay time. Wave your hand — it should come on. Adjust the two knobs on the PIR: one sets the range (sensitivity), the other how long the output stays on after movement. Record each test: what you did, what you expected, what happened.
If it does not work the first time (most circuits do not), check: are VCC and GND on the right pins? Is OUT really on pin 2, and does the code say 2? Is the LED the right way round? Is the PIR jumper set to repeat mode? Write down every fix in your log; this list becomes valuable learning.
Finally, fill in input–process–output tables for an automatic street light (LDR input), an automatic water sprinkler, and one device of your own choice. The street light, for example, uses an LDR on an analog pin; the programme switches the lamp on when the light reading falls below a value you find by testing at dusk.
- Smart light logic: IF motion is detected (input HIGH) THEN light ON, ELSE light OFF.
- PIR connections: VCC to 5V, GND to GND, OUT to a digital input pin.
3Worked example
- Store-room light that comes on when someone enters and goes off about 30 seconds after they leave.
- The same circuit with a buzzer in place of the LED becomes a simple intruder alarm for a cupboard.
- Replacing the PIR with an LDR on pin A0 turns the project into a model automatic street light.
4Your turn
In the smart light, which pin of the PIR sensor should be connected to the Arduino's digital input pin?
5Remember this
Designing your own system: costing, power, records and reflection
1Think first
2The idea, in plain words
The last step is to design an automation system of your own. Choose something that solves a real problem: an automatic plant watering system, an obstacle-detecting toy car, a fire or smoke alarm model, a theft alarm for a cupboard, an automatic gate model, or a small ‘smart fan’ that runs a DC motor when the room is hot. Search for tutorials using words such as ‘DIY automatic plant watering Arduino’, then adapt the code to your needs and note the source and what you changed. That is honest practice, just as quoting a source is in an essay.
Plan on one page: purpose, input–process–output table, sensor and output device chosen, circuit or block diagram, and a bill of materials with costs.
| Item | Qty | Approx. cost (₹) |
| Arduino Uno-compatible board | 1 | 450 |
| Soil moisture sensor | 1 | 80 |
| 5 V mini pump + driver module | 1 | 180 |
| Breadboard + jumper wires | 1 set | 150 |
| Battery holder and cells | 1 | 120 |
| Total | 980 |
Prices vary by shop and year, so write the date and source of each price. Ask: which parts can be shared or reused? Can a cheaper part do the job?
Making it independent. So far the board has drawn power from the computer's USB port. To use the system away from the computer, power it from a battery pack (for example, a 9 V battery or rechargeable lithium-ion cells in a holder) through the board's DC jack, or from a certified USB power bank. Put it in a casing made from a lunch box, cardboard or a 3D-printed case, with holes for the sensor. Protect circuits from voltage fluctuations by using only a good-quality certified adapter, never a damaged charger.
Project log. Keep a record of each activity: date, periods spent, what was done, diagrams, test results, faults and fixes, and help received from teachers, peers or local technicians. At the end, add up the time for each activity.
Reflect. Did the system work as planned? What would you change? Compare sensors with human senses: a machine cannot yet truly read a friend's feelings or judge a situation as you do. Finally, list careers linked to this work — automation engineer, electronics technician, embedded programmer, robotics technician, solar installer and technical support specialist.
- Total cost = sum of (quantity × unit price) for every item in the bill of materials.
- Credit your sources: write the website or person you learned code from and what you changed.
3Worked example
- A bill of materials for a plant-watering model totalling about ₹980, with each price noted with shop and date.
- A cupboard theft alarm boxed in an old lunch box, powered by a 9 V battery through the DC jack.
- A log entry: ‘12 Aug, 2 periods: soldered sensor wires; pump ran backwards — swapped pump leads; works.’
4Your turn
You used a code sample from a tutorial website and changed the pin numbers. What should you write in your project record?
5Remember this
Key Concepts
- Automation
- The use of sensors, controllers and programmes so that a device performs a task without constant human operation.
- Sensor
- A device that converts a change in the surroundings, such as light, heat, sound, motion or moisture, into an electrical signal.
- Microcontroller
- A small programmable computer on a chip, such as the Arduino Uno or Raspberry Pi Pico, that reads inputs and controls outputs.
- Programme (sketch)
- The set of instructions uploaded to a microcontroller telling it how to respond to its inputs.
- Input–processing–output cycle
- The repeating sequence in which a sensor detects a change, a controller decides, and an output device acts.
- Output device
- A part such as an LED, buzzer, motor, LCD or speaker that carries out the microcontroller's command.
- Breadboard
- A reusable board with hidden metal strips that connects components without soldering, used for testing circuits.
- LED
- A light emitting diode that glows when current flows from its longer leg (anode) to its shorter leg (cathode).
- Resistor
- A component that limits the current in a circuit, with a value measured in ohms.
- PIR sensor
- A passive infrared sensor that detects the movement of warm bodies such as people and animals.
- LDR
- A light dependent resistor whose resistance falls as the light on it increases.
- Digital multimeter (DMM)
- A measuring instrument used to check voltage, current, resistance and continuity in circuits.
- Circuit diagram
- A drawing of a circuit using standard symbols joined by straight lines.
- Simulation platform
- Software such as Tinkercad on which circuits can be built and tested on screen before using real parts.
- Ground (GND)
- The common reference point of 0 V in a circuit, to which every part's negative side is connected.
- Short circuit
- An accidental low-resistance connection between the terminals of a supply that causes excessive current and heating.
- Adapter
- A certified device that converts 230 V AC from the socket into safe low-voltage DC for electronics.
- Bill of materials
- A list of every part needed for a project with quantities and costs.
End-of-Chapter Trial Paper & Test Questions
Topic-wise questions to test your understanding of every concept in this chapter.
-
Which of these is the correct order of the automation cycle? (a) Output → Input → Processing (b) Input → Processing → Output (c) Processing → Output → Input (d) Input → Output → Processing / स्वचालन चक्र का सही क्रम कौन-सा है? (a) आउटपुट → इनपुट → प्रोसेसिंग (b) इनपुट → प्रोसेसिंग → आउटपुट (c) प्रोसेसिंग → आउटपुट → इनपुट (d) इनपुट → आउटपुट → प्रोसेसिंग
Show answer
(b) Input → Processing → Output — a sensor first senses a change, the microcontroller then decides, and finally an output device acts. / (b) इनपुट → प्रोसेसिंग → आउटपुट — पहले सेंसर बदलाव को पहचानता है, फिर माइक्रोकंट्रोलर निर्णय लेता है और अंत में आउटपुट उपकरण काम करता है।
-
Which leg of an LED is connected towards the positive side of the supply? (a) The shorter leg (b) Either leg (c) The longer leg (d) Neither; LEDs have no polarity / LED का कौन-सा पैर आपूर्ति के धनात्मक सिरे की ओर जोड़ा जाता है? (a) छोटा पैर (b) कोई भी पैर (c) लंबा पैर (d) कोई नहीं; LED की कोई ध्रुवता नहीं होती
Show answer
(c) The longer leg — it is the anode (+); an LED conducts in one direction only, so the longer leg must face the positive side. / (c) लंबा पैर — यह ऐनोड (+) है; LED केवल एक दिशा में धारा प्रवाहित करता है, इसलिए लंबा पैर धनात्मक सिरे की ओर होना चाहिए।
-
Which sensor would detect a person walking into a room? (a) PIR motion sensor (b) LDR (c) Soil moisture sensor (d) DHT11 / कमरे में आते हुए व्यक्ति को कौन-सा सेंसर पहचानेगा? (a) PIR गति सेंसर (b) LDR (c) मिट्टी की नमी का सेंसर (d) DHT11
Show answer
(a) PIR motion sensor — it detects changes in infrared radiation given out by warm bodies as they move. / (a) PIR गति सेंसर — यह चलते हुए गर्म शरीरों से निकलने वाले अवरक्त विकिरण में बदलाव को पहचानता है।
-
Why must breadboard circuits never be connected to a wall socket? (a) The socket gives too little voltage (b) The socket supplies about 230 V AC, which can cause electric shock, fire and damage (c) Breadboards work only in sunlight (d) Sockets supply DC only / ब्रेडबोर्ड सर्किट को कभी भी दीवार के सॉकेट से क्यों नहीं जोड़ना चाहिए? (a) सॉकेट बहुत कम वोल्टेज देता है (b) सॉकेट लगभग 230 V AC देता है, जिससे बिजली का झटका, आग और नुकसान हो सकता है (c) ब्रेडबोर्ड केवल धूप में काम करते हैं (d) सॉकेट केवल DC देते हैं
Show answer
(b) The socket supplies about 230 V AC, which can cause electric shock, fire and damage — student circuits use only low-voltage DC from batteries, USB or certified adapters. / (b) सॉकेट लगभग 230 V AC देता है, जिससे बिजली का झटका, आग और नुकसान हो सकता है — विद्यार्थियों के सर्किट केवल बैटरी, USB या प्रमाणित एडेप्टर से मिलने वाले कम वोल्टेज DC पर चलते हैं।
-
In an Arduino programme, what does delay(2000) do? (a) Waits 2000 seconds (b) Turns on pin 2000 (c) Waits 2 seconds (d) Repeats the loop 2000 times / Arduino प्रोग्राम में delay(2000) क्या करता है? (a) 2000 सेकंड प्रतीक्षा करता है (b) पिन 2000 चालू करता है (c) 2 सेकंड प्रतीक्षा करता है (d) लूप को 2000 बार दोहराता है
Show answer
(c) Waits 2 seconds — delay counts in milliseconds and 2000 ms = 2 s. / (c) 2 सेकंड प्रतीक्षा करता है — delay मिलीसेकंड में गिनता है और 2000 ms = 2 सेकंड।
-
What is the main purpose of a breadboard? (a) To make permanent soldered circuits (b) To measure voltage (c) To connect and test components without soldering (d) To convert AC into DC / ब्रेडबोर्ड का मुख्य उद्देश्य क्या है? (a) स्थायी सोल्डर किए गए सर्किट बनाना (b) वोल्टेज मापना (c) बिना सोल्डरिंग के पुर्ज़ों को जोड़ना और जाँचना (d) AC को DC में बदलना
Show answer
(c) To connect and test components without soldering — its hidden metal strips join the legs pushed into the same group of holes, so circuits can be changed easily; a PCB is used for permanent circuits. / (c) बिना सोल्डरिंग के पुर्ज़ों को जोड़ना और जाँचना — इसकी भीतरी धातु की पट्टियाँ एक ही समूह के छेदों में लगे पैरों को जोड़ देती हैं, जिससे सर्किट आसानी से बदला जा सकता है; स्थायी सर्किट के लिए PCB का उपयोग होता है।
-
Explain the input, processing and output of an automatic street light. / स्वचालित स्ट्रीट लाइट के इनपुट, प्रोसेसिंग और आउटपुट को समझाइए।
Show answer
Input: a light dependent resistor (LDR) senses the amount of light; its resistance rises as it gets dark, and it is read by the microcontroller. Processing: the microcontroller compares the reading with a set level, found by testing at dusk, and decides whether it has become dark. Output: if it is dark, the microcontroller switches the lamp on; when daylight returns, the reading changes and the lamp is switched off. The cycle repeats continuously, so nobody has to switch the light on or off. / इनपुट: प्रकाश-निर्भर प्रतिरोधक (LDR) प्रकाश की मात्रा को पहचानता है; अँधेरा होने पर इसका प्रतिरोध बढ़ जाता है और माइक्रोकंट्रोलर इसे पढ़ता है। प्रोसेसिंग: माइक्रोकंट्रोलर इस मान की तुलना शाम के समय जाँचकर तय किए गए स्तर से करता है और निर्णय लेता है कि अँधेरा हुआ या नहीं। आउटपुट: अँधेरा होने पर माइक्रोकंट्रोलर लैंप जला देता है; दिन का प्रकाश लौटने पर मान बदल जाता है और लैंप बुझ जाता है। यह चक्र लगातार चलता रहता है, इसलिए किसी को बत्ती जलाने या बुझाने की ज़रूरत नहीं पड़ती।
-
List four safety rules you must follow while working on the home automation project. / गृह स्वचालन परियोजना पर काम करते समय पालन किए जाने वाले चार सुरक्षा नियम लिखिए।
Show answer
1. Use only low-voltage DC power — batteries, USB, a small solar panel or a certified adapter — and never connect any circuit to the 230 V AC mains. 2. Disconnect the power before changing any connection, and check that bare wires do not touch, to avoid short circuits. 3. Solder only with a teacher or adult present: keep the iron in its stand, wear goggles, work in a ventilated room and wash hands afterwards. 4. Keep the workspace tidy and dry, handle cutters and strippers carefully, and ask the teacher before downloading anything from the Internet. / 1. केवल कम वोल्टेज DC बिजली — बैटरी, USB, छोटा सोलर पैनल या प्रमाणित एडेप्टर — का उपयोग करें और किसी भी सर्किट को 230 V AC मेन्स से कभी न जोड़ें। 2. कोई भी कनेक्शन बदलने से पहले बिजली हटा दें और देखें कि नंगे तार आपस में न छुएँ, ताकि शॉर्ट सर्किट न हो। 3. सोल्डरिंग केवल शिक्षक या किसी बड़े की उपस्थिति में करें: आयरन को स्टैंड में रखें, चश्मा पहनें, हवादार कमरे में काम करें और बाद में हाथ धोएँ। 4. कार्यस्थल को साफ़-सुथरा और सूखा रखें, कटर और स्ट्रिपर सावधानी से चलाएँ, और इंटरनेट से कुछ भी डाउनलोड करने से पहले शिक्षक से पूछें।
-
Why is it a good idea to test a circuit on a simulation platform before building it? / किसी सर्किट को बनाने से पहले सिमुलेशन प्लेटफ़ॉर्म पर जाँचना अच्छा क्यों है?
Show answer
A simulation platform such as Tinkercad lets you place components, connect them and run the circuit on a computer screen. Mistakes such as a reversed LED, a missing resistor or a short circuit can be seen and corrected without burning any real part or wasting money. You can quickly try different batteries and resistor values and observe the effect, which builds understanding. When you finally build the real circuit, you already have a tested diagram, so you make fewer errors and finish faster. Like a pilot's flight simulator, it is safe practice before the real thing. / Tinkercad जैसा सिमुलेशन प्लेटफ़ॉर्म कंप्यूटर स्क्रीन पर पुर्ज़े रखने, उन्हें जोड़ने और सर्किट चलाने देता है। उल्टा लगा LED, छूटा हुआ प्रतिरोधक या शॉर्ट सर्किट जैसी गलतियाँ बिना किसी असली पुर्ज़े को जलाए या पैसे बर्बाद किए देखी और सुधारी जा सकती हैं। अलग-अलग बैटरी और प्रतिरोध के मान आज़माकर उनका असर जल्दी देखा जा सकता है, जिससे समझ बढ़ती है। जब असली सर्किट बनाया जाता है, तो पहले से जाँचा हुआ आरेख होता है, इसलिए गलतियाँ कम होती हैं और काम जल्दी पूरा होता है। पायलट के फ़्लाइट सिम्युलेटर की तरह यह असली काम से पहले का सुरक्षित अभ्यास है।
-
A group makes a theft alarm with a board costing ₹450, a PIR sensor costing ₹90, a buzzer costing ₹20, 10 jumper wires at ₹2 each and a battery with clip costing ₹60. Find the total cost and say why a bill of materials is useful. / एक समूह चोरी-अलार्म बनाता है जिसमें ₹450 का बोर्ड, ₹90 का PIR सेंसर, ₹20 का बज़र, ₹2 प्रति तार की दर से 10 जम्पर तार और ₹60 की क्लिप सहित बैटरी लगी है। कुल लागत ज्ञात कीजिए और बताइए कि सामग्री-सूची (बिल ऑफ़ मटीरियल्स) क्यों उपयोगी है।
Show answer
Cost = 450 + 90 + 20 + (10 × 2) + 60 = 450 + 90 + 20 + 20 + 60 = ₹640. A bill of materials lists every part with its quantity and price, so the group knows the budget before buying, can look for cheaper or reusable parts (the board can be reused in another project), can check that nothing is missing before starting, and has a record to show the teacher or anyone who wants to make the same system. / लागत = 450 + 90 + 20 + (10 × 2) + 60 = 450 + 90 + 20 + 20 + 60 = ₹640। सामग्री-सूची में हर पुर्ज़ा उसकी मात्रा और कीमत के साथ लिखा होता है, इसलिए समूह खरीदने से पहले ही बजट जान लेता है, सस्ते या दोबारा उपयोग होने वाले पुर्ज़े खोज सकता है (बोर्ड दूसरी परियोजना में फिर काम आ सकता है), शुरू करने से पहले जाँच सकता है कि कुछ छूटा तो नहीं, और शिक्षक या वही प्रणाली बनाने वाले किसी व्यक्ति को दिखाने के लिए उसके पास एक रिकॉर्ड रहता है।