Skip to main content

Posts

💡 TECH BUZZ

Interfacing Raspberry Pi 3 B+ with DC Motor using L298N 🚀🔧

Recent posts

Interfacing Water Flow Sensor with Raspberry Pi 3 🚿

Interfacing Water Flow Sensor with Raspberry Pi 3 🚿 🎯 Objective To measure the flow rate of water using a Water Flow Sensor (YF-S201) and Raspberry Pi 3. Useful in smart irrigation and water management systems. 🧰 Components Required Component Quantity Raspberry Pi 3 1 YF-S201 Water Flow Sensor 1 10K Pull-down Resistor 1 Jumper Wires As required Breadboard 1 ⚡ Circuit Connections Sensor Pin Connect To Red (VCC) 5V (Raspberry Pi) Black (GND) GND (Raspberry Pi) Yellow (Pulse Out) GPIO18 (Pin 12) with pull-down resistor 🧠 Python Code import RPi.GPIO as GPIO import time FLOW_SENSOR = 18 pulse_count = 0 def countPulse(channel): global pulse_count pulse_count += 1 GPIO.setmode(GPIO.BCM) GPIO.setup(FLOW_SENSOR, GPIO.IN, pull_up_down=GPIO.PUD_DOWN) GPIO.add_event_detect(FLOW_SENSOR, GPIO.FALLING, callback=countPulse) try: while True: pulse_count = 0 time.sleep(1) flow_rate = (pulse_count / 7.5) ...

Interfacing Raspberry Pi 3 with an Ultrasonic Sensor (HC-SR04) - English & Marathi

Introduction The HC-SR04 ultrasonic sensor is used to measure distance by sending and receiving ultrasonic waves. In this tutorial, we will interface the HC-SR04 sensor with Raspberry Pi 3 to measure the distance of an object. HC-SR04 अल्ट्रासोनिक सेन्सर अल्ट्रासोनिक तरंग पाठवून आणि प्राप्त करून अंतर मोजण्यासाठी वापरला जातो. या ट्यूटोरियलमध्ये, आपण HC-SR04 सेन्सरला Raspberry Pi 3 शी जोडून वस्तूचे अंतर कसे मोजायचे ते शिकू. Components Required | आवश्यक घटक: 1. Raspberry Pi 3 2. HC-SR04 Ultrasonic Sensor 3. Jumper Wires 4. Breadboard Circuit Diagram | सर्किट जोडणी: Connections: - HC-SR04 VCC → 5V (Pin 2) - HC-SR04 GND → GND (Pin 6) - HC-SR04 Trig → GPIO23 (Pin 16) - HC-SR04 Echo → GPIO24 (Pin 18) Python Code | पायथन कोड: import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BCM) TRIG = 23 ECHO = 24 GPIO.setup(TRIG, GPIO.OUT) GPIO.setup(ECHO, GPIO.IN) def measure_distance():     GPIO.output(TRIG, True)     time.sleep(0.00001)     GPIO.output(TRIG, False)  ...

Interfacing Rain Sensor with Raspberry Pi 3 ☔

Interfacing Rain Sensor with Raspberry Pi 3 ☔ 🎯 Objective To detect the presence of rain using a Rain Sensor module with Raspberry Pi 3 and display alerts on the console. Perfect for smart weather stations and automatic window systems! 🧰 Components Required Component Quantity Raspberry Pi 3 1 Rain Sensor Module (Analog & Digital Output) 1 Jumper Wires As required Breadboard 1 ⚡ Circuit Connections Rain Sensor Pin Connect To VCC 5V (Raspberry Pi) GND GND (Raspberry Pi) D0 (Digital Out) GPIO17 (Pin 11) 🧠 Python Code import RPi.GPIO as GPIO import time RAIN_SENSOR_PIN = 17 GPIO.setmode(GPIO.BCM) GPIO.setup(RAIN_SENSOR_PIN, GPIO.IN) try: while True: if GPIO.input(RAIN_SENSOR_PIN) == 0: print("🌧️ Rain Detected!") else: print("☀️ No Rain.") time.sleep(1) except KeyboardInterrupt: GPIO.cleanup() 📊 Output Prints "🌧️ Rain Detected!" when...

