Raspberry PI Development Journey-enabling cloud Platform monitoring

Source: Internet
Author: User

First, basic settings

1 sudo raspi-config

Move to the fifth "Enable Camera", enter, press the TAB key to switch to "enable" to confirm the return. Back to the main menu, tab to "Finish" to confirm the return. The Raspberry Pi will restart automatically.

or execute a command to manually shut down the machine

1 sudo shutdown -h now

Warning!!!!!!!!!!!!!!!!!!!!!!!!!
Absolutely can not be plugged into the camera with the power supply, if live operation, ten your camera will GG, Bo Master Blood and Tears lessons. And the camera GG after each call or will light, but you can not accept the data, the problem I have Google for a long time, we generally think it should be burnt out = =

When you are all installed, make sure to connect the hardware and then power it. (Remember not to hot-plug the camera)

Second, the configuration of seven Qiniu

We need to create a new warehouse, point to open their own arbitrary selection of nodes, in fact, several nodes in the domestic speed are similar, can meet the demand.

Then we can get the surveillance photos to come here to query

Third, compile the program

First, we write a. Sh script
take_photo.sh

12 raspistill -o current_photo.jpgpython test.py

Then install the seven Qiniu python SDK and execute it on the command line

1 sudo pip install qiniu

In the take_photo.sh directory we build a test.py

123456789101112131415161718192021222324252627282930 # -*- coding: utf-8 -*-importtimefromqiniu importAuth, put_file, etag, urlsafe_base64_encodeimport qiniu.configimportos#需要填写你的 Access Key 和 Secret Keyaccess_key =‘‘ #这里的密钥填上刚才我让你记住的密钥对secret_key =‘‘ #这里的密钥填上刚才我让你记住的密钥对#构建鉴权对象= Auth(access_key, secret_key)#要上传的空间bucket_name =‘mypi‘#上传到七牛后保存的文件名key =‘%s_%s_%s_%s_%s_%s.jpg‘%(time.localtime()[0],time.localtime()[1],time.localtime()[2],time.localtime()[3],time.localtime()[4],time.localtime()[5])#生成上传 Token,可以指定过期时间等token =q.upload_token(bucket_name, key, 3600)#要上传文件的本地路径localfile =‘current_photo.jpg‘ret, info =put_file(token, key, localfile)filename =‘current_photo.jpg‘ifos.path.exists(filename):    os.remove(filename)

That way, every time we execute the take_photo.sh script, we can have the Raspberry Pi take a picture and send it to the seven cow cloud, we just log in to see the data

Iv. Scheduled execution

Manage this script with Linux's timed task crontab

1 crontab -e

At the end of the Chase Plus

1 ** * * */home/pi/take_photo.sh

Restart Cron After

1 sudo service cron restart

Qshell Use tutorial http://developer.qiniu.com/code/v6/tool/qshell.html

Raspberry PI Development Journey-enabling cloud Platform monitoring

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.