# Category Archives: Electronics

Berhubungan bidang elektronika —— Related to electronics

Last updated by at .

## Vinculum VDRIVE2: modul antarmuka USB Host untuk Flashdisk

Dengan adanya modul VDRIVE2 keluaran vinculum, memungkinkan mikrokontroler dapat membaca dan menulis data ke media penyimpan data flashdisk. Didalamnya ada firmware yang mengendalikan hubungan dengan flashdisk, sehingga antarmuka pembacaan dan penulisan data dengan mikrokontroler secara serial atau SPI. Dengan menggunakan modul ini mikrokontroler akan dapat melakukan operasi layaknya jika flashdisk ditancapkan ke komputer. Hanya saja flashdisk harus diformat terlebih dahulu menggunakan komputer dengan format FAT16 sebelum digunakan. Dengan demikian mikrokontroler dapat membuat direktori, menhapus direktori, menulis data dalam file dan lain sebagainya. Dalam sistem mikroprosesor dapat digunakan sebagai media penyimpan data yang dapat diubah-ubah isinya, misalnya sebagai datalogger.

Untuk mempelajari perintah-perintah yang dimengerti oleh modul ini, saya mengujinya dengan menghubungkan secara serial melalui USBtoSerial-TTL yang ditancapkan ke USB komputer. Kemudian dengan menggunakan program Hyperterminal dengan setting baud 9600,8,n,1 tanpa protokol handshaking, saya dapat mempelajari perintah-perintah sebelum diaplikasikan ke mikrokontroler.

Perintah yang diberikan secara serial merupakan perintah seperti dalam DOS (Disk Operating System), namun perintahnya banyak perbedaan.

## Anda tertarik dan membutuhkan modul ini ?

Silakan hubungi saya atau beri komentar, saya memiliki 10 modul untuk dijual kepada yang membutuhkannya.

Untuk mengetahui perintah-perintah dalam bentuk ASCII pada modul ini, silakan dibaca buku yang dapat anda download dibawah ini.

## Arduino Tutorial: Digital scale

In the previous post has been written about the calibration of load cell sensor for measuring the thrust ofpropeller and the motor/engine. In a posting has been found a constant magnitude of the sensor output voltage per gram about 0.267012014. So every 1 gram increase in weight of load will raise the output voltage of the sensor about 0.267012014 mV.

In my project, this output voltage must be converted into digital numbers using the ADC on the Arduino Nano. Henceforth, the data is sent serially to the PC to be displayed in the monitor. PC programs used in visual basic 6. As a development, in terms of measuring the thrust, required the measurement results are presented in graphical form.

## What about the working principle of the Arduino program ?

1. At just the Arduino turn on, will assume the load is 0.
2. Arduino will sent periodically value of ADC to the PC every 200mS.

As written in previous posting, I will design and make a test equipment to measure the thrust of propeller and the motor/engine in aeromodelling parts. This measure will help to design rc model, such as fixed wing and multicopter. Before designing a total airframe, need to know first the characteristics of the motor/engine and matching propeller size. I used the load cell with specifications was written on this posting. My load cell is 15Kg of full scale with output voltage about 2mV/V. I used the amplifier capable to gained up to 1000x with source 5V for load cell reference voltage. This mean will give output about 10mV in full scale of 15Kg load.

## How to a simple calibrate  ?

Since I do not have the standard weight of high-priced, this way is simple to use a digital scale which has an accuracy of about 0.1gram and can measure up to 1Kg. Next, weigh any load with digital scale, record the result. Then move to the load cell and measuring with a digital voltmeter on the load cell amplifier output voltage.

 Photo of digital scale Photo of Load cell 362.2 gram 105.1 Volt 528.5 gram 151.8 Volt 63.5 gram 19.8 volt 275.9 gram 80.7 volt 34.1 gram 11.7 volt 14.7 gram 6.1 volt 30.2 gram 10.6 volt 130.2 gram 39.1 volt 40.4 gram 13.2 volt 101.2 gram 30.7 volt

Plot data using SCILAB

The commands to plot the datas using SCILAB as follow:

->weight = [362.2,528.5,	63.5,275.9,34.1,	14.7,30.2,130.2,	40.4,101.2]
weight  =

362.2    528.5    63.5    275.9    34.1    14.7    30.2    130.2    40.4    101.2

->volt=[105.1,151.8,19.8,80.7,11.7,6.1,10.6,39.1,13.2,30.7]
volt  =

105.1    151.8    19.8    80.7    11.7    6.1    10.6    39.1    13.2    30.7

->size(weight)
ans  =

1.    10.

->size(volt)
ans  =

1.    10.

->plot(weight,volt,'ro-.')

->xgrid

->ylabel("Loadcell amplifier output (mV)")

Will result a graph as follow:

## How much’s the output voltage of amplifier at zero load ?

On zero load output voltage at zero load is 2.8mV. My amplifier can not adjust to 0.0 volt, because there null offset voltage. On arduino using 10bit adc with 5V ref, will convert into (2.8/5000)*1024 =  0.57344 less than 1, or will known as 0 decimal.

## How to calculate voltage per Kg or mV/Kg ?

From the above data, I would find the average value using Microsoft Excel, will be obtained as follows:

So output voltage of amplifier will be: 0.267012014 mV/gram or 267.012014 mV/Kg.

The output amplifier according to specifications from 0 up to 4.3 volts. So that the maximum load that can be read are: 4300/267.012014 = 16.104Kg, near specification of loadcell about 15Kg.

| Tagged , , | 2 Comments

## Testing of the Arduino Servo library on brushless motor’s cesna 130-46

I’ve created an Arduino ATmega328 built on a perforated veroboard. To connect between pins, I use in soldering wires directly. I use a 16MHz crystal clock and  the Arduino will recognize  as a board of “Nano Arduino w / ATmega328″.

In order board is easy to use, I added a header connector as in the rc receiver configuration is GND / +5 V / Signal. To facilitate the program upload the ISP, pin TX / RX / RST microcontroller mounted single header connectors.

RST microcontroller connected to the RTS of the serial interface using the USB dongle that works automatically reset. In addition, I added the LED on the D9 in order to test whether the Nano board can work well.

Next I will test this board for the throttle of the brushless motor. I am using the simple program that has been available in the example program.

I use a 3S lipo, 18A ESC as a 5V voltage source Arduino board. Potentiometer connected to ADC0 or A0 pin to set the throttle.

## Measuring the response of the electric water heater using the Arduino

This post describes how to measure the response of the electric water heater using the Arduino. By using simple program on the Arduino is very simple to read the output of the temperature response. Arduino has a 10bit ADC accuracy is used to read the output of the LM35 temperature sensor.

The output voltage of the LM35 sensor is amplified using the LM358 with a voltage gain of 5.47. While the output voltage of the LM35 is 10mV per degree centigrade. So the total output voltage LM398 is 5.47x10mV = 54.7mV per degree centigrade.

Arduino simple program are as follows:

To read the temperature using the Arduino ADC channel 0 (A0). Results of ADC convertion is sent in serial with baudrate of 115200baud. By using hyperterminal program, the conversion result is stored in a file in text format form.

## Measurement steps

1. Upload arduino program to arduino board
2. Fill water with water and setup the water flow about 6ml/sec
3. Connect output of temperature sensor to A0 of arduino
4. Run hyperterminal and setup the filename to capture data
5. Start no power on elektric heater for some seconds
6. Start power of electric heater for some minutes
7. Remove power of electric heater for some minutes
8. Stop hyperterminal
9. Graph the results using scilab

## Graph the results using scilab

By using the Scilab command in the console such as the following, the response will be obtained graphically.

// read file

// convert to matrix
-->d=evstr(sh);

// check size of matrix
-->size(d)
ans  =

2652.    1.

// make matrix of time with sampling about 2ms
-->t=0:0.002:2651*0.002;

// check size t matrix must same with d matrix
-->size(t)
ans  =

1.    2652.

// convert to voltage, fullscale of adc = 5Volt
-->v=(d/1024)*5;

// convert to output voltage of LM35
-->v_sensor=v/5.47;

// convert to exact temperature with 10mv per centigrade
-->tc=(v_sensor*1000)/10;

// plot data
-->plot2d(t,tc,style=5)
-->xgrid()

-->title("Step Responses of Water Heater")

-->xlabel("Number of Samplings")

-->xlabel("Time in second")

-->ylabel("Temperature of water heater fluid (centigrade)")


## High Voltage and Current isolated PWM switching

I just finished doing some experiments on high voltage and current isolated pwm switching. This actually starts the need for a dc electric actuators to be installed within the heat exchanger control system.

The need to serve the electric heater actuator, with a 300 Watt power operates at a voltage of 220VAC. In my mind, I would use an electronic method of DC chopper.  To set the pulse width is used by pwm, which will be controlled via an Arduino microcontroller ATmega 328. Finally came the other requirements of the actuator system must be optically isolated, so the ground to be separated. This is usually to avoid EMI (electromagnetic interference). For switching, there are three options are SCR, MOSFET or IGBT. While the optical isolation, I make sure to choose 4N35.

After 3 days of my designs and try it out, finally got it perfect. Through this post, I will share my experiences to all visitors who need these actuators.

## How it works

This simple system without a transformer, the voltage source is directly rectified by the B1 and C1 to reduce the ripples. R1 and R2 form a voltage divider circuit, serves to provide a low voltage dc supply components for 4N35. 4N35 will be supplied with a DC voltage of 12V. However, the voltage on R2 is made higher than 12V to keep the possibility of fluctuations in voltage 220VAC. These fluctuations are usually 10 percent. So at about 200VAC voltage, DC voltage at R2 must be greater 12V.

Furthermore, components R3 and D1 form a circuit for cutting / create a stable voltage to 12V by the zener diode 12V. R3 is used to reduce the current flowing in the zener when the voltage on R2 above 12V. Voltage at the zener diode fed into the circuit R4 and C2 to eliminate riple as a lowpass filter.

12V voltage is then fed to the collector of the 4N35 as the supply voltage.  Emitter of 4N35 in series with R5, so that when the LED is not given voltage, the emitter voltage is zero. This is so when the LED is not given voltage, the output is 0 volts to MOSFET (N) or IGBT (N), and not in an active condition. In short, the input and output 4N35, not as an inverting logic. R6 is a series resistor when the transistor becomes active from 4N35, a pullup to 12V. The value of R6 is selected adjustable voltage requirements of the MOSFET or IGBT Gate.

Lastly, R7 aims to reduce the LED current of 4N35, of course, adjust your PWM peak voltage.

## Value of Components

Lastly, R7 aims to reduce the LED current of 4N35, of course, adjust your PWM peak voltage.

1. R1 = 220K/1W, R2 = 20K/1W, R3 = 2K2/1W, R4 = 470/1W, R5 = 47K/0.5W, R6 = 47/0.5W, R7 = 100/0.5W
2. C1 = 220uF/350V, C2 = 47uF/25V.
3. OP1 = 4N35
4. Q1 = IGBT HGTG18n120 / 1600V /30A

Posted in Electronics, Elektronika | Tagged , | 2 Comments

## An easy way to see the responses of ENC-03 gyro chip

Chip Gyro of ENC-03 is often used as a sensor to stabilize the aircraft or multicopter using RC. To learn seriously need to know the workings and characteristics of this chip. Data sheet for this sensor can be downloaded here. Chip is famous for its resistance to vibration and is easy to use because it has an analog output.

The sensor works because of the angular velocity, analog output voltage will depend on the angular velocity applied to the sensor.  Sensor output voltage will follow the following equation:

$V_{out}=&space;V_0+S_v\cdot&space;\omega$

V0 is the static output voltage at angular velocity = 0 deg/s. $V_0=&space;V_{ref}&space;\pm&space;0.6&space;V$

From datasheet $\small&space;V_{ref}=1.35V$. Thus the magnitude $\small&space;V_o=1.21V&space;-&space;1.41V$. Sv is scale factor in mV/deg/S = 0.67V. And $\tiny&space;\omega=-90&space;to&space;90deg/S$.

## Schematic

This circuit is the simplest. Voltage source connected to the RC tap, 100 ohms and 47uF to eliminate the ripple in the voltage source.

Gyro output voltage tap connected to the RC, 6.8KOhm and 0.68uF, serves as a simple lowpass filter to eliminate the output voltage caused by vibration.

Vref is the output that generates a voltage as a reference that may be required by the circuit on the outside.

At Vref is necessary to add capacitors of 4.7uF.

## Microcontroller

To read the response of the output voltage of the gyro, so easy to do I use nano Arduino board. This board contains a microcontroller type ATMega 328p. Because it already has an internal ADC, it will be easy to record responses.

In my Arduino programming using A0 as the ADC to convert the voltage output come from the gyro into digital numbers. Hereinafter ADC conversion result is sent serially to be recorded by using hyperterminal on windows.  I decided to process the data and plotted using Scilab.

## Board of ENC-03 Gyro

I got this gyro board by removing the yaw gyro on kkboard. However, it should be added 100ohm resistor and 47uF capacitor on the power supply VCC. And 0.68uF capacitor also needs to be added to the gyro output.

In accordance with the data sheet, this board is placed upright and moved radially. Can also be placed upright and inverted, but the gyro output voltage changes will be reversed as well.

To be able to move freely in the radial, required a dish to put this gyro board. To connect with pin of the Arduino board, can be soldered directly  using  cables.

Additional compenents of resistor and capasitor can be soldered into header pins of this board.

## Dish

In order gyro board can be moved radially with ease, need a dish to put the gyro board. The dish is made using styrofoam plate. At the center of the dish, bamboo as a holder mounted to rotate the dish. Arduino board and gyro board placed on this dish.  Furthermore, the Arduino board is connected with usb cable to the computer to record the results of Gyro responses of the radial motions.

This method is the most inexpensive and easy to make because it uses materials easily obtained is styrofoam.

## Other Dish

Because I can do the job using mechanical equipment such as lathes, milling machines, drilling machines, welding machines and so forth. I prefer this dish using iron material, because it is more robust and stable during use.

## Basic Recording

The basis of recording the response of the gyro output is done by reading through the adc conversion. I am using the Arduino programming with nano board. Arduino program as follows:

void setup() {
Serial.begin(115200);
}

void loop() {
Serial.println(sensorValue);
delay(50);
}

#### Recording steps:

1. Turn on Arduino by plugging USB’s arduino board to the computer.
2. Open hyperterminal, set baud to 115200 baud, 8bit, No parity, 1 stop bit.
3. Connect communication by clicking “Call” icon. You must ensure that the serial channel selection is correct. You will see the data receive by hyperterminal
4. Rotate the dish, you’ll see a change of data in hyperterminal.
5. To record and stored in a file, select the “Transfer -> Capture Text”. Then asked to fill in your name and the file folder.
6. Turn the dish as the fourth step in accordance with your wishes.
7. Stop record by select the “Transfer->Capture Text->Stop”.

#### Processing of data

The file name of the data is capture5.txt. Further data will be read and processed using Scilab program. Use the console to process manually. Scilab commands as follow:

-->// read data file into sh matrix

// convert sh matrix string content into d matrix as numeric
-->d=evstr(sh);

// convert adc data (0-1024, 10bit) into analog voltage
-->analog=(d/1024)*5.0;

// how big is the size of data
-->size(analog)
ans  =

694.    1.

// make t matrix as time (axis plot) 0 to 693
-->t=0:693;

// plot data
-->plot2d(t,analog,style=2)

The results of the graph are shown as follows.

| Tagged , , | 2 Comments

In this post, I will explain how to design a keypad by using an internal ADC of the microcontroller or microprocessor system.

ADC will be used to determine which any key is pressed in the state. In principle, there is a circuit that can generate a differrent voltages at each place of push button pressing. A simple circuit is by applying a voltage divider circuit using some  series resitors, which can lead to different voltages for each keystrokes.

