Close
0%
0%

Spongebob that indicates drowsiness levels

Usually, high CO2 in a room can cause drowsiness. This Spongebob gets sleepy as CO2 level in the room rises so you can open the windows!

Public Chat
Similar projects worth following
I came up with the idea of building a cool-looking CO2 monitor that is very intuitive to understand! It is basically an artwork of SpongeBob SquarePants (from the good old days!) whose eyelids move up and down to indicate how drowsy he gets based on the CO2 levels. When the CO2 levels are low, his eyes are wide open with his eyelids up. As the level rises, his eyelids gradually lower according to the ppm level. If his eyes are completely shut, it means there's too much CO2 in the room, and you better let some fresh air in!

This project was designed using EasyEda and I got the PCB manufactured by Seeed Fusion. The heart of the project is a MQ135 Air quality sensor and a Xiao esp32 c3 microcontroller. Then, I built the Spongebob body from low density PVC board. Finally, everything was assembled into an IKEA frame.

The main components of this project are the MQ135 air quality sensor and a Xiao esp32 microcontroller. The setup also contains five hall effect sensors, each one mapped to a certain CO2 ppm level. A motor is connected to the microcontroller through an L293D motor driver IC. This motor is a DIY linear motor that moves the eyelids up or down depending on the direction of rotation. The eyelids contain a magnet at the long end that can be detected by the hall sensors.

The microcontroller reads the MQ135 sensor’s analog output and converts them to the CO2 ppm levels with some math. This is done for a specific duration (5 minutes in my code) and the ppm values are averaged for that duration. Then, the microcontroller turns the linear motor on until the magnet is in front of the hall sensor that corresponds to the same ppm (within a tolerance range). This way the eyelids move to match the ppm level.

This can be done in several different ways. My earlier plan was to have a linear variable resistor (also called a slide potentiometer) in place of the hall sensors and magnet. The slider would be connected to the eyelids. When the motor would move the eyelids up or down, the slider would move along with it and change the resistance. The microcontroller could map the ppm level to the right resistance to achieve the same effect of indicating CO2 levels with the eyelids. However, I later discovered that slide pots have a working life of about 15,000 cycles after which they don’t function well. Even if the eyelids move 50 times a day, the pot will reach end of life in less than a year. So that would not work.

Another way would be to use an ultrasonic distance sensor to detect the distance of the eyelids relative to itself. This is a feasible way. I came up with this only after I ordered the PCB with the hall sensors, so I stuck with that.

co2_sensor_1.ino

Arduino code

ino - 2.99 kB - 09/25/2024 at 17:14

Download

Schematic_co2_monitor_magnetic_2024-09-22.pdf

Schematic diagram

Adobe Portable Document Format - 54.35 kB - 09/25/2024 at 17:14

Preview

  • 1 × Xiao esp32 c3
  • 1 × MQ135 air quality sensor
  • 1 × DC geared motor
  • 10 × Hookup wires
  • 5 × HALL effect sensors

View all 6 components

  • 1
    Making Spongebob's body

    Well, my design currently features SpongeBob without his SquarePants. However, you’re more than welcome to add the pants yourself, there's no rule against it! For this project, I decided to use Sunboard, a type of low-density PVC board. It's incredibly easy to work with while still being remarkably durable, making it perfect for this kind of craft.

    To start, I sketched SpongeBob’s design on a piece of A4 printer paper. I then transferred the design onto the Sunboard using tracing paper.

    I carefully cut out some of the holes on SpongeBob’s body from the main 5mm thick Sunboard. For additional details, I created separate circular cutouts from another 5mm thick Sunboard and also cut out the eyes since we will have a separate back section for them.

    I painted everything in SpongeBob’s classic yellow color

  • 2
    Making the Linear Motor

    Linear motors can be quite expensive, so I decided to make one on my own.

    To begin with, I selected a long M4 bolt and an accompanying nut. These components form the core mechanism of the linear motor. Using a two-component adhesive, I bonded the bolt head to a gear that fits onto the motor. ]

    Once the adhesive had set, I took a geared DC motor and connected the bolt to its head. With the bolt securely attached to the motor, I powered on the motor. By holding the nut with my fingers to prevent it from rotating, it moved forward or backward depending on the polarity of the motor input.

  • 3
    Modifying the CO2 Sensor

    The MQ135 air quality sensor module was used for CO2 detection, and an important component in its functionality is the load resistor, RL. This resistor adjusts its resistance value in response to varying gas concentrations, which is essential for accurate readings. According to the MQ-135 datasheet, the load resistor can have a value ranging from 10KΩ to 47KΩ

    For optimal performance, the datasheet recommends calibrating the sensor using 100ppm NH3 or 50ppm alcohol concentrations in the air, suggesting a load resistance (RL) of approximately 20KΩ. However, if you trace the PCB, you’ll find a 1KΩ (102) load resistor in place. To accurately measure CO2 concentration values, it’s necessary to replace this 1KΩ resistor with a 20KΩ resistor. So, I removed the existing 1kΩ resistor and soldered two 10KΩ resistors in series.


View all 5 instructions

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates