INPUT DEVICES

This week is all about sensors.

Task assigned

This week we have to interface/add a sensor and reading input from it.

A sensor is a device which detects or measures a physical property and records, indicates or otherwise responds to it. This week I decided to work over Sonar sensor to measure the distance from it.

What is sonar sensor

Sonar sensor is an ultrasonic sensor, it is a device that can measure the distance to an object by using sound waves. It measures deistance by sending out a sound wave at a specific frequency and listening for that sound wave to bounce back.

By recording the elapsed time between the sound wave being generated and the sound wave bouncing back, it is possible to calculate the distance between the sonr sensor and the object.

Since it is known that sound travels through air at about 344 meter/second, if we can take the time for the sound wave to return and multiply it by 344 meters to find the total round trip distance of the sound wave. Here the round trip means that the sound wave traveled 2 times the distance to the object before it was detected by the sensor, it includes the from the sonar sensor to the object AND the from the object to the ultrsonic sensor (after the sound wave bounced off the object). To find out the distance to the object, simply divide the round trip distance in half as shown in picture below.

Now its time to develop the board to interface the sonar sensor for that I took Neil's board and re arranged that a little.

In this week's assignment I switched to ATtiny 45 micro controller which is Atmel 8-bit AVR microcontroller with 4-kilo bytes in-system programmable flash, at first I read carefully the data sheet of this micro controller, you can access the data sheet here

Components required

Developing the board using Eagle

Schematic diagram

Board

Traces

Outlines

Creating .rml files for traces and outlines

Milling

Populating the board

Burning bootloader Stepwise

Selecting Board

Selecting Processor

Selecting Internal clock for processor

Port detection

Selecting programmer

Compiling

Done burning bootloader

Following snap is showing that my board is UP

Interfacing the Sonar sensor with the board

Finally its time to play with the sonar as all the set up was ready. Next I upload the code given by Neil to my board. In this assignment it was necessary to show the python interface rather than IDE, Therefore I was have Python 3.6 installed in my laptop. As I run the code in python I got following expected results i.e my sonar sensor was reading the distance input through my hand motion and was successfully showing the motion effect on screen of my laptop as shown in figures below.

Video Demonstration of this week's task

Download useful files Here