Zbotic Logo Zbotic Logo
  • Home
  • Shop
  • Sale
  • 3D Print Service
  • PCB Service
  • B2B
  • Blogs
  • Contact Us
0 0

View Wishlist Add all to cart

0 0
0 Shopping Cart
Shopping cart (0)
Subtotal: ₹0.00

View cartCheckout

  • Shop
  • About Us
  • Contact Us
  • Reseller
  • Blogs
020 69134444
1800 209 0998
[email protected]
Help Desk
Facebook Twitter Instagram Linkedin YouTube
Zbotic Logo Zbotic Logo
0 0

View Wishlist Add all to cart

0 0
0 Shopping Cart
Shopping cart (0)
Subtotal: ₹0.00

View cartCheckout

All departments
  • 3D Print Service
  • 3D Printer
  • Batteries & Chargers
  • Development Boards
  • Drone Parts
  • EBike parts
  • Sensor Modules
  • Electronic Components
  • Electronic Modules
  • IoT and Wireless
  • Mechanical Parts and Workbench Tools
  • Motors & Drivers & Pumps & Actuators
  • DIY and Robot Kits
  • Show more
  • Home
  • Shop
  • Sale
  • 3D Print Service
  • PCB Service
  • B2B
  • Blogs
  • Contact Us
Return to previous page
Home IoT & Smart Home

Google Cloud IoT with Raspberry Pi: Getting Started

Google Cloud IoT with Raspberry Pi: Getting Started

April 1, 2026 /Posted by / 0

Table of Contents

  • Introduction to Google Cloud IoT
  • Why Google Cloud for IoT in India
  • Setting Up Your Raspberry Pi
  • Configuring Google Cloud IoT Core
  • Device Registration and Authentication
  • Sending Telemetry Data with Python
  • Visualising Data with BigQuery and Data Studio
  • Frequently Asked Questions

Google Cloud IoT provides a suite of managed services to connect, process, and analyse data from IoT devices at scale. When combined with the Raspberry Pi’s Linux-based flexibility, you get a complete IoT platform capable of handling everything from prototype to production. This guide covers the entire workflow for Indian developers.

Introduction to Google Cloud IoT

While Google Cloud IoT Core (the original device management service) was retired in August 2023, Google continues to offer powerful IoT capabilities through Pub/Sub, Cloud Functions, BigQuery, and partner integrations. The recommended approach now uses MQTT with Cloud Pub/Sub directly, giving you more flexibility and often lower costs.

Key services for IoT on Google Cloud:

  • Cloud Pub/Sub: Managed message ingestion (first 10 GB/month free)
  • Cloud Functions: Serverless event processing
  • BigQuery: Petabyte-scale analytics (first 1 TB queries/month free)
  • Looker Studio: Free dashboard and visualisation tool

Why Google Cloud for IoT in India

Google Cloud offers compelling advantages for Indian IoT deployments:

  • Mumbai Region (asia-south1): Low-latency data processing within India
  • Generous Free Tier: $300 credit for 90 days plus always-free tier for many services
  • BigQuery: Unmatched for analysing large sensor datasets — query terabytes in seconds
  • TensorFlow Integration: Train ML models on your IoT data using TPU infrastructure
  • Firebase: Real-time database and mobile app integration for IoT dashboards

Setting Up Your Raspberry Pi

Prepare your Raspberry Pi for IoT development:

# Update system
sudo apt update && sudo apt upgrade -y

# Install Python dependencies
sudo apt install -y python3-pip python3-venv
python3 -m venv iot-env
source iot-env/bin/activate

# Install Google Cloud libraries
pip install google-cloud-pubsub google-auth paho-mqtt
pip install adafruit-circuitpython-dht adafruit-circuitpython-bme280

# Install gcloud CLI
curl -sSL https://sdk.cloud.google.com | bash
gcloud init

Sensors for Raspberry Pi IoT

  • DHT22 Digital Temperature and Humidity Sensor Module
  • BME280 Environmental Sensor (Temperature, Humidity, Barometric Pressure)

Configuring Google Cloud IoT Core

