{"id":2318,"date":"2021-03-11T00:51:44","date_gmt":"2021-03-11T08:51:44","guid":{"rendered":"https:\/\/doubleecpu.com\/?page_id=2318"},"modified":"2021-03-11T01:08:11","modified_gmt":"2021-03-11T09:08:11","slug":"blynk-python-raspberrypi","status":"publish","type":"page","link":"https:\/\/doubleecpu.com\/index.php\/blynk-references\/blynk-python-raspberrypi\/","title":{"rendered":"Blynk Python RaspberryPi"},"content":{"rendered":"\n<p>Instruction can be found on https:\/\/blynk.io\/en\/developers and clicking on Python Install <br>Install the Python client for Blynk <\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/doubleecpu.com\/wp-content\/uploads\/2021\/03\/image-19.png\" alt=\"\" class=\"wp-image-2321\" width=\"507\" height=\"320\" srcset=\"https:\/\/doubleecpu.com\/wp-content\/uploads\/2021\/03\/image-19.png 1344w, https:\/\/doubleecpu.com\/wp-content\/uploads\/2021\/03\/image-19-1024x648.png 1024w, https:\/\/doubleecpu.com\/wp-content\/uploads\/2021\/03\/image-19-768x486.png 768w\" sizes=\"auto, (max-width: 507px) 100vw, 507px\" \/><\/figure>\n\n\n\n<p>This will open the github repository which has instructions to check and install python.<br>For this instruction assumes you have Python installed on RaspberryPi already so the Blynk Library needs to be installed <\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">pip install blynklib<\/pre>\n\n\n\n<p>Clone the github repository to get examples<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo get clone https:\/\/github.com\/blynkkk\/lib-python.git<\/pre>\n\n\n\n<p>Install the Python package for DHT11 Sensor provided by Adafruit<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">pip install Adafruit-DHT<\/pre>\n\n\n\n<p>navigate to \/lib-python\/examples\/raspberry\/ <\/p>\n\n\n\n<p>A weather station python script is provided it implements DHT22 and BMP180 sensor modules. This instruction will modify the example to use a DHT11 sensor only and Disable BMP180 functionality. If you get errors of DHT or Blynk not being accessible Put the weather station.py, blynklib.py and AdafruitDHT files in the same folder. Instruction for wiring the RaspberryPi to the sensor is listed in the example: connect 5V to VCC, GND to ground, and GPIO17 to Data.<br>Edit the weather station python script:<br>Comment out<br>#import Adafruit_BMP.BMP085 as BMP085<br>adjust sensor object <br>dht22_sensor = Adafruit_DHT.DHT22 to .DHT11<br>and comment out all code after the # BMP180 remaing in the method read_handler( )<\/p>\n\n\n\n<p>in the lib-python\/ folder open the blynklib.py and in the class Connection modify the __init__( server = &#8216;[server]&#8217; , port 8080 ) method if using a local server (Not using blynk-cloud.com)<br>by default set to:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">def __init__(self, token, server='blynk-cloud.com', port=80, ssl_cert=None, heartbeat=10, rcv_buffer=1024,<\/pre>\n\n\n\n<p>run the python script and the blynk logo should appear. data will not show up until the app connects to the server. Setup the App <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Instruction can be found on https:\/\/blynk.io\/en\/developers and clicking on Python Install Install the Python client for Blynk This will open the github repository which has instructions to check and install python.For this instruction assumes you have Python installed on RaspberryPi already so the Blynk Library needs to be installed pip install blynklib Clone the github &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/doubleecpu.com\/index.php\/blynk-references\/blynk-python-raspberrypi\/\" class=\"more-link\">Read more<span class=\"screen-reader-text\"> &#8220;Blynk Python RaspberryPi&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":2312,"menu_order":2,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-2318","page","type-page","status-publish","hentry"],"featured_media_urls":[],"_links":{"self":[{"href":"https:\/\/doubleecpu.com\/index.php\/wp-json\/wp\/v2\/pages\/2318","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/doubleecpu.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/doubleecpu.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/doubleecpu.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/doubleecpu.com\/index.php\/wp-json\/wp\/v2\/comments?post=2318"}],"version-history":[{"count":4,"href":"https:\/\/doubleecpu.com\/index.php\/wp-json\/wp\/v2\/pages\/2318\/revisions"}],"predecessor-version":[{"id":2323,"href":"https:\/\/doubleecpu.com\/index.php\/wp-json\/wp\/v2\/pages\/2318\/revisions\/2323"}],"up":[{"embeddable":true,"href":"https:\/\/doubleecpu.com\/index.php\/wp-json\/wp\/v2\/pages\/2312"}],"wp:attachment":[{"href":"https:\/\/doubleecpu.com\/index.php\/wp-json\/wp\/v2\/media?parent=2318"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}