BLOG# 7 -Edible Algae System - (Growing Spirulina in space)
System Designs -- Software Design
This is my 7th blog post in a series of blog post for the Design Challenge 1 Meter of Pi
version 1.2
,<<< PREVIOUS BLOG |
NEX BLOG >> |
|
---|---|---|
|
Blog# 8.1 (Part 1 of 2) EAS - System Build |
INTRODUCTION
- This blog will describe all the software and programming used in the system.
- The main focus will be to describe the OS, Database, Libraries, Dev Tools, Class Diagrams and Workflow Sequence diagrams., Alerts, Monitoring, and software for a Controller Unit..
- The Controller Unit hardware consist of
- the challenger kit with the 2 hats wired to the PI 4.
- a waterproof sensor connected to the PI 4
- For now the software will be running on one PI. But I hope to implement the software between 2 pi's and a PI W zero.
-
Operating System
- The following Operating systems will be tested with the system., I have the following 3 OS's running on my various PI 4.
- Raspberry Pi OS with desktop and recommended software
-
- Kernel version 5.4
-
- Size: 2.94MB
-
- 32-bit
-
- Raspberry Pi OS with desktop
-
-
- Kernel version: 5.4
-
-
-
- Size: 1,177MB
-
-
-
- 32-bit
-
-
- DietPI for Raspberry Pi
- The following Operating systems will be tested with the system., I have the following 3 OS's running on my various PI 4.
-
-
-
- Running on a Raspberry PI Zero W
-
-
-
- Experimenting for potential implementation of future components.
-
- The current OS version being developed on is
- Raspberry Pi OS with desktop and recommended software
- I'm also interested in experimenting withthe 64-bit Ubuntu OS
- I plan on following this PAGE to install on one of my PI 4's
- Experimenting since Mongo Server is not supported on an ARM32-bit OS like .the previous 2 types of PI OS above.
-
-
Development tools
- I have used the following tools for development
-
- Python3
- WEB PAGE
-
For Debian or Ubuntu,
-
install the python3.x and python3.x-dev packages.
-
- This was already installed on most of the Linux systems on the PI
- MU editor
- WEB PAGE
pip3 install mu-editor
- this is not installed with Raspberry Pi OS with desktop and recommended software
- Microsoft VS Code
-
- VS Code On Linux
-
The easiest way to install Visual Studio Code for Debian/Ubuntu based distributions is to download and install the .deb package (64-bit),
either through the graphical software center if it's available, or through the command line with:
- Python3
-
-
-
sudo apt install ./<file>.deb
-
-
-
-
- Not sure if this runs on buster 32-bit? ABS: YES, you will need to install the 32-bit version
-
-
Libraries
- The following list are the python libraries that I use for the system
-
-
Name Description installation NOTES/Comments pymongo Mongo DB client Need to research clockit Used for timing and clocks. Need to experiment with this lib smtplib Email client Need to experiment with this lib timer2 Timer Need to experiment with this lib automationhat
Automation Hat curl https://get.pimoroni.com/automationhat | bash Refer to Blog# 4 EAS - Research and Unboxing of the challenge kit Package:
enviroplus-python
libs for the Enviro HAT git clone https://github.com/pimoroni/enviroplus-python
cd enviroplus-python
sudo ./install.sh
Refer to Blog# 4 EAS - Research and Unboxing of the challenge kit bme220 Weather Sensor (Temperature, Air Pressure, Humidity) lib from the enviroplus-python smbus Bus library lib from the enviroplus-python Refer to inBlog# 4 EAS - Research and Unboxing of the challenge kit st7735 Display lib for both the Enviro and Automation Hats lib from the enviroplus-python Refer to Blog# 4 EAS - Research and Unboxing of the challenge kit wttempsensor Water Temperature sensor sudo apt-get install python3-w1thermsensor refer to Blog# 5 EAS - Research Temperature Sensor - DS18B20
-
-
Class Diagram
Here is the class diagram for the software.
-
Software Workflow Sequence Diagrams
- These are the workflows that will be implemented in the system to maintain an ideal growing environment for spirulina..
-
Maintaining an ideal growing temperature of the water
-
-
-
- Studies have found that the ideal temperature is 35C (95F) and should be maintained Between 8C (46.4F) AND 45C (113F)
- Log the Datetime and Value to the data Repository.
-
-
-
Maintain Oxidization in the water
- To maintain an ideal Oxidation level in the tank, an air pump will be used.
- The Air Pump will be Turned On 1 minute 3 times a day
- Log the datetime and value ON/OFF to the Repository.
-
-
- To maintain an ideal Oxidation level for growing spirulina, the following flow will be used:
-
-
-
Maintain the right Amount of light exposure
- Studies show, that to improve the growth rate:
-
- a light can be turned ON every hour for 45 minutes and OFF for 15 minutes
-
- From 7am to 10pm.
- A Lamp will will be turned off and on, at these times.
- Log the datetime and value ON/OFF to the Repository
- To maintain the right amount of light exposure for growing spirulina, the following flow will be used:
-
Keep the Growing House Environment at ideal condition
- The following workflows, all handle the room environment and will use the sensors on the Enviro Hat.
- The design will be to sense the environment and adjust the room with the devices hanging off the Automation Hat.
- Also send out alerts if the conditions are not met.
-
-
-
Keep the Humidity at 50%
- Try to keep the humidity around 50% and send an alert if it goes DOWN or UP by 20%
-
-
-
-
-
-
- Log the Datetime and Value to the data Repository.
- To maintain the right amount of light exposure for growing spirulina, the following flow will be used:
-
-
-
-
-
-
Keep the Temperature at 70F degrees
- Try to keep the temperature at 70F degrees and send an alert if it goes down or up by 20F degrees.
- Log the Datetime and Value to the data Repository.
- if the temperature is less than 70F, turn ON the room heater
- if the temperature is greater than 70F, turn OFF the room Heater
- If the temperature is > 80F and the heater is ON, Turn OFF the Heater and send an Alert
- If the temperature is < 50F and the Heater is OFF, Turn ON the Heater and send an Alert
- Log on/off commands and Email sent to the Data store.
- The following flow will be used:
-
Make sure the light is operational.
- Use the LUX sensor to monitor the Light sensitivity by capturing & storing, the values over the operation of the software.
- Log the Datetime and Value to the data Repository.
- if the lux level is low and within the timeframe of 7am to 10pm.and it's within 45 minutes of the hour, then send an alert that the light should be ON
-
- The following flow will be used:
-
-
-
Telemetry Data Repository
- Mongo DB will be used to persist the data from the system.
- For people that are not aware, Mongo is a NO-SQL database. Here's a link to the Developer Page
- The Mongo DB server can run on a Raspberry PI ,But: there are limitations with the OS version your using.
- not supported on raspberry PI OS ARM32
- Need to research what 64-bit OS to run the server on.
- There is a Mongo Client library written in python called pymongo
- on PyPi you can get a version of the client library.
-
-
- The questions I have at this point are:
- what version of the client pymongo do I need on which OS?
- pymongo version on ARM32?
- PyPi recommends using pip to install pymongo on all platforms:
-
- that way your assuring that you are getting the correct supported version for your installed OS
-
-
$ python -m pip install pymongo
-
- The questions I have at this point are:
- For these reasons , I'm Considering connecting to mongo Atlas. A Cloud based server.
- I have yet to connect to my Atlas server from my current PI configuration. But I'll be working on these issues,
- Since there are no tables to design, I will be designing the schema as I implement the code.
- I'll probably write a separate blog on mongo DB for my design. So stay tuned.
-
-
Alerts
-
- the software will send out alerts if certain components of the growing environment are out of operation range, malfunctioning, etc.
- Send the alert in an email to the system operator.
- Or flash a warning on the Monitor Dashboard (Described below)
-
Controller Unit script
-
This is the main script that will control and sense the growing room environment.
- It will bring together all the sections described above into a controller python script.
- The Classes described in Diagram will be implemented..
- The libraries described in the section will be used for various tasks.
- the Workflows described in the Sequence diagrams will be implemented.
- Data values will be saved to a MongoDB server.
- Alerts will be sent out.to the system operator.
-
-
Monitoring Dashboard
- This software will display historical and current telemetry data from the controller software.
- read telemetry data from the Data Repository for analysis
- report on historical data from the controller.
- generate charts.
- This Dashboard will run on another OS platform connecting to the Mongo DB Server.
- Display warnings from the controller through the Data Repository.
- This software will display historical and current telemetry data from the controller software.
Conclusions
- My original design included 2 raspberry PI4's with the hat's attached to each one, but I will wire up the hats to one PI4 for now
- I will leave the 2 Pi4 design for a future project, experimenting with process to process communication between them.
- I've gained a tremendous amount of knowledge compiling this blog post.
- I was able to brush up on my OS, UML and MongoDB skills. ,And I learned a few new tricks and tips along the way
- I Expanded my knowledge about:
- Other Raspberry PI Operating systems
- Other Available python libraries
- Some New Program editors and old favorites like VS Code.
- Now onto the system build described in the next blog
|
REFERENCES
|
---|---|
https://developer.mongodb.com/how-to/mongodb-on-raspberry-pi | |
https://pimylifeup.com/mongodb-raspberry-pi/ |
,<<< PREVIOUS BLOG |
NEX BLOG >> |
|
---|---|---|
|
Blog# 8.1 (Part 1 of 2) EAS - System Build |
Top Comments