Skip to main content

Posts

Showing posts from 2025

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 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 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...

Interfacing Hall Effect Sensor with Raspberry Pi 3 🧲

Interfacing Hall Effect Sensor with Raspberry Pi 3 🧲 🎯 Objective To detect the presence of magnetic fields using a Hall Effect Sensor and Raspberry Pi 3. Useful for speed sensing, door detection, and proximity sensing applications. 🧰 Components Required Component Quantity Raspberry Pi 3 1 Hall Effect Sensor Module 1 Magnet 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) GPIO17 (Pin 11) 🧠 Python Code import RPi.GPIO as GPIO import time HALL_SENSOR_PIN = 17 GPIO.setmode(GPIO.BCM) GPIO.setup(HALL_SENSOR_PIN, GPIO.IN) try: while True: if GPIO.input(HALL_SENSOR_PIN) == 0: print("🧲 Magnet Detected!") else: print("✅ No Magnetic Field.") time.sleep(0.5) except KeyboardInterrupt: GPIO.cleanup() 📊 Output Displays "🧲 Magnet Detected!" when m...

Interfacing Flex Sensor with Raspberry Pi 3 🤸

Interfacing Flex Sensor with Raspberry Pi 3 🤸 🎯 Objective To read the bending position of a Flex Sensor using an ADC (MCP3008) with Raspberry Pi 3. This setup is useful in gesture control and wearable electronics. 🧰 Components Required Component Quantity Raspberry Pi 3 1 Flex Sensor 1 10KΩ Resistor 1 MCP3008 ADC 1 Breadboard & Jumper Wires As required ⚡ Circuit Connections Flex Sensor + MCP3008 + Raspberry Pi 3 MCP3008 Pin Connect To VDD & VREF 3.3V (Pin 1) AGND & DGND GND (Pin 6) CLK GPIO11 (Pin 23) DOUT GPIO9 (Pin 21) DIN GPIO10 (Pin 19) CS/SHDN GPIO8 (Pin 24) CH0 Flex sensor voltage divider output 🧠 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) 📊 Output Shows analog value corresponding to how much the sensor is bent. The more it bends, the higher the value. 💡 App...

Interfacing Pulse Sensor with Raspberry Pi 3 ❤️

Interfacing Pulse Sensor with Raspberry Pi 3 ❤️ 🎯 Objective To detect heartbeats using a Pulse Sensor and monitor pulse rate on a Raspberry Pi 3 using an MCP3008 ADC. 🧰 Components Required Component Quantity Raspberry Pi 3 1 Pulse Sensor 1 MCP3008 ADC 1 Jumper Wires As required Breadboard 1 ⚡ Circuit Connections Connect the Pulse Sensor to MCP3008 and Raspberry Pi 3 as follows: Pulse Sensor Pin Connect To VCC 3.3V (RPi Pin 1) GND GND (RPi Pin 6) Signal CH0 of MCP3008 🔄 MCP3008 to Raspberry Pi Connections MCP3008 Pin RPi Pin VDD, VREF 3.3V (Pin 1) AGND, DGND GND (Pin 6) CLK GPIO11 (Pin 23) DOUT GPIO9 (Pin 21) DIN GPIO10 (Pin 19) CS/SHDN GPIO8 (Pin 24) 🧠 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) 📊 Output Prints analog values that represent the pulse waveform. Can be p...

Interfacing CO₂ Sensor with Raspberry Pi 3 🌫️

