LESSON TEME: Input Devices
I tried to develop a machine to mesure distance by using an ultrasonic distance sensor "HC-SR04" . Figure  shows an appearance in which the machine mesures distance.
Input Module Trial Approach on Arduino
The first apporch I tried to do is to develop a prototype system by uisng Arduino . The mechanism to mesure distance is that the sensor has output/input pins. The output pin emits ultorasonic and the input pin receives the reflected ultorasonic. So the programming code has to be considered the mecanism and the sound speed. I can get good enough result of the calclated values. I displayed the values on laptop computer by using serial communication .
Sound Sensor Module on ATtiny44
I select a sound sensoer module as input device. The sound sensor module is developed by OSOYOO.com. The sensor device has 4 pins. VCC, GND, AO and DO. We can get input values from the AO (Anolog Output). For A/D converting on AVR, it is important to do the correct ADMUX register settings. The ADMUX configration of ATtiny44 is REFS1, REFS0, MUX5, MUX4, MUX3, MUX2, MUX1 and MUX0. The upper image of Figure  shows the configration. The flag settings to ADMUX influences ADC value. ADC contains two 8bit registers: one is ADCH and the other is ADCL. ADC only use 10 bit in the 8bit x2. The bottom image of Figure  shows input flag pattern of ADMUX in single-end input case. In my case, I used PA2 as an input pin, so I had to set the 000010 to ADMUX as shown Figure. I reused the electronic board developed in week 8 assignment. The ADC value was sent to my laptop PC via serial communication . I also impliment a value viewer tool from serial port by using Python. The result is shown video .