Week 1 – DRE2213 / BTE1522 – Class On Boarding and Step 1

Onboarding, Pre Survey, Basic Concepts in Python Programming. Game Canvas, Snake Creation.

Have a shot – Play With It

This week, we started building the foundation for our programming journey. Before we can create a complete game or work with sensors, we first need to understand how to communicate with a computer through code.

Setting Up: Thonny and Our First Game Window

We began by setting up Thonny as our Python programming environment and getting our first game window running.

Along the way, we explored an important concept for game development: coordinates and pixels.

A screen can be thought of as a coordinate system where the position of an object is represented using values such as X and Y. Understanding coordinates will become increasingly important as we start moving our game objects in the coming weeks.

We also had our first look at colour representation using RGB values, which allows us to define colours digitally.

Step 1: Building Through a Tiered Activity

After completing Step 1, we moved into our first hands-on activity using the Fill-in → Debug → Extend → Create progression:

      1. Fill-in – Complete the missing parts of the code.
      2. Debug – Find and correct errors in the program.
      3. Extend – Modify the existing program to add or change something.
      4. Create – Use what you have learned to create your own solution.

Alongside these activities, we also included:

      1. Concept – What Python concept are you learning?
      2. Reflect – What did you discover, and what did you find challenging?

The idea is simple: don’t just make the code run—understand what you are doing.

Programming Is Like Talking to a Computer

Learning programming is, in many ways, like learning how to communicate or give instructions to a computer.

Computers are very precise. They follow the instructions we provide, but they do not automatically understand what we meant.

This week, you may have already noticed some important characteristics of Python:

      1. Python is case-sensitive.
      2. Spaces and indentation matter.
      3. Small typing differences can change the meaning of a program.
      4. The computer executes the instructions according to the code we provide.

These may seem like small details, but they form the basic “language rules” we need to follow when communicating with a computer.

A First Look at the Command Line

You may also have noticed that we started using CMD / Command Prompt when installing Python libraries.

This is another important skill.

Programming is not only about writing code inside Thonny. As we progress, you will encounter different tools and environments for installing libraries, running programs, and interacting with your development environment.

So, don’t be afraid of the command line! ????

What’s Next?

For next week, we will continue our journey with Step 2 and Step 3 of the game development.

We will gradually introduce more programming concepts while continuing to build our game.

Remember:

Don’t rush to finish the game. Focus on understanding the code as you build it.

Important: Activity 1 Submission

Please make sure you submit Activity 1 through the web platform.

I will be referring to your Activity 1 submission for class attendance, so please make sure it is completed and submitted.

See you in Week 2!

Keep coding, keep debugging, and keep asking: “Why does this code work?”

DRE2213

BTE1522

Welcome on Board BTE1522 and DRE2213

Hi everyone,

A warm welcome to all BTE1522 – Innovation and DRE2213 – Programming and Data Structure students!

This semester, we are bringing a refreshed approach to learning programming. Both courses are designed to build your competencies in Python programming, innovation, and data structures—but instead of learning programming only through examples and exercises, we will be building, experimenting, troubleshooting, and making things work.

 

Phase 1: Learn Python by Building a Snake Game

We will begin with something familiar and fun: a Snake game.

As you build the game step by step, you will encounter and apply Python concepts such as:

      1. Variables and data types
      2. Lists and data structures
      3. Functions
      4. Loops
      5. Conditional statements
      6. Boolean logic
      7. Input and event handling
      8. Mathematical operations
      9. Game states and logic

The game is not simply the end product. The code is the learning environment.

When something does not work, you will troubleshoot it. When the snake behaves unexpectedly, you will investigate why. When you modify the game, you will need to understand what the existing code is doing.

That is where programming starts to make sense.

Phase 2: From Digital to Physical – Meet LilEx

Once we have built our programming foundation, we will move from the digital world into physical computing.

I am excited to introduce LilEx – the sensor node to the class.

Here, you will begin working with real sensors and real data.

You will learn how to:

SENSE → STORE → VISUALISE

You will read data from sensors, process and structure the data, store it in a database, and eventually present it through a dashboard.

This is where Python moves beyond the screen.