Interfacing CO₂ Sensor with Raspberry Pi 3 🌫️ 🎯 Objective To measure carbon dioxide (CO₂) levels using a CO₂ sensor (like MG-811 or MH-Z19) with Raspberry Pi 3 for air quality monitoring. 🧰 Components Required Component Quantity Raspberry Pi 3 1 CO₂ Sensor (MG-811 or MH-Z19) 1 Level Shifter / Logic Converter 1 (for UART sensors) Jumper Wires As required Breadboard 1 ⚡ Circuit Connections For MH-Z19 CO₂ sensor (using UART): MH-Z19 Pin Connect To VCC 5V (RPi Pin 2) GND GND (RPi Pin 6) TX GPIO15 (RX, Pin 10) via level shifter RX GPIO14 (TX, Pin 8) via level shifter 🧠 Python Code import serial import time ser = serial.Serial("/dev/serial0", baudrate=9600, timeout=1) def read_co2(): ser.write(b"\xFF\x01\x86\x00\x00\x00\x00\x00\x79") response = ser.read(9) if len(response) == 9: high = response[2] low = response[3] co2 = (high 📊 Output Displays CO₂ concentration i...

Interfacing IR Temperature Sensor with Raspberry Pi 3 🌡️

Interfacing IR Temperature Sensor with Raspberry Pi 3 🌡️ Interfacing IR Temperature Sensor with Raspberry Pi 3 🌡️ Infrared temperature sensors are non-contact sensors that detect the temperature of objects by sensing emitted infrared radiation. Today, we’ll learn how to interface an IR sensor (like MLX90614) with a Raspberry Pi 3. 🎓 🔧 Components Required Component Quantity Raspberry Pi 3 1 IR Temp Sensor (MLX90614) 1 Jumper Wires 4 Breadboard (optional) 1 🪛 Pin Connections Sensor Pin Raspberry Pi Pin Pin Number VCC 3.3V Pin 1 GND Ground Pin 6 SDA GPIO 2 (SDA) Pin 3 SCL GPIO 3 (SCL) Pin 5 Figure: IR Sensor connected to Raspberry Pi 3 ⚙️ Enabling I2C on Raspberry Pi Open terminal: sudo raspi-config Go to Interfacing Options > I2C and enable it. Reboot your Raspberry Pi. 💻 Python Code import smbus import time bus = smbus.SMBus(1) addres...

Interfacing GPS Module with Raspberry Pi 3 🌍

Interfacing GPS Module with Raspberry Pi 3 🌍 Interfacing GPS Module with Raspberry Pi 3 🌍 Global Positioning System (GPS) modules help us get location data like latitude, longitude, speed, altitude, and more! Let's learn how to connect a GPS module (like NEO-6M) to Raspberry Pi 3 and read real-time location. 🛰️📡 🔧 Components Required Component Quantity Raspberry Pi 3 1 GPS Module (NEO-6M) 1 Jumper Wires 4 USB to TTL Converter (Optional) 1 🔌 GPS Module to Pi Connections GPS Pin Raspberry Pi Pin Pin Number VCC 3.3V / 5V Pin 1 or 4 GND Ground Pin 6 TX GPIO15 (RXD) Pin 10 RX GPIO14 (TXD) Pin 8 Figure: GPS Module connected to Raspberry Pi 3 ⚙️ Enable Serial Interface Run: sudo raspi-config Go to Interfacing Options > Serial Disable shell access over serial and enable serial hardware Reboot your Raspberry Pi 📦 Install Required Packages...

Interfacing Load Cell with Raspberry Pi 3 (via HX711) ⚖️

Interfacing Load Cell with Raspberry Pi 3 (via HX711) ⚖️ Interfacing Load Cell with Raspberry Pi 3 (via HX711) ⚖️ A load cell is a transducer that converts force (weight) into an electrical signal. The HX711 is a precision 24-bit analog-to-digital converter (ADC) designed for weigh scales. Today we’ll connect a load cell to Raspberry Pi 3 using the HX711 module. 🧪 🔧 Components Required Component Quantity Raspberry Pi 3 1 Load Cell 1 HX711 Module 1 Jumper Wires 6 Breadboard (optional) 1 🔌 Pin Connections HX711 Pin Raspberry Pi Pin Pin Number VCC 5V Pin 2 GND Ground Pin 6 DT GPIO 5 Pin 29 SCK GPIO 6 Pin 31 Figure: Load Cell connected to Raspberry Pi 3 via HX711 💻 Python Code from hx711 import HX711 import RPi.GPIO as GPIO import time hx = HX711(dout_pin=5, pd_sck_pin=6) hx.set_reading_format("MSB", "MSB") hx.set_reference_unit(1) hx.reset()...

Interfacing Color Sensor (TCS3200) with Raspberry Pi 3 🎨

Interfacing Color Sensor (TCS3200) with Raspberry Pi 3 🎨 Interfacing Color Sensor (TCS3200) with Raspberry Pi 3 🎨 The TCS3200 color sensor can detect various colors using its array of photodiodes and filters. Let’s interface it with Raspberry Pi 3 and detect different object colors! 🌈 🔧 Components Required Component Quantity Raspberry Pi 3 1 TCS3200 Color Sensor 1 Jumper Wires 8 🔌 Pin Connections Sensor Pin Raspberry Pi Pin Pin Number VCC 3.3V Pin 1 GND Ground Pin 6 S0 GPIO 17 Pin 11 S1 GPIO 27 Pin 13 S2 GPIO 22 Pin 15 S3 GPIO 23 Pin 16 OUT GPIO 24 Pin 18 Figure: TCS3200 Color Sensor connected to Raspberry Pi 3 💻 Python Code import RPi.GPIO as GPIO import time # Set up GPIO pins for S0-S3 and OUT GPIO.setmode(GPIO.BCM) GPIO.setup(17, GPIO.OUT) GPIO.setup(27, GPIO.OUT) GPIO.setup(22, GPIO.OUT) GPIO.setup(23, GPIO.OUT) GPIO.setup(24, GPIO.IN) GPIO.output(...

Interfacing pH Sensor with Raspberry Pi 3 🌿

Interfacing pH Sensor with Raspberry Pi 3 🌿 Interfacing pH Sensor with Raspberry Pi 3 🌿 pH sensors help us monitor the acidity or alkalinity of water and soil. This guide explains how to interface a pH sensor (via MCP3008 ADC) with Raspberry Pi 3 for real-time monitoring. 🧪🌱 🔧 Components Required Component Quantity Raspberry Pi 3 1 pH Sensor 1 MCP3008 ADC 1 Jumper Wires Several Breadboard 1 🔌 Pin Connections MCP3008 Pin Connection Raspberry Pi Pin VDD, VREF 3.3V Pin 1 AGND, DGND GND Pin 6 CH0 pH Sensor Output - DIN MOSI GPIO10 (Pin 19) DOUT MISO GPIO9 (Pin 21) CLK Clock GPIO11 (Pin 23) CS Chip Select GPIO8 (Pin 24) Figure: pH Sensor interfaced with Raspberry Pi 3 using MCP3008 💻 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...

Interfacing Joystick Module with Raspberry Pi 3 🎮

Interfacing Joystick Module with Raspberry Pi 3 🎮 Interfacing Joystick Module with Raspberry Pi 3 🎮 A joystick module is a fun way to capture directional input using two potentiometers and a switch. With Raspberry Pi 3, it’s great for games, robot control, and UI navigation! 🕹️ 🔧 Components Required Component Quantity Raspberry Pi 3 1 Joystick Module (Analog) 1 ADC MCP3008 1 Jumper Wires Multiple 🔌 Pin Connections The joystick gives analog values. Since RPi doesn't support analog input, we use MCP3008 ADC. MCP3008 Pin RPi Pin Joystick Channel CH0 Joystick VRx X-axis CH1 Joystick VRy Y-axis DOUT GPIO 9 (MISO) - DIN GPIO 10 (MOSI) - CLK GPIO 11 (SCLK) - CS GPIO 8 (CE0) - VDD/VREF 3.3V - AGND/DGND GND - Figure: Joystick interfaced using MCP3008 to Raspberry Pi 3 💻 Python Code import spidev import time spi = spidev.SpiDev() spi.open(0, 0) sp...

🪪Interfacing RFID Reader (RC522) with Raspberry Pi 3

Interfacing RFID Reader (RC522) with Raspberry Pi 3 🪪 Interfacing RFID Reader (RC522) with Raspberry Pi 3 🪪 The RC522 is a widely used RFID reader for 13.56 MHz tags. With a Raspberry Pi 3, we can use it to identify and authenticate users using RFID cards. 🧾 🔧 Components Required Component Quantity Raspberry Pi 3 1 RC522 RFID Reader 1 RFID Tags/Cards 1+ Jumper Wires 7 🔌 Pin Connections RFID Pin Raspberry Pi Pin Pin Number SDA GPIO 8 (CE0) Pin 24 SCK GPIO 11 (SCLK) Pin 23 MOSI GPIO 10 (MOSI) Pin 19 MISO GPIO 9 (MISO) Pin 21 IRQ Not Connected - GND Ground Pin 6 3.3V 3.3V Pin 1 Figure: RFID Reader RC522 connected to Raspberry Pi 3 💻 Python Code # Install library # git clone https://github.com/pimylifeup/MFRC522-python.git import RPi.GPIO as GPIO from mfrc522 import SimpleMFRC522 reader = SimpleMFRC522() try: print("Place your tag...") ...

🌫️ Interfacing Raspberry Pi 3 with MQ-135 Air Quality Sensor

MQ-135 Sensor with Raspberry Pi 3 🎯 Objective In this project, we will use the MQ-135 Air Quality Sensor with Raspberry Pi 3 to monitor air pollution levels. This sensor is often used in indoor air quality systems. 🧰 Components Required Component Quantity Raspberry Pi 3 1 MQ-135 Air Quality Sensor 1 MCP3008 ADC Module 1 Breadboard 1 Jumper Wires As needed Power Supply 1 💡 MQ-135 provides analog output. RPi needs MCP3008 ADC to convert analog to digital. ⚡ Circuit Connections Sensor to MCP3008: From (MQ-135) To VCC 5V (RPi3) GND GND (RPi3) AOUT CH1 (MCP3008) MCP3008 to RPi3: MCP3008 Pin RPi3 GPIO 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) + ...

