Solar noon finder
Two light sensors stand either side of a short stick, and the shadow of the stick covers them equally at the moment the sun is highest. A Nano with a clock logs that moment each day and compares it with your clock. You see why noon on the clock and noon in the sky differ.
Build it step by step
0 of 7 doneSet the clock
Run RTClib's DS3231 example once.
Fix the sensors
Either side of the stick on a flat board, along an east to west line.
Wire the dividers
East to A0 and west to A1, each with a 10 kilohm resistor to GND.
Wire the clock and the screen
Both to A4 and A5.
Press the button in even light
With the stick removed, to calibrate.
Put the board in the sun
Level, with the stick upright.
Check the screen at noon
It shows the solar noon time and the gap to 12:00.
How do you build a solar noon finder?
Two light sensors stand either side of a short stick, and the shadow of the stick covers them equally at the moment the sun is highest. A Nano with a clock logs that moment each day and compares it with your clock. You see why noon on the clock and noon in the sky differ. You need Arduino Nano, LDR Photoresistor × 2, Resistor 10 kΩ × 2, DS3231 RTC module, SSD1306 OLED Display, Tactile push button 6 mm, Breadboard 830 Tie Points and Jumper wires male to male (40 pcs, 20 cm). It takes 7 steps and about 90 minutes.
- Level
- Beginner
- Time
- About 90 min
- Parts
- 8
Parts list
- Development BoardsBuyArduino Nano × 1
- SensorsBuy
- PassivesBuyResistor 10 kΩ × 2
- SensorsBuy
- DisplaysBuy
- SwitchesBuy
- PrototypingBuy
- PrototypingBuy
Tick what you already own. It saves to My Garage, so “Build with what I have” knows.
Wiring
| From | To | Why |
|---|---|---|
| East light sensor leg 1 | Nano 5V | Top of the east divider |
| East light sensor leg 2 | Nano A0 and a 10 kilohm resistor to GND | East light level |
| West light sensor leg 1 | Nano 5V | Top of the west divider |
| West light sensor leg 2 | Nano A1 and a 10 kilohm resistor to GND | West light level |
| RTC SDA and SCL | Nano A4 and A5 | I2C data and clock |
| OLED SDA and SCL | Nano A4 and A5 | Shares the same I2C wires |
| RTC and OLED VCC and GND | Nano 5V and GND | Power |
| Calibrate button | Nano D2 and GND | Press once in even light, with the stick removed |
Code
Stand a short stick upright between two light sensors laid along an east to west line, close to the stick, so its shadow sweeps across them. In the morning the sun is in the east, the shadow points west and the west sensor is darker; in the afternoon it is the other way round. At solar noon the shadow points straight north and both sensors are lit equally, so the difference between them passes through zero. The sketch smooths the difference, notes the last time the east sensor was brighter and the first time the west sensor is brighter, and records the middle of those two times as solar noon. Then it shows how far that is from 12:00 on your clock. Press the button once, in even light with the stick removed, so the sketch learns any difference between the two sensors. It ignores readings when it is dark. This is for places in the northern hemisphere where the midday sun is in the south, so reverse the east and west if you live where the sun passes to the north. Solar noon differs from 12:00 because of your longitude within the time zone and because the sun's speed through the year changes a little (the equation of time). Install "RTClib", "Adafruit SSD1306" and "Adafruit GFX" from the Library Manager. Set the clock once with RTClib's example. Keep the electronics under cover and only the sensors in the sun. Note the result for several days and see how it drifts.
Runs on a virtual Arduino Nano in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).
// Libraries: RTClib, Adafruit SSD1306 and Adafruit GFX.
#include <Wire.h>
#include <RTClib.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
RTC_DS3231 rtc;
Adafruit_SSD1306 oled(128, 64, &Wire, -1);
const uint8_t EAST = A0;
const uint8_t WEST = A1;
const uint8_t BTN = 2;
const int LIMIT = 15; // the sensors must differ by this much to count
const int DAYLIGHT = 250; // ignore readings when it is dark
float diffEma = 0;
float offset = 0;
int lastSign = 0;
uint32_t lastPositive = 0; // last time the east sensor was brighter
uint8_t doneDay = 0;
uint32_t noonTime = 0;
unsigned long lastRead = 0;
void showTime(uint32_t t) {
DateTime d(t);
if (d.hour() < 10) oled.print('0');
oled.print(d.hour()); oled.print(':');
if (d.minute() < 10) oled.print('0');
oled.print(d.minute()); oled.print(':');
if (d.second() < 10) oled.print('0');
oled.print(d.second());
}
void draw(int e, int w) {
DateTime now = rtc.now();
oled.clearDisplay();
oled.setTextColor(SSD1306_WHITE);
oled.setTextSize(1);
oled.setCursor(0, 0);
oled.print(F("Clock "));
showTime(now.unixtime());
oled.setCursor(0, 14);
oled.print(F("East ")); oled.print(e); oled.print(F(" West ")); oled.print(w);
oled.setCursor(0, 28);
oled.print(F("Solar noon:"));
oled.setCursor(0, 40);
if (noonTime == 0) oled.print(F("waiting..."));
else {
showTime(noonTime);
long mins = ((long)noonTime - (long)(DateTime(now.year(), now.month(), now.day(), 12, 0, 0).unixtime())) / 60;
oled.setCursor(0, 52);
oled.print(mins >= 0 ? F("+") : F(""));
oled.print(mins);
oled.print(F(" min from 12:00"));
}
oled.display();
}
void setup() {
pinMode(BTN, INPUT_PULLUP);
Serial.begin(9600);
if (!rtc.begin()) Serial.println(F("RTC not found"));
oled.begin(SSD1306_SWITCHCAPVCC, 0x3C);
}
void loop() {
unsigned long ms = millis();
if (digitalRead(BTN) == LOW) { // calibrate: both sensors in the same light
long sum = 0;
for (uint8_t i = 0; i < 20; i++) { sum += analogRead(EAST) - analogRead(WEST); delay(20); }
offset = sum / 20.0;
diffEma = 0;
Serial.print(F("Offset set to ")); Serial.println(offset);
delay(500);
}
if (ms - lastRead >= 5000) { // read every five seconds
lastRead = ms;
int e = analogRead(EAST), w = analogRead(WEST);
DateTime now = rtc.now();
if (now.day() != doneDay && now.hour() < 6) { noonTime = 0; lastSign = 0; } // new day
diffEma = diffEma * 0.6 + ((e - w) - offset) * 0.4;
if ((e + w) / 2 > DAYLIGHT) {
int sign = (diffEma > LIMIT) ? 1 : (diffEma < -LIMIT) ? -1 : 0;
if (sign == 1) { lastSign = 1; lastPositive = now.unixtime(); }
if (sign == -1 && lastSign == 1 && noonTime == 0) {
noonTime = (lastPositive + now.unixtime()) / 2; // halfway between the last east-bright and first west-bright
doneDay = now.day();
Serial.print(F("Solar noon at ")); Serial.println(noonTime);
}
}
draw(e, w);
}
}What the serial monitor should show
Open the serial monitor at the baud rate in the code. This is what our simulator prints for a virtual Arduino Nano with its sensors at their default values. Your numbers will follow your real readings, but the format should match.
RTC not found
Test checklist
What you should see at each check. If a reading is far off, stop and use the troubleshooting list.
| Check | Expected |
|---|---|
| Morning | West sensor darker than east |
| Afternoon | East sensor darker than west |
| Around noon | Readings cross over |
| Screen | Shows solar noon and minutes from 12:00 |
| Several days | Result drifts slowly |
If it does not work
Never finds noon
Check both sensors are in sun and the stick's shadow touches them.
Readings jump
Shield the sensors from passing shade.
RTC not found message
Check the I2C wires.
Blank screen
Check the OLED wires and try address 0x3D.
Result is off
Re-do the calibration and check east and west.
Still stuck? Find the fault step by step with your multimeter →
Common questions
What parts do I need for the solar noon finder?
Arduino Nano, LDR Photoresistor × 2, Resistor 10 kΩ × 2, DS3231 RTC module, SSD1306 OLED Display, Tactile push button 6 mm, Breadboard 830 Tie Points and Jumper wires male to male (40 pcs, 20 cm).
How long does the solar noon finder take to build?
About 90 minutes for a beginner maker, in 7 steps.
How do I know the solar noon finder works?
Morning: West sensor darker than east. Afternoon: East sensor darker than west. Around noon: Readings cross over.
Never finds noon: what should I check?
Check both sensors are in sun and the stick's shadow touches them.
Readings jump: what should I check?
Shield the sensors from passing shade.
RTC not found message: what should I check?
Check the I2C wires.
Blank screen: what should I check?
Check the OLED wires and try address 0x3D.
