This week's assignment is to 'measure something: add a sensor to a microcontroller board that you have designed and read it'.
My Approach
I selected a SHARP GP2Y0A41SK0F Distance Measuring sensor as an input device and taking the output on serial monitor. I designed my own board to stuff all the required components into my board and then milled it, as discussed subsequently.
Board Designing
I took inspiration from Neil's hello.ftdi.44 board for designing my board. Initially, I decided the components, I am going to stuff in my board i.e.
Attiny 44
1 10k Resistor.
1 1 microfarad Capacitor.
1 2x3 pin header for connecting FabISP.
1 1x3 pin header for SHARP IR Sensor.
1 1x3 pin header for Servo motor.
1 1x3 pin header for Potentiometer.
1 1x6 pin header for FTDI.
Afterwards on Eagle 8.0.2, I created my schematic as shown below.
To make me understand serial communication, my local Instructor took one lecture for me on the same and asked me to explore his page. On his page, in a very simple manner he explained the procedure step by step and have discussed the structure of the program to make serial communication.
After exploring his page, I tried some serial communication codes. I wrote one program in which Hello is diplayed in serial monitor, when a letter c is passed through serial communication window.
For connecting various components on the board u need to know the pin configuration. Following diagrams can help you to understand pin configuration.
Programming the board for IR sensor
To understand the working of the IR sensor, I referred Sharp sensor data sheet and to understand the structure of the program following link, can be visited:
http://playground.arduino.cc/Main/SharpIR
GP2Y0A41SK0F is a distance measuring sensor unit, composed of an integrated combination of PSD (position sensitive detector) , IR-LED (infrared emitting diode) and signal processing circuit. The variety of the reflectivity of the object, the environmental temperature and the operating duration are not influenced easily to the distance detection because of adopting the triangulation method. This device outputs the voltage corresponding to the detection distance. So this sensor can also be used as a proximity sensor.
Distance measuring range for this sensor is from 4 to 30 cms. So, I calculated the voltage value at 4 cms and 30 cms respectively and mapped them on serial monitor, which can be seen on the video below.