🤖 HD Atlas: Boston Dynamics' Revolutionary Humanoid Robot

🎥 Video Credit: Official video by Boston Dynamics , embedded from their YouTube channel. Used here for educational and informational purposes only. 🌟 Introducing HD Atlas The HD Atlas robot, developed by Boston Dynamics , represents a significant leap in humanoid robotics. Designed to navigate complex environments and perform dynamic tasks, HD Atlas showcases the pinnacle of robotic agility and control. 🔍 Key Features of HD Atlas 🦿 Advanced Mobility HD Atlas is equipped with 28 hydraulic joints, allowing for a wide range of movements, including walking, running, jumping, and even backflips. This mobility enables the robot to traverse challenging terrains and perform tasks that require high agility. QVIRO 🧠 Intelligent Control Systems Utilizing advanced control algorithms, HD Atlas can process sensory information in real-time, adjusting its movements to maintain balance and adapt to new situations. This intelligence is crucial for tasks that involve dynamic intera...

🤖 NEO Gamma: The Sweater-Wearing Humanoid Robot That’s Redefining Home Automation

📽️ Video Credit: Official video by 1X Technologies, via their YouTube channel . Used here for educational and informational purposes. 🌟 Meet NEO Gamma — The Friendly Android for Everyday Life In a world increasingly influenced by artificial intelligence and robotics, NEO Gamma stands out as one of the most human-like and practical humanoid robots ever introduced for real-world household use . Developed by 1X Technologies , a robotics company based in Norway , NEO Gamma merges cutting-edge AI with domestic functionality , wrapped in a warm, sweater-wearing exterior that makes it feel right at home—literally. 🧠 What Makes NEO Gamma Special? Unlike many humanoid robots that are confined to labs or tech showcases, NEO Gamma is built to function in everyday environments like homes and offices. Here’s what makes it a game-changer: 👕 1. Human-Friendly Design NEO Gamma’s soft, human-like appearance —complete with a sweater—sets it apart from the cold, mechanical look of traditional ro...