For this week's assignment, two sensors will be used, the first a humidity sensor that can measure analog and digital signals according to the pin we use, and a motion sensor that gives us a digital signal.
For the humidity detector we use pin A0 as analog output and connect it to pin 2 of our ATtiny 44
To read the digital signal we use a motion sensor HC-SR501 connected in the same way to pin 2 of our ATtiny 44 For more information and to be able to download the files, I invite you to see the following link INPUTS
This week I decide to use the Attiny45 and a TCRT5000 Module which have an IR emitter and a phototransistor incorporated and can be use for some applications as detect white and black color (commonly used in line follower robot) distance detection (short distances), position sensor for shaft encoder and more. This module have an analog output and digital output so it's perfect to test and read from the same sensor both kind of signals.
Connecting the module pins, vcc, gnd and digital, analog signals to the board and the Tx, Rx pins from the board to Arduino, everything ready to read the values. This module have a potenciometer to calibrate the sensitivity of the digital signal to change from one to zero. This can be usefull if you don't need to map the analog values, in other words, show data to the user to be read as distance. It's also important to notice using analog signal will be always more precise than a potenciometer calibration in this module and could be cases is needed to detect different positions of an object and not just care obout a "border line" in this cases will be convinient read an analog signal.
Once everything is programmed and connected it's time to read the values
You can find the original files and more details on my personal Week 10 Assigment page
You can find further details of my work with digital and analog modes on my site: