The Smart Fan ************* Description: ============ The smart fan is a device that runs on Raspberry Pi. It consists of a rotating piece that revolves on a motor axis and changes speed based on the distance from the objects facing it. This will reduce the amount of air current given by the fan as the person comes closer and increases it as the person in front of it goes farther. The fan will stop rotating if the person in front of it comes very close for safety reasons. Learning Objectives: ==================== The Smart Fan is an integrated system that helps students learn and apply the following: - Coding, electronics, robotics science, and physical science through a hands-on application that can be directly related to real life situations. - Motion concepts: + Sound waves, their properties and speed + The use of formulas to find distance in relation to speed of sound + Angular momentum - The implementation of the engineering design process - Application of theoretical concepts to real life situations Materials Needed: ================= - Raspberry Pi with micro SD card and Raspbian - One ultrasonic sensor - One 6V simple DC motors - Diode - Transistor - Jumper wires - Resistors 300Ω or similar - Breadboard - Glue gun and glue sticks - Cutter blades or scissors - Thin sturdy cardboard (poster or portfolio cardboard) Setup and Functionality: ======================== The Smart Fan runs on Raspberry Pi and uses a simple DC rotating motor and an ultrasonic sensor. The speed of the rotation of the fan is controlled by the ultrasonic sensor. It is programmed to slow down as the distance between any object and the sensor increases and vice versa. The fan will fully stop rotating if an object comes very close to the sensor. Circuitry and Electronics: ========================== The diagrams below show all the wiring and connections of all the componenets used in the Smart Fan: .. image:: _static/SmartFan/image3.png :align: center *Figure 1: shows the wiring and connections of all the components to the Raspberry Pi.* The function of the transistor is to amplify the current that is produced by Raspberry Pi voltage output GPIO. The 6V simple DC motor requires more current than that provided by the Raspberry Pi. In order to provide the required current, a transistor is connected to the circuit. At the same time, it is essential to connect a diode. Diodes allow current to move only in one direction and prevent it from flowing back. After turning the fan off, the motor keeps rotating for a while before it comes to a stop. During this time, the motor is acting like a generator, thus producing electricity. The diode will prevent the current produced from damaging the GPIO voltage output of the Raspberry Pi. .. warning:: Proper attention should be given to the wiring of the diode and transistor. Make sure to follow the diagram above. Improper connection of the transistor will lead to improper functioning of the motor. In addition, reversing the wiring of the diode will cause the current to stop flowing and the whole device will not function. Programming: ============ The Smart Fan has been programmed using Python language: **Code of the smart fan** .. literalinclude:: ../examples/SmartFan/SmartFan.py .. include:: scienceConcepts/smartFanPythonSC.rst