Skip to main content

Case 8: Oil Pump


Introduction

Press button A on the micro:bit V2 board, and the 360° building-block servo rotates at full speed (100), simulating a beam pumping unit (nodding donkey oil pump) in continuous operation extracting oil. Press button B, and the servo stops rotating, simulating pump shutdown.


Learning Objectives

  1. Learn about the servo module.
  2. Learn about the button A and button B blocks in MakeCode — triggering different servo actions via different button presses.
  3. Understand what petroleum is.

Required Materials

ItemImageQuantity
micro:bit V21
Jacdac Expansion Board1
Jacdac 25cm Connector Cable1
Jacdac Servo Module1
360° Building-Block Servo1
USB Cable1

Assembly Steps


Model Principle

Servo Module (360° Continuous Rotation Servo)

Servo Module

The servo module (360° continuous rotation servo) is a motor module that can rotate continuously through 360°. Its rotation speed and direction are adjusted via control signals, rather than being fixed at a specific angle like a standard servo. It is commonly used for driving robot wheels, conveyor belts, and simulating reciprocating mechanical motion.

Beam Pumping Unit (Nodding Donkey)

The beam pumping unit (walking beam pump) is one of the primary oil extraction devices in oilfields. Driven by an electric motor, it causes the walking beam to oscillate up and down, which in turn drives the sucker rod to pump underground oil to the surface. Its appearance and motion resemble a "nodding" or "kowtowing" action, hence the nickname "nodding donkey."

Fun Fact: Petroleum is a fossil fuel buried deep underground, formed from the remains of ancient organisms over millions of years of geological processes. It is known as the "blood of industry" and serves as a key raw material for gasoline, diesel, plastics, synthetic fibers, and many other products.


Sensor Principle

This case does not use an external sensor module; control is achieved entirely through the built-in button A and button B of the micro:bit V2 board.


Connection Diagram

As shown below, insert the micro:bit V2 board into the Jacdac expansion board, and connect the servo module to the Jacdac expansion board's edge connector.

Connection Diagram


Programming Software

Microsoft MakeCode


MakeCode Programming

Step 1: Adding the Jacdac Extension

  1. Go to Microsoft MakeCode and click "New Project".

    New Project

  2. Enter a project name in the pop-up window and click "Create".

    Create Project

  3. Click "Extensions" in the code drawer.

    Extensions

  4. In the pop-up interface, type "Jacdac" and click the search icon, then select the Jacdac software library as shown.

    Search Jacdac


Step 2: Connecting the Hardware

  1. Use a USB cable to connect the micro:bit V2 board to the computer.

    Note: If this is the first time running a Jacdac program on the micro:bit V2, please pre-load a blank Jacdac program onto the board first. Otherwise, skip this step.

    Connect micro:bit

  2. Connect the sensor. MakeCode will automatically detect and simulate it in the simulator area, where sensor status is displayed in real time.

    Sensor Simulation

  3. Click "ADD BLOCKS" to add the sensor extension module.

    Note: When connecting a new sensor, repeat the "click 'ADD BLOCKS'" workflow once.

    ADD BLOCKS


Write the Program as Shown

Program Screenshot


https://makecode.microbit.org/_eA4Pg13sPaj0

You can also download the program directly from the webpage below. Once downloaded, you can start running the program.


Result

Press button A on the micro:bit V2 board, and the 360° building-block servo rotates at full speed, driving the walking beam to oscillate up and down, simulating a beam pumping unit continuously extracting oil. Press button B, and the servo stops rotating, simulating pump shutdown.


Think

  1. What other scenarios in daily life can a servo be applied to?
  2. Besides the beam pumping unit, what other oil extraction equipment do you know of?

Program Logic

Trigger ConditionActionSource
Button A pressed360° building-block servo rotates continuously at full speed (100) in a single direction, simulating oil pump operationmicro:bit Button A
Button B pressed360° building-block servo stops rotating, simulating pump shutdownmicro:bit Button B

Knowledge Extension: Petroleum and Our Future

I. Petroleum — The "Blood" of Modern Civilization

Petroleum is not just a source of gasoline and diesel — it permeates every corner of modern life:

Petroleum ProductEveryday Uses
Gasoline, diesel, jet fuelFuel for cars, trucks, airplanes, ships
Plastics (polyethylene, polypropylene, etc.)Phone cases, stationery, toys, packaging, water pipes
Synthetic fibers (polyester, acrylic, nylon)Clothing, backpacks, sneakers, carpets
Fertilizers, pesticidesAgricultural production, ensuring food supply
AsphaltRoad and airport runway paving
Synthetic rubberTires, seals, shoe soles
Pharmaceuticals, cosmeticsAspirin, petroleum jelly, lipstick, shampoo

The Numbers: In 2024, the world consumed approximately 103 million barrels of oil per day, totaling about 37.4 billion barrels for the year. Since 1900, humanity has extracted approximately 1.57 trillion barrels of oil. Petroleum accounts for 32% of global fossil fuel carbon emissions, second only to coal (41%).


II. The Real Challenges We Face

⚠️ Challenge 1: Finite Resources

Key Data PointValue
Global proven oil reserves~1.73 trillion barrels
Years of extraction remaining at current rate~47 years

This means: at current consumption rates, proven oil reserves will only last until around 2070. While technological advances continue to discover new oil fields, exploration is becoming increasingly difficult and costly.

⚠️ Challenge 2: Climate and Environmental Crisis

  • 2024 global fossil fuel carbon emissions reached a record 37.4 billion tons, up 0.8% year-on-year.
  • Oil spills from extraction (e.g., offshore platform blowouts) cause devastating damage to marine ecosystems.
  • Plastic pollution is staggering: approximately 8 million tons of plastic enter the ocean each year — equivalent to dumping one truckload of plastic waste into the sea every minute.
  • Wastewater and exhaust emissions from petrochemical production threaten water sources and air quality.

⚠️ Challenge 3: Geopolitics and Energy Security

Oil resources are extremely unevenly distributed, with the Middle East (Saudi Arabia, Iraq, Kuwait, etc.) holding nearly half of the world's proven reserves. When conflict or political instability erupts in oil-producing regions, global oil prices fluctuate violently, directly affecting every country's economic development and every person's cost of living.


III. A Glimmer of Hope — The Energy Transition Underway

Facing these challenges, the world is rapidly embracing clean energy. The good news: change is already happening.

☀️ Solar Power: The Fastest-Growing Energy Source

YearGlobal New Solar InstallationsCumulative Capacity
2024582 GW2.25 TW
2025647 GW~2.9 TW
  • 2024 global solar electricity generation reached 2,132 TWh, 6.9% of global electricity.
  • Solar module prices plunged ~45% in the past year to just ~$0.10 per watt.
  • 99 countries have doubled their solar capacity in the past five years; 23 countries now get over 10% of their electricity from solar (Hungary leads globally at 25%).

💨 Wind Power: A Strong Comeback

  • 2025 global new wind installations: 167 GW, up 47% year-on-year; cumulative ~1,300 GW.
  • 2024 global wind electricity generation: 2,494 TWh, 8.1% of global electricity.
  • Wind + solar combined directly contributed ~15% of global electricity in 2024 (~31.9% if all renewables including hydro are counted).

🚗 Electric Vehicles: Rewriting Oil Demand

  • Mass adoption of new energy vehicles is reducing transportation's dependence on oil at the source.
  • 2024 global EV sales (including plug-in hybrids) exceeded 17 million units, up ~25% year-on-year. The electrification wave is accelerating globally.

IV. What We Can Do

Facing the dual challenges of oil depletion and environmental crisis, everyone can contribute:

DirectionConcrete Actions
Save energyTurn off lights when leaving, set AC reasonably (≥26°C in summer), choose public transport, cycling, or walking
Reduce plastic useBring your own water bottle and shopping bags, refuse single-use plastics, practice proper waste sorting
Support clean energyLearn about solar, wind, hydrogen, and other clean energy; share environmental awareness with those around you
Cultivate scientific interestStudy science seriously and consider future careers in energy technology, environmental protection, and innovation
Practice low-carbon livingSave paper, finish your food, recycle — every small habit reduces your carbon footprint