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组中了。

November 4, 2016

debug iptables

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 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:

February 22, 2016

config raspberry pi sound volume

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!

February 20, 2016

play wechat voice via raspberry pi

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

February 20, 2016

play in Raspberry PI

thanks this repo: you need install mplayer first: sudo apt-get install mplayer then install via pip sudo pip install make sure your raspberry pi’s locale, I got a unicode error when I run, 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).

January 1, 2015

build octopress blog on raspberry pi

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

Powered by Hugo & Kiss.