Blog Arşivleri

Arduino Sonar System While It is Working

Hi,

In my previous post i mentioned my system’s basics. Now i will show my project’s presentation video.

It is not in English but you can understand how it works.

Earlier i mentioned that it has two modes. One of rmanual another for automatic. You can choose this modes from screen.

If you want to quit just press the stop button.

You can see the distances and coordinates of the object at the manual mode.

Sincerely Yours.
gökhan öztürk

Arduino Sonar System

Today, i will briefly introduce about my graduation project.

My project is making sonar with Arduino Mega R3.

System Design

           System Design

The equipments that i used:

Arduino Mega R3
Hc-sr04 x2
Futaba S3003 Servo Motor.
3.2″ TFT LCD Screen
Shield for TFT LCD Screen
12V-1A Dc Power Supply x2

As you know HC-SC04 distance sensors measured the distance with speed of sound.
Also we know that distance is equal to velocity times time (x=v.t).
At an certain degree my sensors measures whole time (going forward and coming back)
I divide that time by two and multiply bu speed of sound in terms of cm/us.
this is about 1/29. So my equation becomes; Distance = (time duration/2)/29.

At the beginning for automatic mode; press auto at the screen and for manual mode press at the screen.
You can exit from the modes by pressing stop.

Rotationary Part

Rotationary Part

Then let’s talk about rotationary system. I placed one of my sensor at 0 degrees and another at 180 degrees.
They stand opposite to each other. While my servo motor is on , it turns from 0 to 180 degree and comes back
to origin (zero degree). In mean time one my sensor measures distance from 0 to 180 degree interval and other one is measures
180 to 360 degrees interval.

If it gets and object it multiplies the distance with cosine of angle for x-axis, with sine for y-axis.
Than i mapped my corrdinates to my radar cirle. It runs as this at automatic mode.

Sreen Design

Sreen Design

At manual mode , our only difference is input for servo motor in degree. I gave the input from joystick.
Also you can observe the x,y coordinates and distances for both sensors at manual mode.

I am going to post a video of my system while it is working.

Sincerely Yours.

Traffic Lights and Pedestrian Way Control System with MSP430

Hi, at my this i created a system for traffic lights and pedestrian way control.

You can also watch my Youtube presentation.

Equipments that used in this project are;
+ MSP430 Chipset
+ GLCD (Nokia 5110)
+ Distance Sensor (HCSR-04)
+ Buzzer
+ LEDs
+ Buttons

20150101_120527

Procedure of my system is like this;
I have two counters. One stars 60 to zero , another one counts
30 to zero. If we are in the first time interval ( 60 -> 0 ) cars can use their way
but pedestrians should wait until time is end. We can see the down counting from
the screen. If any person attempts to pass across the street ( from car’s road ),
the distance sensor that located edge of car’s road, will war by buzzer.

After first time interval car’s passed. Another countdown starts. (from 30 -> zero )
Cars should stop and people can pass across the street.

Third past is interrupt section. At the late hours traffic won’t be busy so we don’t need
LCD, sensors, buzzer and etc. We just need a blinking LED for warning. That also reduce
the power consupmtion.

P.s. You can find the port interrupt program and my lcd commands from early posts.

Best wishes.

Distance Sensor Application with MSP430

Hi, at my this project i made an sensor application. In the program sensor measures the distance then if it is in the range of mine, it reacts as a LED ON. My sensor is HC-SR04 that has approximately 4.5 meters distance long. It has one input (echo),one output(trigger) and the supply voltages on it. Working princible of sensor (HC-SR04) is like that; we are sending an output signal from echo pin about 20us then set trig as LOW. After that we are waiting the return signal from echo pin. By the way we are measuring the time between sended and recieved. After that we are calculating the time by using speed of the light from the measured time. Last step is converting the time to distance. That is the whole working princible. You can find the code at below. Good Luck.

Sensor Application With MSP430

Sensor Application With MSP430

// Ultrasonic rangefinder example for MSP430G2553
// - An LED is driven by P1.3
// - The trigger pulse is sent to the rangefinder via P1.2
// - The echo pulse is read from the rangefinder via P1.1
#include <msp430.h>

void main(void) {
int distance_cm;
// Disable watchdog timer
WDTCTL = WDTPW + WDTHOLD;
BCSCTL1 = CALBC1_1MHZ;
DCOCTL = CALDCO_1MHZ;
TA1CTL = TASSEL_2 + ID_0 + MC_2;
P1DIR = 0x03;

while(1) {
distance_cm = read_distance_sensor_cm();
if (distance_cm < 50) P1OUT |= BIT3; // LED on
else P1OUT &= ~BIT3; // LED off
}
}

int read_distance_sensor_cm()
{
int echo_pulse_duration; // time in us
int distance; // distance in cm
// Send a 20us trigger pulse
P1OUT |= BIT2; // trigger high
__delay_cycles(20); // 20us delay
P1OUT &= ~BIT2; // trigger low
// Measure duration of echo pulse
while ((P1IN & BIT1) == 0); // Wait for start of echo pulse
TA1R = 0; // Reset timer at start of pulse
while ((P1IN & BIT1) > 0); // Wait for end of echo pulse
echo_pulse_duration = TA1R; // Current timer value is pulse length
distance = 0.017 * echo_pulse_duration; // Convert from us to cm
return distance; // Return distance in cm to calling function
}

//Special thank to Ali Gökoğlu