Your program will no longer simply move a character on a game window. Your code will interact with the physical world.

And What About AI?

Yes, you could ask AI to generate the Snake game.

You could also ask AI to generate the sensor code, database, and dashboard.

But that is not the main purpose of this semester.

For this phase of your learning, we will intentionally focus on developing the fundamental competencies step by step, without AI assistance during class activities.

Why?

Because I want you to experience the process of thinking through the code.

When you eventually use AI for a larger project, you should be able to look at the generated code and ask:

What does this code actually do?
Why does it work?
Is this the right solution?
How can I modify it?

That is very different from simply copying and running AI-generated code.

Code with AI, not code by AI.

AI can become a powerful learning and development partner—but first, we need to build the foundation that allows us to work with AI intelligently.

So, Welcome Aboard!

This semester will be about more than learning Python syntax.

It will be about building competency through making:

Learn → Build → Break → Troubleshoot → Understand → Improve → Create

From a Snake game to LilEx sensor-based systems, we will gradually move from digital programming to physical computing, data structures, IoT, and dashboards.

I am excited to have both BTE1522 and DRE2213 on board this semester.

Let’s learn, build, experiment—and see where your ideas take us.

Welcome to the class!

Raspberry Pi Programming 2026/8 – SMK Seri Jengka (PPD Maran)

*UMPSA STEM Lab Raspberry Pi Programming Synopsis can be found here.

In the Raspberry Pi IoT session, 34 students and 5 teachers from SMK Seri Jengka, and representatives from PPD Maran were introduced to the concept of the Internet of Things (IoT) using Raspberry Pi on the UMP STEM Cube, a pico-satellite learning kit specifically designed to facilitate engineering learning.

The content covered basic digital input/output operations on onboard LEDs, as well as topics such as dashboard design using gyro meter and BMU280 sensor data, including collecting and storing data in a cloud database. Participants learned to interface sensors with Raspberry Pi boards and develop IoT applications for real-world scenarios. The session provided students with valuable insights into IoT technology and its applications in various domains.

Dr Rosdiyana Samad and Dr Raja Mohd Taufika Raja Ismail delivered their talk on the applications of SBC computer Rasp Pi Programming in Image Processing, and STEM/TVET pathways to the participants.

A special appreciation is extended to Cikgu Hailmey Bin Ikhsan from PPD Maran for organizing and coordination in facilitating communication between the participants and the UMPSA STEM Lab :).

Nurul Sept 21st

 

UMPSA STEM Lab – Raspberry Pi IoT 2026

UMPSA STEM Lab has engineered a comprehensive, self-paced Internet of Things (IoT) curriculum centered around the Raspberry Pi Pico and MicroPython. Designed to transition beginners into capable hardware developers, this 11-activity framework bridges fundamental programming concepts with real-world wireless cloud telemetry and long-range hardware interaction.

Core Pedagogy: Self-Paced Mastery & True Digital Literacy

The UMPSA STEM Lab curriculum operates on two foundational principles: individual pacing and absolute code ownership.

The learning pathway systematically introduces hardware control, bus protocols, analog processing, and wireless telemetry.

 

1. Fundamentals & Digital Outputs

Students begin by interacting with basic General Purpose Input/Output (GPIO) pins.

      1. GPIO Control Defining output pins to control red, yellow, and green LEDs using MicroPython’s machine.Pin library.
      2. Timing & Iteration Implementing time.sleep(), for loops, and while True infinite execution loops to construct traffic light state machines.

 

2. Actuation & Input Logic

Moving beyond static outputs, the curriculum introduces dynamic control and user interaction.

      1. Pulse Width Modulation (PWM) Driving SG90 servo motors at 50 Hz, translating duty cycles (duty_u16) into precise physical horn positions and smooth sweep animations.
      2. Digital Inputs Configuring tactile push buttons and slide switches with internal pull-up resistors (Pin.PULL_UP).
      3. Conditional Logic Utilizing if/else structures to make real-time operational decisions based on pin states.

3. Display Integration & Shared Bus Architecture

As output demands grow beyond simple LEDs, multi-device communication channels are introduced.

      1. I2C Protocol Interfacing 0.96-inch OLED displays using the ssd1306 library over shared SDA (GP2) and SCL (GP3) bus lines.
      2. Sensory Data & Motion Connecting MPU6050 motion sensors on the same I2C bus using custom libraries (imu.py), formatting floating-point readings with round() and abs() to create tilt alert systems.

4. Analog Processing & Sensor Calibration

To measure continuous physical phenomena, students transition from binary digital signals to analog processing.

      1. Analog-to-Digital Conversion (ADC) Reading soil moisture levels using 16-bit resolution (read_u16()) on ADC-capable pins (GP26).
      2. Empirical Calibration Testing probes in dry air and saturated soil to establish customized numerical thresholds, converting raw voltages into accurate 0–100% moisture percentages.

5. Cloud Telemetry & Peer-to-Peer Wireless Protocols

The advanced modules transform standalone microcontrollers into connected IoT endpoints.

      1. Wi-Fi & Cloud Telemetry (Pico W) Connecting to 2.4 GHz Wi-Fi networks and establishing lightweight MQTT messaging with Adafruit IO. Students construct cloud dashboards with interactive toggle blocks to control physical board LEDs globally via sub/pub callbacks (set_callback, check_msg).
      2. Hardware UART & Long-Range Radio Configuring physical radio transceiver modules (Ebyte E70) via UART at 9600 baud. Students set mode pins (M0, M1, M2), reconfigure operating frequencies/channels across 410–441 MHz, and send encoded byte payloads over airwaves without requiring cloud infrastructure.

UMPSA STEM Lab – ESP32 MicroController IoT Programming 2026

The UMPSA STEM Lab 2026 ESP32 MicroController IoT Programming Module delivers a progressive, hands-on learning pathway that transforms beginners into proficient IoT developers using the ESP32 / ESP32-S3 microcontroller and the Wokwi online simulator. Designed around a project-driven curriculum, the module transitions systematically from basic circuit dynamics to cloud-integrated smart systems.

The Learning Journey: From Single Bits to Cloud Integration

Phase 1: Fundamental Electronics & Sensing – LED Output Control (GPIO, Digital High/Low, Delay Timing) | | – Analog Sensing (LDR Photoresistors, 12-bit ADC, Thresholds)

Phase 2: Visual Displays, Proximity & Motion | | – I2C Visual Output (Adafruit SSD1306 OLED Display) | | – Acoustic Ranging (HC-SR04 Ultrasonic Sensor & pulseIn) | | – Human Input & Motion (Potentiometers, Buttons & Servos)

Phase 3: Connected IoT & Cloud Data Systems | | – Cloud Telemetry (Blynk IoT Dashboard & Virtual Pins) | | – Automated Data Logging (Google Sheets via Apps Script) |

Phase 1: Digital Fundamentals and Environmental Sensing

Learners begin by building digital output foundations using the ESP32 DevKit. The lesson introduces GPIO pin initialization, constant declaration (const int), setting output modes with pinMode(), and delivering 3.3V logic signals using digitalWrite(pin, HIGH). Current-limiting 220 Ω resistors ensure component protection.

Building on basic outputs, Activity 2 introduces time-domain control. Students learn to toggle states using digitalWrite(pin, LOW) paired with delay() calls in milliseconds. The core concept highlights how loop() endlessly executes sequence steps to form repeatable hardware timing patterns.

Transitioning from binary outputs to continuous input monitoring, learners connect a 4-pin LDR (Light Dependent Resistor) module to ADC1 pin GPIO34.

      1. 12-bit Resolution Unlike 10-bit Arduino boards (0–1023), the ESP32 processes analog values across a 0–4095 scale.
      2. Serial Communication Data is transmitted back to the host via Serial.begin(115200) and monitored in real time using Serial.println().
      3. Decision Boundaries Activity 4 establishes conditional logic (if / else), using threshold values to trigger automated hardware responses based on ambient light changes.

Phase 2: User Interfaces, Acoustic Distance, and Precision Motion

