วันพุธที่ 28 มิถุนายน พ.ศ. 2566

การ ต่อ Serial max232 กับ Raspberry pi/Jetson Nano

Serial rs232 การมี voltage เป็น +/- ไม่ใช่ Serial TTL เป็น 0-5 V การต่อมี 2 วิธี ใช้ USB->RS232 หรือ ใช้ ต่อ Pin UART TX RX ของ Raspberry Pi/ Jetson Nano  โดย Board Max232




วิธีการต่อ โดยใน Max232     

หัวต่อแบบนี้จะเป็นหัว ต่อ ที่สลับสาย แล้ว ให้ต่อ ตรง กับ หัวตัวเมีย ของ Serial PC ได้

ต่อขากับ Raspberry 

  • GND connects to Pin 6.
  • RX connects to Pin 10. GPIO 15
  • TX connects to Pin 8. GPIO 14
  • VCC connects to Pin 1. use 3.3 V

ต้องแก้ใน OS เพื่อเปิด /dev/serial0

1. sudo vi /boot/config.txt 
   เพิ่ม enable_uart=1
2. ไม่ใช้ console ใช้ serial 
   sudo systemctl stop serial-getty@ttyS0.service
  sudo systemctl disable serial-getty@ttyS0.service
และ sudo vi /boot/cmdline.txt 
 ตัด console=serial0,115200 แล้ว save



raspberrypi = /dev/serial0
jetson nano = /dev/ttyTHS1

pc dos ใช้ COM2 

วันอาทิตย์ที่ 18 มิถุนายน พ.ศ. 2566

ติดตั้ง opencv บน Raspberry pi และ Samba share folder

 Raspberry pi

sudo apt-get --allow-releaseinfo-change update 

sudo apt-get upgrade


pip install numpy

pip3 install numpy


sudo apt-get install -y libhdf5-dev libhdf5-serial-dev python3-pyqt5 libatlas-base-dev

pip install opencv-contrib-python==4.0.0.10


เวลาลงจะมี ขึ้น Vi agreement ให้กด q


ทดสอบ opencv



# define a video capture object

vid = cv2.VideoCapture(0)

  

while(True):

      

    # Capture the video frame

    # by frame

    ret, frame = vid.read()

# Display the resulting frame

    cv2.imshow('frame', frame)

      

    # the 'q' button is set as the

    # quitting button you may use any

    # desired button of your choice

    if cv2.waitKey(1) & 0xFF == ord('q'):

        break

  

# After the loop release the cap object

vid.release()

# Destroy all the windows

cv2.destroyAllWindows()







Install samba share folder

sudo apt-get install samba samba-common-bin

sudo chmod 777 /etc/samba/smb.conf

—add ลงใน smb.conf

[Home]
comment=Raspberry Pi Share
path=/home/pi
browseable=Yes
writeable=Yes
only guest=no
create mask=0777
directory mask=0777
public=yes


--- จบแล้ว แก้ permission ของ Folder

sudo pcmanfm

—right click at home/pi "anyone"


Reboot