embeded/arduino(genuino)2025. 10. 11. 21:01

아두이노 나노 v3.0 이고, 아래의 셋팅으로 진행함

 

라이브러리 매니저에서 servo / arduino 를 설치하고

 

귀찮으니 D5/D6/D9/D10 옮겨가며 해보는걸로 하고, 일단은 날로 먹기 모드 ㅋㅋ

 

아래 코드를 대충 작성해서 넣어주면

#include <Servo.h>

Servo myservo[4];
String inputString = "";
bool stringComplete = false; 
unsigned char pwm_ch[4] = {5,6,9,10};
unsigned char pwm_val[4] = {127,127,127,127};

void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
  Serial.println("Hello");
  
  inputString.reserve(200);

  for(int idx = 0;idx < 4;idx++)
  {
      myservo[idx].attach(pwm_ch[idx]);
      myservo[idx].write(pwm_val[idx]);
  }
}

void loop() {
  // put your main code here, to run repeatedly:
  if (stringComplete) {
    char data[64] = "";
    inputString.toCharArray(data, inputString.length());
    sscanf(data, "%d,%d,%d,%d\n",
      &(pwm_val[0]),
      &(pwm_val[1]),
      &(pwm_val[2]),
      &(pwm_val[3]));

    char res[64] = "";
    sprintf(res, "get %d %d %d %d\n", pwm_val[0], pwm_val[1], pwm_val[2], pwm_val[3]);
    Serial.print(res);

    Serial.print(inputString);
    // clear the string:
    inputString = "";
    stringComplete = false;

    for(int idx = 0;idx < 4;idx++)
    {
      if(pwm_val[idx] > 255) pwm_val[idx] = 255;
      if(pwm_val[idx] < 1) pwm_val[idx] = 1;
      myservo[idx].write(pwm_val[idx]); 
    }
  }
}

void serialEvent()
{
  while(Serial.available())
  {
    char inChar = (char)Serial.read();
    inputString += inChar;
    if (inChar == '\n')
    {
      stringComplete = true; 
    }
  }
}

 

최초 구동시 Hello가 나오고

콤마로 4개의 값을 넣어주면 된다. 개별 범위는 0~255