Interfacing Gas Sensor (MQ2) with Raspberry Pi 3 🔥

Interfacing Gas Sensor (MQ2) with Raspberry Pi 3 🔥 🎯 Objective To detect gases like LPG, smoke, or methane using the MQ2 Gas Sensor and Raspberry Pi 3. Helpful for creating safety and fire alert systems. 🧰 Components Required Component Quantity Raspberry Pi 3 1 MQ2 Gas Sensor Module (with digital output) 1 Jumper Wires As required Breadboard 1 ⚡ Circuit Connections MQ2 Sensor Pin Connect To VCC 5V (Raspberry Pi) GND GND (Raspberry Pi) D0 GPIO27 (Pin 13) 🧠 Python Code import RPi.GPIO as GPIO import time GAS_SENSOR_PIN = 27 GPIO.setmode(GPIO.BCM) GPIO.setup(GAS_SENSOR_PIN, GPIO.IN) try: while True: if GPIO.input(GAS_SENSOR_PIN) == 0: print("🔥 Gas Detected!") else: print("✅ Air is Clean.") time.sleep(1) except KeyboardInterrupt: GPIO.cleanup() 📊 Output Displays "🔥 Gas Detected!" when smoke or gas is present. Shows "✅ Air is Cl...

Interfacing Raspberry Pi 3 with Soil Moisture Sensor 🌱

Interfacing Raspberry Pi 3 with Soil Moisture Sensor 🌱 🎯 Objective Use the Soil Moisture Sensor with Raspberry Pi 3 to measure soil humidity levels. This setup is ideal for building smart irrigation systems for gardens and farms. 🌾 🧰 Components Required Component Quantity Raspberry Pi 3 1 Soil Moisture Sensor (Analog) 1 MCP3008 ADC 1 Breadboard 1 Jumper Wires As required ⚡ Circuit Connections Sensor to MCP3008: Soil Sensor Pin Connect To VCC 3.3V (RPi) GND GND (RPi) Analog Out CH0 of MCP3008 MCP3008 to Raspberry Pi: MCP3008 RPi3 GPIO Pin VDD, VREF 3.3V AGND, DGND GND CLK GPIO11 DOUT GPIO9 DIN GPIO10 CS GPIO8 🧠 Python Code import spidev import time spi = spidev.SpiDev() spi.open(0, 0) spi.max_speed_hz = 1350000 def read_channel(channel): adc = spi.xfer2([1, (8 + channel) << 4, 0]) data = ((adc[1] & 3) << 8) + adc[2] return data try: while True: moisture_lev...

Interfacing Vibration Sensor with Raspberry Pi 3 💥

Interfacing Vibration Sensor with Raspberry Pi 3 💥 🎯 Objective To detect vibration or shock using a Vibration Sensor module (SW-420) with Raspberry Pi 3. Useful in industrial machinery monitoring and security systems. 🧰 Components Required Component Quantity Raspberry Pi 3 1 SW-420 Vibration Sensor Module 1 Jumper Wires As required Breadboard 1 ⚡ Circuit Connections Sensor Pin Connect To VCC 3.3V (Pin 1 on RPi) GND GND (Pin 6 on RPi) D0 (Digital Out) GPIO27 (Pin 13) 🧠 Python Code import RPi.GPIO as GPIO import time VIBRATION_PIN = 27 GPIO.setmode(GPIO.BCM) GPIO.setup(VIBRATION_PIN, GPIO.IN) try: while True: if GPIO.input(VIBRATION_PIN): print("💥 Vibration Detected!") else: print("🟢 No Vibration.") time.sleep(0.5) except KeyboardInterrupt: GPIO.cleanup() 📊 Output 💥 Displays "Vibration Detected!" if vibration is sensed. 🟢 Displa...