GardenSense – Smart Garden Monitoring with Blazor & Raspberry Pi

🌿 GardenSense Dashboard

“Smart garden monitoring — simulated today, Raspberry Pi tomorrow.”

GardenSense is a Blazor Server prototype for a modular smart gardening system. Its interface simulates environmental sensor data, while preparing for future integration with physical devices such as Raspberry Pi-based controllers and GPIO-controlled hardware. It serves as a template for home automation or greenhouse monitoring setups.

Tech Stack

  • Frontend: Blazor Server (.NET 8), Bootstrap 5
  • Backend: C#, Razor Components
  • Database: EF Core with modular component structure
  • Future Plans: Raspberry Pi GPIO integration, real-time charts, authentication

🏡 Home Dashboard

GardenSense Home Dashboard
The main dashboard welcomes the user with clear navigation and quick access to sensor data and control simulation tools. Each section is modular and can be extended.

Zone Manager

GardenSense Zones Page
Users can define and manage multiple garden zones like “Tomato Patch” or “Greenhouse A.” Each zone includes fields for name, location, and associated sensor/control data.

Sensor History Viewer

Sensor History Page
Simulated sensor readings (temperature, humidity, soil moisture, and light) are recorded and presented in a sortable table. Zone-based filtering enables efficient monitoring.

Controls Panel

Controls Panel
Simulated GPIO control toggles let users activate heaters, fans, and lights per zone. These switches currently update database states — later versions will trigger GPIO events.

🚧 Planned Enhancements

  • Live sensor integration with Raspberry Pi GPIO
  • Authentication and secure zone editing
  • Data visualization with real-time charts
  • Remote access and mobile-friendly controls

🧠 Code Highlights

Managing Zones in Blazor (Zones.razor)

This component allows users to add and manage custom garden zones. Each zone has a name and a location, handled using Blazor’s @bind syntax for real-time updates.

Zones.razor Code Snippet

GardenZone Model (C# Class)

Each zone is represented by a GardenZone class with properties for name, location, and zone-specific sensor data. Clean model definition supports scalable state.

GardenZone Model Snippet

SensorReading Class

Sensor readings are logged using this C# class, including temperature, humidity, light, and moisture levels. This powers both the history view and real-time control logic.

SensorReading Code Snippet

Zone Controls UI (Controls.razor)

This component simulates hardware toggles for each garden zone — including lights, fans, and heaters. It binds to zone state and updates the database, mimicking GPIO triggers.

Controls.razor Code Snippet

Sensor History Table (History.razor)

A sortable, filterable table that displays past sensor readings per zone. Users can select a zone, view time-stamped values, and visually monitor trends over time.

History.razor Code Snippet

Sensor Simulation Logic

This logic generates simulated sensor values and logs them for testing. Later, this will be replaced with live Raspberry Pi GPIO input.

Sensor Simulation Logic

🔧 Next Steps

  • Data visualization with real-time charts — Add responsive line or bar charts using Chart.js, Blazorise, or a JSInterop wrapper.
  • Live sensor integration — Connect to Raspberry Pi GPIO input using System.Device.Gpio and log actual readings.
  • GPIO command output — Replace current toggles with real-world hardware control (relays, LEDs, etc.).
  • Authentication and authorization — Use ASP.NET Identity or a simple token-based system to protect zone controls.
  • Mobile responsiveness — Improve UX for tablets and phones; consider swipeable cards or collapsible zone displays.
  • Remote dashboard access — Deploy behind HTTPS and allow external users to monitor/control via login.

View the full source code: GitHub Repository

Have a project like this in mind? Get in touch.