Automatic Ventilation With a Hatch

by protyg7 in Circuits > Arduino

120 Views, 1 Favorites, 0 Comments

Automatic Ventilation With a Hatch

IMG_9845.jpg

The aim of this project is to set up the ventilation system needed to maintain the reactor's humidity. An electronic system will be developed using the Arduino microcontroller, which will use data from a humidity sensor to operate the fan. The microcontroller will also be used to open and close the fan in relation to the culture medium, driving a rack-and-pinion system to move a trap door.

Supplies

For the electronic circuit:

  • Arduino board, or your microcontroller of choice
  • a DHT22 humidity sensor
  • 3x 10kOhm resistor
  • a Double H-bridge L298N
  • a fan
  • a motor with a gearbox
  • a power supply for Arduino between 5 and 12V
  • Two limit switches
  • a 128x64 OLED display (we used an AdaFruit SSD1306)
  • a computer and upload cable
  • wires and a breadboard


For the box design:

  • CAD files for the 3 walls of the box
  • 3mm MDF
  • a laser cutting machine
  • Software (CAD, Rhino)

CAD and Fabrication of the Walls + Assembly of the Box

assemblage.png
416116710_1780622982439696_2977210411998492526_n.jpg

We draw up the CAD files for the 3 walls. To manufacture the joints, we produce 3 mm slots, with a tolerance of 0.2 mm to ensure that they hold tightly.

CAD and Fabrication of the Hatch

cremaillere.png
404660622_719693220227102_7285527826530458777_n.jpg
WhatsApp Image 2024-01-24 at 12.04.59.jpeg

The closing flap is a square slightly larger than the size of the fan (in this case, a 4.5cm square).

Our hatch contains the rack on one side, to accommodate the rack-and-pinion sliding system. It was designed using CATIA and then produced using the 3D printer to facilitate mechanical integration of the rack.

CAD and Fabrication of the Pinion

pignon.png
pignon_dos.png
WhatsApp Image 2024-01-24 at 12.08.46.jpeg

The pinion is the link between the motor and the flap, allowing it to move. It must allow the flap to move along its entire length (here 4.5 cm). To secure the pinion, a pocket has been designed in the middle to allow the motor shaft to pass through.

The inner radius is 1.75 cm and the outside radius is 2.25 cm.

Electronic Blueprint

Capture d'écran 2024-02-01 144812.png
Capture d'écran 2024-02-01 151125.png
Capture d'écran 2024-02-01 151015.png

The wiring is quite straightforward. Everything has its own block as you can see by the captions.

The Arduino Uno board here is connected to the power via an external power supply plugged in the power jack. This enables us to get higher power outputs out of the Vin port of the Arduino.


Screen

The communication with the screen is done with the I2C ports of the arduino (SDA and SCL pins). As such, screens can have different serial addresses and may require specific libraries according to your screen manufacturer's specifications.

You can find the correct library for your screen by searching its model name in your search engine. The serial address may be written on the back of the screen. Alternatively, you may find it by running the 'i2c_scanner' example code included in the Wire.h library.

Temperature and humidity sensor

The sensor used here is the DHT22 sensor. It can measure a good range of temperature and humidity. However, a delay of two seconds is necessary between each reading par the manufacturer's instructions. You will have to adapt the code and wiring if you are using a different sensor. It is wired into pin 3 of the arduino.

Limit switches

The limit switches we used are pre-wired, button-based switches. You could use optical-based ones or simple buttons.

They are wired into pins 7 and 8 of the arduino.

Hatch and fan control with the double h-bridge

An h-bridge is an interesting piece of circuitry that can switch the direction of the current passing through a motor with external signals. This was a requirement here as we are using a DC motor and a fan at the same time, which can draw quite a lot of current from the arduino board and damage it.

The fan we were using is quite underpowered and runs at a maximum of 5V. However, the DC motor runs with 7-12V. However, the h-bridge will supply a common voltage to both our motors. To circumvent that, we wired the fan to the 5V output of the h-bridge and the other wire to an input so that power can flow when we want to.

You may scale the project to higher powered fans by plugging them in the h-bridge.

The enable pins are wired into pins 5 and 6, and the control ones are plugged into pins 9, 10, 11 and 12.


Arduino Code

The attached code is already commented. We will now detail how it works with pseudo code.

Definition of the pins and initialization of the different components

Here we:

  • Import the necessary libraries for the screen, and the sensors.
  • Define the pins and set them as in- or outputs.
  • Instantiate the screen and DHT sensors.

Definition of the functions to control the hatch and the fan and update the screen

  • When called, the updateScreen() function updates the displayed information to the latest readings.
  • The startFan() and stopFan() functions will start and stop the fan.
  • The openHatch() function will open the hatch. Beware : it will not stop turning and all other operations stop until the open limit switch has been pressed.
  • The closeHatch() function will close the hatch by a similar logic.

Control loop

Each loop:

  • New readings of the temperature and humidity are made.
  • If the humidity is above a set threshold and the hatch is not open, then the fan is started, the hatch opened and the screen updated.
  • If the humidity is below a set threshold and the hatch is open, then the hatch is closed, the fan is stopped and the screen updated
  • The screen is updated.
  • A two second delay is applied between humidity readings, in accordance to the DHT sensors specifications.

CAD and Fabrication of the Plates in Plexiglass

trajet_plexi_support_elec.png
404639909_1080340496616812_3198328709478134721_n.jpg
404549050_1054212629124642_682522776599973961_n.jpg
cachemisere.png
404625303_7447354531981253_1529550409179287579_n.jpg
404590997_252056157915201_1925829875148595828_n.jpg

To continue observing the inside of the reactor, two Plexiglas sheets were cut out using a circular saw (laser cutter not available, but preferable for a cleaner and more precise cuts).


One plate separates the electronics and the fan from the culture medium. It is also used to secure the electronics. In this plate, we used a dremel to cut a hole the size of the trapdoor. As this cut was particularly difficult, the result was not satisfactory (even after sanding). A PLA part was designed and glued to the sheet for a cleaner finish.

The second plate is used to close the reactor and attach the fan.

Holes are drilled to secure the various components and to allow a good ventilation.

Assembly and Demonstration

IMG_9843.jpg
IMG_9846.jpg
IMG_9844.jpg
IMG_9842.jpg

The plexiglas plates are holding up by nuts and bolts.

We drew up some drawings on the walls of the box but a laser engraving should be preferred.

A hole was drilled for the power supply.