Giter Site home page Giter Site logo

pico-sensor's Introduction

概要

Bosch社製のセンサーBME280を使って温湿度と大気圧をOLEDに表示するサンプルです。タクトスイッチを押すことで右下の画像を切り替え、ソケット通信で簡単なWebサーバーを作りテキストを表示します。

291956404-62c1d481-8774-489e-b8ef-7630af7fb385

使うパーツ (秋月電子で調達)

つなぎ方

BME280 Raspberry Pi Pico (W) SSD1306 LED Tactile switch
VCC 3V3 (36pin) VCC - -
GND GND GND Cathode GND
- GP7 (10pin) SCL - -
- GP6 (9pin) SDA - -
CSB - - - -
SDI GP4 (6pin) - - -
SDO GND -
SCK GP5 (7pin) - - -
- GP10 (14pin) - Anode -
- GP19 (25pin) - - To GND

WIFIの設定

/lib ディレクトリに env.py ファイルを作成してSSIDとパスワードを設定してください。 IPアドレスは固定にすることをおすすめします。のでFIXED_IPに固定したいIPアドレスを設定してください。

起動時シェルに表示される

Connection successful
('xxx.xxx.x.xx', 'xxxx.xxx.xxx.x', 'xxx.xxx.x.x', 'xxx.xxx.x.x')

こちらがPicoのIPアドレスです。

SSID = "YOUR SSID"
PASSWORD = "YOUR PASSWORD"
FIXED_IP = "YOUR FIXED IP ADDRESS"
SUBNET_MASK = "YOUR SUBNET MASK"
GATEWAY_IP = "YOUR GATEWAY IP ADDRESS"
DNS_IP = "YOUR DNS IP ADDRESS"

テキストの切り替え

デフォルトは Hello! です。再起動時はこの値になります。

起動するとシェルにPicoのIPアドレスが表示されます。

Connection successful
('xxx.xxx.x.xx', 'xxxx.xxx.xxx.x', 'xxx.xxx.x.x', 'xxx.xxx.x.x')

一番左のアドレスがPICOのIPです。同じネットワーク内のブラウザで http://YOUR.PICO.IP.ADDRESS/ にアクセスし、テキストを入力すれば文字が変わります。

image

文字はスペースも含めて10~11文字以上は右下のイラストと被ってしまいますので良い感じにしてください。

セキュリティは考慮されていないので注意してくださいね。

画像の作り方

ディスプレイのサイズは128x64ドットです。何らかの方法で128x64pxのモノクロ二階調の画像を作成してください。JPGでもPNGでも問題ないです。

次に img2ccp を使って画像をプレーンのビットマップに変換します。最後のOutputの項目にあるCode output formatはPlain bytesを選択してください。

そちらのビットマップの文字列を.txtとして /img フォルダの中に保存するだけで追加されます。

インストール済のイラストサンプル

PXL_20231220_163648357

PXL_20231220_163733769

PXL_20231220_163715927

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.