LESSON TEME: Input Devices

  I tried to develop a machine to mesure distance by using an ultrasonic distance sensor "HC-SR04" [2]. Figure [1] shows an appearance in which the machine mesures distance.

web site page
[1] Distance Mesure Machine

Input Module Trial Approach on Arduino

  The first apporch I tried to do is to develop a prototype system by uisng Arduino [3]. 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 [4].

web site page
[2] Ultrasonic Distance Sensor "HC-SR04"
web site page
[3] Mesuring Distance
web site page
[4] Displaying Distance Values on Serial Monitor

Sound Sensor Module on ATtiny44

  I select a sound sensoer module as input device. The sound sensor module is developed by OSOYOO.com[5]. 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 [6] 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 [6] 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[7]. I reused the electronic board developed in week 8 assignment. The ADC value was sent to my laptop PC via serial communication [8]. I also impliment a value viewer tool from serial port by using Python. The result is shown video [9].

web site page
[5] Sound Sensor Module @OSOYOO.com
web site page
[6]ADMUX of ATtiny44
web site page
[7] Programming code for ATtiny44
web site page
[8] Wiring between ATtiny44 and Sound Sensor Module
[9] Sound Sensor Module on ATtiny44

Data Files