For example, it is necessary to distinguish the five key functions in the program the microcontroller, the UP, DOWN, RIGHT, LEFT, and SELECT button. There are required 6 pieces of resistor: 2K, 220, 330, 1K, 3k3 and 10K, in order to generate the  rising voltage at ADC of microcontroller by successive key presses: UP, DOWN, LEFT, RIGHT, SELECT.

1. The circuit will work as follow:

1. If  the “UP” button is pressed, the voltage to ADC will be 0 Volt, because the 2K resistor will be pulled down to ground.
2. If the “DOWN” button is pressed, the voltage to ADC will be:
$\frac{330\Omega&space;}{330\Omega+2K\Omega}.5V=0.7082V$
3. If the “LEFT” button is pressed, the voltage to ADC will be:
$\frac{330\Omega+620\Omega&space;}{330\Omega+620\Omega+2K\Omega}.5V=1.6102V$
4. If the “RIGHT” button is pressed, the voltage to ADC will be:
$\frac{330\Omega+620\Omega+1K\Omega&space;}{330\Omega+620\Omega+1K\Omega+2K\Omega}.5V=2.4684V$
5. If the “SELECT” button is pressed, the voltage to ADC will be:
$\frac{330\Omega+620\Omega+1K\Omega+3K3\Omega&space;}{330\Omega+620\Omega+1K\Omega+3K3\Omega+2K\Omega}.5V=3.6207V$
6. If no button is pressed, the voltage to ADC will be:
$\frac{330\Omega+620\Omega+1K\Omega+3K3\Omega+10K\Omega&space;}{330\Omega+620\Omega+1K\Omega+3K3\Omega+10K\Omega+2K\Omega}.5V=4.4203V$

If the output of the voltage divider circuit (“to ADC”) fed to the 10bit ADC input, then any key presses will produce a decimal:

1. UP button: 0V will be 0 decimal.
2. DOWN button: 0.7082 Volt will be 145 decimal.
3. LEFT button: 1.6102 Volt will be 329 decimal.
4. RIGHT button: 2.4684 Volt will be 505 decimal.
5. SELECT button: 3.6207 Volt will be 741 decimal.
6. No Button: 4.4203 Volt  will be 905 decimal.

3. How to programming tricks

In fact every keystrokes are not exactly generate a voltage as described in point 1. Means a range slightly above or below the voltage. Thus, the voltage value of the middle is taken, for example: the “UP” from 0V to 0.7082 / 2 = 0.3541V, the “DOWN” from 0.7082V to 0.7082 + (1.6102-0.7082) / 2 = 1.1592 V, and so on.
More easily calculated from point 2, the decimal after being converted by the ADC.
1. The button of  “UP” on pressed state when the conversion result of ADC is defined below value of 145/2 or 72 decimal.
2. The button of  “DOWN” on pressed state when the conversion result of ADC is defined below value of 145+(329-145)/2 or 237 decimal.
3. The button of  “LEFT” on pressed state when the conversion result of ADC is defined below value of 329+(505-329)/2 or 417  decimal.
4. The button of  “RIGHT” on pressed state when the conversion result of ADC is defined below value of 505+(741-505)/2 or 623 decimal.
5. The button of  “SELECT” on pressed state when the conversion result of ADC is defined below value of 741+(905-741)/2 or 823 decimal.
6. No button on pressed state when the conversion result of ADC is defined below value of 905+(1024-905)/2 or 964 decimal.

C  Programming

/*********************************************************/
// created by: Bambang Siswoyo
// Electronic department - University of Brawijaya
/*********************************************************/

int adc_button_table[6] = { 72, 237, 417, 623, 823, 964 };
int NUM_KEYS = 6;
#define UP      0
#define DOWN    1
#define LEFT    2
#define RIGHT   3
#define SELECT  4
#define NOKEY   5

{
............................................
............................................
}

int get_key()
{
int k_num;            // number of key

// Convert voltage from voltage devider
for (k_num = 0; k_num < NUM_KEYS; k_num++)
{
{ return k_num }
}
}

