Hardware


BEST HARDWARE, HIGH SCHOOL WINNER

Hardware - Metalytic


“Metalytic” is a compact bacterial culturing system that integrates AI vision and IoT technology for the automatic detection and notification of color changes in bacterial cultures. In our project, Metalytic is utilized to monitor and analyze chromoprotein expression in GM E. coli cultures, which indicates the levels of heavy metals in the samples.

Please come visit our Booth T-8 (Group A) to see the final product of our hardware!

Figure 1: 3D model of Metalytic. Showing the bacteria culture chambers, magnetic stirrer and the ESP32Cam for imaging.


Our team has developed genetically modified E. coli strains specifically designed to detect heavy metals. We engineered and transformed recombinant plasmids—pPbrR-dTomato for lead (Pb), pZntR-eforRed for zinc (Zn), pCadA-amilCP and pYodR-amilCP for cadmium (Cd), and pMerR-tsPurple for mercury (Hg)—into these strains. Each strain expresses distinct chromoproteins, resulting in colour changes: pink for Pb, red for Zn, blue for Cd, and purple for Hg, in the presence of their respective metal ions.

By monitoring these colour changes and their intensities, we can determine the presence of heavy metals and assess whether their concentrations exceed safe limits. Theoretically, higher concentrations of heavy metals facilitate the formation of more chromoproteins, resulting in increased colour intensity. Therefore, if the colour intensity of the captured image surpasses the established safety limit (the intensity of the GM E. coli at the corresponding concentration), it indicates that heavy metal levels are above acceptable thresholds.

However, synthesising chromoproteins takes time, necessitating regular checks. To address this, we decided to build a machine capable of automatically detecting colour changes in the genetically modified E. coli using AI vision. This allows us to determine whether the sample solution contains excessive metal ions that could be harmful to health. If this capability is realised, we can promptly contact the relevant government organisations responsible for monitoring heavy metal levels for follow-up actions, thereby preventing potential harm to public health and enhancing public hygiene.


The enginnering of Metalytic involved model design, programming and testing.




Design Concept:


We incorporated feedback from human practices into the design of Metalytic. Our goal is to create a product that is appealing to users.

  1. Our goal is to develop an effective and affordable device to address the public concerns regarding heavy metal contamination in daily life.
  2. We have minimised the dimensions of Metalytic to improve its portability, enabling users to conduct heavy metal detection freely, anytime and anywhere.
  3. We developed an AI vision model equipped with advanced image recognition capabilities to facilitate robust analysis, supported by an extensive database and adaptive algorithms. In comparison to human vision and colorimeters, it offers superior sensitivity and reliability in detection.
  4. To achieve our automation goals, we established a global online server powered by AI, which periodically analysis sample solutions with minimal human intervention. Upon detecting a colour change, IoT services are activated, promptly notifying users via SMS messages. Meanwhile, we installed an LCD screen that displays the detection results to ensure immediate user notification.



