Smart Farming System

Whether you’re growing greens for sustenance or you just love gardening, this mini greenhouse is a satisfying project. We will look at how to make a simple green house with automated temperature control.

This project is originally published in micro:bit Magazine Issue 07, a quarterly publication by CLASSROOM


YOU WILL NEED

  • 1 x BBC Micro:bit
  • 1 x Sensor:bit
  • 1 x Relay module
  • 1 x Fan
  • 1 x Battery holder
  • 1 x Water pump

STEP 1

Connecting the components
• Connect Fan to PIN 1 (not pictured)
• Connect Relay module to PIN 2
• Connect the output of Relay to water pump
• Connect the G and V to the Relay and water pump
• Plug in micro:bit battery case to the micro:bit




Materials

• 1 x BBC Micro:bit
• 1 x Sensor:bit
• 1 x Relay module
• 1 x Fan
• 1 x Battery holder
• 1 x Water pump



STEP 2

Coding
Drag ‘forever block’ from Basic



STEP 3

Coding
Our goal is using micro:bit driving the fan and water pump when the value of temperature is higher than 30°, so them > 30 is the judgement condition. In that way, we need drag “if else” block from Logic, then set temp > 30



STEP 4

Coding
• The micro:bit will send signal to motor fan through P1 and water pump through P2. When temperature higher than 30 then turn on the fan and water pump (i.e. digital write pin P1 and P2 to ‘1’).
• Else, means if temperature lower than 30, the fan and water pump will turn off (i.e. digital write pin P1 and P2 to ‘0’)



STEP 5

Download the hex file into the micro:bit and try your mini greenhouse


Downloads: microbit-MM7_SmartFarming.hex

Code and References

Made this activity? Good Job! Now spread the word. Share a photo of your creation on social media with #letsgethacking #SmartFarmingSystem