๋ชฉ๋ก๐ฉ๐ป IoT (Embedded)/Arduino (64)
๐ ๊ณต๋ถํ๋ ์ง์ง์ํ์นด๋ ์ฒ์์ด์ง?
โญ MQTT ver.broker โ pub.c // pub.c #include #include #include #include #include #include #include // ์๋ฆฌ์ผ ์ฝ๋ typedef struct { int fd; } SerialPort; int serial_open2(SerialPort *port, const char *device) { port->fd = open(device, O_RDWR | O_NOCTTY | O_NDELAY); if (port->fd == -1) { perror("Unable to open port"); return -1; } struct termios options; tcgetattr(port->fd, &options); cfsetispeed(&optio..
โญ MQTT ver.local โ pub.c // pub.c #include #include int main(){ int rc; struct mosquitto * mosq; mosquitto_lib_init(); mosq = mosquitto_new("publisher-test", true, NULL); //mosquitto ๊ตฌ์กฐ์ฒด ์์ฑ rc = mosquitto_connect(mosq, "localhost", 1883, 60);//mosqutiio ๋ธ๋ก์ปค์ ์ฐ๊ฒฐ if(rc != 0){ printf("Client could not connect to broker! Error Code: %d\n", rc); mosquitto_destroy(mosq); return -1; } printf("We are no..

๐ง๐ Floating(ํ๋กํ )๊ฐ ์๋์ด๋ ธ๋ ์ ๋ ฅ๋๋ ์ ์์ด 2.6V ~ 5V ๊น์ง๋ 1 (HIGH)๋ก ์ธ ์ ๋ ฅ๋๋ ์ ์์ด 0V ~ 0.6V ๊น์ง๋ 0 (LOW)๋ก ์ธ์. โป ์๋์ด๋ ธ ๋ณด๋ ์ข ๋ฅ์ ๋ฐ๋ผ ์ธ์๋๋ HIGH, LOW V(์ ์) ๋ฒ์๋ ๋ค๋ฆ. Floating (ํ๋กํ ) : ๋ถ์ ํ๋, ๋ ์๋, ์ ๋์ ์ธ 0๊ณผ 1 ์ฌ์ด์ ๋ฐฉํฉํ๋ ๊ฐ (ํ๋กํ ๊ฐ) 0.6V ~ 2.6V ์ฌ์ด์ ๊ฐ ๐ง๐ Pull_UP (ํ์ ) Pull_Down(ํ๋ค์ด) ํ๋ก ํ๋กํ ๊ฐ์ ํด๊ฒฐํ๊ธฐ ์ํด์๋ ์๋์ ๊ฐ์ด "ํ์ " ํ๋ก์ "ํ๋ค์ด" ํ๋ก๋ฅผ ์ฌ์ฉ ๐ ํ์ Pull_Up ์ ํญ์ 5V(์ ์) ์ชฝ์ ๋๊ณ ํ๋กํ ํ์์ ํด๊ฒฐ [ ํ์ ์ ํญ์ ์ฌ์ฉํ๋ฉด ํ์๋ ํญ์ 5V ์ ์์ด ๊ฐํด์ง. ] ํธ์ฌ๋ฒํผ์ ๋๋ฅด์ง ์์๋ : ๋์งํธ HIGH (..

โญ ultrasonic sensor ์ Servo motor // Includes the Servo library #include . // Defines Tirg and Echo pins of the Ultrasonic Sensor #define trigPin 9 //TRIG ํ ์ค์ (์ด์ํ ๋ณด๋ด๋ ํ) #define echoPin 8 //ECHO ํ ์ค์ (์ด์ํ ๋ฐ๋ ํ) // Variables for the duration and the distance long duration; int distance; Servo myServo; // Creates a servo object for controlling the servo motor void setup() { pinMode(trigPin, OUTP..

โญ CAN (Controller Area Network) ์ฐจ๋ ๋ด์์ ํธ์คํธ ์ปดํจํฐ ์์ด ๋ง์ดํฌ๋ก ์ปจํธ๋กค๋ฌ ์ฅ์น๋ค์ด ์๋ก ํต์ ํ๊ธฐ ์ํด ์ค๊ณ๋ ํ์ค ํต์ ๊ท๊ฒฉ ๋ฉ์์ง ๊ธฐ๋ฐ ํ๋กํ ์ฝ ๐ณ ํน์ง 1๏ธโฃ ์๋ฆฌ์ผ ํต์ ๊ธฐ๋ฐ, ๊ฐ์ ๋ฒ์ค๋ผ์ธ ํตํด ์ ์ก ๋ฐ ์์ 2๏ธโฃ Multi-Master, ํต์ ๋ฒ์ค๋ฅผ ์ฌ๋ฌ ๋ ธ๋๋ค์ด ๊ณต์ ํ๋ค 3๏ธโฃ ๊ฐ๋จํ๊ณ ๋ ธ์ด์ฆ์ ๊ฐํ๋ค twist pair ์ ์ฌ์ฉํ๋ฉฐ, CANH ์ CAHL ์ 2๊ฐ ์ ์ผ๋ก ํต์ ํ๋ค 4๏ธโฃ ID ๊ฐ ์ด์ฉํ ์ฐ์ ์์๋ฅผ ๋งค๊ธด๋ค ECU ๋ ๊ณ ์ ํ ID ๋ฅผ ๊ฐ์ง๋ค ID๊ฐ ๋ฎ์์๋ก ์ฐ์ ์์๊ฐ ๋๋ค ์ฃผ์๊ฐ ์๋ ID๋ก ๋ฉ์์ง๋ฅผ ๊ด๋ฆฌํ๋ค ๋๋จธ์ง๋ ๋ค์ bus cycle ์ ์ฌ์ ์กํ๋ค 5๏ธโฃ CSMA (Carrier Sense Multiple Access) & CS/CD ..

โญ RTOS ์ค์๊ฐ(Real Time) ์ด์์ฒด์ (Operating System)์ ์ฝ์ ์ ํ๋ ์๊ฐ๋ด์ ์ํ๋ ์์ ์ ๋ชจ๋ ์ฒ๋ฆฌํ๋๊ฒ์ ๋ณด์ฅํ๋ ์ด์์ฒด์ ๋ฉํฐํ์คํน ํ๊ฒฝ์์ Task ์ฒ๋ฆฌ์๊ฐ์ ์ผ๊ด๋๊ฒ ์ ์งํ๊ธฐ ์ํ ์ฉ๋๋ก ์ฌ์ฉ ์๋ถํ ์์คํ ํ์์ ์ฐ์ ์์ ๊ธฐ๋ฐ ์ค์ผ์ค๋ง์ ํตํด ์ฐ์ ์์๊ฐ ๋์ task๊ฐ ๋จผ์ ์์ ์ ์ฒ๋ฆฌํ ์ ์๊ฒ ํจ ์ค์ผ์ค๋ง : ํ๋ก์ธ์ค๋ค์๊ฒ CPU ๋ฑ ์์์ ๋ฐฐ์ ํ๋ ๊ฒ์ ๋งํจ ๋์์ ์ฌ๋ฌ๊ฐ์ง ์์ฉ ํ๋ก๊ทธ๋จ์ ์ฌ์ฉํ๋ค๋ณด๋ฉด ์ฒ๋ฆฌ์๋๊ฐ ์ง์ฐ๋๊ฑฐ๋ ํ๋ก๊ทธ๋จ์คํ์ด 1์ด ์ด์ ์ง์ฐ๋จ RTOS๋ฅผ ์ฌ์ฉํ ๊ธฐ๊ธฐ๋ ์์ฉ ํ๋ก๊ทธ๋จ์ ์ต๋ 1์ด์์ ์ฒ๋ฆฌํ๋ ๊ฒ์ ๋ณด์ฅํ๋ค ์๋์ฐ๋ ๋ฆฌ๋ ์ค์์๋ millisecond, microsecond ๋จ์๋ก ํ๋ก๊ทธ๋จ์ ์ ์ดํ๋ ๊ฒ์ ์ด๋ ต์ง๋ง, RTOS์์๋ ๊ฐ๋ฅ โญ..

โญ Digital-to-Analog Converter (DAC) ๐ณ CODE /* SineWave Generates a pre-generated sawtooth-waveform. See the full documentation here: https://docs.arduino.cc/tutorials/uno-r4-wifi/dac */ #include "analogWave.h" // Include the library for analog waveform generation // DAC์์ ์ฌ์ธํ ๋ฐ์ง์ด ์์ฑ๋๊ธฐ ์์ // ์ฃผํ์์ ๋ฐ๋ผ ์์ ๋ฒ์ ๋ ์คํผ์ปค์์ ์ฌ์ด๋๋ฅผ ์์ฑํ๋ ๋ฐ ์ฌ์ฉ analogWave wave(DAC); ..

โญ Arduino UNO R4 WiFi Wi-Fi ๋คํธ์ํฌ์ ์ฐ๊ฒฐํ๊ณ ๋คํธ์ํฌ ์์ ์ ์ํํ ์ ์๋ ESP32-S3 ๋ชจ๋์ด ๋ด์ฅ๋์ด ์์ HTTPS, MQTT, UDP๋ฅผ ํฌํจํ ํ๋กํ ์ฝ์ด ํ ์คํธ๋๊ณ ์ง์๋จ WiFiS3 Arduino UNO R4 Core ์ ํจ๊ป ์ ๊ณต๋๋ ๋ผ์ด๋ธ๋ฌ๋ฆฌ โญ WiFi Web Server LED Blink ๐ณ Print Date // UNO R4 WiFi์ RTC๋ Renesas ์ฝ์ด ์ ํฌํจ๋ RTC ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ์ฌ์ฉํ์ฌ ์ก์ธ์ค // ์๊ฐ์ ์ค์ /๊ฐ์ ธ์ฌ ์ ์์ ๋ฟ๋ง ์๋๋ผ ์๋์ ์ฌ์ฉํ์ฌ ์ธํฐ๋ฝํธ๋ฅผ ํธ๋ฆฌ๊ฑฐ #include "RTC.h" void setup() { Serial.begin(96..