Raspberry Pi Pico weather display (MicroPython)
Your first MicroPython project: temperature and humidity on an OLED.
Shop by category
Shop all componentsThe Sensor Shield V5 sits on an Uno and turns every pin into a 3-pin S-V-G header, so sensors and servos plug straight in with their own cables. An LDR light sensor module plugs into A0 and a servo into D9. The Uno maps the light level to a needle angle on a paper dial, like an analogue meter. It is a quick way to show how analog input becomes motion.
Tick anything you already have and the total updates.
Reads light and drives the servo
Light sensor module
Follow the colours: red is power, dark grey is ground, blue is a signal.
USB is enough for one SG90. For bigger servos feed the shield's SER PWR terminal and remove the jumper.
light_gauge.inoVerify & upload in Electrolark#include <Servo.h>
Servo needle;
const int DARK = 900, BRIGHT = 100; // module reads high in the dark; check yours in the serial monitor
float smooth = 512;
void setup() {
Serial.begin(9600);
needle.attach(9);
}
void loop() {
int raw = analogRead(A0);
smooth = smooth * 0.9 + raw * 0.1;
int angle = constrain(map((int)smooth, DARK, BRIGHT, 0, 180), 0, 180);
needle.write(angle);
Serial.println(raw);
delay(50);
}
Raise the smoothing (0.95 / 0.05) or add a 100 µF capacitor across the servo supply.
Swap DARK and BRIGHT.
The servo draws too much from USB; power the shield's servo terminal separately.
Any 3-pin module: sound, soil, IR, buttons. Pick the matching pin row.
No, everything plugs into headers.
Yes, swap the LDR for an LM35 module and change the range.
5 parts: Uno R3 CH340G ATmega328p Compatible Development Board, Arduino USB-A to USB-B Data Cable for UNO/MEGA, Arduino Sensor Shield V5 Expansion Board, Digital LDR Light Sensor Module for Arduino – LM393 Comparator, Adjustable Sensitivity and TowerPro SG90 9g Micro Servo (180°). On this page you can tick the parts you already have and add only the rest to your cart.
It is a beginner project and takes about 45 minutes. The build on this page has 6 steps.
No. This page has the complete, tested code (light_gauge.ino).
About ₹472 for the parts at the prices on this page. Quantity price breaks lower the cost when you build several.
Using a sensor shield's S-V-G headers; Reading analog values; Mapping a range to servo angles.
Your first MicroPython project: temperature and humidity on an OLED.
A web page with ON and OFF buttons that switches a relay over Wi-Fi.
A warm ring light that fades up at dusk and down at dawn.
Turn a Pi and a touchscreen into a home command centre with a clock and to-do list.
Lessons are free to read. Maker (₹499/month) and Pro add quizzes, worked problems and certificates, paid with your Geekobot account. See plans
Learning project. Check every circuit and the datasheet of each part before you power it up.