[링크 : https://docs.arduino.cc/learn/electronics/servo-motors/]

 

그나저나 pinMode 설정과 analogWrite() 로는 정상적으로 작동하지 않네.. 머가 문제일까?

int ledPin = 9;      // LED connected to digital pin 9
int analogPin = A0;  // potentiometer connected to analog pin A0
int val = 0;         // variable to store the read value

void setup() {
  pinMode(ledPin, OUTPUT);  // sets the pin as output
}

void loop() {
  val = analogRead(analogPin);  // read the input pin
  analogWrite(ledPin, val / 4); // analogRead values go from 0 to 1023, analogWrite values from 0 to 255
}

[링크 : https://support.arduino.cc/hc/en-us/articles/9350537961500-Use-PWM-output-with-Arduino]

 

그래서 찾아보니

servo는 대부분 pwm이 아니라는 이야기. 아.. 그렇지! pwm이 아니지?!

[링크 : https://forum.arduino.cc/t/analogwrite-vs-servo-write/370486/3]

[링크 : https://forum.arduino.cc/t/servo-with-analogwrite/438505/7]

'embeded > arduino(genuino)' 카테고리의 다른 글

아두이노 시리얼 이벤트 핸들러  (0) 2025.10.09
퀄컴 아두이노 인수  (0) 2025.10.08
아두이노 sd 카드  (0) 2025.08.24
skt-444 콘덴서 마이크 모듈 분해  (0) 2025.08.07
HW-504 이상해..  (0) 2025.08.02
Posted by 구차니
embeded/arduino(genuino)2025. 10. 9. 22:44

예제로 맨날 폴링만 보다보니 인터럽트가 될거라 생각을 못했네..

/*
  SerialEvent occurs whenever a new data comes in the hardware serial RX. This
  routine is run between each time loop() runs, so using delay inside loop can
  delay response. Multiple bytes of data may be available.
*/
void serialEvent() {
  while (Serial.available()) {
    // get the new byte:
    char inChar = (char)Serial.read();
    // add it to the inputString:
    inputString += inChar;
    // if the incoming character is a newline, set a flag so the main loop can
    // do something about it:
    if (inChar == '\n') {
      stringComplete = true;
    }
  }
}

 

[링크 : https://docs.arduino.cc/built-in-examples/communication/SerialEvent]

[링크 : https://juahnpop.tistory.com/85]

[링크 : https://m.blog.naver.com/dhtpals32123/222270427302]

'embeded > arduino(genuino)' 카테고리의 다른 글

arduino nano로 4채널 pwm 출력하기  (0) 2025.10.11
퀄컴 아두이노 인수  (0) 2025.10.08
아두이노 sd 카드  (0) 2025.08.24
skt-444 콘덴서 마이크 모듈 분해  (0) 2025.08.07
HW-504 이상해..  (0) 2025.08.02
Posted by 구차니
embeded/raspberry pi2025. 10. 9. 18:47

SPI LCD를 한번 써보고 싶어서(직접 드라이버 구현)

일단은 장치가 문제없나 확인부터 해보고 스펙 확인겸~ 남이 만든거 쓱쓱~

 

준비물

라즈베리 파이 피코 / 1.8 TFT SPI 128x160 이라고 써있는 LCD 보드

그냥 싸서 샀는데 color TFT LCD 이다.

 

라즈베리 파이 피코 핀아웃. 오랫만에 하니 헷갈려서 봤는데

정작 이건 참고 안하고 보드에 실크보고 해결 ㅋㅋ

[링크 : https://www.raspberrypi.com/documentation/microcontrollers/pico-series.html]

 

결선은 아래와 같이 하면 된다.

LED는 백라이트다. 뽑는다고 LCD 컨트롤러가 죽진 않는다.

TFT Board => Raspberry Pi Pico Pin
LED => 3v3(Out)
SCK => GP10
SDA => GP11
AO/DC => GP16
Reset => GP17
CS => GP18
GND => GND
VCC => VBUS 5V

[링크 : https://alastairmontgomery.medium.com/tft-display-st7735-with-micropython-ef48ecbfc278]

 

라즈베리 파이 피코

 

 

LCD

 

윈도우에서 thonny 깔고, tool - options - interpreter 에서 micropython (Raspberry Pi Pico) 선택

아래 포트는 확인하고 설정하던가 귀찮으면 try to detect port automatically 하면 끝.

[링크 : https://thonny.org/]

 

bootsel 누른채로 꽂아서 다음에서 다운로드 한 uf2 파일을 던져주면 끝

[링크 : https://www.raspberrypi.com/documentation/microcontrollers/micropython.html]

 

아래 프로젝트를 다운로드 해서

[링크 : https://github.com/alastairhm/micropython-st7735]

  [링크 : https://alastairmontgomery.medium.com/tft-display-st7735-with-micropython-ef48ecbfc278]

 

thonny 에서 view - files 하면 탐색기 뜨고 그걸로 업로드 하면 된다.

 

graphicstest 실행시 아래의 것들이 순차적으로 실행된다.

 

 

 

이거 하나 채워지는데 제법 오래걸린다.

 

 

tftbmp 실행시. 체감상 다 그려지는데 한 5초?

 

mandelbrot_tft 실행시. 그리고 표시하는지 한 10초 걸리는 듯

 

 


----

circuitpython usb fs 미지원?

[링크 : https://forums.raspberrypi.com/viewtopic.php?p=1812620#p1812620]

 

혹시나 해서 윈도우에서 thonny나 pip 안깔고 되나했는데

이래저래 귀찮을 듯 해서 포기하고 thonny 설치하는 걸로 해결 -_-

[링크 : https://mikeesto.medium.com/uploading-to-the-raspberry-pi-pico-without-thonny-53de1a10da30]

[링크 : https://github.com/dhylands/rshell]

Posted by 구차니
embeded/전자회로2025. 10. 8. 22:21

이번에 하나를 산 거 같은데 정리하다 보니 두 개가 나와서 이력을 찾아보니

아니 왜 산걸 까먹고 또 산겨 -_-

머 덕분에 멀티 adc를 이용한 채널 확장도 해볼순 있겠네

 

'embeded > 전자회로' 카테고리의 다른 글

열전대 써모커플러  (0) 2025.07.17
buzzer - 액티브 패시브  (0) 2025.07.15
rheostat ?  (0) 2024.07.25
notch filter  (0) 2024.05.21
멀티미터 TR 테스트  (0) 2023.11.02
Posted by 구차니
embeded/arduino(genuino)2025. 10. 8. 22:15

어떤 의미로 놀랍긴 한데.. wiring 기반으로 발전해왔고

라즈베리에서도 wiring을 잘 썼는데

퀄컴이 아두이노 인수하면서 어떻게 될지가 좀 조심스러워진다.

[링크 : https://news.hada.io/topic?id=23502]

[링크 : https://www.techpowerup.com/341673/qualcomm-to-acquire-arduino]

 

눈에 띄는건.. Adreno GPU 3D 가속기와 카메라 2개 가능, cortex-M33 160Mhz 별도 장착.

Core
Qualcomm Dragonwing™ QRB2210
Includes the powerful Qualcomm Dragonwing™ QRB2210 processor featuring:
Quad-core Arm® Cortex®-A53 @ 2.0 GHz
Adreno GPU 3D graphics accelerator
2x ISP (13 MP + 13 MP or 25 MP) @ 30 fps
Overview
Microcontroller
STM32U585 Arm® Cortex®-M33 32-bit MCU
The UNO Q integrates the STM32U585 microcontroller featuring:
Arm® Cortex®-M33 up to 160 MHz
2 MB flash memory
786 kB SRAM
Floating Point Unit

[링크 : https://docs.arduino.cc/hardware/uno-q/]
[링크 : https://www.arduino.cc/product-uno-q] UNO Q

 

가격이 낮아질것 같진 않지만.. 일단 아두이노가 라즈베리를 타겟으로 하는 가격을 보여주는 듯.

[링크 : https://store-usa.arduino.cc/products/uno-q]

 

 

'embeded > arduino(genuino)' 카테고리의 다른 글

arduino nano로 4채널 pwm 출력하기  (0) 2025.10.11
아두이노 시리얼 이벤트 핸들러  (0) 2025.10.09
아두이노 sd 카드  (0) 2025.08.24
skt-444 콘덴서 마이크 모듈 분해  (0) 2025.08.07
HW-504 이상해..  (0) 2025.08.02
Posted by 구차니
embeded/odroid2025. 9. 22. 22:36

다이소에서 싼 맛에 산

5천원 / 32GB / Axxen sd 카드가

odroid c2 에서 armbian 으로 쓰는데 허구한날 먼가 하다가 날아간다.

2개 가서 두개가 번갈아 가면서 몇번 발생하거면

지지리도 운이 없거냐

axxen이 내구도가 안 좋거나

armbian이 문제거나..

 

에러메시지는 맨날 btrfs 에서 멈춰서 혹시나 해서 봤는데 ext 인디..

$ mount
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
udev on /dev type devtmpfs (rw,nosuid,relatime,size=835580k,nr_inodes=208895,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,nodev,noexec,relatime,size=196088k,mode=755)
/dev/mmcblk0p1 on / type ext4 (rw,relatime,errors=remount-ro,commit=120)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
cgroup2 on /sys/fs/cgroup type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate,memory_recursiveprot)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
bpf on /sys/fs/bpf type bpf (rw,nosuid,nodev,noexec,relatime,mode=700)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=32,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=3927)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,nosuid,nodev,relatime,pagesize=2M)
debugfs on /sys/kernel/debug type debugfs (rw,nosuid,nodev,noexec,relatime)
mqueue on /dev/mqueue type mqueue (rw,nosuid,nodev,noexec,relatime)
configfs on /sys/kernel/config type configfs (rw,nosuid,nodev,noexec,relatime)
fusectl on /sys/fs/fuse/connections type fusectl (rw,nosuid,nodev,noexec,relatime)
tmpfs on /tmp type tmpfs (rw,nosuid,relatime)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,nosuid,nodev,noexec,relatime)
/dev/mmcblk0p1 on /var/log.hdd type ext4 (rw,relatime,errors=remount-ro,commit=120)
/dev/zram1 on /var/log type ext4 (rw,nosuid,nodev,noexec,relatime,discard)
sunrpc on /run/rpc_pipefs type rpc_pipefs (rw,relatime)
tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,size=196084k,nr_inodes=49021,mode=700,uid=1000,gid=1000)
portal on /run/user/1000/doc type fuse.portal (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)

 

commit=120은 2분에 한번 강제 저장인데

그렇다고 해서 무조건 또 저장이 되는건 아니라고

그런데. relatime 해놓고 commit 하면 sd 카드 수명 팍팍 갉아 먹는거 아닌가?

Posted by 구차니
embeded/odroid2025. 9. 22. 22:10

aplay 로 목록을 보면나온다는데 안나오고

aplay -L 
null
    Discard all samples (playback) or generate zero samples (capture)
default
    Playback/recording through the PulseAudio sound server
lavrate
    Rate Converter Plugin Using Libav/FFmpeg Library
samplerate
    Rate Converter Plugin Using Samplerate Library
speexrate
    Rate Converter Plugin Using Speex Resampler
jack
    JACK Audio Connection Kit
oss
    Open Sound System
pulse
    PulseAudio Sound Server
speex
    Plugin using Speex DSP (resample, agc, denoise, echo, dereverb)
upmix
    Plugin for channel upmix (4,6,8)
vdownmix
    Plugin for channel downmix (stereo) with a simple spacialization
hw:CARD=ODROIDC2,DEV=0
    ODROID-C2, 
    Direct hardware device without any conversions
plughw:CARD=ODROIDC2,DEV=0
    ODROID-C2, 
    Hardware device with all software conversions
sysdefault:CARD=ODROIDC2
    ODROID-C2, 
    Default Audio Device
dmix:CARD=ODROIDC2,DEV=0
    ODROID-C2, 
    Direct sample mixing device
usbstream:CARD=ODROIDC2
    ODROID-C2
    USB Stream Output

[링크 : https://forums.libretro.com/t/odroid-c2-hdmi-audio-output-has-no-sound/10559]

 

커널 메시지 상으로도 이렇다할 무언가가 보이지 않는 느낌..

$ sudo dmesg | grep -i hdmi
[    0.069016] /soc/vpu@d0100000: Fixed dependency cycle(s) with /soc/hdmi-tx@c883a000
[    0.069037] /soc/hdmi-tx@c883a000: Fixed dependency cycle(s) with /soc/vpu@d0100000
[    0.073417] /soc/vpu@d0100000: Fixed dependency cycle(s) with /soc/hdmi-tx@c883a000
[    0.073562] /soc/vpu@d0100000: Fixed dependency cycle(s) with /soc/hdmi-tx@c883a000
[    0.073616] /soc/hdmi-tx@c883a000: Fixed dependency cycle(s) with /soc/vpu@d0100000
[    0.075830] /soc/hdmi-tx@c883a000: Fixed dependency cycle(s) with /hdmi-connector
[    0.075893] /hdmi-connector: Fixed dependency cycle(s) with /soc/hdmi-tx@c883a000
[    1.682512] meson-dw-hdmi c883a000.hdmi-tx: Detected HDMI TX controller v2.01a with HDCP (meson_dw_hdmi_phy)
[    1.683044] meson-dw-hdmi c883a000.hdmi-tx: registered DesignWare HDMI I2C bus driver
[    1.683310] meson-drm d0100000.vpu: bound c883a000.hdmi-tx (ops 0xffff800081233b38)

 

정식 배포된 마지막 버전인 ubuntu mate 20.04로 한번 해보고 나오나봐야겠다.

Posted by 구차니
embeded/i.mx 8m plus2025. 9. 16. 12:11

오디오와 비디오로 크게 나뉘고

비디오에서는 classification / obejct detection / segmentation 정도가 현재 관심사

sementic segmentation과 instance-segmentation 차이는 멀까?

List of domains
Audio
anomaly detection
command recognition
speech recognition
Vision
classification
face recognition
object detection
pose estimation
semantic segmentation
super resolution
instance-segmentation
low-light enhancement

[링크 : https://github.com/NXP/eiq-model-zoo]

 

텍스트로 넣으니 css 때문에 깨져서 이미지로 복사 -_-

selfie-segmenter는 proprietary dataset이었군..

[링크 : https://github.com/NXP/eiq-model-zoo/tree/main/products]

'embeded > i.mx 8m plus' 카테고리의 다른 글

eiq 데이터 구조  (0) 2025.09.05
ubuntu 22.04 + cuda + cudnn 설치  (0) 2025.09.04
import tensorflow illegal instruction  (0) 2025.09.04
eiq on windows with nvidia  (0) 2025.09.03
vainfo  (0) 2025.09.03
Posted by 구차니
embeded/i.mx 8m plus2025. 9. 5. 10:39

크게 세 가지가 가능한데

VOC dataset은 detection을 위한 것이고

structured folder는 classification

tfds는 classification과 detection 모두를 위한 것인데...

 

3.3.1 VOC dataset
VOC datasets are introduced in Pascal Visual Object Classes Challenge. This format is also used by the ImageNet
datasets. Images and labels in this dataset can be used to train detection models.

 

3.3.2 Structured folders dataset
Using the Import dataset screen, you can also import datasets that have a specific folder structure. These datasets do
not have to be compressed into TAR files as with VOC datasets. The only requirement is that the images are saved in
specific folders. The datasets created this way can be used to train models for classification tasks.

 

3.3.3 TFDS datasets
TFDS datasets allow you to import some of the datasets provided by tensorflow in their catalog here. The tool allows
you to download datasets for image classification and object detection.

 

그러면 segmentation은 누구냐..

문서 상에서는 cli를 통해서 직접해야 하는건가..

7.1 Image segmentation
The following models target the image segmentation use case:
• deeplab_v3
To run the “deeplab” model, the workspace\models\deeplab_v3\runner_demo.py script runs the inference using the
converted model on the target device and decodes the output. You may also inspect the Python code. The script sends
a simple HTTP request to the device and the rest of the script decodes the output. There are also a few images available
for testing in the imgs folder.

'embeded > i.mx 8m plus' 카테고리의 다른 글

eiq 모델 정리  (0) 2025.09.16
ubuntu 22.04 + cuda + cudnn 설치  (0) 2025.09.04
import tensorflow illegal instruction  (0) 2025.09.04
eiq on windows with nvidia  (0) 2025.09.03
vainfo  (0) 2025.09.03
Posted by 구차니
embeded/i.mx 8m plus2025. 9. 4. 12:36

 

압도적 감사!

그런데 비교해보니 환경변수가 필수였나.. 싶네

export PATH=/usr/local/cuda/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH

[링크 : https://starlane.tistory.com/1]

[링크 : https://bo-10000.tistory.com/209]

 

 

+

하드웨어

i7-10700F / 3070 8GB

 

명령어. 나중에 nouveau 쪽 수행하지 말고 바로 nvidia-driver 설치해봐야 겠다. 그러면 제법 시간이 단축될 듯

sudo apt install build-essential gcc ubuntu-drivers-common dkms vim nvidia-modprobe
sudo apt-get update; sudo apt-get upgrade -y
sudo bash -c "echo blacklist nouveau > /etc/modprobe.d/blacklist-nvidia-nouveau.conf"
sudo bash -c "echo options nouveau modeset=0 >> /etc/modprobe.d/blacklist-nvidia-nouveau.conf"
cat /etc/modprobe.d/blacklist-nvidia-nouveau.conf 
sudo update-initramfs -u

# after reboot
lsmod | grep nouveau
ubuntu-drivers devices
sudo apt install nvidia-driver-575

# add environment variables
echo export PATH=/usr/local/cuda/bin:$PATH > ~/.bashrc
echo export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH > ~/.bashrc

wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-ubuntu2204.pin
sudo mv cuda-ubuntu2204.pin /etc/apt/preferences.d/cuda-repository-pin-600
wget https://developer.download.nvidia.com/compute/cuda/13.0.0/local_installers/cuda-repo-ubuntu2204-13-0-local_13.0.0-580.65.06-1_amd64.deb
sudo dpkg -i cuda-repo-ubuntu2204-13-0-local_13.0.0-580.65.06-1_amd64.deb
sudo cp /var/cuda-repo-ubuntu2204-13-0-local/cuda-BE1CC667-keyring.gpg /usr/share/keyrings/

sudo apt-get update
sudo apt-get -y install cuda-toolkit-13-0
sudo apt-get install -y cuda-drivers

# for test
nvcc -V


wget wget https://developer.download.nvidia.com/compute/cudnn/9.12.0/local_installers/cudnn-local-repo-ubuntu2204-9.12.0_1.0-1_amd64.deb
sudo dpkg -i cudnn-local-repo-ubuntu2204-9.12.0_1.0-1_amd64.deb
sudo cp /var/cudnn-local-repo-ubuntu2204-9.12.0/cudnn-*-keyring.gpg /usr/share/keyrings/

 

eIQ 설치를 위한 준비

sudo apt-get install libffi7

 

'embeded > i.mx 8m plus' 카테고리의 다른 글

eiq 모델 정리  (0) 2025.09.16
eiq 데이터 구조  (0) 2025.09.05
import tensorflow illegal instruction  (0) 2025.09.04
eiq on windows with nvidia  (0) 2025.09.03
vainfo  (0) 2025.09.03
Posted by 구차니