555 timer LED flasher
The most famous chip in electronics, blinking an LED about once a second.
Shop by category
Shop all componentsThe CD4051 is an 8-channel analog switch. Three address pins choose which of its eight inputs is connected to the common pin, so the Nano can read eight analog signals one after another on A0. Here each input is a soil moisture sensor. The Nano reads all eight, shows which pots are dry on an OLED, and powers the sensors only while reading, which makes them last longer.
Tick anything you already have and the total updates.
Soil moisture sensors
Follow the colours: red is power, dark grey is ground, blue is a signal.
USB or a 5 V adapter.
soil_scanner.inoVerify & upload in Electrolark#include <Adafruit_SSD1306.h>
Adafruit_SSD1306 oled(128, 64, &Wire, -1);
const int ADDR[3] = {2, 3, 4};
const int SENS_PWR = 7;
const int DRY = 600; // higher reading = drier on most sensors
int readChannel(int ch) {
for (int b = 0; b < 3; b++) digitalWrite(ADDR[b], (ch >> b) & 1);
delay(5); // let the signal settle
return analogRead(A0);
}
void setup() {
for (int b = 0; b < 3; b++) pinMode(ADDR[b], OUTPUT);
pinMode(SENS_PWR, OUTPUT);
oled.begin(SSD1306_SWITCHCAPVCC, 0x3C); oled.setTextColor(WHITE);
}
void loop() {
digitalWrite(SENS_PWR, HIGH); delay(100);
oled.clearDisplay(); oled.setTextSize(1); oled.setCursor(0, 0); oled.println("Pot reading");
for (int ch = 0; ch < 8; ch++) {
int v = readChannel(ch);
oled.print(ch + 1); oled.print(" "); oled.print(v); oled.println(v > DRY ? " DRY" : "");
}
digitalWrite(SENS_PWR, LOW);
oled.display();
delay(60000);
}
The address pins are not wired or INH is not grounded.
Channel pin numbers on the CD4051 are not in order; check the list in the wiring.
Make sure D7 switches them off between readings.
Yes, with a second CD4051 on another analog pin, or by chaining.
Its switch resistance is small next to the sensor's, so not noticeably.
Yes, add relays or MOSFETs on spare pins.
6 parts: CD4051 8-Channel Analog Multiplexer IC (DIP-16), 8 × Generic Soil Moisture Sensor Hygrometer Module – Analog/Digital Output, Generic Nano CH340 Development Board (Soldered), 0.96" OLED Display 128x64, Solderless Breadboard and Dupont Jumper Wires (40 pcs). On this page you can tick the parts you already have and add only the rest to your cart.
It is a intermediate project and takes about 2 hours. The build on this page has 7 steps.
No. This page has the complete, tested code (soil_scanner.ino).
About ₹676 for the parts at the prices on this page. Quantity price breaks lower the cost when you build several.
How an analog multiplexer works; Binary addressing with three pins; Powering sensors only when needed.
The most famous chip in electronics, blinking an LED about once a second.
Press once and the light stays on for about 11 seconds, then goes off by itself.
A running light like the one on Knight Rider, made from two classic chips.
Touch two wires with a fingertip and an LED lights: skin current switches a transistor pair.
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.