Blog Arşivleri

Creating Butterworth and Chebyshev filters with by Using Sptool

Hi, at my previous post i talked about the filters and input-output relationship.
As you remember i mentioned that i will design the discrete-time
filters with Butterworth and Chebyshev approximations.

Let’s see the properties of the filter again.

0.8 < |H(exp(jw))| < 1   for     0 < w < 0.22*pi
|H(exp(jw))| < 0.26     for   0.32*pi < w < pi



For able to desing filter we will use “sptool” command. When we write ‘sptool’ to command window, we get SPTOOL:startup.spt window.


Then click ‘FIRbp[design]’ and ‘New’.



So we have a new window like ‘Filter Design & Analysis Tool-(FIRbp)’, change the values of filter at the blue arrows and right click to ‘Magnitude (DB)’ at the red arrow and hange as given. Finally, click ‘Design Filter’. After that click to ‘Edit’ and use ‘convert to single section’.

Now we will get our numerator and denominator coefficients of filter.  Use this way; ‘File -> export (change name of coefficients) -> export’.




Name numerator coefficients b1,denominator coefficients a1 for Butterworth filter and b2,a2 for
Chebyshev filter.


BW = filter(b1,a1,data)
CS1 = filter(b2,a2,data)

title('Magnitude response of my input signal');
grid on;
title('Magnitude response of my output,filtered by Butterworth ');
grid on;
title('Magnitude response of my output,filtered by Chebyshev');
grid on;

Let’s examine the differences Butterworth and Chebyshev approximations.


As you see transition region at Chebyshev approximation is smaller than Butterworth approximation.
But at the passband region of Chebyshev approximation has ripples and filters the signal around zero.

I hope it would be helpful to you.

gökhan öztürk

Creating A New Character UTFT Library

Creating A New Character UTFT Library

Today i will try to explain an easy way to create a new character.
By calling “creating” i meant changing.
I won’t create a new character forom the beginnig but we will achieve our goal by changing
a letter that already exist in the UTFT library.

When you open UTFT folder you will able to see “DefaultFonts.c” file.
you can open this file by notepad. After that, for the small letters
just find ”  fontdatatype SmallFont[1144] PROGMEM={ …} ”
(and  for the capital letters ” fontdatatype BigFont[3044] PROGMEM={ … } ” )

I will talk about for the small font.

At UTFT library our smallfont character’s dimensions is 5*7 pixels and it expressed by
like this “0x00,0x00,0x20,0x00,0x00,0x60,0x20,0x20,0x20,0x70,0x00,0x00, // i”
That was letter of “i” let’s examine for this.

Figure 1

You might be noticed that it is not 5*7 pixels actually ,is 8*12 pixels. But with the
spaces it seems like 5×7 and it is a convenient order.

So my first 0x00 (hex. number) is at the top then 0x00,0x20 goes by relatively through
bottom. You can create a table like mine at Microsoft Excel, then
fill the squares, calculate the exact values in hexadecimal.

Finally, we came to “changing” part. Now you must have 12 hexadecimal numbers for your new character,
replace these values with the values of a rarely used character. For example you calculated value
new values for “é” caharacter, placed the values of this caharacter “/”. When you used “/” at your code
it will be seen at the screen like “é”.

Be aware that this is for small font. For the big font there are 32 parallel lines
(hex. numbers) to change.


gökhan öztürk

Arduino Sonar System While It is Working


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.