element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
1 Meter of Pi
  • Challenges & Projects
  • Design Challenges
  • 1 Meter of Pi
  • More
  • Cancel
1 Meter of Pi
Blog Gr0G - 10 - Software design
  • Blog
  • Forum
  • Documents
  • Polls
  • Files
  • Events
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: amgalbu
  • Date Created: 13 Nov 2020 4:11 PM Date Created
  • Views 440 views
  • Likes 4 likes
  • Comments 1 comment
  • 1meterofpi
  • gr0g
  • 1meter of pi
Related
Recommended

Gr0G - 10 - Software design

amgalbu
amgalbu
13 Nov 2020

Here is a list of the posts in this challenge

Gr0G - 01 - Introduction

Gr0G - 02 - Why aeroponics?

Gr0G - 03 - High-pressure system design

Gr0G - 04 - Mechanical design

Gr0G - 05 - Electrical design

Gr0G - 06 - Building the box

Gr0G - 07 - Playing with the Gertbot

Gr0G - 08 - Installing LEDs

Gr0G - 09 - The control board

Gr0G - 10 - Software design

Gr0G - 11 - Building the box (2)

Gr0G - 12 - Building the high-pressure system

Gr0G - 13 - Building the high-pressure system (2)

Gr0G - 14 - Piping

Gr0G - 15 - Improvements

Gr0G - 16 - Remote UI

Gr0G - 17 - Remote UI (2)

Gr0G - 18 - Conclusions

 

Source code available at https://github.com/ambrogio-galbusera/gr0g, https://github.com/ambrogio-galbusera/gr0g-ble-android and https://github.com/ambrogio-galbusera/gr0g-ble

 

Tools

I don't like to reinvent the wheel, so I would really prefer to start from an existing library that can simplify the access to all the functionalities of both the Enviro Hat and the Gertbot.

Gertbot provides libraries in C and Python, but libraries for Enviro Hat are available only for Python. So the choice is simple: I will write the application in Python. Which is, in some way, good because it is an opportunity for me to learn a new programming language

 

Assumptions

To develop the application, the following assumptions have to be considered

  • there is no Internet connection on a starship: you can not use any online service or do any API mashup
  • KISS - keep it simple stupid (keep it simple, stupid) because the less the code, the less the bugs
  • it's important to segregate related functions in classes, because it's not clear yet how to properly control the environment inside the box. For this reason, it's important to be able to change control logic without affecting other parts of the system

 

Software architecture

The application will be a basic process control loop that will

  1. Read sensors
  2. Process the sensors data
  3. Drive the outputs

Alongside the control loop, there will be a task to show sensors readouts on the Enviro Hat display.

 

The picture below shows the classes being developed and their interactions

image

 

The main classes involved in the software architecture are

  • DataStore: stores a sensor readouts (both current and historical values). Currently I'm planning to keep all the data in memory, but the class can be eventually extended to handle a database
  • Sensors: handles the communication with the PiMoroni Enviro hat
  • ScreenManager: manages the navigation through the screens. Each Screen class implements two functions: update (to update the screen content) and handleKey (to handle the key press events). The ScreenManager keeps track of the current screen and reacts to the key event that the current Screen is not able to handle
  • Display: implements some user-friendly functions to make access to the PiMoroni Automation Hat's display easier
  • xxxController: implements the logic to control a specific component of the Gr0G box (fan, condenser, LEDs, solenoid valve). Each xxxController class has full access to the DataStore and can apply a control logic that can be customized and changed as the project evolves. Each xxxController also includes a class (Fan, LED, Condenser, SolenoidValve) that hides the details regarding the access to the physical board

 

The diagram below shows how classes interact

image

 

The screens I am currently planning to develop are

  • Home: shows an overview of the current box status (temperature, humidity, light)
  • Temperature chart: show a chart with the last 160 temperature readouts
  • Humidity chart: show a chart with the last 160 humidity readouts
  • Light chart: show a chart with the last 160 light readouts
  • Settings: shows the current settings, namely
    • Day duration: duration of the day
    • Night duration: duration of the night
    • Spray interval: how often the solenoid valve is opened to feed the plants with the air-water mixture. According to the literature, the best method to provide nutrients to the plants in an aeroponic system is to dispense at regular intervals. I will try this simple approach at first. Then, depending on the results, I will eventually implement a more complex algorithm
    • Spray time: the amount of time the solenoid valve stays open
    • Temperature setpoint: when temperature inside the box reaches the threshold, the fan is switched on to cool down. I did not provide an heater because I expect the starship environment control system to keep the temperature at a comfortable value. The only problem I foresee is that the electronic components inside the box may cause undesired raise in internal temperature that we must be able to cope with
    • Humidity setpoint: when humidity inside the box reaches the threshold, the condenser is switched on. To build the condenser, I will use a Peltier cell and a PC heat sink. The Peltier cell will cool down the heat sink and, as a consequence, the humidity will condense on the heat sink itself

image

  • Sign in to reply

Top Comments

  • DAB
    DAB over 4 years ago +1
    Nice update. DAB
  • DAB
    DAB over 4 years ago

    Nice update.

     

    DAB

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube