Hardware

The main purpose of this hardware is to facilitate the experimental part to have a relatively stable experimental environment, which ensures that the experiment is not affected by or less affected by external factors. At the same time, it can also conduct more accurate measurement and data collection of the experimental results. Similarly, our hardware can also accumulate some experience for future industrialization and practice.

The hardware part mainly includes light adjustment, sensors and its control display, 3D modeling and 3D printing. In the part of light adjustment, according to the experiment, we put several groups of blue and green lights on the upper part of the bioreactor, and can adjust their brightness by pressing keys to achieve the control of colony growth, and have a certain aesthetic effect; In the sensor and its control display part, we designed temperature, gas concentration and pH sensors according to the experimental needs to detect the relevant important parameters in the bioreactor, and display the data through the screen installed on the side wall of the bioreactor; 3D modeling and 3D printing are mainly used to make the base and top cover outside the bioreactor to ensure the airtightness and aesthetics of the bioreactor.

Table 1: electronic components

Blue-green brightness

Purpose:

Provide the controllable blue-green light equipment to realize that under blue light irradiation, the engineering bacteria express four catalytic enzymes in the nitrogen removal route, thereby reducing the nitrogen content in the sewage. Under green light, the engineered bacteria express nucleic acid hydrolase to achieve suicide and maintain the balance of bacterial density.

Methods:

This part is mainly supplied by multiple RGB lamps, which are fixed on the upper part of the bioreactor and connected to the stm32f103c8t6 fixed on the lower part of the bioreactor through DuPont wires. Since at least three buttons are required to control the blue and green lights, and there is only one reset button on this model of SCM, we connect two additional buttons: button 1 and button 2 to control the green lights and blue lights respectively. Press key 1 to control the four kinds of brightness of the green lights. In the code, PWM wave is output by using a timer; Press key 2 to control the four kinds of brightness of the blue lights, and the PWM waves are also output by using a timer. In the interrupt function, whether to change the brightness is determined by monitoring whether to press the key. Pressing the key is to adjust the PWM waves according to the preset duty cycle in the array. The different duty cycle of PWM waves will make the output voltage of GPIO port different, which will affect the power of RGB lamps and make RGB lamps appear different brightness. The RGB lights are initially off. When the operator presses key 1 once, the green light will turn on for a level. After reaching the highest level of brightness, pressing the key again will turn off the green lights; Press key 2 to control the blue lights, and the specific operation is similar to that of key 1; The reset key can turn off the blue lights and green lights under any conditions.

RGB lamps have 4 pins, which are used to control red lamps, green lamps, blue lamps and grounding. The red lights are not used in this project, so the red light pins can be vacated, and other pins can be connected to the corresponding singlechip pin.

Figure 1 RGB Lamp

In order to ensure sufficient brightness when the blue lights and green lights are initially lit, we not only adopt the design of multiple light strips, but also set the initial duty cycle to 50% according to the actual situation, which can basically meet the brightness requirements under various conditions. The stm32f103c8t6 used in this part is a common small singlechip.

Figure 2 stm32f103c8t6

Figure 3 Preliminary wiring diagram of blue-green light

The final result:

One end is connected to the power supply, and the other end is connected to the stm32f103c8t6 single chip microcomputer to supply power for the single chip microcomputer and burn the program; In the computer, program burning is carried out on the singlechip by using the burning environment flymcu. Meaning: The hardware designed above provides good light experimental conditions for this project, assists in confirming the existence of blue light, which can induce our engineered bacteria to highly express enzymes related to nitrogen removal, indicating that our engineered bacteria have the ability to reduce water nitrogen content and purify water quality.

Code:Interrupt Function

Code:PWM Configuration

Temperature detection

Objective:

Bacillus subtilis can grow and reproduce normally in the water temperature range of 10-40 °C, grow and reproduce slowly at 10-24 °C, and accelerate reproduction with increasing temperature, 25-37 °C is most suitable for growth and reproduction of microbial activity, in the carbon source is sufficient (that is, organic matter is abundant) when about 20-30 minutes to breed a generation, growth and reproduction after more than 48 °C is inhibited. In the water temperature below 5 to 10 degrees celsius subtilis can grow greatly inhibited, as the water temperature is getting lower and lower, the microorganism finally sleeps or dies. Therefore, the DS18B20 digital temperature sensor probe is used for temperature detection to ensure the normal growth and reproduction of Bacillus subtilis.

Device:

 DS18B20.

Connection method:

In this design, the red wire (VCC) of DS18B20 is connected to 5 V of the stm32f103c8t6 minimum system board , the black wire ( GND ) is connected to the GND of the minimum system board , and the yellow ( DATA ) is connected to the minimum system board the B12 .

Design method:

 Initialize DS18B20

All communication on the single bus starts with an initialization sequence . First, the single-chip microcomputer pulls the bus low for at least 480us , generates a reset pulse, and then releases the bus; after the bus detects the DS18B20 request, it pulls the low level for about 60 ~240us to indicate the response; Between 60~240us when DS18B20 is pulled low , the single-chip microcomputer reads the level of the bus. If it is low, it means that the initialization is successful, and then the bus is released.

Write timing:

The Bus Controller writes logic 1 or 0 into the DS18B20 by controlling the single bus high or low level duration. Only 1 bit of data is transferred at a time. When the microcontroller wants to write a 0 to the DS18B20, it needs to pull the microcontroller pin down, keep the level low for a time between 60 and 120us, and then release the bus. When the microcontroller wants to write a 1 to the DS18B20, it needs to pull the microcontroller pin down, the pull down time needs to be greater than 1us, and then pull the bus high within 15us.

During the period of 15μs to 60μs after the start of the write sequence , the DS18B20 is in the state of sampling the single bus level. If the bus is high during this period, write 1 to DS18B20; if the bus is low, write 0 to DS18B20.

Read timing:

The host pulls down the bus level for at least 1 μs and then releases the bus, and reads the 1 or 0 sent by the DS18B20. After the DS18B20 detects that the bus is pulled down for 1 μs, it starts to send data. If it wants to send a 0, pull the bus is low until the end of the read cycle. To send a 1, release the bus high.

There are also 3 commands that must be used for temperature conversion and temperature reading:

The core code to get the temperature value from D S18B20 is shown in the figure below.

pH detection

Objective:

Microbial growth and biosynthesis have their optimum and tolerated pH ranges, and the optimum range for most bacterial growth is 6.3 to 7.5. pH will affect the charge state of the cell membrane, causing the permeability of the membrane to change, which in turn affects the absorption of nutrients by the bacteria and the formation of metabolites, and also affects the stability of the product . Studies have shown that when the pH value is 6.0, the total number of bacteria and the number of spores are both lower, and with the increase of pH value, the total number of bacteria and the number of spores also gradually increase; when the pH value is 7.0, both reach the maximum value, and the spore production rate reaches 82.9 % ; then, with the increase of pH, the number of bacteria and spores decreased continuously . Therefore , the pH value has a significant impact on the number of spores, and it is necessary to detect the pH of the water body in real time to create suitable living conditions for Bacillus subtilis .

Device:

 pH sensor module.

Connection method:

The VCC of the sensor module is connected to the 5V of the minimum system board of stm32f103c8t6, the GND is connected to GND, and the PO is connected to PA0 , as shown in the following table.

Instructions:

Due to individual differences in pH electrodes and resistance errors in potentiometers, before using the pH module , first perform pH calibration to obtain a standard pH curve. The specific operation method is as follows.

Step 1: Connect the pH sensor module to the pH electrode , and unscrew the pH electrode protective cap. There is a bulb protection solution in the protective cap , be careful not to spill it.

Step 2: Provide 5V voltage to the module, so that the voltage is as close to +5.00V as possible. The more accurate the voltage, the higher the accuracy , so try to ensure the accuracy of the voltage.

Step 3 : Put the pH electrode into a standard buffer solution with a pH value of 6.86, and adjust the potentiometer knob until the output voltage of the PO port is about 1.7V.

Step 4: Put the pH electrode into the standard buffer solution with a pH value of 4.00, and adjust the potentiometer knob until the output voltage of the PO port is about 2.2V.

Step 5: Put the pH electrode into the standard buffer solution with a pH value of 9.18, and adjust the potentiometer knob until the output voltage of the PO port is about 1.3V.

Step 6: Excel to fit the curve formula according to the measured voltage value . The orange line in the figure is the standard formula of the 5V ADC acquisition system, and the blue line is the standard formula of the 3.3V ADC acquisition system.

Step 7: Connect the pH module to the AD conversion chip or the ADC acquisition interface of the microcontroller .

Step1 Power the module

Step2 Calibrate with pH=6.86 buffer

Step3 Calibrate with pH=4.00 buffer

Step4 Calibrate with pH=9.18 buffer

Step5 Curve fitting

Therefore, the relationship between the voltage collected by the ADC and the pH is obtained:

The following is the core code to convert the voltage value collected by A DC into the corresponding pH .

Ammonia gas detection

Objective:

The extracellular enzymes secreted by Bacillus subtilis can decompose and absorb protein , starch, fat and other organic matter in water and sediment, which can reduce the eutrophication of water and remove sediment. In the process of action, part of the organic nutrients is converted into cellular material, and most of them are converted into energy for bacterial activity. During its transformation, ammonia and nitrogen escape from the water to the atmosphere . This method can effectively reduce the nitrogen content of the water body, avoid the eutrophication of the water body, and achieve the purpose of purifying the water quality. In order to test whether Bacillus subtilis can effectively reduce the nitrogen content of water bodies, we need to detect the nitrogen content of water bodies. Using the reaction of Bacillus subtilis to convert ammonia nitrogen to produce ammonia and nitrogen, we will detect ammonia nitrogen in water bodies. The content is converted into the detection of the gaseous ammonia gas produced by the reaction.

Device:

 MQ-135.

Connection method:

Design method:

The MQ135 sensor has high sensitivity to ammonia, sulfide, and benzene-based vapors, and is also ideal for smoke and other harmful monitoring. This sensor can detect a variety of harmful gases and is a low-cost sensor suitable for a variety of applications. Figure 1 is a typical sensitivity characteristic curve of the sensor. The ordinate in the figure is the resistance ratio (Rs/Ro) of the sensor, and the abscissa is the gas concentration . Rs represents the resistance value of the sensor in different concentrations of gas, and Ro represents the resistance value of the sensor in clean air. All tests in the figures were done under standard test conditions.

From the NH4 curve, roughly take several sets of data:

ppm: [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 200]

Rs/Ro: [ 1.65 , 1.36, 1.20, 1.08, 0.98, 0.92, 0.89, 0.85, 0.82, 0.80, 0.65 ]

 

Use the software to fit the data to obtain a fitting curve that conforms to the fitting equation Y = a * X b , as shown in the following figure .

Among them, Ro is 10k, RL is 1k according to the schematic diagram of the module, Vcc is the power supply voltage 5V, Vout is the output pin, the voltage value collected by the ADC, and finally the formula is obtained:

Ro, RL, Vcc and Volt into C language to calculate:

The following is the core code for converting the voltage value collected by A DC into ammonia gas content:

WIFI connection to Alibaba Cloud

Objective:

The design is based on the s tm32f103 c 8t6 minimum system board and the MQTT communication project of the Alibaba Cloud IoT cloud platform. The project uses TCP/IP communication to connect to the Alibaba Cloud IoT cloud platform and uses the MQTT protocol to upload temperature sensors, air quality sensors and pH sensors . After collecting the data of the water body, you can log in to Alibaba Cloud with a laptop or mobile phone to observe the data of the three indicators in real time.

The picture shows the effect achieved.

Device:

 ESP-01S.

Connection method:

Design method:

The first is the flow chart of the use of E SP-01S, as shown in the following figure:

After the system is powered on, the first step is to initialize the WI-FI module pins, including the RESET pin of the WI-FI module. In this design, the WI-FI module communicates with the master STM32 through the USART3 serial port, so it is also necessary to use the USART3 ( Serial port 3) Initialize, and then configure the WI-FI module. First, the master STM32 sends the RST reset command to ESP8266 through serial port 2, and then clears the cache in ESP8266. According to the requirements of this design, the hardware acquisition layer is All the acquired data is transmitted to the cloud platform, so configure its working mode as "STA" mode (WI-FI mode). After configuring to STA mode, you need to connect to the mobile phone hotspot, and send AT commands to ESP8266 through serial port 2 to configure the name and password of the WIFI . After you can access the Internet, you can access the public network IP of the cloud platform.

Modeling and 3D printing

The hardware 3D modeling part is for the convenience of display, controller placement and wiring.We chose to use SolidWorks for modeling. The model includes two parts: shell and base.The transition fit is adopted between the two to ensure the stability of the structure, and there is no need to use other parts for fixing. The length, width and height of the fish tank are 300*170*200 respectively, while the inner size of the shell is 307*178*203, and the spare position is used for wiring.

Saving the model as a stl format file, import it into the 3D slicing software Miracle for slicing, and finally export the gcode format file and input it into a 3D printer for printing.

Finite Element Analysis

Finite Element Analysis in SolidWorks Simulation after the fish tank is assembled.First, assigning materials and correlation coefficients to each part, such as elastic modulus, Poisson's ratio, mass density, etc.Then, the connection between the shell and the base is set as a rigid connection to ensure that large displacement deformation will not occur under external force;Setting the relationship between components to global interaction to ensure that there is a stress relationship between the shell and the base, not two relatively independent components.

Set the fixture on the bottom of the base and keep the bottom surface in a fixed state. Because the purpose of this analysis is to explore the force of the water and the glass cylinder on the pressure of the base, an external load is added to the glass cylinder, including the pressure of the water and its own gravity, and the water here has pressure on the surrounding.

Finally, mesh the assembly as a whole, and perform finite element analysis after success.The finite element analysis results are as follows:

①Displacement:The maximum displacement is 8.913*10^-4 mm, and the minimum displacement is 1.000*10^-30 mm.

It shows that under this pressure, the base hardly deforms, and the design is reasonable.

②Stress:The maximum stress is 2.445*10^4 N/m^2, and the minimum stress is 0N/m^2.

However, since the maximum stress is only located at the connection between the outer casing and the glass cylinder, the area is very small, and under practical conditions.

The shell is not affected by external forces other than gravity, and the overall stress of the model is blue, that is, the average value is below 2.445*10^3.

③Strain: As shown below