Moving beyond simple LEDs, learners integrate a 0.96-inch SSD1306 OLED screen.

      1. I2C Protocol Communicates via two dedicated lines—SDA (GPIO21) and SCL (GPIO22)—at I2C address 0x3C.
      2. Graphics Libraries Implements Adafruit_SSD1306 and Wire.h to manage buffer clearing (display.clearDisplay()), cursor positioning (display.setCursor()), and screen updates (display.display()).

Activity 6 introduces the HC-SR04 Ultrasonic Sensor for spatial awareness:

        1. Trigger and Echo High-frequency sonic bursts are initiated via a 10 µs pulse on the TRIG pin (GPIO12) and timed via the ECHO pin (GPIO14) using pulseIn().
        2. Kinematic Conversion Distance in centimeters is calculated using sound velocity:
          • $$\text{Distance (cm)} = \frac{\text{duration} \times 0.034}{2}$$
        3. Proximity Triggers Threshold logic compares measured distances against target limits (< 40 cm or < 100 cm) to activate visual warning indicators.

Activities 7 and 8 unite analog and digital inputs to command physical motion:

      1. Dual Inputs: Combines an analog potentiometer knob (GPIO34) with a digital push button operating in INPUT_PULLUP mode (active LOW logic on GPIO25).
      2. Range Re-mapping: Uses map(potValue, 0, 4095, 0, 180) to translate 12-bit raw readings into servo rotation angles.
      3. Commanded Actuation: Incorporates the ESP32Servo library (servo.write(angle)) to trigger precise motor positioning upon button press events.

Phase 3: Cloud Telemetry, IoT Dashboards, and Data Logging

Activity 9 elevates physical projects to connected Internet of Things (IoT) applications. Leveraging Wokwi’s simulated Wi-Fi (Wokwi-GUEST), sensor data is streamed off-site:

      1. Blynk IoT Setup Configures Cloud Templates, Virtual Pins, and authentication tokens to display live readings on interactive web and mobile dashboards.
      2. Google Apps Script Bridge An HTTPS doGet(e) web app script intercepts incoming URL parameters and appends time-stamped entries to a live Google Sheet spreadsheet:
        function doGet(e) {
          var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Sheet1");
          if (!e || !e.parameter.distance) return ContentService.createTextOutput("No distance received");
          var distance = parseFloat(e.parameter.distance);
          sheet.appendRow([new Date(), distance]);
          return ContentService.createTextOutput("OK");
        }

The final module activity completes the IoT feedback loop by demonstrating bi-directional communication. Instead of just sending data to the cloud, learners use Blynk Dashboard widgets to transmit control signals back to the ESP32 hardware, toggling actuators and indicators over the internet from anywhere in the world.

Core Competencies Developed

Curriculum Area Concepts & Key Technologies
Microcontroller Basics ESP32/ESP32-S3 pinouts, GPIO modes, internal pull-up resistors (INPUT_PULLUP)
Signal Types Binary digital I/O, 12-bit Analog-to-Digital Conversion (ADC, 0–4095)
Communication Standards Serial UART (115200 baud), I2C protocol (SDA/SCL)

Sensors & Actuators LDR Photoresistors, HC-SR04 Ultrasonic Sonar, Potentiometers, Servo Motors, SSD1306 OLEDs
Cloud & IoT Technologies Wi-Fi simulation (Wokwi-GUEST), Blynk Cloud Dashboards, Google Apps Script REST APIs

UMPSA STEM Lab – Edge Intelligence (Image Processing) on ESP32 2026

Deploying artificial intelligence directly on compact microcontrollers—often termed Edge Intelligence—represents a major leap in embedded engineering. This UMPSA STEM Lab module provides a hands-on roadmap for transitioning from basic software-based computer vision to standalone, hardware-integrated AI models capable of performing real-time image processing, feature extraction, and object classification on low-power ESP microcontroller hardware.

The Shift to Edge Intelligence

Traditional computer vision solutions rely on cloud servers or heavy laptop GPUs to process video streams. Edge Intelligence moves processing power directly to the physical sensor level. In this module, participants move beyond pre-packaged datasets to create, train, and deploy bespoke computer vision pipelines designed specifically for embedded micro-processors.

Image Processing & Data Engineering Discipline

