By the end of week 7, you will be able to:
Understand Arduino Code structure and write Arduino C code syntax correctly
Create and Use Variables to store and manipulate different types of date in Arduino C
Use Looping (For) for repeating actions in Arduino C
Create and use Functions in Arduino C
It’s so ordinary and boring to just have a normal Desk Lamp to just turn it on and off by a switch! What if it was smarter and senses your presence! To just sit on your desk and Voila! The lamp turns ON, and once you move away, it turns OFF. This is your chance to try and build your first Smart Desk Lamp!
This smart Desk lamp works in Two Modes: Manual Mode and Automatic Mode:
The Manual mode means that you manually control the Desk lamp using a regular ON/OFF Switch.
The Automatic mode means that the Desk lamp is automatically controlled: If the IR sensor is sensing the presence of a person near the lamp, it keeps the lamp ON. If the IR sensor is not sensing the presence of a person in the room, it turns the Desk lamp OFF.
Type: Individual Activity
Tools & Materials:
1 Arduino UNO
1 LED (Represents the Desk Lamp)
2 Slide switches (1 switch represents the Mode selector and 1 switch represents the Desk Lamp's ON/OFF Switch)
1 IR Sensor module
1 DC adaptor
1 Breadboard
Description
We will be making this activity using Divide and Conquer Technique!
Manual Mode:
Build the manual mode circuit using a slide switch and LED (View Circuit Wiring)
[Hint: use a 3 pin slide switch]
Build your code to control the LED using the switch ON/OFF (Use Block Code on Tinkercad)
Automatic Mode:
Build the Automatic mode circuit using IR sensor and LED (View Circuit Wiring)
[Hint: you can replace IR sensor inside Tinkercad with PIR sensor as Tinkercad doesn’t have IR sensor]
Build your code to control the LED using the IR sensor
Adding selector and merging 2 codes together:
Add a slide switch (3 pin) to your circuit to choose between the two modes (View Circuit Wiring)
Build your code so that the slide switch (selector) chooses between manual and automatic modes
Reflect & Share
How did you write the code to control your smart lamp solution? Please explain in detail.
Did it work as it was supposed to? Why?
What challenges did you face while writing and testing your code?
Follow the video tutorials below (in order) to learn how to program an Arduino UNO to control input components and action components using Text code (in Arduino C). View the Code Library to follow along.
Arduino Code Structure & Syntax
Loops & If Conditions
Deadline: Before Midweek Session
Mode: Online via Google Meet
Session Outcomes
Discuss video tutorials and address challenges or problems with your instructor
Participate in a pair programming activity to program a smart circuit using Arduino C Language
Participate in an Activity to Find the bugs in Arduino project software
Session Exercises
Exercise 1: Make a Smart Temperature Indicator circuit using Arduino (This circuit could be part of a device that is sensitive to temperature changes).
(Expand to view Description & Requirements)
Description: The smart temperature indicator uses an LM35 sensor at the input and an LED at the output. The LM35 sensor senses the temperature and the circuit indicate one of three states:
LED is OFF and “COOL” message is displayed on the Serial Monitor when the temperature is higher than 15 AND less than 20
LED is ON and “HOT” message is displayed on the Serial Monitor when the temperature is higher than 20 AND less than 30
LED is blinking (ON & OFF Continuously) and “Error” message is displayed on the Serial Monitor when the temperature is lower than 15 OR higher than 30
Hint: Google search “Logical AND” and “Logical OR”
Requirements:
Use TinkerCad to develop Circuit Wiring only (since LM35 doesn’t exist in Tinkercad)
Build the circuit and make your connections on a physical breadboard with an Arduino UNO Board.
Write the Code: Use Arduino C text code PRIMARILY to write your code in Arduino IDE
Upload the code to your Arduino Board
Test your Smart Temperature Indicator:
To lower the temperature: grab any frozen objects from the freezer and put it near the temperature sensor
To raise the temperature: blow hot air from your mouth at the sensor or put the sensor near a hot cup of tea.
Debug: the serial monitor is your friend! Display the current temperature regardless of the state, to be able to track changes in temperature and debug for problems
WARNING: Avoid the leakage of any liquids or using any flame source on your electronic circuit!
[Solution] Wiring & Arduino Code
Exercise 2: Find the "Bug"!
(Expand to view Description & Requirements)
Description: you will be presented with a set of “buggy” codes that you need to “debug”. The project is not working, and you need to find the bug(s)!
Requirements:
Open the Tinkercad project sent by your instructor
Click "Copy and Tinker" to have your own copy of the project
Simulate the circuit to observe the behavior (No need to build the Physical Circuit)
Download the .ino code, open in Arduino IDE, and compile the code to find errors
Utilize the serial monitor to find the bugs whenever possible
[Solution]
Bug #1: Syntax Errors
Solution Tutorials - Wiring & Arduino Code
Bug #2: Incorrect Boolean Expression (If Condition)
Solution Tutorial - Wiring & Arduino Code
Bug #3: Incorrect Statement (If Condition)
Solution Tutorial - Wiring & Arduino Code
Bug #4: Incorrect Pin Assignment
Solution Tutorial - Wiring & Arduino Code
Bug #5: Incorrect Boolean Expression (For Loop)
Follow the video tutorials below (in order) to explore various use cases of Arduino UNO in real-life projects and applications. View the Code and Wiring to follow along.
Smart Home System - Automatic
Smart Home System - Manual
Smart Home System - Merging Modes
Deadline: Before EOWeek Session
Mode: Face-to-face @ Fab Lab
Session Outcomes
Discuss video tutorials and address challenges or problems with the instructor
Participate in a group exercise to practice Arduino programming in a mini-project
Discuss assignment progress: concept and execution
Smart Planting System
Build a simple representation of a smart planting system. This system senses the moisture level in a plant's soil, as well as, weather parameters (temperature and humidity) in order to control a DC fan and a Pump.
(Expand to view Description & Requirements)
Tools & Materials: I/P: 2 ON/OFF switch - 1 Moisture Sensor - 1 DHT Sensor- 1 Slide Switch
O/P: 1 Pump - 2 Relay Modules - 1 DC Fan
1 Arduino Uno
9V Adaptor
Others: Jumper Wires - Crocodile Wires - 2 Large Breadboards
Requirements:
You are required to build and program two modes; Manual and Automatic, using a slide switch:
Manual Mode: In this mode, a person can simply control the DC pump ON/OFF) using an ON\OFF switch or slide switch at the input. And the DC Fan using another ON\OFF switch or slide switch also connected at the input of the Arduino board.
Automatic Mode: In this mode, the Moisture sensor would check for moist level in a plant’s soil, if it is dry, the pump will turn ON, or otherwise it stays OFF. On the other hand, the DHT sensor would check the temperature and humidity levels and display them on LCD screen; in order to control the DC fan and put it into one of two states:
Fan is ON when Temperature is higher than 40 or Humidity is higher than 80
Fan is OFF otherwise
Hint: you need to test the Moisture sensor [Get ranges on Serial Monitor]
Design and build a smart gadget/device that fits one of the following themes:
Smart Devices for Your Backpack
Create a gadget/device that helps you while you're on the move — something that can live in your bag and makes your life easier, safer, more productive, or more fun.
Smart Devices for Your Work Desk
Create a gadget/device that stays on your desk — something that improves your workflow, reminds you of something important, keeps you focused, or simply brings joy to your workspace.
You’re free to define the problem and solution, as long as it fits one of those two themes.
Description:
Find any exciting idea to do for the assignment: you may find cool ideas on Instructables, Hackster, Hackaday, or Arduino Project Hub. As long as it fits one of the two themes mentioned above.
Please don't repeat the smart house and smart planter ideas, as they will not be accepted. Try to scout the internet for inspiration. And, you are encouraged to use new input and output components from your electronics kit.
Google your idea and see how other people have wrote their code, and provide links to other codes that you've tweaked or reused in your assignment as reference.
Make sure to take a look at the AI usage regulations page to see what is allowed and what is not.
It’s always a good idea to build a piece of your final project as an assignment this week. Just make sure it fits all the requirements 😉
Technical Requirements:
The smart device utilizes the Arduino UNO board to control the inputs and outputs.
The smart device is programmed using Arduino C (Text Code) (Provide a screenshot of your Arduino C code, *.ino code file, and wiring diagram).
The smart device includes two input components (at least) and two action components (at least).
The smart device program utilizes:
Two dynamic variables (at least)
(For example, you can use the two dynamic variables to store the two input components readings.)
One if condition (at least).
(For example, compare the sensor readings and take different actions accordingly.)
Logical operators (&& ||) OR Nested if condition (Select at least one of the two and utilize it in your Arduino program).
(For example, use the logical operators to check for two different conditions at the same time and take actions accordingly.)
(For example, use the nested if condition to add a mode selection functionality to your device. It can be switching from automatic control mode to manual control mode and vice versa.)
The smart device is wired and tested with an actual Arduino board and electronic components on a breadboard (Provide a video recording of the final outcome).
The smart device has an enclosure from cardboard, and the non-electric parts are prototyped from cardboard or any scrap material (You are not required to use any CAD or digital fabrication).
The smart device is functional and achieves its intended objective
Make sure to document your Assignment for Week 7 in the Maker Journal covering the following requirements:
Process Documentation:
Theme and Ideation: Clarify the theme you selected and describe how you came up with the idea for the smart device/gadget. Were you inspired by a certain reference? or did you customize design it to fulfil a certain objective?
Tools: Describe software, components, materials, and tools that you used in your assignment
Design: Describe the design of your smart device. What are the input and action components that you used? Make sure to include a screenshot of your circuit wiring on Tinkercad or any other software (Fritzing or Microsoft PowerPoint). Explain your Arduino C code in detail, describe the code that you wrote using simple text, Pseudocode, or Flowchart format
Implementation/Fabrication: Describe how you implemented your smart circuit on a breadboard and integrated the components within the enclosure. And most importantly, show us the final outcome of the assignment, make sure to include a video recording for your complete smart circuit in action
Media: Provide supporting images and videos to demonstrate the design and implementation processes
Learning Documentation:
Learning from Mistakes: Describe problems and challenges that you faced, and briefly describe solutions. How did you debug your code for error?
Community of Learning: Highlight an advice or idea provided by a peer or an instructor that helped in solving a problem or a challenge. Or an advice that YOU provided to help your peer(s)
Progress Review Deadline: September 1st, 2025 @4:00 PM