By: Austin Lindquist
I received two sensors:
- Touch Sensor: KY-036 Metal Touch Sensor
- Requires both the black head and any “spiky metal bit” of the chip itself to be touched for your touch to be read
- Only used it’s digital pin; analog pin made no sense, nor will it ever
- Light Sensor: TSL2561 Luminosity Sensor
- Requires a library to be able to understand the data being read: Adafruit TSL2561
- The data that is effectively put out using the library is call “lux” which is a unit of illuminance that describes the intensity of the light being picked up
Metal Touch Sensor
This sensor has 4 pins:
- Analog Output
- Ground
- 5v(+)
- Digital Output
For this project, I only used the ground, voltage, and digital output pins. The ground and 5V pins should naturally make their way to being connected to your Arduino’s respective ports, and the digital output pin should be nestled in one of the Arduino’s digital ports, as such in the image below:
From there, it is a matter of setting the digital pin’s mode to:
pinMode(<digital pin number>, INPUT);
and reading from it using:
digitalRead(<digital pin number>);
Luminosity Sensor
The sensor has 7 pins:
- Vin (VCC -> Voltage Common Collector)
- Ground
- 3vo (ignore)
- Address (ignore)
- Interrupt (ignore)
- SDA
- SCL
Though there are several pins, we only need to use four to operate: Vin, Ground, SDA, and SCL. Vin can take either a 3.3V or 5V charge, but for this project I used a 3.3V from the Arduino. Ground should make its way to a ground port in the Arduino. As for SDA and SCL, these two pin should be read as both analog. According to Adafruit, to use their library you should place the SDA and SCL pins as such in the image below:
However, you can use any of the analog ports, as the library will be able to read them without you having to recognize them as pins within the .ino script. If you want to properly learn how and what you can do with this sensor programmically, there is an example sketch that comes with the library for you to explore with. Of course, I will also provide the script to this project for you to understand how everything works together.
Project Overview
This is my PC cooler, which involves the user to play with the joy-stick to simulate running my toaster of a computer, which sucks at doing simple operations. It sucks so much that it slowly begins to heat up (red light gets brighter). No matter! Luckily, I have a sensor (Luminosity Sensor) that tells my computer to amp up the fan more and more as the computer heats up. However, my computer is so bad, and I am so impatient, that I want to cool down my computer immediately. Luckily, with my handy-dandy shutdown button (Touch Sensor), all I need to do is touch for 5 seconds and it will “shutdown” and reboot. Then, I can finally get back to using my computer.
To get a look at this piece of beauty, check out my video running it!
Here is the code to run it!
Leave a Reply