Set up your Google Cloud project for IoT:

  1. Create a new project in Google Cloud Console
  2. Enable the Cloud Pub/Sub API
  3. Create a Pub/Sub topic named iot-telemetry
  4. Create a subscription for consuming messages
  5. Create a service account with Pub/Sub Publisher role
  6. Download the JSON key file and transfer to your Raspberry Pi

Device Registration and Authentication

For secure device authentication, generate an RSA key pair on your Raspberry Pi:

# Generate RSA-256 key pair
openssl genpkey -algorithm RSA -out device_private.pem -pkeyopt rsa_keygen_bits:2048
openssl rsa -in device_private.pem -pubout -out device_public.pem

# Set proper permissions
chmod 600 device_private.pem

Sending Telemetry Data with Python

Here is a complete Python script that reads sensor data and publishes to Google Cloud Pub/Sub:

import json
import time
from datetime import datetime
from google.cloud import pubsub_v1
import board
import adafruit_dht

# Configuration
PROJECT_ID = "your-project-id"
TOPIC_ID = "iot-telemetry"
DEVICE_ID = "rpi-sensor-mumbai-01"

# Initialise sensor (DHT22 on GPIO4)
dht_sensor = adafruit_dht.DHT22(board.D4)

# Initialise Pub/Sub publisher
publisher = pubsub_v1.PublisherClient()
topic_path = publisher.topic_path(PROJECT_ID, TOPIC_ID)

def read_and_publish():
    try:
        temperature = dht_sensor.temperature
        humidity = dht_sensor.humidity

        if temperature is None or humidity is None:
            print("Sensor read failed, retrying...")
            return

        payload = {
            "device_id": DEVICE_ID,
            "temperature_c": round(temperature, 2),
            "humidity_pct": round(humidity, 2),
            "timestamp": datetime.utcnow().isoformat(),
            "location": "Mumbai, India"
        }

        data = json.dumps(payload).encode("utf-8")
        future = publisher.publish(topic_path, data)
        print(f"Published: {payload} [msg_id: {future.result()}]")

    except Exception as e:
        print(f"Error: {e}")

if __name__ == "__main__":
    print(f"Starting IoT telemetry for {DEVICE_ID}")
    while True:
        read_and_publish()
        time.sleep(60)  # Publish every 60 seconds

Recommended Product

DHT22 Digital Temperature and Humidity Sensor Module

Buy on Zbotic.in

Visualising Data with BigQuery and Data Studio

Once data flows into Pub/Sub, route it to BigQuery for analysis:

  1. Create a BigQuery dataset and table matching your JSON schema
  2. Set up a Pub/Sub subscription that writes directly to BigQuery (no code needed)
  3. Query your data: SELECT AVG(temperature_c), DATE(timestamp) FROM iot_data.telemetry GROUP BY 2
  4. Connect Looker Studio to BigQuery and build real-time dashboards

The entire pipeline — from Raspberry Pi sensor to visual dashboard — can be set up within the free tier for small projects.

Recommended Product

BME280 Environmental Sensor (Temperature, Humidity, Barometric Pressure)

Buy on Zbotic.in

Frequently Asked Questions

Is Google Cloud IoT Core still available?

Google Cloud IoT Core was retired in August 2023. However, you can build equivalent functionality using Cloud Pub/Sub with MQTT, Cloud Functions, and BigQuery. Many users find this approach more flexible and cost-effective.

How much does Google Cloud cost for IoT in India?

Google Cloud offers $300 free credit for 90 days. The always-free tier includes 10 GB Pub/Sub throughput, 1 TB BigQuery queries, and 2 million Cloud Function invocations per month. A typical hobby project costs nothing.

Can Raspberry Pi handle continuous sensor reading?

Yes. Raspberry Pi runs Linux and can operate 24/7. Use systemd services to ensure your Python script auto-starts on boot and restarts on failure.

What is the latency from India to Google Cloud?

With the Mumbai region (asia-south1), typical latency is 5-15ms from major Indian cities. This is suitable for real-time monitoring applications.

{“@context”: “https://schema.org”, “@type”: “FAQPage”, “mainEntity”: [{“@type”: “Question”, “name”: “Is Google Cloud IoT Core still available?”, “acceptedAnswer”: {“@type”: “Answer”, “text”: “Google Cloud IoT Core was retired in August 2023. However, you can build equivalent functionality using Cloud Pub/Sub with MQTT, Cloud Functions, and BigQuery. Many users find this approach more flexible and cost-effective.”}}, {“@type”: “Question”, “name”: “How much does Google Cloud cost for IoT in India?”, “acceptedAnswer”: {“@type”: “Answer”, “text”: “Google Cloud offers $300 free credit for 90 days. The always-free tier includes 10 GB Pub/Sub throughput, 1 TB BigQuery queries, and 2 million Cloud Function invocations per month. A typical hobby project costs nothing.”}}, {“@type”: “Question”, “name”: “Can Raspberry Pi handle continuous sensor reading?”, “acceptedAnswer”: {“@type”: “Answer”, “text”: “Yes. Raspberry Pi runs Linux and can operate 24/7. Use systemd services to ensure your Python script auto-starts on boot and restarts on failure.”}}, {“@type”: “Question”, “name”: “What is the latency from India to Google Cloud?”, “acceptedAnswer”: {“@type”: “Answer”, “text”: “With the Mumbai region (asia-south1), typical latency is 5-15ms from major Indian cities. This is suitable for real-time monitoring applications.”}}]}

Ready to Build Your IoT Project?

Browse our complete collection of ESP32 boards, sensors, and IoT components. Fast shipping across India with technical support.

Shop IoT Components on Zbotic.in

Tags: Cloud, India, iot, Iot Smart Home
Share Post
  • Facebook
  • Linkedin
  • Whatsapp
Driveway Alert: PIR Sensor Vis...
blog driveway alert pir sensor visitor notification 613332
blog esp32 stepper motor control tmc2208 silent driver 613334
ESP32 Stepper Motor Control: T...

Related posts

Svg%3E
Read more

IoT Home Insurance Sensor Kit: Leak, Smoke, and Motion

April 1, 2026 0
Table of Contents IoT and Home Insurance Water Leak Detection Smoke and Fire Detection Motion and Intrusion Sensing Building the... Continue reading
Svg%3E
Read more

IoT Pet Tracker: GPS Collar with Geofencing Alerts

April 1, 2026 0
Table of Contents Introduction and Overview Hardware Components Required GPS Module Integration with ESP32 Cloud Platform Setup Real-Time Tracking Dashboard... Continue reading
Svg%3E
Read more

IoT Aquaponics Controller: Fish and Plant Automation

April 1, 2026 0
Table of Contents The Water Monitoring Challenge in India Sensor Technologies for Water Building the Sensor Node Data Transmission and... Continue reading
Svg%3E
Read more

IoT Composting Monitor: Temperature and Moisture Tracking

April 1, 2026 0
Table of Contents Why Temperature Monitoring Matters Sensor Selection Guide Hardware Assembly and Wiring Firmware Development Cloud Data Logging Alert... Continue reading
Svg%3E
Read more

IoT Beehive Monitor: Weight, Temperature, and Humidity

April 1, 2026 0
Table of Contents Why Monitor Beehives Weight Measurement System Temperature and Humidity Sensing Building the Monitor Data Analysis for Bee... Continue reading

Add comment Cancel reply

Your email address will not be published. Required fields are marked

Facebook Twitter Instagram Pinterest Linkedin Youtube

Get the latest deals and more.

Download on Google Play Download on the App Store

Call us: 020 69134444 / 1800 209 0998

Monday - Saturday 09:30 AM - 06:00 PM
For Technical Supports Email: [email protected]
For Sales / Enquiries Email: [email protected]

  • My Account

    • Cart

    • Wishlist

    • Checkout

    • My Orders

    • Track Order

    • My Account

  • Information

    • FAQs

    • Blogs

    • Career

    • About Us

    • Contact Us

    • Payment Options

  • Policies

    • Privacy Policy

    • Terms & Conditions

    • GST Input Tax Credit

    • Shipping Return Policy

    • E-Waste Collection Points

    • Our Sitemap

© Zbotic.in is registered trademark of Moxie Supply Pvt Ltd – All Rights Reserved
Login
Use Phone Number
Use Email Address
Not a member yet? Register Now
Reset Password
Use Phone Number
Use Email Address
Register
Already a member? Login Now