Zachary Sng's Coding Projects

Hi, I'm Zachary and I am 12 years old this year. I started learning robotics with the Lego Mindstorms together with block-based coding when I was in Primary 4. I enjoy working on different structures and robots, designing and building them to automate routine daily tasks in my life Beyond honing my python fundamentals, I wanted to create games that was beneficial to students. I leant how to use Pygame and created different games that my friends could compete and challenge one another. I have documented my journey in robotics, coding, Innovation and STEM.

Portrait of Zachary Sng

Project 1: Ping Pong Racket

Ping Pong Racket

I learned how to use LEGO Technic parts to design and build various mechanical structures. By applying coding concepts such as conditionals (if-else) and incorporating different sensors, I programmed my designs to perform specific actions based on real-time input. For example, I created a ping pong racket mechanism that swings to hit the ball when the touch sensor is activated—demonstrating how sensor-triggered automation is used in real-world systems that respond to user input.

Project 1: Ping Pong Racket
Project 2: Distance sensor Coin dispenser
Project 2: Distance sensor Coin dispenser

Distance sensor Coin dispenser

Inspired by arcade coin dispensers, I applied the design principles and coding skills I learned to build a distance-activated coin dispenser. The dispenser uses two ultrasonic sensors that detect my hand in a specific sequence within a defined distance threshold. When both sensors are triggered in order, the mechanism opens to release coins. This project demonstrates how sensor integration and conditional logic can create automated systems, similar to those used in vending machines .

Project 3: Ultrasonic Activated Automated car

Ultrasonic Activated Automated car

I decided to create an automated car using LEGO Technic parts that can return to its original parking position after detecting an obstacle. This project simulates the logic behind autonomous parking systems found in modern vehicles. Using the concept of nested while loops with variables, I programmed the car to activate and begin moving when the touch sensor is activated. While in motion, the car continuously checks for obstacles using the ultrasonic sensor. Once an obstacle is detected, the car automatically stops and reverses back to its starting point—mimicking a vehicle returning to its parking spot.

Project 3: Ultrasonic Activated Automated car
Project 4: Colour & Ultrasonic Activated Spinning Top
Project 4: Colour & Ultrasonic Activated Spinning Top

Ultrasonic Activated Automated car

Playing the top is my childhood game and I decided to recreate a sensor-controlled spinning top using LEGO technic parts and coded it to move when it is activated by a colour sensor. I could control the direction it spins using an ultrasonic sensor when it detects someone within different range. If the ultrasonic sensor detects someone near it, it will spin clockwise, else, it spins anti-clockwise. This setup mirrors real-life smart devices that respond to environmental cues. The system responds intuitively to human presence, creating an interactive and dynamic user experience.

Simple Division (simple_division.py)

Description:

This project shows how to calculate the remainder when one number is divided by another. It’s a great way to practice using arithmetic and the modulo operator (%).

Diagram:

simple_division.png

Trinket:

Even/Odd Checker (even_odd_checker.py)

Description:

In this project, I designed a program that checks if a number is even or odd using if-else statements. This project teaches me how to make decisions in code based on conditions.

Diagram:

Diagram for Even/Odd Checker

Trinket:

Prime Number Guesser Game (prime_number_game.py)

Description:

This game challenges you to decide if a number is prime by using if-else statements. It’s a fun way to reinforce the concept of prime numbers and divisibility in code.

Diagram:

prime_number_game.png

Trinket:

Calculator Factory Production Tracker (factory_tracker.py)

Description:

In this project, I tracked the production rate of a calculator factory that follows an arithmetic progression. I calculated the number of calculators produced on day 30 and the total after 30 days. This shows how loops can handle repeated calculations for real-world scenarios.

Diagram:

factory_tracker.png

Trinket:

Count Vowels and Consonants in a String (count_vowels_consonants.py)

Description:

In this project, I used a for loop to count the number of vowels and consonants in a given string. The loop iterates through each character in the string, checking if it is a vowel or consonant, and updates the counts accordingly.

Diagram:

Diagram for Count Vowels and Consonants

Trinket:

Number Pyramid (number_pyramid.py)

Description:

In this project, I created a number pyramid using nested for loops. The outer loop controls the number of rows, while the inner loop prints the numbers in each row. This project demonstrates how to use loops to create patterns and shapes in Python.

Diagram:

Diagram for Number Pyramid

Trinket:

Sum of My Even Numbers (sum_of_my_even_numbers.py)

Description:

I have created a Python script named sum_of_my_even_numbers.py. It prompts me for a positive integer, and using a while loop, it calculates and displays the sum of all even numbers from 2 to the entered integer.

Diagram:

Diagram for sum of even numbers

Trinket:

Countdown Timer (my_countdown_timer.py)

Description:

In this project, I built a countdown timer that uses a while loop to count down from a starting number until it reaches 1. This is important because it shows me how to repeat an action until a condition is met.

Diagram:

Diagram for Countdown Timer

Trinket:

No other achievements listed yet.