Source: https://mokxi.com/learn/path/build-moon-phase-lamp
Updated: 2026-11-20

All paths

# Build a moon phase lamp

Learn why the Moon has phases, work them out from any date, and build a lamp that shows tonight's Moon in the dark.

Arduino Uno R3 Free 6 lessons 5 h 3 chapters 1,480 XP Maker · Beginner +100 XP

0 of 6 done

Start the course free The lunar cycle Build it as a kit Retails for about $33, free on Mokxi. Lesson plan for teachers

What you will build

## 2 projects, built step by step

6 lessons in 3 chapters, about 5 hours on a simulated Arduino Uno R3. Free, in your browser, every step checked by the simulator.

Chapter 1 project

### Phase from a date

Work out the Moon on any date from one known new moon and the length of the month: day counting, a remainder, and a trap in C.
Open it in the simulator

Chapter 2 project

### Glow at night

Read a light cell in a divider, switch at night with two thresholds so it never flickers at dusk, and ignore passing headlights.
Open it in the simulator

The map

## Chapter by chapter

Each lesson opens when the one before it is done, and each chapter ends in a project.

Chapter 1

## The Moon in the sky

Why the Moon has phases, and the sum that finds them.

Open 190 XP

### The lunar cycle

Watch a whole synodic month in fifteen seconds on 64 LEDs, learn why the Moon has phases, and stop the clock on any day you like.

0 of 6 steps

Start What is in it

Project Locked 380 XP

### Phase from a date

Work out the Moon on any date from one known new moon and the length of the month: day counting, a remainder, and a trap in C.

0 of 6 steps

5 questions, graded as you go.

Chapter 2

## Light, time and dark

Draw the Moon on LEDs, keep the date and see the night.

Locked 190 XP

### LEDs as a moon

Draw any phase on an 8x8 WS2812B panel: a disc of 52 LEDs, the shadow edge from one cosine per row, and panels that zigzag.

0 of 6 steps

Locked 190 XP

### RTC time

Read a DS3231 register by register: binary coded decimal, the oscillator stop flag, setting the time and a leap day, then the Moon from the clock.

0 of 6 steps

Project Locked 330 XP

### Glow at night

Read a light cell in a divider, switch at night with two thresholds so it never flickers at dusk, and ignore passing headlights.

0 of 5 steps

4 questions, graded as you go.

Chapter 3

## Tonight's moon

Put it all together into a lamp worth sharing.

Locked 200 XP

### Project: tonight's moon

Put it all together: tonight's Moon from the clock, glowing in the dark, with the next full moon, a month-long time-lapse and a southern sky.

0 of 7 steps

3 questions, graded as you go.

Syllabus

## Every lesson in the course

All 6 lessons, in order, each with what it covers. Any of them opens in the editor right away.

Chapter 1

### The Moon in the sky

- The lunar cycle Watch a whole synodic month in fifteen seconds on 64 LEDs, learn why the Moon has phases, and stop the clock on any day you like.
- Phase from a date Work out the Moon on any date from one known new moon and the length of the month: day counting, a remainder, and a trap in C.

Chapter 2

### Light, time and dark

- LEDs as a moon Draw any phase on an 8x8 WS2812B panel: a disc of 52 LEDs, the shadow edge from one cosine per row, and panels that zigzag.
- RTC time Read a DS3231 register by register: binary coded decimal, the oscillator stop flag, setting the time and a leap day, then the Moon from the clock.
- Glow at night Read a light cell in a divider, switch at night with two thresholds so it never flickers at dusk, and ignore passing headlights.

Chapter 3

### Tonight's moon

- Project: tonight's moon Put it all together: tonight's Moon from the clock, glowing in the dark, with the next full moon, a month-long time-lapse and a southern sky.

Keep going

## The next course on your track

Build a moon phase lamp is part of the maker track, a ladder of courses from zero to expert.

Next course

### Build a music visualizer

Turn sound into light: levels, a fixed-point FFT into octave bands, beat detection, LED matrix bars, color themes and a party wall.
Open the next course

Track

### Maker track

Follow the starter kit you already own, then build a claw machine, a balance bot, a handheld console or an LED cube, each a short course checked by the simulator.
See every course on the track

Kits

## Build it on your bench too

Every lesson runs in the simulator with nothing to buy. When you want the real thing, these kits have the parts.

The kit for this course

### Moon Phase Lamp Kit

An Uno, a real-time clock (DS3231), addressable RGB LEDs and a light sensor: a lamp that shows tonight's Moon.
Open the kit

Have a kit already?

### Find your kit

Pick the starter kit you own and run every lesson in its manual with the same parts on the same pins.
See every kit

Questions

## About Build a moon phase lamp

Is Build a moon phase lamp free?

Yes. All 6 lessons of Build a moon phase lamp are free and run in your browser, with nothing to install and no parts to buy before you start.

Do I need a real Arduino Uno R3?

No. Every lesson runs on a simulated Arduino Uno R3 with its parts on the canvas, and the simulator checks each step as you go. When you want to build it for real, the same wiring and code work on a real board.

How long does Build a moon phase lamp take?

About 5 hours: 6 lessons in 3 chapters, each one a few short steps. Your progress is kept, so you can stop after any lesson and pick up where you left off.

What will I build?

Each chapter ends in a project that puts it together: Phase from a date and Glow at night.

Where do I start?

With "The lunar cycle", and each lesson builds on the one before it. New to circuits? Electronics basics is the course that starts from zero.
