You are on page 1of 6

NAMA : Ardelia Amanda Putri SEMESTER : IV

NIM : 21502241006 TANGGAL : 28 Maret 2023


WAKTU : 15.00 JUMLAH ANGGOTA KELOMPOK : 4
TOPIK PRAKTIKUM
Analog Input Experiments
Reguler ADC block converts the analog signal into digital data. Users can select the channels and
sample rate (sample time) pf ADC module for the blockset in Simulink library >> Waijung
Blockset >> STM32F4 target >> On Pripheral Chip >> ADC. Reguler ADC Block has the
following characteristic

Objective
• To enable the user to read the analog signal using a Regular ADC Blocket
• To understand the fuction of light sensor and enable to the user to control the LED

The sensor aMG Photocell-A is show in Figure 2-2. It measures the light intensity. Voltage driver
rule can be applied to find the which is governed by the following relationship.
Figure 2-2: Circuit board for aMG Photocell-A

Figure 2-3 show a Simulink model for switching the LED. Regular ADC bock is used. The
working of the model is described as follows;
• The LED will be turned on if the voltage is above or equal to2.5 V (threshold voltage)
• The LED will be turned off if the voltage is less than 2.5 V (threshold voltage)

Figure 2-3: Simulink Model for LED switching using Light sensor

Digital data from ADC module has 12-bit resolution. It is not convenient to display the value from
0 to 4095 on STM32F4. the values from 0 to 4095 does not give us meaningful information
therefore it is better to translate this information from 0 to 3.3 V with the help of simple transfer
fuction (By multiplying with the gain of 3.3/4095.

Figure 2-4 show the relationship between the digital values and the actual output.on the x-axis, the
digital velues are given and on y-axis the corresponding analog voltage value is given.
Figure 2-4: Relationship between digital value and actual voltage

In Figure 2-4, we can see a red line. For example, the value of ADC is 3060 and we want to obtain
its corresponding voltages. To get corresponding voltage, velue of ADC is multiplied by te gain
factor i.e.

3060*(3.3/4095) = 2.465 V

Analog signal to digital signals


Purpose
• To test the performance of the ADC module to read analog value from digital signal.

Figure 4-1: Simuink model to read values from analog signal to digital signals

The Simulink model of this experiment consists of two parts: reading the analog input and
displaying the results on LCD screen and creating a digital signal using 4 Pulse Generators with a
period of 0.001 second (frequency 1 KHz) each and duty cycle of 25, 50, 75 and 99%. Digital
signal is called Duty Cycle Pulse Width Modulation which is a popular technique for controlling
the speed of the motor or adjusting the light bulb. The user can generate the PWM signals using
basic PWM or Advanced PWM blocks in Simulink library >> Waijung Blockset >> STM32F4
target >> On peripheral Chip >> TIM. After downloading the program to STM32F4DISCOVERY,
pin D15 will send a digital signal with a frequency of 1 KHz. User can select the duty cycle of the
digital signal by setting DIP switch as shown in Table 4-1. Pin D15 is to be connected with an RC
circuit which serves as a first order filter for the signal as shown in Figure 4-2. Signal after
filtration will be sent to the LCD for display.
ALAT DAN BAHAN
Aplikasi Matlab
Simulink
Waijung
USB
STM32F4
Jumper
METODE/LANGKAH KERJA
1. Membuka Aplikasi Matlab 2016
2. Open Simulink
3. Open or Build Blocs
4. Connect to STM32F4
5. Run atau jalankan Program
6. Outpun LED akan terlihat di STM32F4
7. Jika ada kesalahan pada code Program dapat dilihat pada colom window
HASIL PRAKTIKUM

ANALISIS
Pada praktik ini di perintahkan untuk menjalankan program pengubah sinyal analog mejadi data
digital. Komponen yang di gunakan adalah modul STM32F4 serta sensor MG Photocell-A. Sensor
MG Photocell-A ini digunakan untuk mengukur intensitas cahaya.

Dari tabel di atas menjelaskan pin-pin yang tersambung dari sensor menuju modul STM32F4.
Namun pada pada percobaan yang kami lakukan kami tidak menggunakan sensor MG Photocell-
A, yang kami gunakan adalah rangkaian sederhana untuk sensor nya. Dalam Rangkaian kami
terdapat satu sensor SCR, dua resistor dan satu LED sebagai indikator. Sensor SCR di sambung
pada pin PA5 pada STM serta GND, kemudian sensor di pralel dengan dua resistor 1K, kaki lain
dari salah satu resistor tersambung pada pin 3V STM, kemudian positif pada board sambung
dengan pin VDD pada STM dan negatif board sambung dengan GND STM.
Setelah itu modul STM32F4 di koneksikan dengan program yang ada pada Simulink>> Waijung
dan kemudian di compile.
Hasilnya led yang sebagai indikator akan menunjuk kan dimana ketika SCR di beri cahaya maka
LED ada mengindikasikan mati atau dalam data menunjukkan 0. Dan ketika SCR tidak di beri
cahaya maka Indikator LED akan menyala atau dalam data menunjukan 1.
KESIMPULAN
• Digital input analog reading merupakan program untuk mengubah sinyal analog menjadi digital
pada mikrokontroller (modul STM32F4)
• Blok ADC pada simulink untuk mengubah sinyal analog menjadi sinyal digital dengan resolusi
12-bit.
• Tidak pas ketika menampilkan nilai 0 hingga 4095 pada STM karena terlalu banyak dan tidak
memberikan informasi berarti, makan lebih baik menerjemahkan informasi dari 0 hingga 3,3V
dengan fungsi transfer sederhana (mengalikan gain 3,3/4095).

DIKERJAKAN OLEH : DIPERIKSA OLEH :


Azzahra Isnaini Putri (21502241001) Suprapto, Ph.D.
Ardelia Amanda Putri (21502241006)
Diajeng Ayu Berliana (21502241009)
Adelia Berlian Rizka S (21501141010)

You might also like