Skip to main content

Smart Fan Switch

Fans installed in lift lobbies are generally switched on at all times and after passengers board the lift the switched on fan is a source of wasting electricity. In these places, there is no way to detect if there are people waiting for the lift or not. A solution to this problem is a smart switch which can be attached to any electrical appliance; in this case a fan, and would be switched on only in presence of a person. Smart fan switch was a project that was done as a part of course embedded systems at IIT Delhi under the guidance of Prof M Balakrishnan. The final prototype of this project was on display at the 13th Open House IIT Delhi.
The components we used in our project were:
  1. Raspberry pi 3.0
  2. Webcamera
  3. Circuit board
  4. Transformer (220V to 5V)
  5. Transistor
  6. SD card
  7. Relays
  8. Resistors
  9. Fan

Raspberry pi

The first and foremost task is to get familiarized with this micro-controller and know about all its components. It is a very popular micro-controller, costs around 3500 and one can easily study about its components on the internet.
Raspberry Pi 3.0
It has 4 USB ports, one LAN port, one micro USB for power, and GPIO pins apart from several other components. At the bottom side of this board, there is a slot for micro SD card. The first task on our journey of this project is to install a pi operating system. There are several options for this like Raspbian, Ubuntu Mate, Pidora, RISC OS pi etc.

We have used Raspbian for our project. First phase of work was getting familiar with using the Raspbian and watching some tutorials about this operating system. The OS should be installed on the SD card which is mounted on raspberry pi. We have to work on pi and access it through our PC and these can be connected using a LAN cable.

Face Detection

web-camera
pi camera
One of the major tasks is now face detection. We have used  a web-camera for this purpose. While working on the project we found out that a simple camera of even 5MP would work perfectly fine for this project. What one can do is use a pi camera as an alternative to the web-camera. There is though one issue with pi camera that needs to be resolved. We faced an error while taking live feed from pi camera on the computer screen; the terminal showed error with sunny cable. Sunny cable error is a hardware error which comes in case of pi camera and can be resolved by removing the sunny cable in the pi camera. Although one might have to look up online for particular errors.
Web-camera can be connected with pi using the USB port.

For the face detection, we used the OpenCV libraries available for free online. These libraries have in-build algorithms to detect face and also have training data. The remainder of coding was done on python. We used the data to train our algorithm to become better at detecting faces and become adjusted to even lower lighting conditions when it is difficult for the camera to get a clear picture. There is another problem which we did not encounter in testing phase; the case of very bright light. If the camera is placed someplace with direct sunlight, the face detection needs to be trained for darker face complexions since camera sees very dark faces in those cases.

Circuit Design

Circuit testing phase
After testing for the face detection which is done using pi connected with laptop and camera, the next step is to build a circuit with complete connections. Fan operates on 220V AC supply and the pi on 5V DC, thus a transformer was used for this conversion.The pi gives output 0 or 1 after executing the code and gives the signal to relay ( the yellow component seen in the picture is relay) which in turn switches the fan ON or OFF.

We needed to embed transformer and a transistor on the circuit board along with resistance. While testing we used breadboard to check the circuit so as to be sure if everything is perfectly alright. Later we used a circuit board, placed all the components on it, connected pi with circuit board using GPIO pins and used soldering for making circuit connections. Needless to say electric proofing was also done, for which we used glue gun.
Overview of circuit

Final Prototype

The final aim for this project was to build a small and decent prototype that can be placed in a lift lobby. For this we needed to take care of two things:
  • PCB
  • A box for the final prototype
CAD model
Side view
For the prototype we needed a box that was compact and would be able to house the components that we had made. The design should be as small as possible along with keeping in mind proper installation. We made CAD models for the design and decided to get it 3D printed from the 3D printing workshop at IIT Delhi. This box was 11cmx11cmx4cm in dimensions. There were slots made for LAN port, USB cable and input and output power plugs. Grooves were made to fix the pi inside with screw. We also added two LEDs on the top of the yellow coloured 3D printed box, a red LED to indicate that power input is there for the pi and a green LED to indicate when the smart switch is ON. The circuit board was to be replaced with PCB and installed in the final prototype.

The final prototype
Inside the final prototype

OPEN HOUSE

Open house
After completion, the project was installed at the busiest lift lobby of IIT Delhi on the day of Open House. Everyone was curious about the camera switch connected to the fan and we were showered with lots of questions from curious students about its functioning. There were a few people from industry who also had a discussion with us about cost analysis of such a product in case of large scale production. Some people inquired whether such sensors are also available in the market and tried to compare them with other sensors like laser sensors which also detect presence of people.

Installment
During our journey of this project we also came up with another solution specific to lift lobbies; switching the fans ON only when someone presses the button for lift and fan remains switched ON for the duration of waiting time of the lift. We would surely like this coming up as a project next time.




Do leave your queries and any suggestions in comments sections below.

Comments

  1. Hello, I am working on similar problem, could you pls let me know how to access the code for facial recognition.
    Thanks

    ReplyDelete

Post a Comment