[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] Draw an analog clock using MicroPython.

The previous article discussed how to improve the display speed by using the double buffer technique. It is applied for the analog clock display as shown in Figure 1. We used Trigonometric calculations to determine the coordinates (x,y) of the tips of the seconds, minutes and hours. Each second operation uses a timer to make the operation closer to real-time than the Loop or Delay.

Figure 1 Result of drawing Analog clock
Read More

[EN] MicroPython : pyb USB_HID/USB_VCP

This article discusses the use of USB HID capabilities of  STM32F411CEU6 via MicroPython in pyb class, our team was inspired by Dr. Rawat’s article MicroPython for STM32F411 Black Pill: Embedded Programming Style of Siriphokaphirom. So let’s start compiling and uploading the firmware (Read details from Ajarn Dr. Rawat’s article). We use the WeAct STM32F411CEU6 imitation board as shown in Figure 1. When installing MicroPython, there will be a pyb class to use.

Figure 1 Our board
Read More

[TH] Queue data structure with array and Singly Linked List.

บทความนี้เป็นการอธิบายเกี่ยวกับโครงสร้างข้อมูลแบบคิว (Queue) ซึ่งได้เคยเขียนถึงไปในบทความ Queue Data Structure ที่เป็นภาษาไพธอนและถูกนำไปใช้บ่อยกับตัวอย่างของ MicroPython แต่บทความนี้เป็นภาษา C ที่เขียนผ่าน Arduino IDE เพื่อใช้งานกับบอร์ดไมโครคอนโทรลเลอร์ LGT8F328P, SAM-D21, ESP8266, ESP32 และ ESP32-S2 ดังภาพที่ 1 โดยยกตัวอย่างการนำโครงสร้างแถวลำดับ และลิงค์ลิสต์เดี่ยวมาเป็นโครงสร้างข้อมูลแบบคิว และคงเป็นบทความสุดท้ายบน JarutEx แล้วครับ

ภาพที่ 1 บอร์ดไมโครคอนโทรลเลอร์ ESP32-S2, LGY8P326P และ SAM-D21
Read More

[TH] Stack data structure with Singly Linked List.

บทความนี้เป็นการอธิบายเกี่ยวกับโครงสร้างข้อมูลแบบสแต็ก (Stack) เพื่อเขียนโปรแกรมด้วยภาษา C บนแพล็ตฟอร์มต่าง ๆ โดยใช้โครงสร้างข้อมูลแบบลิงค์ลิสต์เดี่ยวเป็นที่เก็บข้อมูลของสแต็กพร้อมตัวอย่างการแถวลำดับเป็นที่เก็บข้อมูล และทดสอบการทำงานกับบอร์ดไมโครคอนโทรลเลอร์ LGT8F328P, SAM-D21, ESP8266, ESP32 และ ESP32-S2 ดังภาพที่ 1 และ 2 ส่วนกรณีที่ต้องการไปใช้กับแพล็ตฟอร์มอื่น ๆ ยังคงสามารถดัดแปลงโค้ดเพื่อนำไปใช้ได้เช่นเดียวกัน

ภาพที่ 1 บอร์ดไมโครคอนโทรลเลอร์ ESP32, LGY8P326P และ SAM-D21
Read More

[TH] Generate temperature and humidity graphs with data from Singly Linked List.

จากบทความโครงสร้างข้อมูล Singly Linked List, การใช้โมดูลเซ็นเซอร์ DHT11 กับไมโครคอนโทรลเลอร์ STM32F103 และการใช้โมดูลแสดงผล TFT ที่ใช้ตัวควบคุม st7735s จึงเกิดเป็นแนวคิดของบทความนี้ คือ นำตัวอย่างการใช้โครงสร้างข้อมูลแบบลิงค์ลิสต์เดี่ยวที่เก็บค่าอุณหภูมิและความชื้นมาหาค่ามากสุด น้อยสุด ค่าเฉลี่ย พร้อมทั้งข้อมูลในลิสต์มาแสดงในรูปแบบของกราฟดังภาพที่ 1

ภาพที่ 1 ตัวอย่างผลลัพธ์ที่ได้จากบทความนี้
Read More

[TH] Singly Linked List

บทความนี้เป็นการเขียนโปรแกรมภาษา C/C++ กับบอร์ด Arduino Nano, Arduino Uno, LGT8F328P หรือบอร์ดอื่น ๆ และแพล็ตฟอร์มอื่น ๆ ที่ใช้ภาษา C ได้ โดยในบทความนี้กล่าวถึงวิธีการใช้โครงสร้าง struct สำหรับเก็บข้อมูลและตัวชี้ที่ใช้สำหรับชี้ไปยังตำแหน่งของหน่วยความจำ และวิธีการบริหารหน่วยความจำได้แก่ การจองหน่วยความจำ การเข้าถึงหน่วยความจำ และการยกเลิกการใช้หน่วยความจำเพื่อสร้างวิธีการจัดเก้บข้อมูลแบบลิงค์ลิวต์เดียว (Singly Linked List) พร้อมทั้งตัวอย่างโปรแกรมที่ใช้สำหรับเก็บรายการค่าอุณหภูมิและความชื้นจากโมดูล DHT11 ดังภาพที่ 1

ภาพที่ 1 บอร์ดไมโครคอนโทรลเลอร์ที่ใช้ชิพ LGT8F328P กับโมดูล DHT11
Read More

[EN] How to used Arduino 2.4″ TFT LCD&Touch Shield with STM32F401?

From the previous article that has used a 3.5″ display for Raspberry Pi Board to use with ESP32, we also have an Arduino 2.4″ TFT LCD & Touch Shield that is used with Arduino Uno and Arduino Mega (as shown in Figure 1. ) and want to use with a microcontroller STM32F401RET6 Board NUCLEO-F401RE and STM32F401CC (Figure 2), which are Cortex-M4 with 96KB and 64KB memory respectively, ROM memory is 512KB and 128KB, with 8 switches connected to the pin. In this article, Board ET-TEST 10P/INP (Figure 3) is used to replace the left, up, down, right, m1,m2, A and B buttons respectively.

Nucleo-F401RE+Arduino Uno 2.4" TFT&Touch Shield
(Figure. 1 Arduino Uno TFT&Touch Shield module on Nucleo-F401RE)
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-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