# 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,750

## Things used in this project

### Hardware components

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

### Software apps and online services

 Microsoft MakeCode

## 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'):
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)
time.sleep(1)
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)
time.sleep(1)