Ergo Fan

by guillaume.tibergyn in Circuits > Electronics

1419 Views, 5 Favorites, 0 Comments

Ergo Fan

Schermafbeelding 2021-06-14 165035.png

This project is a smart laptop cooling pad which helps to cool down your laptop and apart from that also tries to make your experience using the laptop more comfortable.

A temperature sensor reads the temperature of the laptop and based on those measurements 3 PWM-fans are being controlled. The goal is to keep your laptop as cool as possible and the performance the best it can be, while also trying to keep your workspace quiet when the extra cooling is not needed.

People often sit to close to their screen, there for I use and ultrasonic distance sensor to measure the distance between the users face and the laptop screen. If you get to close to your screen, you get notification on the LCD screen that your distance is to close.

People who use powerful laptops often have a tendency to work late at night. When people work in dark environments the screen brightness is almost always set too high. That is why I use to light sensors to measure the strength of the ambient lighting and the light coming of your screen. Just like with the distance sensor you get a notification on the screen.

The position of your hands and wrists is also an important factor if you're using a laptop for long periods of time. By bringing the keyboard of your laptop under a slight angle your can drastically increase the comfort while using your laptop. To solve this problem I use and accelerometer, this is device with computes its change in position on 3 axes. Here I only use the x-axes to compute the coolers angle of the laptop cooler.

The speed of the fans can manually be changed used is rotary encoder or change speed automatically according to the readings of the temperature sensor.

On the site which comes with the product you can see the most recent readings of all the sensors and also a visual representation of the status; green is good, and red is bad.

Like I mentioned before there is a small display on the cooler itself, on the screen you can also the different sensor values. You can control which one you see using the 4 buttons underneath it. If one of the sensors measures something that's not according to the boundaries that were set the screen automatically switch to this sensor on the screen.

Supplies

For this project you do need a lot of components. Let us start with the most important ones:

- Raspberry Pi: This is the computer which drives everything. The website, some of the sensors and communication with the Arduino to control the fans and read the other sensors is all done by the raspberry pi.

Raspberry Pi5v power cable: This power connector is used to power the raspberry pi.

16GB SD-card: This card is used to store all the files on the pi.

(Optional) Raspberry Pi T-cobbler: This is a piece which makes it simpler to identify the different ports on your raspberry pi.

- Arduino uno V3: The Arduino uno is a microcontroller which can operate on very high speeds. To compensate the lack of speed on the raspberry pi I use the Arduino to control the PWM-signal of my fans. Some sensors are also much easier to read using the Arduino.

USB A - B cable: This cable is used to send the code to the Arduino.

12v power connector: The power connector is mostly needed to power the 12-volt fans, but the Arduino also needs a voltage between 7 and 12 volt.

- 3 x 4-pin connector pc fans

- Tip120 Darlington transistor: this component is used to power off the dans when needed.

- 2 inch wave share display: https://www.banggood.com/Waveshare-2-inch-IPS-Display-Module-SPI-Interface-240320-General-2inch-IPS-LCD-Display-Module-p-1754352.html?cur_warehouse=CN&rmmds=search

- 2 x Breadboards: 1full size breadboard / 1 half size breadboard

- Dupont jumper cables / cable kit to make custom length jumper cables

- Resistors according to the fritzing diagram

Sensors

- MPU6050

- Dallas One-wire temperature sensor

- HY-SRF05 ultrasonic sensor

- 2 LDR (light dependent resistors) light sensors

- 1 rotary encoder

- 4 regular buttons

- 2 60X40x0.2 cm ABS sheets

- 1 3d-printed component.

Frizing Schema

Fritzing Project One Electronics.jpg
Fritzing Project One.jpg

The electronics used for this project are not really difficult to hook up to a raspberry pi or an arduino, howerver because of the big amount of sensor and cables is can get complicated very quickly. The raspberry pi is used to read the temperature using the one wire sensor, and the MPU6050 to calculate the keyboard angle. There is also a little screen hooked up to the raspberry pi to show sensor values. The arduino is used to read the ultrasonic distance sensor, the lightsensors, the rotary encoder and to send a PWM signal to the 4-pin fans.

Setting Up the Raspberry Pi

The raspberry pi is the computer that is running all of your code, but in order to do this you need an operating system, the best choise here is the Raspberry Pi OS. To makes things a little easier you should download the "Raspberry Pi OS with desktop and recommended software" because this version already had a lot of things preinstalled.

link: https://www.raspberrypi.org/software/operating-sys...

Preparing the SD-card

Preferably you should use a normal SD-card with a capacity of 16GB. The SD-card must be completly empty, so you can eighter by a new one, or format one you have laying around.

Writing the image

You can't just copy the image onto the SD-card and expect it to work. I used a program called win32-disk-imager to write the image onto the SD-card.

link: https://sourceforge.net/projects/win32diskimager/

In the next step we will connect the raspberry pi to our computer but first we need to make a few changes to the files on the SD-card.

First you need to find the file named "cmdline.txt" and open it using notepad++. At the end of the code u need to past the folowing text: ip=192.168.168.168. After you did this you can save and clos the file.

Second you need to make a sile named "ssh" without any extension, if the file automatically get an extension then you need to delete this.

Now you can eject the SD-card from your PC using the safe eject feature on windows.

