Diana Khalipina
Published © GPL3+

Solar weather station

This kit get charged from solat battery and provides information about temperature, light level, CO2 level and moisture level of the soil.

BeginnerFull instructions provided1 hour1,495
Solar weather station

Things used in this project

Hardware components

BBC micro:bit board
BBC micro:bit board
×1
Grove - Temperature Sensor
Seeed Studio Grove - Temperature Sensor
×1
Grove - Air quality sensor v1.3
Seeed Studio Grove - Air quality sensor v1.3
×1
Gravity: Analog Soil Moisture Sensor For Arduino
DFRobot Gravity: Analog Soil Moisture Sensor For Arduino
×1
Grove - Light Sensor
Seeed Studio Grove - Light Sensor
×1
grove shield micro:bit
×1

Software apps and online services

MakeCode
Microsoft MakeCode

Story

Read more

Schematics

Schematics for micro:bit board

Code

Code for micro:bit board

MicroPython
Code to program solar weather station
from microbit import *
import time
import math
from sgp30 import SGP30

# Temperature Sensor on pin1
# Light Sensor on pin0
sgp30 = SGP30()
# Moisture Sensor on pin2

def getGroveTemperature(pin, unit='celsius'):
  R = 1023.0/(pin.read_analog()+1e-3) - 1
  t = 1/(math.log(R)/4250+1/298.15) - 273.15 # celsius
  if unit == 'fahrenheit':
    t = t * 9/5 + 32
  elif unit == 'kelvin':
    t += 273.15
  return t

while True:
  led_image = Image('99999:00900:00909:00900:00909')
  display.show(led_image)
  time.sleep(1)
  display.show(getGroveTemperature(pin1))
  time.sleep(1)
  if getGroveTemperature(pin1) > 24:
    display.show('! HOT !')
  if getGroveTemperature(pin1) < 18:
    display.show('! COLD !')
  time.sleep(1)
  led_image = Image('90000:90000:90009:90000:99909')
  display.show(led_image)
  time.sleep(1)
  display.show(pin0.read_analog())
  time.sleep(1)
  if pin0.read_analog() < 50:
    display.show('! DARK !')
  time.sleep(1)
  led_image = Image('99900:90000:90009:90000:99909')
  display.show(led_image)
  time.sleep(1)
  display.show(sgp30.eCO2())
  time.sleep(1)
  if sgp30.eCO2() > 700:
    display.show('! POLLUTED !')
  time.sleep(1)
  led_image = Image('90009:99099:90909:90909:90909')
  display.show(led_image)
  time.sleep(1)
  display.show(pin2.read_analog())
  time.sleep(1)
  if pin2.read_analog() > 300:
    display.show('! HUMID !')
  time.sleep(1)

Credits

Diana Khalipina

Diana Khalipina

7 projects • 88 followers
I am e-health engineer Diana in Paris. Wish one day everybody become self-quantified. ❕❕ ONLINE COURSES OF PROGRAMMING MEDICAL PROJECTS ❕❕

Comments

Add projectSign up / LoginAbout BBC micro:bit