2022-07-06 16:29:48 +00:00
# strawberry-pi-greenhouse
2022-07-17 17:34:55 +00:00
Strawberry Pi Greenhouse is a little project that i made in my holidays. It's a software that sends sensor data (temperature, water level) to a Homeassistants instance and can receive commands from this HA instace to control a relay.
2022-07-06 16:29:48 +00:00
2022-08-04 17:44:15 +00:00
# Hardware Installation
GPIO Pin Layout:
| Pin | Kabel | Pin | Kabel |
| --- | ----------------------- | --- | ---------------- |
| 1 | | 2 | Ultraschall VCC |
| 3 | Temperatur SDA | 4 | LED VCC |
| 5 | Temperatur SCL | 6 | |
| 7 | | 8 | |
| 9 | Relay GND | 10 | |
| 11 | | 12 | |
| 13 | | 14 | |
| 15 | | 16 | |
| 17 | Temperatur VCC | 18 | Ultraschall Trig |
| 19 | | 20 | Ultraschall GND |
| 21 | | 22 | Ultraschall ECHO |
| 23 | | 24 | |
| 25 | | 26 | |
| 27 | | 28 | |
| 29 | | 30 | |
| 31 | | 32 | |
| 33 | | 34 | Temperatur GND |
| 35 | Relay 1 | 36 | Relay 2 |
| 37 | Relay 3 | 38 | Relay 4 |
| 39 | Relay GND (for devices) | 40 | |
2022-07-24 08:01:16 +00:00
2022-07-24 08:01:51 +00:00
# Software Installation
2022-07-24 08:01:36 +00:00
2022-07-24 08:02:18 +00:00
To activate the sensors you have to add these lines to you `/boot/config.txt` file on your raspberry pi micro sd card. You can change the pin numbers if you want.
2022-07-17 17:34:55 +00:00
```
2022-07-17 15:27:39 +00:00
dtparam=i2c1=on
dtparam=i2c_arm=on
enable_uart=0
#i2c Temperaturesensor
2022-07-17 17:34:55 +00:00
dtoverlay=i2c-gpio,bus=2,i2c_gpio_delay_us=1,i2c_gpio_sda=2,i2c_gpio_scl=3
```
2022-07-24 08:01:16 +00:00
Also you have to enable the i2c devices in the raspi-config menu. If you dont know how to do it you can just google it.
Now we need some packages that are needed to run the script. You can install them with this command:
```
2022-07-24 08:15:51 +00:00
sudo apt install python3-pip screen rpi.gpio -y
2022-07-24 08:01:16 +00:00
```
Now you can put the following command in a crontab to run the strawberry pi script in the background when the raspberry pi starts:
```
crontab -e
@reboot bash /path/to/repo/strawberry-pi-greenhouse/start.sh
```
You can also create a service/deamon or something like that if thats your thing instead of crontab.
The last thing you have to do befor you reboot is to enable i2c devices in the raspi-config.
1. execute this command `sudo raspi-config`
2. go to `Interface Options`
3. select `I2C`
4. select `Yes`
Now you can reboot your pi with `sudo reboot`