Introduction

This project utilizes a temperature sensor and the TINKERplate to turn on a USB powered fan when the room temperature climbs above 78°F. This project will require access to of the purchase of a short USB 2.0 extender cable and a USB powered desk fan. In addition, the USB cable will require some modifications as described below.

Required Parts

The following parts are required for this project:

  • A TINKERplate attached to a preprogrammed Raspberry Pi
  • From a TINKERkit
    • the mini breadboard
    • the DS18B20 temperature sensor module
    • male to male jumper wires as required
  • A USB extender cable like this one.
  • A USB powered fan like the one here.
  • Wire strippers to perform cable modifications

Assembly Steps

Modify USB Extender Cable

Using a pair of wire strippers, modify the USB extender cable by following the steps shown below:

 

Finalize Assembly

Assemble the components as shown below. Take some care when routing the jumper wire and the black wire from the modified USB cable into the GND port on the DIgital I/O block.

Code

Copy and paste the code below to a file called TempFan1.py. The run it by typing python3 TempFan2.py at the command prompt.

Our program uses a technique called hysteresis to prevent the fan from quickly turning off and on around the trip temperature - a phenomena we refer to as "chatter."  The thermostat in your home does this also. For more information about hysteresis, refer to the Wikipedia article here.

Note that the above program can be downloaded from github by typing the following instructions on the command line:

  1. git clone https://github.com/pi-plates/TINKERplate-Projects.git
  2. cd TINKERplate-Projects
  3. python3 TempFan1.py

A slight variation of the above program uses the METER library to display the temperature on the screen. When the fan is off, the temperature text is blue to reflect the cooler temperature. When the fan turns on the color of the text is set to red to indicate warmer temperatures.:

Again the above program can be downloaded from github by typing the following instructions on the command line:

  1. git clone https://github.com/pi-plates/TINKERplate-Projects.git
  2. cd TINKERplate-Projects
  3. python3 TempFan2.py

 

Series Navigation<< Analog Panel VoltmeterMotion Sensing Lamp with Alarm >>