Now you can put the SD-card into the raspberry pi. Do this when the raspberry pi has no power. The SD-card should never be touched whe, your pi is powered.

Connect to your PC

First you need to set a static IP-adress for your PC.

IP-adress: 192.168.168.100
Subnetmask: 255.255.255.0

To connect to the Raspberry via SSH we need another program, called putty
link: https://www.putty.org/

You can open this program, insert the ip ip: "192.168.168.168", choose the correct port: 22 and set the connection type to SSH.

If everything goes well you should see a commandline that is asking for your login. The default user is named "pi" and is password is "raspberry".

Settings

We will start by going into the root, this will make it easier because you won't have to type your password all the time.

sudo -i

Then we go into the pi's configuration to activate a few different things.

raspi-config

Here you should go to interface options and activate: SPI, I2C adn the hardware port of the serial Port.

When you have done all this you can click back and reboot your raspberry pi.

After you reboted we will set up wifi: in the commandline you shoud type:

wpa_passphrase "ssid" "password" >> /etc/wpa_supplicant/wpa_supplicant.conf

On the place of ssid you need to place your networks name and on the right of it your website.

Now you should go back into the root using the "sudo -i" command and type:

wpa_cli
interface wlan0
reconfigure

Now you should have a wifi connection.

Software downloads

First of all you'll need to update the existing software on the Raspberry pi:

sudo apt update sudo apt upgrade

Then you should download the apache2 webserver:

apt install apache2 -y

Next up you should download the mariaDB database server:

apt install mariadb-server mariadb-client -y

The last step is to download all the files involving python:

pip3 install flask-cors
pip3 install flask-socketio
pip3 install mysql-conector-python
pip3 install gevent
pip3 install gevent-websocket

Clone the repository

The last step is to clone the repository onto the raspberry pi:

git clone https://github.com/howest-mct/2020-2021-projectone-TibergynGuillaume

Database Structure

Database Structure.png

The database that is connected to this projects website had 4 tables, the first and most important one is the device table, this one holds all the information about the sensors and it’s most recent reading.
The second one is the sensor log table. This table holds a history of all the reading that have been done by the sensors. The 3 one is called boundries, this ons holds the information about when there should be a signal that you are using the laptop or device in a bad way. The last one is called actions, this table holds information about a reading: the reading was ok, the was a problem, etc.

Backend Code

The backend of this project exists a few different files.

The first two folders named Font and lib are used for the LCD display, in these maps are the fonts that are being displayed and the libraries which make it possible to display these texts.

Then there is the repositories folder. This folder is necesarry for the connection to the database. In the Datarepository.py file you can find all the MySQL commands that are used in this project.

The most important file is the app.py file. In here is the code that makes connection to the arduino, the frontend, the database and the sensors.

The second to last file is the config.py file. This file is used to make sure that the device makes a connection to the correct database.

MPU6050class.py is the last file. This files is used to calculate the keyboard angle of the ergo fan.

Arduino

This step is easy, you only need to download the arduino code and upload it to your arduino using the arduino software on your PC and the USB A to B cable.

Downloads

Frontend Code

Schermafbeelding 2021-06-14 202705.png

Because of the dark colored case I have, I also wanted a webinterface which used a dark theme. The design is fairly simple. The interface exists of a sidebar/header and objects which show the measurements of the different sensors.

The frontend code consists of 3 parts: javascript, html and css.

HTML is used to display all the information and CSS is used to display all this information in a pretty way. I've used javascript to display all the readings on the site. The combenation of javascript and socketio makes it possible for me to show realtime data on my website.

Link to the repository where you can also find the code again: https://github.com/howest-mct/2020-2021-projectone...

Casing

Schermafbeelding 2021-06-14 141834.png
Schermafbeelding 2021-06-14 191653.png

And last, but certainly not least, the finishing touch: the case. The case exists of 8 different laser-cutted ABS pieces. ABS is a fairly strong plastic; you can buy in sheets. I used 2 sheets of 60 cm by 40 cm with a thickness of 2 mm. You can download the illustrator files I've used for this project below. However, if you don't had access to a laser cutter, the case can also be made out of wood, using slightly bigger dimensions to compensate the few extra millimeters coming from the thickness of your wood sheets.

All the ABS pieces except for the top are connected to each other using a technic called "plastic welding". There are expensive machines you can use to do this; however, I just used an old soldering iron to melt the pieces to each other.

I started by positioning everything correctly together using paper tape. Once this was done, I used the soldering iron to melt the pieces into each other but be careful leaving the soldering iron for to long in one place can make holes into the edges of your case.

The holes in the underside of the case are covered with a metal mesh and glue.

(extra) To seal all the gaps, I also used a mixture of ABS and acetone. You put the little pieces of ABS you had left over in a closed off jar together with acetone. After at least an hour and 30 minutes, you get some kind of glue u can use to seal every gap and make the case even stronger.

For the ultrasonic distance sensor, I also designed a case which fits the thickness of my screen (0.5mm) exactly. This file can also be downloaded below. Now the last step is to put all of your electronics into the case.

Here are some extra tips for putting all your electronics in:

- The length of the cables going to the little LCD screen is important! If the cable is too long, the screen will not work.

-Duct tape is your best friend. Cables often have a tendency to come loose, so I use a lot of duct tape to either fixate or insulate cables and electronics.