A fundamental lesson of embedded machine learning is that an AI model is only as effective as the data used to train it.

Figure 1: The compact ESP32 camera board featuring an integrated 2 megapixel camera sensor and Wi-Fi capability.

The Thumbnail Test & Image Resolution

      1. Pixel Reduction Raw images captured by the sensor are downscaled to 96 x 96 pixel grayscale or RGB arrays.
      2. Visual Clarity Before training, images are evaluated via the “thumbnail test” to ensure visual features remain recognizable when shrunk to stamp-sized dimensions.

Essential Rules for Dataset Quality

        1. Single Variable Changes Change only one condition (angle, lighting, position) between consecutive photo captures to maximize information density.
        2. Background Separation Avoid shooting all target objects on identical surfaces. Otherwise, the model learns background cues rather than object features.
        3. Consistent Label Formatting Labels must follow strict naming rules (lower case, no spaces, e.g., red_chili) to prevent duplicate target classes.

3. Feature Extraction & Impulse Pipeline Design

Once images are collected and labeled, raw pixel values are mapped into numerical feature vectors inside Edge Impulse.

Figure 2: The four-block impulse design connecting input image data to digital signal processing (DSP) and neural network classifiers.

      1. Raw Image Preprocessing Images are normalized and structured into uniform dimensions.
      2. DSP Feature Generation Spatial characteristics (edges, textures, color distributions) are extracted, generating distinct visual clusters in 3D feature space.
      3. Classifier Training Neural networks process the extracted features to assign probabilities across classes.
      4. Inference Speed Real-time classification executes in approximately 1 ms per frame, enabling fluid live monitoring.

4. Bounding Boxes, Confidence Thresholds, and the “Nothing” Class

A key challenge in real-world vision deployment is handling unexpected inputs—a scenario highlighted by the “chili problem“.

Challenge Cause Embedded Solution
False Positives The model forces unseen objects into known classes. Add an explicit background or “nothing” class.
Fluctuating Predictions Minor shifts in lighting or tilt alter confidence scores. Apply confidence thresholds (e.g., ignore results below 0.80).
Spatial Localization Image classification lacks coordinate location. Implement bounding box object detection for region tracking.

5. Microcontroller Integration on ESP32 Hardware

The culmination of the module is flashing the trained impulse directly onto an ESP microcontroller processor.

Figure 3: Real-time classification outputs streamed over the Arduino Serial Monitor at 115200 baud.

Hardware Deployment Steps

      1. Firmware Setup Configure the Arduino IDE with necessary ESP32 board definitions and upload the custom collection sketch (ESP32_datacollection.ino).
      2. Port Selection & Cabling Ensure high-speed data cables are used, as charge-only cables will fail to establish COM communication.
      3. Network Configurations Connect via self-generated Wi-Fi access points (Route A) or local network infrastructure (Routes B/C).
      4. Serial Verification Initialize the Serial Monitor at 115200 baud and press the hardware reset (RST) button to verify initialization and monitor live inference logs.

6. Key Takeaways

Through this module, participants develop end-to-end expertise in embedded machine learning:

    1. Moving from cloud-dependent AI to standalone micro-processor execution.
    2. Mastering raw image preprocessing, feature extraction, and dataset hygiene.
    3. Deploying real-time computer vision models on low-cost hardware platforms.

The Culture That Stayed :)

There is a photograph that I showed in today’s meeting — and before I get to the meeting, I need to tell you about the photograph.

It was taken in Edinburgh in 2013. My daughter was small. We had stopped at a booth during the Edinburgh Science Festival — in a botanical garden, in the city centre, somewhere I can no longer precisely remember. She is there the way children are at things like this: wide open to the world, pointing at something she has just discovered.

We had no idea, standing there, that she would go into medicine. None of us are in the medical field. But today, thirteen years later, she is in her first year of dentistry.

I am not claiming that Edinburgh Science Festival pointed her toward a career. I am claiming something smaller and more important: that when you show a child that science is something that happens in public — in streets and gardens and borrowed halls, not only in labs — you plant a seed whose shape you cannot predict.

That is what Edinburgh gave me. Not just the PhD. Not just the signal processing and the RF engineering I still use every day. It gave me a philosophy. The Royal Observatory on Blackford Hill, open to the public for a hundred and thirty years. The Science Festival filling the city every April. The unspoken conviction that science belongs to the people around it — not only to the people who do it.

The Meeting

Had a short meeting with Professor Eric C. Schirmer – Director of Internationalisation, School of Biological Science,  Professor Colin Snodgrass, Director of Internationalisation at the School of Physics and Astronomy, and Ms Audrey Kon from Edinburgh Global.

Edinburgh has been in my life for a long time. I did my postgraduate studies there, under Professor Tughrul Arslan and Dr Brian Flynn. I used to walk past the Royal Observatory on Blackford Hill on my way to somewhere else, and stop.

The UMPSA STEM Lab started in 2016 with a simple idea: that the skills we teach in an electrical engineering faculty are the same skills that put hardware in orbit. Twelve thousand students and teachers across Pahang later, that idea has held.

Radio foxhunting was one of the earliest building blocks — students going into the field with a handheld receiver kit we designed ourselves, the LilEx, hunting hidden transmitters. Antenna theory. Signal propagation. Direction-finding. The same physics that underpins every radio telescope on Earth. There are now 126 of these kits deployed in schools. No lab required. You take it outside.

What makes this more than a collection of activities is the thread connecting them — from Software-Defined Radio, to FPGA design, all the way to our current work with MYSA, the Malaysian Space Agency, on a reconfigurable backplane for a CubeSat. Four universities are collaborating on one satellite and UMPSA on the reconfigurable backplane. Our design is FPGA-based and reconfigurable — adaptable to changing payloads.

An Asteroid was named after Professor Snodgrass 

The Signature Red

Audrey brought a gift — something in that particular shade of scarlet that the University of Edinburgh puts on everything. If you went to Edinburgh, you know the red. It is not just a brand colour. It is almost a landmark =) .

The culture of explaining science has always resonated with me. There’s something powerful about turning complexity into understanding and making knowledge accessible to everyone.

That is exactly it. That is the thing Edinburgh gave me, and the thing I have been trying to give back ever since.

A child at a science festival booth in 2013, who has no idea she will one day study dentistry, is not learning biology or chemistry in that moment. She is learning that science happens near her. That it is for her. That the world contains more than she knew, and that the people who find out more are ordinary people doing an ordinary thing.

Fourteen years later, that is still the blueprint for the UMPSA STEM Lab. Every kit in a student’s hands. Every foxhunting session on a field in Pahang. Every time a school student looks at a handheld receiver and discovers that the invisible world has a shape you can trace.

Not because Edinburgh told me to. Because Edinburgh showed me it was possible. <3

mBlock Programming 2026/3 – SK Pekan Jaya

A synopsis of the program can be retrieved via the following link.

In today’s program, 35 participants from SK Pekan Jaya Pekan were introduced to mBlock programming, learning to use its graphical interface to create sequences of instructions. They explored sequential programming, conditional statements, and loops through hands-on tutorials. These foundational skills were applied in two projects: a Snake game and a Pac-Man game. In the Snake game, they programmed the snake’s movement, growth, and collision detection, while in the Pac-Man game, they navigated a maze, collected points, and avoided ghosts. This approach provided a comprehensive understanding of programming concepts and their practical applications.

Appreciation to Cikgu Nor Mazua for coordinating the communication between the participants and UMPSA STEM Lab.

mBlock Programming 2026/2 – SK Temai

A synopsis of the program can be retrieved via the following link.

In today’s program, 36 participants from SK Temai Pekan were introduced to mBlock programming, learning to use its graphical interface to create sequences of instructions. They explored sequential programming, conditional statements, and loops through hands-on tutorials. These foundational skills were applied in two projects: a Snake game and a Pac-Man game. In the Snake game, they programmed the snake’s movement, growth, and collision detection, while in the Pac-Man game, they navigated a maze, collected points, and avoided ghosts. This approach provided a comprehensive understanding of programming concepts and their practical applications.

Appreciation to Cikgu Izwan for coordinating the communication between the participants and UMPSA STEM Lab.