Posts

Showing posts with the label Raspberry Pi

ปีใหม่ไทย ปีหนึ่งเจอกันครั้งหนึ่ง

Image
ปีหนึ่งเจอกันครั้งหนึ่งครับ มีแต่ความปรารถณาดีให้แก่กันครับ  เพิ่มเติม หลานๆเต็มบ้าน ^^

Install OMV on Raspberry Pi 4

Image
download script and execute wget -O -  https://github.com/OpenMediaVault-Plugin-Developers/installScript/raw/master/install  | sudo bash [credit :  https://github.com/OpenMediaVault-Plugin-Developers/installScript/blob/master/README.md  ]

Configuring to Emulate Ethernet Over USB RPi Zero W

1.Configuring to Emulate Ethernet Over USB Our long term goal will be to use SSH over USB. This means that we have to configure Raspbian to treat the USB port like an ethernet port. Mount the micro SD card in a computer (not Pi Zero) and open it with Finder, or Windows Explorer, or whatever it is that you use. The first thing that you want to do is open a file at the root of the mounted drive called  config.txt . In this file you want to add the following line at the very bottom: dtoverlay =dwc2 The above line will set us up for the next file that we alter. The next file we alter is  cmdline.txt , but it is a bit different. Parameters in this file are not delimited by new lines or commas, they are delimited by space characters. In this file we want to add the following: modules-load =dwc2,g_ether The above parameter should be added after the  rootwait  parameter. Yes the above parameter is a single parameter, meaning don’t add a bunch of space character...

ใช้งานเซนเซอร์อุณหภูมิและความชื้นสัมพัทธ์ของอากาศ DHT22 ร่วมกับ Node Red บน RPi3

Image
ก่อนอื่นให้เราติดตั้ง  BCM2835 library เพื่อให้สามารถใช้งาน GPIO ของ RPi โดยสามารถหาข้อมูลได้จากเวบนี้นะครับ http://www.airspayce.com/mikem/bcm2835/  ทั้งนี้เมื่อหาไฟล์มาได้แล้วก็ทำการติดตั้งโดยใช้คำสั่ง # download the latest version of the library, say bcm2835-1.xx.tar.gz, then: tar zxvf bcm2835-1.xx.tar.gz cd bcm2835-1.xx ./configure make sudo make check sudo make install cd .node-red Install the node-dht-sensor dependency sudo npm install --unsafe-perm -g node-dht-sensor Install this node sudo npm install --unsafe-perm -g node-red-contrib-dht-sensor ต่อ DHT-22 เข้ากับบอร์ด Rpi ใช้ ขา Data Pin4 ไฟลบ และไฟบวก 3.3V  ใช้ flow ตามนี้  Edit ค่าในบล๊อก DHT22 ตามนี้ และเพิ่ม function 2 output เพื่อแยกค่า Temp กับ Humid ออกจากกันจากข้อความ payload  var msg1 = {}; var msg2 = {}; msg1.payload = msg.payload; msg1.topic='Temp'; msg2.payload=msg.humidity; msg2.topic='Humid'; node.status({fill:"blue...

Modbus RTU read data from SDM120 Energy Meter [Node Red]

Image
SDM120 Energy Meter หาซื้อได้จาก aliexpress คลิกที่นี่  USB to RS485 ก็จาก aliexpress คลิกที่นี่  นำมาใช้งานกับ RPi ได้อย่างดี ใช้คำสั่ง เพื่อหาว่ามี usb to serail port ต่ออยู่หรือไม่ $ lsusb ค้นหาว่า usb-serial ของเราต่อกับ tty ไหน จากคำสั่ง  $  dmesg | grep tty  เราจะเจอ usb to serial port ที่ /dev/ttyUSB0 หลังจากนั้นก็จะทำการต่อสายการสื่อสารชนิด RS485 Modbus ไปยัง SDM120 Energy Meter ลาก flow modbus มาวางนะครับ ส่วน  วิธีการติดตั้ง modbus flow คลิก  กำหนดค่าใน modbus ดังนี้ โดยผมจะเลือก FC-4 เพื่ออ่านค่าจาก Input Register ส่วนตำแหน่งของ Register ของ SDM120 ก็ดังนี้นะครับ  การกำหนด Register เลือกอ่านค่า Volts ที่ address 0 [30000] เลือก Quantity 2 เนื่องจาก format เป็น IEEE754 float ใช้ 4 bytes   กลับไปกำหนดค่า Buad rate ที่ 2400 bps นะครับ เพราะเป็นค่าเริ่มต้นของ SDM120  ต่อ DHT-22 เพื่อใช้วัดอุณหภูมิและความชื้นสัมพัทธ์ วิธีการใช้งานคลิก   ...

มาเล่น Node Red บน Rpi กันเถอะ

Image
เราจะลำดับทำการติดตั้งกันดังนี้นะครับ ติดตั้ง Version ล่าสุดกันก่อน ทำให้ Node Red ทำงานอัตโนมัติตอน RPi ทำงาน  sudo systemctl enable nodered.service ติดตั้ง Flow เสริม มีดังนี้  Modbus serial  BCM GPIO เพื่อสามารถใช้งาน GPIO ของ RPi ได้  dashboard เพื่อการใช้งาน GUI  Autostart on boot, If you want Node-RED to run when the Pi boots up you can use sudo systemctl enable nodered.service 1.ติดตั้ง version ล่าสุดก่อนจากคำสั่ง  bash <(curl -sL https://raw.githubusercontent.com/node-red/raspbian-deb-package/master/resources/update-nodejs-and-nodered) หน้าจอ Terminal แสดงการติดตั้งแบบนี้ 2) ติดตั้ง Modbus จากหน้า โปรแกรมของ Node Red  2.1) เข้าหน้าเวบของ Node Red จาก IP ของ RPI Port 1880 ในที่นี้ของผมเป็น 192.168.1.104:1880 เลือก Managepalette 2.2) คลิก Install เพื่อเลือกลง Modbus ใช้ 2 ตัวคือ  npm install node-red-contrib-modbus  และ  npm install node-red-contrib-serial-modbus  ...

SSH to vnc4server with tightvncserver for RPi GUI

$ sudo apt-get install vnc4server  and start $ vnc4server first login -> seting up password configuration with autostart vnc4server $ cd .config $ cd autostart sudo nano vnc4server.desktop [Desktop Entry] Type=Apllication Name=vnc4server Exec=vncserver :1 -geometry 1120x808 -depth 24 -dpi 95 StartupNotify=false ctrl+X -> yes sudo reboot and  start tightVNC viewer WIN10 type password for login vncserver https://www.youtube.com/watch?v=jtgk8MSo_hA

Setup Dynamic DNS / DynDNS for *FREE* on Raspberry Pi / Ubuntu

Link: http://www.techjawab.com/2013/06/setup-dynamic-dns-dyndns-for-free-on.html Credit: Techjawab.com

How to setup ownCloud 7 on Raspberry Pi

How to setup ownCloud 7 on Raspberry Pi Link : http://www.techjawab.com/2014/08/how-to-setup-owncloud-7-on-raspberry-pi.html  Credit: Techjawab.com

DISKPART (Windows)

Credit :  http://raspberrypi.stackexchange.com/questions/1446/how-can-i-reformat-my-sd-card-to-use-it-normally-again  Start a command prompt, and start the DISKPART console. List all of your disks by typing  LIST DISK , then select the proper disk with   SELECT DISK #   (where # is obviously the SD card). You can then type   CLEAN   (MAKE SURE YOU SELECTED THE PROPER DISK!), and it will clear the partition table on the card. To create a primary partition to reuse the space on the card, type  CREATE PARTITION PRIMARY . This will then reallocate the previously "cleaned" space. To format, type  FORMAT FS=FAT32 QUICK , and finally, to reassign a drive letter, type  ASSIGN . If you're unable to determine the proper disk, remove the SD card, run  DISKPART  and  LIST DISK , and then re-run it with the SD card inserted. The SD card is just the disk that has been added.

Remove the Pi partitions from an SD card using the Windows 7

Credit: http://brucesbraindump.blogspot.com/2013/04/removing-raspberry-pi-partitions-from.html C:\temp>diskpart Microsoft DiskPart version 6.1.7601 Copyright (C) 1999-2008 Microsoft Corporation. On computer: PC014033 DISKPART> list disk   Disk ###  Status         Size     Free     Dyn  Gpt   --------  -------------  -------  -------  ---  ---   Disk 0    Online          167 GB      0 B   Disk 1    Online         7460 MB  5802 MB MAKE SURE YOU SELECT THE CORRECT DISK OR YOU WILL WIPE THE WRONG ONE !!! DISKPART> select disk 1 Disk 1 is now the selected disk. DISKPART> list part   Partition ###  Type              Size     Offset   -------------  ----------------  -------  -------   Partition 1   ...

installing VSFTPD (FTP) on the Raspberry Pi

sudo apt-get install vsftpd Press Enter Press Y when prompted Type nano /etc/vsftpd.conf Press Enter. Edit or uncomment the following lines to secure VSFTPD Anonymous_enable=NO Local_enable=YES Write_enable=YES Ascii_upload_enable=YES Ascii_download_enable=YES Press CTRL + O To save Press CTRL + X To exit Type: /etc/init.d/vsftpd restart You are done

ติดตั้งและใช้งาน Airplay [AirPi – AirPlay audio with Raspberry PI]

Upgrade Debian At this step, it’s a good idea to upgrade pre-installed packages : # aptitude update # aptitude upgrade Change audio output To force audio output to stereo jack, a single line is required : # amixer cset numid=3 1 0 -> HDMI 1-> Stereo Jack Install shairport Before download and compile shairport, we need to install prerequisites : # aptitude install git libao-dev libssl-dev libcrypt-openssl-rsa-perl libio-socket-inet6-perl libwww-perl avahi-utils Then download shairport sources and compile it : # git clone https://github.com/albertz/shairport.git shairport # cd shairport # make Finally, launch shairport foreground : # ./shairport.pl -a AirPi You can now use your iDevice to try AirPlay audio, don’t forget to plug an headphone or speakers into the 3.5mm stereo jack. If you want or need your Pi load automatically shairport, follow next procedure : root@raspberrypi:~/shairport# make install root@raspberrypi:~/shairport# cp shairport.init.sam...

Install OMXPlayer ให้กับ RPi เพื่อเล่นหนัง

Credit [ http://omxplayer.sconde.net/ ] Instructions First you need install required dependencies: # aptitude install libpcre3 fonts-freefont-ttf - or - # apt-get install libpcre3 fonts-freefont-ttf Optionally you can install fbset, I highly recommend it if you are going to use  --refresh / -r  option: # aptitude install fbset - or - # apt-get install fbset When you have installed the dependencies you can go ahead downloading the omxplayer and install it with dpkg: # wget http://omxplayer.sconde.net/builds/omxplayer_ x.x.x ~git xxxxxxxx ~ xxxxxxxx _armhf.deb # dpkg -i omxplayer_ x.x.x ~git xxxxxxxx ~ xxxxxxxx _armhf.deb Key bindings Key Action 1 Increase Speed 2 Decrease Speed j Previous Audio stream k Next Audio stream i Previous Chapter o Next Chapter n Previous Subtitle stream m Next Subtitle stream s Toggle subtitles q Exit OMXPlayer Space or p Pause/Resume - Decrease Volume + Increase Volume Left Seek -30 Right Seek +30 Down Seek -6...

ติดตั้ง Driver Wireless lan TP-Link TL-WN723N ให้กับ RPi

Image
Driver Wireless lan TP-Link TL-WN723N Credit : [ http://www.raspberrypi.org/phpBB3/viewtopic.php?p=462982#p462982 ] rtl8188eu drivers for 3.10.25+ (includes driver 8188eu.ko, firmware file rtl8188eufw.bin and README) CODE: SELECT ALL 3.10.25+ #616 - 8188eu-20131223.tar.gz Link to driver files - use date code from list above to download rquired driver CODE: SELECT ALL https://dl.dropboxusercontent.com/u/80256631/8188eu-2013xxyy.tar.gz NOTE: If updating firmware revisions, say from 3.10.23+ to 3.10.24+, and they use the same driver, in this case 8188eu-20131209.tar.gz, you will still need to reinstall the driver on the newer version of Linux, even though the driver has not changed as it will be loaded from a different director by the new Linux revision and you need to install it in the new directory. Download and install the driver, and firmware if required, with the following commands CODE: SELECT ALL # wget https://dl.dropboxusercontent.com/u/80256631/8188eu-2013...

RPi and I2C LCD PCF8574 (addr = 0x38)

Image
วิธีที่ให้ RPi เปิดใช้งาน I2C Link: [ Credit [http://www.instructables.com/id/Raspberry-Pi-I2C-Python/?ALLSTEPS] ] ส่วนลักษณะการต่อแบบนี้สามารถใช้งานได้กับ arduino ได้เลยนะครับ LCD Link: http://www.rpiblog.com/2012/07/interfacing-16x2-lcd-with-raspberry-pi.html  แสดงค่าตัวแปร lcd.lcd_puts("IP " + str(get_ip_address('eth0')),1)   lcd.lcd_puts("IP %s" % get_ip_address('wlan0'),2)