What you learn today
- Climate, light and harvest in one chip
- Warnings
- Display
The week delivered all the parts, now they go into one chip: a greenhouse with a hydroponics device, a Harvie, a heater and a grow light.
The setup
| Device | Prefab | Name |
|---|---|---|
| Gas sensor | StructureGasSensor | “Gewaechshaus” |
| Wall heater | StructureWallHeater | “Gewaechshaus” |
| Grow light | StructureGrowLight | “Pflanzenlicht” |
| Switch | StructureLogicSwitch2 | “Licht” |
| Hydroponics device | StructureHydroponicsTrayData | “Beet” |
| Harvie | StructureHarvie | “Ernter” |
| Wall light | StructureWallLight | “Warnung” |
| LED display | StructureConsoleLED5 | “Reife” |
The rules
- Climate: heater on below 20 °C, off above 24 °C. Without the sensor it stays off.
- Light: the grow light follows the switch
Open. If the switch is missing, it stays off. - Harvest: with a free arm, harvest when
Mature= 1, and plant when the tray is empty and there are seeds in the import. - Display:
MaturityRatioin whole percent, −1 for an empty tray or a missing device. - Warning: light on below 15 °C, without the sensor or without seeds.
Milestones
- The heater holds 20 to 24 °C with hysteresis.
- The grow light follows the switch.
- Ripe plants are harvested, empty trays are planted.
- The display shows the ripeness in percent.
- The warning light reports cold, missing seeds and a failed sensor.
Split the code into five sections, just like the rules. Each section reads what it needs and writes exactly one or two devices. Then you will find a fault later within a minute.
sgtz tmp tmp after reading the switch turns NaN into 0. That way the light goes off when somebody removes the switch, instead of writing NaN to the light.
Diagram
Project task
Task
Build the greenhouse control following the five rules above. The defines and aliases are already there.
Milestones
- Milestone 1: heater with hysteresis
- Milestone 2: light follows the switch
- Milestone 3: harvesting and planting
- Milestone 4: ripeness in percent
- Milestone 5: warnings
Hints
Hint 1
Climate as yesterday: two slt, and/or, then and heat heat ok.
Hint 2
Harvest as on Tuesday: seqz free free, then write Harvest and Plant as 0 or 1.
Hint 3
Warning: slt warn temp T_MIN, plus seqz tmp ok and seqz tmp seed with or.
Quiz
2 questions. You pass from 60 % – the server does the grading.
Complete the day
- Passed all milestones of the project
- Passed the quiz with at least 60 %
Without an account progress is saved in this browser only.
Report a mistake in this lesson
Please sign in to report. Sign in