Skip to content
Snippets Groups Projects
Input Devices.md 2.33 KiB
Newer Older
Mitalee Parikh's avatar
Mitalee Parikh committed
Input Devices
======================

This week I will use analog sensors to measure things like temperature and light using a Peizo vibration sensor and a phototransistor.

For reference, I used the Arduino love-o-meter project as it used the temperature sensor.
I started by collecting all the components.

![Gathering components](./images/input/shopping.jpeg)

I used this schematic to connect everything.
![Sketch](./images/input/schematic.jpeg)

The circuit setup was fairly easy. This is how it looks.
Mitalee Parikh's avatar
Mitalee Parikh committed
![setup](./images/input/setup.jpeg)docs/images/inputs/setup.jpeg
Mitalee Parikh's avatar
Mitalee Parikh committed

At first all lights were continuously on. I checked the serial monitor and saw that the temperature was around 26 degrees without touching. So I adjusted the baseline temperature to 25 in the sketch. After some trial and error, I adjusted the sketch so that on touching it lightly for about 5 seconds, the second led lit up and on holding it tight for some seconds the third led lit up. The serial monitor indicated temperature range from 26-32 degrees.
So an increment of 2-4-6 degrees worked out perfectly.

![serial](./images/input/serial.jpeg)

This is it in action.
![in action](./images/input/hot.gif)

####Code
Mitalee Parikh's avatar
Mitalee Parikh committed
[Sketch](./images/input/3leds.zip)
Mitalee Parikh's avatar
Mitalee Parikh committed

####Tutorials
[Arduino Project 3](https://create.arduino.cc/projecthub/godboi123/love-o-meter-bda552)
Mitalee Parikh's avatar
I  
Mitalee Parikh committed


####Objective
1. measure something: add a sensor to a microcontroller board that you have designed and read it
2. probe an input device's analog levels and digital signals

#### Measuring light color using a RGB colour sensor

[ATtiny412 Datasheet](https://ww1.microchip.com/downloads/en/DeviceDoc/ATtiny212-214-412-414-416-DataSheet-DS40002287A.pdf)  
[VEML6040](https://www.vishay.com/docs/84276/veml6040.pdf)


#####Designing the board

Downloaded the footprint from [Here](https://www.snapeda.com/parts/VEML6040A3OG/Vishay%20Semiconductor%20Opto%20Division/view-part/702426/?company=-&welcome=home)
Installed the symbol and footprint on KiCAD using [this guide](https://www.snapeda.com/about/import/#)
![libraries]()

![VEML6040 colour sensor pinout](./images/input/VEML6040-pinout.png)
![ATtiny412 pinout](./images/input/ATtiny412-pinout.png)
![pins](./images/input/pins.jpg)
![412schematic](./images/input/412schematic.jpg)
![schematic](./images/input/schematic.jpg)

####Design Files
[Schematic](./images/input/t412+VEML6040-schematic.pdf)