Features of Metalytic :


  • The use of fiberboard
  • Metalytic has been designed with a focus on ease of manufacturing and repair. During the prototype development, we discovered that cardboard was too fragile compared to acrylic boards. However, 5mm acrylic boards presented challenges in laser cutting and raised environmental concerns, fiberboard emerged as the ideal solution.

    Fiberboard offers a perfect balance of durability and maneuverability, making it easy to work with. Additionally, its biodegradability aligns with our commitment to sustainability. Most importantly, fiberboard allows for efficient mass production through laser cutting, streamlining our manufacturing process. This thoughtful choice not only enhances the performance of Metalytic but also supports our environmental goals.



  • Mortise & Tenon Joint structure

  • Figure 2: Mortise & Tenon Joint Structure of Metalytic.

    After extensive research, we chose to incorporate mortise and tenon structures, a technique that Chinese architects have successfully used in wooden buildings for over 7,000 years, into our Metalytic.

    This approach offers several advantages. Firstly, it significantly reduces manufacturing costs, as we only need to produce plates with mortise and tenon joints instead of constructing the entire device from scratch. Secondly, the work-in-progress (WIP) has a smaller footprint compared to a fully assembled machine, which lowers delivery costs. Lastly, this design is user-friendly, enabling customers to easily repair components on their own. Overall, the use of this traditional joinery technique enhances both efficiency and accessibility in our product.

    The prototype was designed using the product development platform "onshape". Here is a link to the view only document of Metalytic, with Onshape you have option to export "dxf." file for laser cutting. We had produced a few prototypes of Metalytic using fiberboard.

    We constructed several prototypes, including the one shown in Figure 2, demonstrating that the design of our Mortise & Tenon Joint structure is functional.



  • E. coli culture system
  • In the development of our bacterial culture system for GM E. coli expressing heavy metal reporters, we incorporated insights gained from consultations with Prof. Ngo Chi Ki, Jacky, and Prof. Tsui Tsz Ki, Martin. Acknowledging the critical importance of maintaining a controlled environment, our design emphasizes precise temperature regulation at 37°C and consistent agitation for optimal chromoprotein expression.

    Figure 3: Temperature-control unit that maintains an optimum temperature for E.coli’s growth and culture.


    Figure 4: Magnetic stirrer that promotes the oxygen penetration

    The temperature control mechanism is designed using an Arduino R3 microcontroller, integrated with a DHT11 temperature sensor to monitor environmental conditions. This system includes a fan for cooling and a heater to maintain optimal growth conditions for E. coli. To ensure uniform mixing of the bacterial culture, we implemented a stirring apparatus that features motors, magnet pieces, and magnet rods. This setup not only regulates temperature effectively but also promotes consistent agitation, crucial for the healthy growth of E. coli in a controlled environment.

    During our wet lab session, we attempted to grow bacteria without stirring or at room temperature. We discovered that the bacterial cultures did not grow well under either condition. This indicates that both stirring and a temperature of 37°C are essential for our device. We assembled the circuit and tested our program code. Both the heating element and magnetic stirrer functioned as intended. To prevent splashing of the bacteria caused by the magnetic stirrer running too fast, we experimented with different voltage levels and found that a lower voltage (2V) was more suitable. For all the required Arduino codes and hardware list, it is documented in the HongKong-JSS gitlab respository.

    We tested bacterial growth using stirring and heating with Metalytic. After 24 hours, the culture became visibly cloudy, indicating positive growth. However, due to the small volume, evaporation was significant. We used parafilm to seal the growing chamber and prevent evaporation. For future designs, we should consider adding a transparent lid.




  • Colour sensor using AI vision
  • Figure 5: Colour sensor using AI vision.

    Using AI and machine learning significantly enhances the analysis of bacterial chromoprotein expression. By processing large datasets from imaging and automating color analysis, AI improves both efficiency and consistency.

    We employed four ESP32 CAM modules as webcams to capture the color changes of GM E. coli with heavy metal-specific reporters. Each camera is equipped with an integrated light source, allowing for photo capture even in low-light environments. Additionally, we incorporated an ESP32 board to facilitate Wi-Fi connectivity, enabling direct communication between the ESP32 cameras and the online server. This setup streamlines data acquisition and enhances the overall efficiency of our monitoring system.

    The cameras continuously monitor the color changes of the GM E. coli and upload images to the server for analysis. The AI model processes these images to accurately identify colors and assess their intensity. If heavy metal levels exceed safety limits, an alert is triggered, and a notification is sent via SMS.

    We set up an AI server on the cloud platform "PythonAnywhere" and successfully connected the ESP32CAMs to it. As illustrated below, we can view images from the four cameras, along with a log indicating that they are regularly sending frames to the server.




  • SMS notification & Instant alert
  • We employ IoT technology to connect the machine with the user effectively. If heavy metal levels exceed safety limits, the system triggers IoT services to notify users via SMS. In future planning, these notifications could also include contact information for relevant government organizations, such as the Centre for Food Safety and the Water Supplies Department, facilitating timely follow-up actions.

    Figure 6: SMS notification sent if the heavy metal content exceeds the safety threshold.

    Figure 7: LCD screen showing detection results.

    Additionally, to ensure immediate user notification even if a mobile device is unavailable, we have installed an LCD screen on the device that displays detection results. If the concentration of heavy metals surpasses the safety threshold, a prominent warning will be shown on the screen, ensuring that users are promptly informed.

    We tested and the LCD can display information as intended. The code for the Arduino uno r3 that control all these is documented in the HongKong-JSS gitlab respository.

    We also tested the SMS / Whatapps alert function. It also works well.




  • Rechargeable power unit & Transformer
  • Figure 8: Rechargeable power unit & Transformer.

    We favour rechargeable batteries over disposable ones due to their superior convenience, waste reduction, and environmental benefits. Rechargeable power units not only enhance the user experience but also mitigate pollution risks associated with the leakage of hazardous battery chemicals. Specifically, we utilise rechargeable lithium batteries, which serves as a more sustainable energy source compared to traditional primary batteries.

    We incorporated a transformer to manage the voltage and current disparities among the various electrical components. Additionally, we strategically separated the power control area from the loading dock to mitigate the risk of splashing, which could potentially damage the circuitry and create safety hazards.

    During the prototype development, we discovered that the fan and heater could disrupt the circuit due to its excessive energy draw. Consequently, we isolated the fan and heater from the main power supply and implemented a PWM control method to prevent circuit failure.



  • Sterilisation using low-power UV light and bleach
  • Figure 9: Sterilisation unit.

    We have implemented a low-power UV light system for sterilization prior to testing, which is essential to prevent potential contamination that could affect the GM E. coli cultures. Additionally, to mitigate the risk of GMO leakage, we have installed a bleach dispensing system that introduces bleach directly into the Petri dish. This system effectively eliminates GM E. coli and degrades its DNA, thereby minimizing the risk of GMO transmission.

    Looking ahead, we recognize the need for an even more robust solution. As part of our future plans, we aim to incorporate a kill switch within the GM E. coli strains. This enhancement will further ensure containment and safety in our operations.



  • Website and Software for monitoring backend processes
  • Figure 10: The management website.

    Figure 11: The management software

    We have developed a multifunctional website and software that enables us to perform various operations while promptly addressing any unforeseen bugs that may arise. The website is hosted on PythonAnywhere, an online integrated development environment and web hosting service built on the Python programming language.

    1. AI model training.
    2. Live streaming of the image captured by the ESP32 CAMs.
    3. Adjusting the colour standard.
    4. Adjusting the time interval for sending SMS notification.
    5. Making predictions for the detection result.
    6. Logs are available to access there.



