[EN] Arduino: STM32F103CBT6 ADC&LDR.

From reading articles on how to use board STM32L432 ADC and articles about STM32F103x connecting to ST7735S, it’s time to take STM32F103CBT6 or Blue-Pill/Black-Pill board. Let’s write a program to use ADC to display on a TFT screen. The example of the result of this article is as shown in Figure 1, which is reading from Pin PA0 that has been connected to Pin Analog signal from Board LDR in Figure 2 to Displayed on a TFT display.

Figure 1 Our board’s operation
Read More

[EN] Arduino: ESP32-S2’s DAC&ADC.

After testing the DAC and ADC of both the ESP32, SAM-D21, LGT8F328P and STM32L432KC, This time, it’s the time of the ESP32-S2 that we have. The test performance is still the same as before using the DAC. Three types of waves are sent out: zigzag, triangular, and sine waves and connect to the ADC pin to read the value and test the graph to see what it looks like.

In this experiment, DAC1 is connected to the ADC as shown in Figure 1. The ESP32-S2 has 2 ports of 8-bit DAC called DAC1 and DAC2. The ADC has a 12-bit resolution, which is seen to have the same properties as the ESP32, but whether the results are the same or not, you can tell that they are probably different because they use different microcontrollers. The ESP32-S2 uses the same one as the ESP32-S3 with only one core and no BLE.

Figure 1 Neucleo L432KC with A3 connected to D3
Read More

[EN] Arduino: STM32L432 Nucleo-32’s DAC&ADC.

From reading the article Using STM32 Core Support for Arduino for Board Nucleo L432KC by Ajarn Rewat Siriphokapirom, we have provided the board to test and connect the pin for sending data output DAC to ADC as shown in Figure 1 to test the operation of the DAC and ADC of the board by using the working code like the ESP32 microcontroller board, SAM-D21 and LGT8F328P. Let’s get started.

Figure 1 Neucleo L432KC with A3 connected to D3
Read More

[EN] Arduino: The LGT8F328P’s ADC/DAC.

This article is a continuation of the previous article introducing the LGT8F328P board and its use of ADC and DAC. By focusing on the use for the chip LGT8F328P, which is different from the SAM-D21 in that it uses pin D4 as a pin that serves as DAC0 and the DAC circuit has a resolution of 8-bit.  The output can be from 0 to 255. The ADC sector uses pins A0, A1, … normally and has a resolution of 12 bits. Therefore, in this article, the connection pins from A0 to D4 are used in the experiment as shown in Figure 1.

Figure 1 LGT8F328P connected A0 to D4
Read More

[EN] Arduino ADC/DAC

This article introduces the ESP32 and SAM-D21 microcontroller board to learn how to use ADC (Analog to Digital Converter) and DAC (Digital to Analog Converter) instruction by connecting the DAC pin to ADC as shown in Figures 1 (Connect A0 to A1 of Board SAM-D21 ) and 2 (Connect Pin GPIO26 to GPIO36 of ESP32) to send data to DAC and have ADC read it back. Then send the results out to the serial port for display with the Serial Plotter, which is an example program to send 3 types of data, which is a zigzag graph, triangular graph and waveform graph from the sinusoidal function

Figure 1 SAM-D21 with A0 connected to A1
Figure 2 ESP32 with port 26 connected to port 36
Read More

[TH] Arduino: STM32F103CBT6 ADC&LDR.

จากที่ได้อ่านบทความการใช้ ADC ของบอร์ด STM32L432 และบทความเกี่ยวกับ STM32F103x ในการเชื่อมต่อกับ ST7735S เลยถึงคราวนำ STM32F103CBT6 หรือบอร์ด Blue-Pill/Black-Pill มาเขียนโปรแกรมใช้งาน ADC เพื่อแสดงผลบนจอ TFT กันบ้าง โดยตัวอย่างผลลัพธ์ของบทความนี้เป็นดังภาพที่ 1 อันเป็นการอ่านค่าจากขา PA0 ที่ได้เชื่อมต่อกับขาสัญญาณแอนาล็อกจากบอร์ด LDR ในภาพที่ 2 เพื่อแสดงผลบนจอแสดงผลแบบ TFT

ภาพที่ 1 ตัวอย่างการทำงานของโปรแกรมในบททความ
Read More

[TH] Arduino: ESP32 PWM.

บทความนี้กล่าวถึงการใช้ PWM (Pulse Width Modulate) ของไมโครคอนโทรลเลอร์ ESP32 ในเฟรมเวิร์ก Arduino หลังจากที่ได้กล่าวถึงการทำงานของส่วนนี้ใน ESP-IDF และ MicroPython ไปแล้ว โดยบทความกล่าวถึงฟังก์ชัน การใช้งาน และตัวอย่างโปรแกรม ด้วยการเชื่อมต่อบอร์ดกับลำโพงดังภาพที่ 1

ภาพที่ 1 บอร์ด esp32G2 ที่ติดตั้งลำโพงแบบบัซเซอร์ไว้ที่ GPIO19
Read More

[TH] Arduino: ESP32-S2’s DAC&ADC.

หลังจากที่ทดสอบ DAC และ ADC ของทั้ง ESP32, SAM-D21, LGT8F328P และ STM32L432KC เป็นที่เรียบร้อย ครั้งนี้ก็เป็นคราวของ ESP32-S2 ที่ทางเรามีใช้งานอยู่ โดยการทดสอบการทำงานยังคงเป็นเหมือนก่อนหน้านี้ที่ใช้ DAC ส่งคลื่น 3 ลักษณะคือ ฟันปลา สามเหลี่ยม และคลื่นรูปไซน์ออกมา และเขื่อมต่อเข้ากับขาของ ADC เพื่อนอ่านค่า พร้อมทั้งทดสอบดูกราฟว่ามีลักษณะออกมาเป็นอย่างไร

ในการทดลองนี้ได้เชื่อมต่อ DAC1 เข้ากับ ADC ดังภาพที่ 1 โดย ESP32-S2 มี DAC ขนาด 8 บิตจำนวน 2 พอร์ตเรียกว่า DAC1 และ DAC2 ส่วน ADC มีความละเอียด 12 บิต ซึ่งจะเห็นว่ามีคุณสมบัติเหมือนกับ ESP32 แต่จะได้ผลลัพธ์เหมือนกันหรือไม่นั้นคงบอกได้ว่าน่าจะแตกต่างเนื่องจากใช้ไมโครคอนโทรลเลอร์คนละรุ่นกัน โดยใน ESP32-S2 ใช้ตัวเดียวกับ ESP32-S3 ที่มีเพียงแกนเดียว และไม่มี BLE

ภาพที่ 1 บอร์ด Neucleo L432KC เชื่อมต่อขา A3 เข้ากับ D3
Read More