PMS7003

December 7, 2016

PMS7003(后面简称G7)是一款空气质量传感器,型号03表示最小可检测颗粒直径为0.3um,常见的PM2.5当然在检测范围内,G7不仅可以检测颗粒浓度,还可以检测颗粒数量。 G7的接口为10pin,购买后赠送一个母座(基本没啥用,除非你自己焊接),可以另外购买一个G7转排针的转接板,转接后就可以把G7接到USB串口设备上测试,VCC接5V,GND,TX,RX都接好后连上USB串口就可以收到数据。如果你的系统是Linux,可以用hexdump /dev/ttyUSB0看到数据进来,我用的USB串口设备是PL2303HXA,在win10中貌似没法用了,所以把这个设备连到vmware的Ubuntu中也没法使用,但在另一台电脑上正常。如果你不知道PL2303具体是哪个型号,可以看芯片上的编号,例如我的芯片第一行是PL2303,第二行是LF10193A,第二行的10表示2010年,19表示第19周,3A表示芯片的版本,很可惜是HXA,无法在win10中使用。 G7接入到树莓派上后可以从系统的ttyAMA0设备中读写数据,我的ttyAMA0是root:tty,root可读写,tty组可写但不可读,可以考虑chmod但最简单的应该删掉/boot/cmdline.txt中的console=/dev/ttyAMA0,115200(我的是console=serial,115200),可以参考这里,重启后发现变成了root:dialout,dialout组可读写,默认pi这个用户已经在dialout组中了。

debug iptables

November 4, 2016

If you want to know how ip packets are moved in iptables tables or chains, you need add some rules in RAW table. I always find the method out from http://backreference.org/2010/06/11/iptables-debugging/ But in my raspberry pi, I installed raspbian system, the modprobe ipt_LOG doesn’t work for me, the nf_log_ipv4 module must be load, you can find it on this answer: http://serverfault.com/a/739411/140035

config raspberry pi sound volume

February 22, 2016

thanks to here The simplest way to change sound volume in raspberry pi is alsamixer, it’s a GUI tool for ALSA. There is a post for comparing different models sound quality This is a hardware sound card for raspberry pi, so cool!

play wechat voice via raspberry pi

February 20, 2016

UPDATE: if you are working with personal mp wechat, you can register a test account which is full privilege, or you can register a company account(choose team, not a real company) UPDATE: mplayer plays better than omxplayer You need a wechat certificated mp account, because you need a privilege only certificated account can acquire. When I almost finished the project, I found I can’t acquire that privilege, so I can’t get the voice file from API. ... Read more

play douban.fm in Raspberry PI

February 20, 2016

thanks this repo: https://github.com/taizilongxu/douban.fm you need install mplayer first: sudo apt-get install mplayer then install douban.fm via pip sudo pip install douban.fm make sure your raspberry pi’s locale, I got a unicode error when I run douban.fm, so make sure your locale is support UTF8. If you need login with captcha, scp the captcha image from /tmp to your PC/MAC and view(my raspberry pi is CLI env).

build octopress blog on raspberry pi

January 1, 2015

First post on 2015! I have a raspberry pi several months ago, and I often use it to recording temp and humidity, uploading to a cloud host, but after a home movement, it had been stored in my drawer. Last day of 2014, while waiting 2015, I want build it and host an external disk for MacBookPro backup(Time Machine), but failed for power supply, normal power supply is not enough for raspi, so I should buy another USB Hub powered by itself. ... Read more

© 2018 | Follow on Twitter | Hucore theme & Hugo