Programme involved in Metalytic


We wrote a micropython programme to instruct our device to:

    1. Detect colour and analyse its intensity using AI vision.
    2. Send notification to users via SMS automatically, the colour detected exceeds the safety threshold formulated.
    3. Display detection results on the LCD screen.

We also wrote an Arduino programme to instruct our device to:

    1. Maintain an optimum temperature for E. coli’s growth and culture.


Details of the coding part are as follow:

  • Detect colour and analyse its intensity using AI vision.
  •     @app.route('/stream/', methods=['POST'])
        def stream(camera_id):
            global LAST_SMS_TIME
    
            update_log_file(f"stream; {camera_id}", TXT_FILE_PATH)
            if camera_id not in [1, 2, 3, 4]:
                update_log_file(f'Invalid camera ID: {camera_id}', TXT_FILE_PATH)
                return jsonify({'status': 'invalid camera ID'}), 400
    
            file = request.files['file']
            filepath = CAMERA_FRAME_PATHS[camera_id - 1]
            file.save(filepath)
            update_log_file(f'Frame received from camera {camera_id}.', TXT_FILE_PATH)
    
            if is_predict_image_enabled:
                try:
                    result = predict_image(image_path=filepath)
                    update_log_file(f'Prediction result for camera {camera_id}: {result}', TXT_FILE_PATH)
    
                  detected_colors = []
    
                  # Check each color against its respective threshold
                    if result.get('pink', 0) > pink_threshold:
                        detected_colors.append('pink')
                    if result.get('blue', 0) > blue_threshold:
                        detected_colors.append('blue')
                    if result.get('deep_red', 0) > deep_red_threshold:
                        detected_colors.append('deep_red')
                    if result.get('blue_purple', 0) > blue_purple_threshold:
                        detected_colors.append('blue_purple')
      
  • Send notification to users via SMS automatically if the colour detected exceeds the safety threshold formulated.
  •     if detected_colors:
                    detected_colors_str = ', '.join(detected_colors)
                    message = (f"\nTimestamp: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}\n"
                              f"WARNING\n"
                              f"{metal_name[detected_colors_str]} exceeded safety level\n"
                              f"Pls contact Centre for Food safety : +852 1823 or 2868 0000")
    
                    current_time = time.time()
                    if current_time - LAST_SMS_TIME >= SMS_RATE_LIMIT_SECONDS:
                        #send_sms(to_list=tele, body=message)
                        send_whatsapp(to_list=tele, body=message)
                        LAST_SMS_TIME = current_time
                        update_log_file(message, TXT_FILE_PATH)
                        update_log_file(f'SMS alert sent for colors: {detected_colors_str}.', TXT_FILE_PATH)
                        frame_save_path = os.path.join(BASE_DIR, 'saved_image', f'camera{camera_id}-frame-detected.jpg')
                        shutil.copy(filepath, frame_save_path)
                        update_log_file(f'Frame saved to: {frame_save_path}', TXT_FILE_PATH)
                        update_log_file(f'SMS alert sent for colors: {detected_colors_str}. Frame saved at: {"https://tom4997.pythonanywhere.com/" + frame_save_path[1:]}', ESP_PATH)
                    else:
                        update_log_file(f'SMS rate limit not reached. No SMS sent for colors: {detected_colors_str}.', TXT_FILE_PATH)
            except Exception as e:
                update_log_file(f'Error during image processing or prediction: {e}', TXT_FILE_PATH)
    
        return jsonify({'status': 'success'})
      
  • Display detection results on the LCD screen.
  •     import network
        import urequests
        import time
        from machine import I2C, Pin
        from lcd_api import LcdApi
        from i2c_lcd import I2cLcd
          
        # Wi-Fi credentials
        SSID = 'ABCD'
        PASSWORD = '00000000'
          
        # URL for fetching logs
        URL = 'https://tom4997.pythonanywhere.com/get_logs'
          
        # LCD settings
        I2C_ADDR = 0x27
        TOTAL_ROWS = 2
        TOTAL_COLUMNS = 16
          
        # Initialize I2C and LCD
        i2c = I2C(scl=Pin(22), sda=Pin(21), freq=400000)
        lcd = I2cLcd(i2c, I2C_ADDR, TOTAL_ROWS, TOTAL_COLUMNS)
          
        def connect_wifi():
          wlan = network.WLAN(network.STA_IF)
            wlan.active(True)
            if not wlan.isconnected():
                print('Connecting to WiFi...')
                wlan.connect(SSID, PASSWORD)
                while not wlan.isconnected():
                    pass
            print('WiFi connected')
          
        def fetch_logs():
            response = urequests.get(URL)
            if response.status_code == 200:
                return response.json()['logs']
            else:
                print('Failed to fetch logs')
                return []
          
        def process_logs(logs):
            detected_metals = []
            for log in logs:
                if 'detect the heavy metal for camera' in log:
                    metals = ['Pb', 'Zn', 'Cd', 'Hg']
                    for metal in metals:
                        if f'{metal} exceeded safety level' in log:
                            detected_metals.append(f"{metal} detected")
            return detected_metals[::-1]  # Reverse the list to show from furthest to current
          
        def display_on_lcd(message):
            lcd.clear()
            lcd.putstr(message[:TOTAL_COLUMNS])
            if len(message) > TOTAL_COLUMNS:
                lcd.move_to(0, 1)
                lcd.putstr(message[TOTAL_COLUMNS:TOTAL_COLUMNS*2])
          
        def main():
            connect_wifi()
            last_fetch_time = 0
            message_index = 0
            messages = []
          
            while True:
                current_time = time.time()
                  
                # Fetch new data if it's been more than 1 minute since last fetch
                if current_time - last_fetch_time >= 60:
                    try:
                        logs = fetch_logs()
                        messages = process_logs(logs)
                        if not messages:
                            messages = ["No metals detected"]
                        last_fetch_time = current_time
                        message_index = 0
                    except Exception as e:
                        print(f"Error: {e}")
                        messages = ["Error occurred"]
                        message_index = 0
          
                # Display current message
                if messages:
                    display_on_lcd(messages[message_index])
                    message_index = (message_index + 1) % len(messages)
          
                # Wait for 10 seconds before showing the next message
                time.sleep(10)
          
        if __name__ == '__main__':
            main()
      
  • Maintain an optimum temperature for E. coli ’s growth and culture.
  •     #include 
    
          #define DHTPIN 2
          #define DHTTYPE DHT11
          #define FANPIN 7
          #define HEATERPIN 13  // New pin for heater control
          
          DHT dht(DHTPIN, DHTTYPE);
          
          void setup() {
            Serial.begin(9600);
            dht.begin();
            pinMode(FANPIN, OUTPUT);
            pinMode(HEATERPIN, OUTPUT);
          }
          
          void loop() {
            delay(2000);
          
            float humidity = dht.readHumidity();
            float temperature = dht.readTemperature();
          
            if (isnan(humidity) || isnan(temperature)) {
              Serial.println("Failed to read from DHT sensor!");
              return;
            }
          
            bool fanStatus = false;
            bool heaterStatus = false;
          r
            if (temperature > 24) {
              analogWrite(FANPIN, 255);  // Full speed
              analogWrite(HEATERPIN, 0); // Heater off
              fanStatus = true;
            } else if (temperature < 20) {
              analogWrite(FANPIN, 0);    // Fan off
              analogWrite(HEATERPIN, 255); // Heater on full
              heaterStatus = true;
            } else {
              analogWrite(FANPIN, 0);    // Fan off
              analogWrite(HEATERPIN, 0); // Heater off
            }
          
            // Send data to ESP32
            Serial.print(temperature);
            Serial.print(",");
            Serial.print(humidity);
            Serial.print(",");
            Serial.print(fanStatus ? "1" : "0");
            Serial.print(",");
            Serial.println(heaterStatus ? "1" : "0");
            Serial.print("\n");
          }
      

    Many tools developed by iGEM teams have demonstrated professional quality, while others show significant potential for improvement by future teams. We are pleased to offer future iGEM teams a coding resource, contributing to the iGEM community.




    Cost of Metalytic


  • The following table lists out the costs of all materials and accessories for producing Metalytic.

  • The overall expenditure for developing Metalytic is approximately USD $20. In contrast to professional-grade instruments, such as ICP-MS, which are priced between USD $50,000 and $250,000 and offer precise detection of heavy metal content, our product significantly reduces the financial barrier, presenting a far more affordable option for everyday use by the general public. This innovative solution effectively addresses the existing gap in the availability of domestic-use devices for heavy metal detection.


    Total cost = $ 19.898
    Part Price (single) Price (Total)
    Cooling fan 0.43 0.43
    DHT 11 sensor 0.15 0.15
    ESP32 0.31 0.31
    ESP32 CAM * 4 0.57 2.28
    Extension board 1.87 1.87
    Fiberboard * 3 0.993 2.98
    Heater 0.43 0.43
    LCD screen 0.3 0.3
    Magnet piece * 8 0.0085 0.068
    Magnet rod * 4 0.11 0.44
    Motor * 4 0.26 1.04
    Pipe 0.2 0.2
    PWM switch 0.28 0.28
    Rechargeable lithium battery * 2 2.41 4.82
    Transformer * 2 0.5 1.0
    UV light 1.47 1.47
    Water pump 0.33 0.33
    Wire * 20 0.075 1.5

    Table 1: Cost of Metalytic (In USD)



    Pros of the Metalytic:


    • Metalytic is designed to operate routinely and automatically, monitoring chromoprotein synthesis and its intensity.
    • If heavy metal content is detected to exceed safety thresholds, an alert will be triggered, displaying a warning on the LCD screen, while a notification is simultaneously dispatched via SMS.
    • The compact design of Metalytic not only reduces production costs but also enhances portability, facilitating mass production and improving user convenience.
    • We aspire for our machine to provide an accessible option for the general public, facilitating repeated use. To achieve this, we have made concerted efforts to minimize production costs. The GM E. coli can be cultivated periodically, and the electronic components employed are engineered for long-term durability. Consequently, Metalytic is highly affordable for daily use by most individuals.


    Limitation:


    1. Learning from TCM partitioners, TCM can be consumed in powder form. Metalytic is not designed to detect heavy metals in solid samples, as bacterial cultures necessitate liquid media for effective analysis.
    2. Our device's detection range is limited by the specific types and concentrations of heavy metals that our GM E. coli can respond to. Further refinement of our GM strains is needed for broader detection capabilities.
    3. Based on current web lab data, the range and types of heavy metals that our GM E. coli can respond to are as follows:
      • Pb: 0.1µM to 10 µM
      • Cd: 200µM
      • Hg: To be determined
      • Zn: To be determined


    Future directions:


    • We may need to test additional promoters and fine-tune their strength by modifying their DNA sequences. This approach will broaden the spectrum of heavy metals that can be detected.
    • Additionally, we may need to investigate a broader range of reporter genes to determine if they can provide a stronger or more stable signal, thereby enhancing the sensitivity of our device.
    • To improve the accuracy and reliability of the AI vision model, we will expand our database by collecting additional samples for training purposes.
    • To expand the functionality of our machine, we may need to investigate collection methods that facilitate the detection of samples from diverse environments. For instance, since smog can contain heavy metal particles, we could utilise wet cotton wool to effectively capture these particles from the air and subsequently wash them down for analysis.
    • When we introduced Metalytic to the public at our street counter, some citizens pointed out that the management interface hosted on "PythonAnywhere" was complicated. In response, we are developing an app that will connect directly to our server, featuring all the necessary functions with a cleaner and more user-friendly interface.
    • Furthermore, we will evolve our prototypes into various practical iterations tailored to meet the specific needs of different stakeholders.