void main()
{ // main program for testing only
int btn;

btn = get_key();
// action
switch(btn)
{
case UP:
//do something when var equals 0
break;
case DOWN:
//do something when var equals 1
break;
case LEFT:
//do something when var equals 2
break;
case RIGHT:
//do something when var equals 3
break;
case SELECT:
//do something when var equals 4
break;
case NOKEY:
//do something when var equals 5
break;
}

## Filter Low Pass: aplikasi pada sensor temperatur

Silakan digunakan untuk kepentingan proses pembelajaran untuk mencerdaskan bangsa ini dengan tidak lupa menyebutkan sumbernya.
Namun yang harus dihindari adalah: mengambil isi dengan mengakui sebagai haknya, mengambil isi untuk tujuan komersialisasi.
Semua tergantung kepada hati-nurani, jika terjadi saya berkewajiban mengingatkan para plagiator. Biasakan sesuatunya terlahir dari tangan anda, itu menunjukkan bahwa anda ada dan anda diberi hidayah sebagai ciptaanNya yang paling mulia untuk memberikan manfaat di dunia ini. Biasakanlah memberikan manfaat kepada orang lain, dan jangan membiasakan memanfaatkan orang lain.

Sensor temperatur sering digunakan sebagai umpan balik pada sistem kontrol temperatur. Sensor sangat penting dalam sistem kontrol, harus memiliki kepresisian yang baik dan harus stabil. Dalam aplikasinya sensor temperatur mengubah temperatur menjadi tegangan. Namun tegangan yang dihasilkan oleh sensor selalu disertai dengan sinyal-sinyal diluar dari informasi yang sebenarnya.

Sebagai contoh sensor temperatur LM35, merupakan sensor elektronik yang kompak dan murah harganya dapat digunakan sebagai senor temperatur dalam sistem kontrol. Sensor ini memiliki kepresisian 10mV/oC. Biasanya sensor ini diperpanjang dengan menggunakan 3buah kabel jalur tegangan dc +- dan jalur keluaran sensor. Sinyal noise akan dihasilkan karena adanya perpanjangan kabel dan akan membuat kesalahan pada sistem umpan balik.

Untuk menghilangkan sinyal-sinyal yang bukan informasi dari temperatur digunakan filter low pass. Yang paling murah menggunakan komponen pasip R dan C  yang diletakkkan pada ujung paling akhir dari perpanjangan kabel menuju ke pengkondisi sinyal.

Adapun rangkaian pasip RC low pass filter diperlihatkan dalam gambar berikut ini:

Dari rangkaian filter low pass diatas dapat ditulis persamaan sebagai:

$V_o_u_t=\frac{Z_c}{Z_R+Z_c}.V_i_n$

Dimana:

Selanjutnya untuk mendapatkan tegangan keluaran secara statis, persamaan dapat dituliskan kembali menjadi:

$V_o_u_t=\left&space;|&space;\frac{Z_C}{Z_R+Z_C}&space;\right&space;|=\frac{Z_C}{\sqrt{(Z_R^2+Z_C^2)}}=\frac{1/2\pi&space;f&space;C}{\sqrt{R^2+(1/2\pi&space;f&space;C)^2}}$

Salah satu contoh dalam aplikasi yang saya posting disini, menggunakan $R=1K\Omega$ dan $C=10\mu&space;F=10^-^8F$. Maka hasil perhitungan untuk tegangan masukan sebesar 5 volt adalah:

$X_C=\frac{1}{2.\pi.5.10^-^8}=3183098.862&space;\Omega&space;,&space;Z_R&space;=&space;1000\Omega$

$V_o_u_t=\frac{3183098.862}{\sqrt{1000^2+3183098.862^2}}.5=4.999999753&space;Volt$

$X_C=\frac{1}{2.\pi.400.10^-^8}=39788.73577&space;\Omega&space;,&space;Z_R&space;=&space;1000\Omega$

$V_o_u_t=\frac{39788.73577}{\sqrt{1000^2+39788.73577^2}}.5=4.999684322&space;Volt$

Agar lebih mudah menggambarkan respon keluaran sebagai fungsi frekwensi, digunakan parameter s, kemudian dengan menggunakan fungsi bode dalam SCILAB, respon keluaran akan mudah digambarkan dalam kawasan frekwensi.

Fungsi alihnya dapat dituliskan kembali menjadi:

$\frac{V_o_u_t}{V_i_n}=\frac{1/10^-^8s}{1000+1/10^-^8s}=\frac{1}{10^-^5s+1}$

Perintah scilab mencari tanggapan frekwensi dan tanggapan fasa adalah sebagai berikut:

-->clear all;

-->s=%s
s  =

s

-->G=syslin('c',1,10^-5*s+1)
G  =

1
-----------
1 + 0.00001s

-->bode(G,0,100000)

Frekwensi cutt-off pada penguatan -3db berada pada sekitar 10KHz, atau sinyal yang diloloskan pada 0 db sampai pada frekwensi 100Hz. Ini sudah cukup pada sebagai umpan balik pada sistem kontrol temperature dengan frekwensi sampling maksimal 50Hz atau 20mS. Paling tidak dengan waktu sampling 50mS sinyal umpan balik sudah bisa mengikuti respon temperatur plant dengan penguatan 0 db.

Dibuat oleh: Bambang Siswoyo

Filter low pass diatas memiliki orde 1. Agar penurutan penguatan menjadi lebih tajam digunakan orde 2 dengan menyusun 2 filter low pass secara kaskade. Sebagai contoh dua filter low pass dihubungkan secara kaskade diperlihatkan dalam gambar berikut ini.

Untuk mencari fungsi alihnya dapat dituliskan sebagai berikut:

$\frac{V_o_u_t}{V_i_n}=G1(s).G2(s)$

$G1(s)=\frac{(1/10.10^-^9s)}{1000&space;+(1/10.10^-^9s)}&space;,&space;G2(s)=\frac{(1/10.10^-^9s)}{500&space;+(1/10.10^-^9s)}$

Dengan menggunakan scilab dapat diperoleh fungsi alih totalnya dengan perintah sebagai berikut:

-->s=%s
s  =

s

-->ZR1=1000;

-->ZC1=1/(10*10D-9*s);

-->ZR2=500;

-->ZC2=1/(10*10D-9*s);

-->G1=ZC1/(ZR1+ZC1);

-->G2=ZC2/(ZR2+ZC2);

-->GT=G1*G2
GT  =

1.000D-14
-----------------------------------
2
1.000D-14 + 1.500D-18s + 5.000D-23s

-->G=syslin('c',GT)
G  =

1.000D-14
-----------------------------------
2
1.000D-14 + 1.500D-18s + 5.000D-23s

-->bode(G,0,100000) 

Adapun respon frekwensinya diperlihatkan sebagai berikut:

Kesimpulan

Pada filter orde dua atau dua kaskade memiliki penurunan fasa paling curam jika dibandingkan dengan filter orde satu. Kecuraman penguatan  sangat diperlukan pada filter,karena akan semakin mendekati filter ideal.

Posted in Electronics | Tagged , , | 2 Comments

## Programming Tools for Altera FPGA — Usb Blaster

If you work with an evaluation board from Altera FPGA, you need a suitable programmer for Altera FPGA. One is a programmer called Usb Blaster is intended only for Altera FPGA.
With Usb Blaster was only using the usb interface with your computer. While the interface to an FPGA using JTAG mode.

This tool would be suitable for all Altera FPGA. To install the drivers, drivers are required to be directed manually to the directory where you installed the program.

Thus you do not need to buy an evaluation board equipped with an internal usb. So you are free to choose the evaluation board or you will work with minimal FPGA and compact.

## 4digits 7segment display driver: input 4 BCD with blink

This module is similar to the module that has been in post here. However, this module is not equipped with an internal RAM, so that as the input is 4-digit BCD. Usually this module is used, if the previous modules has registers or RAM which hold data BCD.

In this module has a 4-digit BCD input in parallel. So that the BCD data provided will be displayed to the 4-digit 7segment.

### Block of Module

The function of each i / o of this module are:

• CLK50MHZ is oscillator about 50MHz.
• BLINK is input control for flashing the 4 digit 7segment display. Active in logic 1.
• 4 digit BCD input are called as BCD_DIG0..3. Its function is as much as 4-digit bcd input. This 4 digits bcd input is obtained from the previous module connected to this input.
• Output of SEG(7:0) is used for pattern of 7segment display. Segments of 4 digit usually are connected in parallel.
• Output of the SEG (3:0) is used to activate each digit of common anode. Because each digit of 7segment will be displayed in scanning method.

### Testing module

To test the module is not enough if you use the switch on the evaluation board. One way is to use additional modules in the form of a binary counter. The data of counter will be assigned to the output that connected to input of display module.

The following block diagram as a whole to test the module of  “drive7seg_noram_blink”.

Additional modules is called “test_counter” serves as a counter having 4 bcd output. The other used is  library in ISE AND2 to stop the counter because CLK50MHZ on the block if STOP = 0.

## UART RS232

Serial communication is often used for general applications is RS232. This module is a modification of the module that was created by Dan Pederson, Digileninc, 2004.

Here I made some modifications to the baudrate of the rx / tx can be set manually. Setting baudrate usual through a combination of a switch or a schematic. If you wish to make modifications, please write your profile included in the program comments.

### How it works

I will first explain the function of each pin of this module, namely:

1. BAUD(2:0)
This pin is 3 bits serves to set baudrate of the TX and RX. There are 8 kinds of combinations baudrate from 000 to 111 are 1200, 2400, 4800, 9600, 19200, 38400, 115200, 115200. Last baudratenya same, so there are only 7 different baudrate. Parity used is odd, 8bits data, stop bit 1.
2. TX
This pin is used for transmit data by serially at current baudrate.
3. RX
This pin is used for receive data by serially at current barudrate.
4. CLK
As base clock at 50MHz.
5. DBIN
This pin is used as an 8bits parallel data will bel transmittesd  by serially via the TX pin. This data is provided when TBE = 1 means the bus was empty and ready to accept new data.
6. DBOUT
This pin will contain 8bits data has been received by serially via RX pin.  This data will ready if RDA=1.
7. RDA – Read Data Available
This pin is used as a flag that the serial data has been received from the RX when RDA=1.
8. TBE – Transfer Bus Empty
This pin is used as a flag that the byte to transmit is empty and ready to get a byte again.
9. RD
As Read control to get a byte from DBOUT when RDA=1. Active as logic 1.
10. WR
As Write control to write a byte to DBIN when TBE=1. Active as logic 1.
11. PE, FE, OE
As an indicator of the process of the module.
12. RST
As control to reset module and start using baudrate of setting.

### Testing

To test this module, additional modules required as a “Top of Module” in ISE. Top module serves to bypass the data from DBOUT sent to DBIN. This means that data is as internal loop. If you use hyperterminal as a tool, then typed data provided in the keyboard will be accepted back as an echo character. Here you will be able to check the function of the module right or wrong.

Source code of top module as follow.

### Testing

To test this module, additional modules required as a “Top of Module” in ISE. Top module serves to bypass the data from DBOUT sent to DBIN. This means that data is as internal loop. If you use hyperterminal as a tool, then typed data provided in the keyboard will be accepted back as an echo character. Here you will be able to check the function of the module right or wrong.

Source code of top module as follow.

## 4digits 7segment display driver: with blink

This module is the same as the previous module . This module also serve as a  4 digit  7segment display driver. Module has the distinction is equipped with blinking control lines internally, called “blink”. By providing a logic 1 on this channel, automatically display will flash with a certain period.

### How it works

As a display controller 7segmen 4digit led by scanning methods. Scan time to 4 digits is 4x8000x1/50uS = 640uS. Each 7segmen equipped with an internal RAM which can be written using the data bus din [3:0], addr [1:0] and control wr. This RAM contains the BCD data to be displayed to each digit 7segmen.

This module is equipped with an internal oscillator in a blink.  Only by providing a logic 1 on input channel “blink”, the display will flash with a certain period. This would make it simpler to control for the display flashes.

### Board Used

To test the module is used fpga evaluation board Spartan3 XC3S200 from Xilinx. Clock Frequency used is 50MHz. 7segmen displays already available in this board as much as 4 digits. It has been designed featuring a multiplex, because each digit is equipped driver transistor to activate each digit. Led every bit connected in parallel.

### Block Architecture

Functional pins can be explained as follows:

• output digout [3 .. 0] is used to enable every digit of 7segmen displays, active logic 0.
• seg [7 .. 0] as the display pattern data for forming the digits 0-9 and A-F at 7segment display.
• addr[1..0] as address bus of internal ram for display bcd buffer.
• din[3..0] as data bus of internal ram.
• blink as blink control of display. If blink = 1 the display will flash with a certain period. This is useful for applications that require the display blinking mode, for example, to give warning, the setting for the operator, or other.
• wr as a control writing of data into ram, active at rising edge.
• clk50mhz as clock source.

Controller architecture from 7segment drivers provide blinking using the scanning method is described as follows:

DEMO

## 4digits 7segment display driver: noblink

In the electronic systems are usually required to display the measuring value, setting value, and so forth. Thus the required module to interface displays.  This module is not equipped with blinking internal control input. So, we need externally blinking pulse, blinking oscillator. Externally blinking pulse is usually obtained from the previous module. So that the pulse period can be determined in accordance with the previous module state. This module is the same except have been equipped with blinking control internally.

### How it works

As a display controller 7segmen 4digit led by scanning methods. Scan time to 4 digits is 4x8000x1/50uS = 640uS. Each 7segmen equipped with an internal RAM which can be written using the data bus din [3:0], addr [1:0] and control wr. This RAM contains the BCD data to be displayed to each digit 7segmen.

This module is not equipped with an internal oscillator in a blink, blink, so input must be adjusted to a specific frequency through an external oscillator. This module is intended to blink period can be adjusted with the desire.

This module was tested using an evaluation board FPGA from XILINX XC3S200 Spartan3. The frequency of the oscillator used in this evaluation board is 50MHz. To display 4 digits, has been available as 4-digit 7segmen display. This display uss a scanning or multiplex method, because each digit is equipped transistor to turn on each digit of 7segmen display. Every bit segment of 7segmen connected in parallel.

### Block architecture

Functional of pins can be explained as follows:

• output digout [3 .. 0] is used to enable every digit of 7segmen displays, active logic 0.
• seg [7 .. 0] as the display pattern data for forming the digits 0-9 and A-F at 7segment display.
• addr[1..0] as address bus of internal ram for display bcd buffer.
• din[3..0] as data bus of internal ram.
• blink as blink control of display. If blink = 1 the display will turn off, blink = 0 the display will turn on. This is useful for applications that require the display blinking mode, for example, to give warning, the setting for the operator, or other.
• wr as a control writing of data into ram, active at rising edge.
• clk50mhz as clock source.

Controller architecture from 7segment drivers using the scanning method is described as follows:

### Application Circuit

To apply this module is required circuit 7segmen 4 digit display. To display each digit is switched to logic 0 via the output digout [3 .. 0]. While the pattern formed by the ag segment associated with the output of the module seg [7 .. 0], the remaining segment is the dot. The following image is an electronic circuit at least for the application.

DEMO

## Programming tools for XILINX FPGA — Platform MultiLINX

Fpga programmer tool MultiLINX Platform provides several modes of programming are: JTAG, Serial and Select MAP. While the interfaces with a computer provided by 2 modes: Serial RS232 and USB. This is a professional programmer and cost more expensive than the Platform Cable USB. However, providing a variety of programming modes and will give you flexibility to program the fpga.

It should be noted, the tool described here is only additional equipment to experiment with the xilinx fpga. This tool is only used as a programmer fpga for xilinx, in order to move the result of the binaries program based your design using fpga development software. Xilinx using ISE , and Altera using Quatrus II as fpga development software. Both hardware (programming tool, the explanation here) and fpga development software should have the right driver (typically been included). Then you are welcome to choose the appropriate board fpga evaluation of your financial ability.

### Platform MultiLINX

Using this programming tool, you can freely choose the interface with computers and programming mode with the fpga. But the necessary external power supply is usually obtained from the evaluation board with a voltage of 2.5-5 Volts fpga. Use this to prosesional purposes or financial condition that you have enough to buy it. Provided 4 groups are floating cable, used to serve all existing fpga programming mode. With this floating cable you will easily connect to pin fpga programming. There is a list of labels for the signals in accordance with fpga programming mode. Label numbers correspond to the cable socket.

Have 3 groups of programming mode cables for JTAG, Slave Serial and Select MAP. As you look at sinyal names at box near cables connectors have two header connector are located up and down. At up connector have two groups cables, left for JTG, right for Slave Serial. The bottom connector is used programming for Select MAP mode.  By using this programmer, you do not need to buy an evaluation board equipped fpga programmer internally. Usually the programmer is equipped in the evaluation board with USB interface.

## How to turn off the 4 digits of 7segment display

On the evaluation board of fpga spartan 3 has 4-digits 7segment display. The displays are usually used to display data or a limited character.

However, for applications that do not require this display, is needed to turn off all digits of 7segment display.  An example is a demo of the application in the post here, the appearance of the 4 digits 7segment can interfere with performance, so need to be turned off.

You need to know the workings of the 7segment 4digits display on the evaluation board of fpga spartan 3, please click here to know it. To turn off all digits of 7segment display is by disabling all common anode of 7segment display. To disable each digit is by setting the common anoda to logic 1, because each digit will active at logic 0.

Common anode pins of 7segment display is called as AN3, AN2, AN1, AN0 with a pin number in sequence are E13, F14, G14, D14.

There are two methods  are behavioral or schematic to turn off all the digits of the 7segment display.

### Behavioral

Well I will refer vhdl code posted here. The trick is to add output port for each digit of AN3, AN2, AN1 and AN0 written in Entities Block. To be concise to use array of std_logic.

Finally, in Block of process use the initialization as “1111″. Here are excerpts vhdl code then there is the addition, the results become:

Finally, in Block of process use the initialization as “1111″. Here are excerpts vhdl code then there is the addition, the results become:

### Schematic

If you are working on schematic design, you can use schematic editor to disable all 7segment display. Each common anode of 7segment digit must be pulled up to VCC using I/O marker, it’s mean give a logic 1. Next, gave a name each I/O marker, for example as AN0, AN1, AN2 and AN3.

The following video will describe it:

DEMO

## How to design a digital system by a mixture of VHDL and Schematic

Posting this time I plan to redesign the existing digital system that i’ve posted here. Of course, different methods, namely a combination of VHDL and schematic.

And I will explain to you how it works.

### Schematic

Schematic above, have a working principle that has been posted here , but designed here is a combination schematic and VHDL modules.

How it works The above schematic can be explained as follows:

1. STOP input is used to disable CLK50MHZ for passing out to output of AND2 when STOP = 1. When STOP = 1 input module of delay250ms did not get the pulse of CLK50MHZ.
2. The function of the module delay250ms is to create pulses at the output about 250ms of periode.
3. The output of addr_count module will move from 00000 to 11111 and vice versa every “rising edge” of input. This output will be as address for the input of led_pattern module.
4. The led_pattern pattern module is ROM for leds pattern about 32x8bit of size. This ROM held  binary datas and is defined as an array.
5. Q_LED output will be a binary data in accordance with input address of ADDR.
6. Finally leds will turn on/off according with ROM output.

### VHDL Code of Modules

Each module on the schematic above is made in behavioral VHDL and converted to a schematic symbol. Except for INV and AND2 are internal library of the ISE. As the top module constructed schematically as shown in the picture above. The pull up of AN0..AN3 to VCC is used for disable or turned off the 4digits 7segment display. This is up to you.

## 8 leds flasher using pattern look up table

As you can see in this post, the pattern of the 8 leds is only two kinds: turn all leds to off or on. From this post I have an inspiration what if the pattern is stored in a table of ROM or is called  as the look up table (LUT).

Just LED pattern permanently stored in ROM make the LEDs display will have variations. So in this post, the delay time is maintained constant so you can easily understand how it works. But on the other posts will be modified with a delay time that varies.

### VHDL Code

About the workings of the program above can be explained as follows:

• Lines 1-3 is definitions of library used. STD_LOGIC_ARITH library contain library of CONV_INTEGER that used in line 36 for converting INTEGER to STD_LOGIC_VECTOR.
• I / O ports are defined in lines 5-9, STOP to stop flasher, Q_LED to control 8 LED, CLK50MHZ as input timer.
• Lines 13-23 define the ROM 32x8bits for the pattern of the LED display is called “led_lut”. LUT was marked by the addresses 0-31 or 00000 to 11111 in binary. As marker addresses of LUT is addr_lut and the defining is line 26.
• Lines 25-26 are defining of variable dly as delay counter and addr_lut as a marker addresses of LUT.
• Lines 31-44 are block of process.

## Simple 8 leds flasher with options delay

Examples of programs here is same with the previous example, just added the option of delay using combination of switchs. Consists of two switches that are used to select the delays. The combination switch will determine a constant delay that is stored in the ROM table as a reference delay at this time.

### VHDL Codes

The line by line explanations of vhdl codes as follow:

• Lines 1-4 is the definition of libraries used.
• Lines 6-12 is the definition of I/O channels used. STOP is input channel for stopping leds flashing or all leds will turned off. DLY_OPT is used to select the time of delay that held in ROM tables called as romdelay. Q_LED is array channel outputs for driving 8 leds. CLK50MHZ as oscillator clock.
• Line 16 is the definition of type_romdelay as integer in range 0 to 100000000 or 0 to 2 second.
• Line 18 is the definition of dly and dly_buff variable as integer in range 0 to 100000000. dly for delay counter and dly_buff as comparing delay assign from romdelay table based on DLY_OPT.
• Lines 21-27 is  the table of delay selections. 100000000 is 2 second, 50000000 is 1 second, 25000000 is 0.5 second, 12500000 is 0.25 second.
• Lines 31-50 is the block of process.
• Lines 34-39, increment dly as delay counter, if same with dly_buff will read new delay from table, dly reset to zero, make toggle flag_blink.
• Lines 41-49, turned on leds if STOP=0 and flag_blink=1, if not it leds will turned off.

DEMO