工業製造
産業用モノのインターネット | 工業材料 | 機器のメンテナンスと修理 | 産業プログラミング |
home  MfgRobots >> 工業製造 >  >> Manufacturing Technology >> 製造プロセス

TV Series / Anime New Episode Release Date Notifier

コンポーネントと消耗品

>
JLCPCBカスタマイズPCB
× 1
Arduino Nano 33 IoT
× 1
Raspberry Pi3モデルB
Raspberry Pi3またはRaspberryPi 4
× 1
Raspberry Pi4モデルB
Raspberry Pi3またはRaspberryPi 4
× 1
SparkFun Nokia5110画面
× 1
OPEN-SMARTによるシリアルMP3プレーヤー
× 1
RGB拡散共通アノード
× 1
フラッシュメモリカード、SDカード
× 2
抵抗220オーム
× 12
押しボタンスイッチ6x6x5
× 4
TaydaElectronicsDCパワージャック2.1MMバレルタイプPCBマウント
× 1

必要なツールとマシン

>
はんだごて(汎用)
ホットグルーガン(汎用)

アプリとオンラインサービス

>
Arduino IDE
KiCad
NotePad ++

このプロジェクトについて

説明

お気に入りの番組のリリース日を追跡するためのWebおよびモバイルアプリケーションは無数にありますが、リスト内のシリーズまたはアニメの新しいエピソードがゼロからリリースされたときに通知するデバイスを作成したいと思いました-ハードウェアとソフトウェア-さまざまな機能。

まず、PHPでWebアプリケーション(TVシリーズ/アニメリリース日トラッカー)を作成して、シリーズ/アニメリストを作成し、リリース日に関する情報を収集しました。その点で、私はTVMAZE REST APIを利用しました。これにより、アプリケーションは、雑多で複雑なコーディング手順を実行しなくても、リリース日までにエピソード情報を正確に取得できます。次に、Raspberry PiにLAMP(w / MariaDB)サーバーをセットアップして、アプリケーションを実行します。しかし、Raspberry Piを持っていない人や、Raspberry Piをホストとして使用したくない人のために、ユーザーフレンドリーなインターフェイスを備えた無料バージョンのアプリケーションを自分のWebサイトに公開しました。また、アプリケーションのソースコードは以下にあります。

Webアプリケーションで情報の転送を実行した後、リリース時に新しいエピソードがある場合は、アプリケーションによって生成されたデータを照合するための開発ボードとしてArduino Nano 33IoTを使用することにしました。区切り文字を使用して、アプリケーションによって転送された応答をどのように分類したかについて、以下で詳細を確認できます。また、Nano 33 IoTに実装した機能とモードを管理するために、Nokia 5110画面とプッシュボタンを備えたユーザーインターフェイス(メニュー)を設計しました。

最後に、オープニング曲とともにリリースされた私のリストの番組の新しいエピソードを知らせるために、使いやすいUARTコマンドリストがあるため、シリアルMP3プレーヤーモジュール(OPEN-SMART)を使用しました。さらに、MP3プレーヤーモードを追加して、すべてのオープニングソングを再生できるようになりました。これにより、デバイスが私の部屋の魅力的なアクセサリになりました:)

ブレッドボードでデザインを完成させ、コードをテストした後、ユニークなレトロな電話の形をしたPCB(TVシリーズ/アニメリリース日通知)をデザインして、まったく新しい見た目で使いやすいデバイスを作成しました。

このプロジェクトを後援してくれたJLCPCBに大いに感謝します。

ステップ1:テレビシリーズ/アニメのリリース日通知PCBの設計とはんだ付け

私はKiCadを使用してTVシリーズ/アニメリリース日通知PCBを設計しました。以下にPCBのガーバーファイルを添付したので、必要に応じて、このPCBをJLCPCBに注文して、このプロジェクトを複製し、リリース時にお気に入りの番組の新しいエピソードがあるときに通知を受け取ることができます:)

まず、はんだごてを使って、ヘッダー、押しボタン、220Ω抵抗、電源ジャック、5mmアノードRGBLEDを取り付けました。

PCB上のコンポーネントリスト:

A1(Arduino Nano 33 IoTのヘッダー)

J1(シリアルMP3プレーヤーのヘッダー)

J2(DS3231のヘッダー-必須ではありません)

J3(Nokia 5110画面のヘッダー)

J4(パワージャック)

D1(5mmアノードRGB LED)

K1、K2、K3、K4(プッシュボタン)

R1、R2、R3、R4、R5、R6、R7、R8、R9、R10、R11、R12(220Ω抵抗)

ステップ2:RaspberryPiでMariaDBを使用してLAMPWebサーバーをセットアップする

Raspberry Piを使用したプログラミングの初心者の場合は、RaspberryPiの公式Webサイトで十分に説明されている手順とチュートリアルを調べることができます。

公式のRaspberryPiセットアップチュートリアルにアクセスするには、ここをクリックしてください。

  • メニューから[アクセサリ]> [ターミナル]を選択して、ターミナルウィンドウを開きます。
  • ターミナルに次のコマンドを入力してEnterキーを押し、apache2パッケージをインストールします。

sudo apt-get install apache2 -y

  • サーバーをテストするには、メニューから[インターネット]> [Chromium Webブラウザ]を選択してChromiumを開き、http:// localhostと入力します。
  • 必要に応じて、RaspberryPiのIPアドレスを使用することもできます。

ホスト名-私

  • 次のコマンドを使用してPHPパッケージをインストールします。
  • Piを更新することを忘れないでください。

sudo apt-get update

sudo apt-get install php -y

  • ターミナルウィンドウに次のコマンドを入力して、MySQLサーバー(MariaDB)およびPHP-MySQLパッケージをインストールします。

sudo apt-get install mariadb-server php-mysql -y

  • 新しいユーザーを作成するには、ターミナルウィンドウでMySQLセキュアインストールコマンドを実行します。

sudo mysql_secure_installation

  • rootの現在のパスワードを入力するように求められます(noneの場合は入力してください): —Enterキーを押します。
  • Yを入力し、Enterキーを押して rootパスワードを設定します。 。
  • ボットと入力します 新しいパスワード: プロンプトを表示し、Enterキーを押します。
  • Yを入力して、匿名ユーザーを削除
  • Yを入力して、 rootログインをリモートで禁止する
  • Yを入力して、テストデータベースを削除してアクセスします
  • Yを入力して、特権テーブルを今すぐ再読み込み
  • 完了すると、このメッセージが表示されます-すべて完了です。そしてMariaDBをご利用いただきありがとうございます!

  • TVMAZE REST APIによって生成された変数を保存するデータベース(tvseries)を作成するには、ターミナルウィンドウで次のMySQLコマンドを実行します。

sudo mysql -uroot -p

  • ルートパスワードを入力してください-ボット
  • MariaDBモニターへようこそというメッセージが表示されます 。
  • MariaDB [(none)]> の後に以下の行をたどります : tvseries を作成するためのプロンプト MariaDBのデータベース:

データベースtvseriesを作成します;

tvseries。*のすべての特権を 'bot'によって識別される 'root' @ 'localhost'に付与します;

フラッシュ権限;

  • Ctrl + DでMariaDBプロンプトを終了します。

  • file_get_contents()を使用するだけで、TVMAZE RESTAPIからデータを取得する PHPで機能する場合は、php-curlパッケージをインストールします。

sudo apt-get install php-curl

  • 次に、Apacheサーバーを再起動して、ローカルホストにインストールされているパッケージを使用できるようにします。

sudo service apache2 restart

ステップ3:お気に入りのシリーズ/アニメに関するTVMAZE RESTAPIから情報を取得する

TVMAZEは、無料で使いやすいREST APIを提供します。これにより、ユーザーは番組を名前、日付、エピソード番号などで検索できます。利用可能なエンドポイントとクエリを調べることができます。

TVMAZE RESTAPIに移動します。

日付別エピソードを使用しました 特定の日に放送された特定の番組からすべてのエピソードを取得するオプション。

リリース日ごとに情報を取得するには、TVMAZEでお気に入りの番組を検索し、それらのリンクに示されているTVIDを使用する必要があります。

  • URL:/ shows /:id / episodesbydate?date =:date
  • 日付:ISO8601形式
  • 例:http://api.tvmaze.com/shows/1/episodesbydate?date =2013-07-01

指定された日に放映されたエピソードがある場合、APIは完全なエピソード情報の配列を返します。

それ以外の場合、APIはHTTP404を返します。

以下では、私が作成したお気に入りのシリーズ/アニメリストを調べて、そのうちの1つの新しいエピソードが私のプロジェクトでリリースされているかどうかを追跡できます。

毎日のショーなので、コードをテストするためにレイトレイトショーを追加しました。

<コード> 1)ワンピース

TV ID: 1505

https://www.tvmaze.com/shows/1505/one-piece

2)僕のヒーローアカデミア

TV ID: 13615

https://www.tvmaze.com/shows/13615/boku-no-hero-academia

3)Westworld

TV ID: 1371

https://www.tvmaze.com/shows/1371/westworld

4)シンプソンズ

TV ID: 83

https://www.tvmaze.com/shows/83/the-simpsons

5)ジェームズコーデンとのレイトレイトショー

TV ID: 2831

https://www.tvmaze.com/shows/2831/the-late-late-show-with-james-corden

ステップ4:PHPのRaspberry Piで実行されるTVシリーズ/アニメリリース日トラッカー(アプリケーション)を開発し、データを挿入するためのシリーズテーブルを作成する

私はPHPでTVシリーズ/アニメリリース日トラッカーを開発し、興味のある人のために以下のコード説明セクションでアプリケーションのソースコードを説明しました。

ただし、PHPを使用したWeb開発が好きでない場合は、ダウンロード(TV-Series-Anime-Episode-Tracker.zipという名前)でアプリケーションをダウンロードし、PHPコーディングに飛び込むことなくRaspberryPiにアップロードできます。

アップロード <コード>:

次の手順で、ローカルホストにTVシリーズ/アニメのリリース日トラッカーをインストールします。

  • index.phpファイルとquery.phpファイルを含むアプリケーション(TV-Series-Anime-Episode-Tracker.zip)をダウンロードします。

  • TV-Series-Anime-Episode-Tracker.zipを抽出します。

  • Apacheサーバーは保護された場所であるため、ターミナルを使用して、アプリケーションフォルダー(TV-Series-Anime-Episode-Tracker)をダウンロードからサーバー(/ var / www / html)に移動します。

sudo mv / home / pi / Downloads / TV-Series-Anime-Episode-Tracker / / var / www / html /

  • TVシリーズ/アニメのリリース日トラッカーに移動します:

http:// localhost / TV-Series-Anime-Episode-Tracker /

機能 <コード>:

1)インストール後、アプリケーションを開いて、データベース(tvseries)にseriesという名前のテーブルを作成します。 index.phpファイルを最初に開くと、アプリケーションはseriesという名前のテーブルを自動的に作成し、ユーザーに通知します-データベーステーブルが作成されました!

2)データベーステーブル(シリーズ)がデータベースに正常に作成された場合、アプリケーションはユーザーに通知します-データベーステーブルが見つかりました!

3)データベーステーブル(シリーズ)を作成した後、リスト内の各ショーのTVMAZE REST APIに必要な変数を挿入するには、次の手順を実行します。

  • ターミナルウィンドウで次のMySQLコマンドを実行します:

sudo mysql -uroot -p

  • ルートパスワードを入力してください-ボット
  • tvseries を選択します データベース:

USE tvseries;

  • 必要な変数(シリーズ名、TV ID、ステータス)を各番組のテーブルに挿入します。ステータス変数は、特定の日付に新しいエピソードがリリースされたときに、繰り返し発生することなくユーザーに通知するためにアプリケーションによって使用されます。

INSERT INTO `series`(` series_name`、 `tv_id`、` status`)VALUES( 'One Piece'、 '1505'、 'Pending');

5)query.phpで、アプリケーションはTVMAZE REST APIにリクエストを送信して、データベース内の番組の新しいエピソードがリリースされているかどうかを検出します。 TVMAZE REST APIが、リリースされたエピソードの完全なエピソード情報の配列を返す場合、アプリケーションは、再発を防ぐためにArduino Nano 33IoTで照合可能な情報を1回印刷します。

http://localhost/TV-Series-Anime-Episode-Tracker/query.php

%Series_Name%Season%Episode_Number%Episode_Name%

%レイトレイトショー%2020%91%ジェイソンシュワルツマン、アリシアキー%

6)それ以外の場合、アプリケーションはエントリが見つかりません!を出力します。

コードの説明 <コード>:

1)index.php

  • データベース接続設定を定義します-「localhost」、「root」、「bot」、「tvseries」。
  • checkDatabase() 関数、指定された名前にデータベーステーブルがあるかどうかを検出します-シリーズ。
  • createTable() 関数、データベースに見つからない場合はシリーズテーブルを作成し、ユーザーに通知します。

2)query.php

  • クエリ クラス、リクエストを行うためのTVMAZEAPIへのパスを定義します。
  • define_user() 関数、接続設定とテーブル名を取得します。
  • check_ep_release_date() 関数、 file_get_contents()を使用 機能、現在の日付で特定のTVIDの新しいエピソードがリリースされているかどうかを検出します。再発を防ぐために、新しいエピソードがリリースされている場合は、データベースのステータス変数を[保留中]から[リリース済み]に変更します。
  • track_db_entries() 関数、 check_ep_release_date()を実行します データベーステーブルに登録されているショーごとに-シリーズ。

ステップ4.1:RaspberryPiを使用せずにWebアプリケーションを実行する

私のウェブサイト(TheAmplituhedron)の購読者のために、Raspberry Piを持っていない人や、このプロジェクトのホストとして使用したくない人のために、TVシリーズ/アニメリリース日トラッカーの無料バージョンを開発しました。

データベースを管理するためのユーザーフレンドリーなインターフェースを提供します。 Raspberry Piのターミナルを使用してデータを挿入する代わりに、プロジェクトでこのインターフェイスを使用する場合は、私に連絡してください。

アプリケーションに移動します:

https://www.theamplituhedron.com/dashboard/TV-Series-Anime-Episode-Tracker/

ステップ5:Arduino Nano 33IoTのセットアップ

Arduino Nano 33 IoTを使用したプログラミングの初心者の場合、心配しないでください。ArduinoIDEで簡単に使用できます。必要なドライバー(Arduino SAMD Core)をダウンロードするだけです。ここでも説明されています。

Arduino Nano 33 IoT経由でWiFiに接続できるようにするには、ここからWiFiNINAライブラリをダウンロードしてください。

Nokia 5110画面でテキストを印刷してグラフィックを描画するには、ここからLCD5110_Basicライブラリをダウンロードします。

Arduino Nano 33 IoTの2番目のシリアルポート(Serial1)を使用して、シリアルMP3プレーヤーと通信しました。

Arduino Nano 33IoTのシリアルポート

"ボードのUSBコネクタはSAMD21のUSBホストピンに直接接続されています。このルーティングにより、Arduino NANO 33 IoTをクライアントUSBペリフェラルとして使用できます(コンピューターに接続されたマウスまたはキーボードとして機能します) )またはUSBホストデバイスとして、マウス、キーボード、AndroidフォンなどのデバイスをArduino NANO 33 IoTに接続できます。このポートは、Arduinoプログラミング言語のSerialオブジェクトを使用して仮想シリアルポートとしても使用できます。 。RX0ピンとTX1ピンは、Serial1として使用できる2番目のシリアルポートです。 "

これで、Arduino Nano 33IoTはプロジェクトコードを実行する準備が整いました:)

ステップ6:シリアルMP3プレーヤー(OPEN-SMART)にコマンドを送信する

このプロジェクトでお気に入りのシリーズ/アニメリストのオープニング曲で構成されるプレイリストを作成しました:

1)ワンピース-オープニング|聞く

2)僕のヒーローアカデミア-オープニング|聞く

3)ウエストワールド-オープニング|聞く

4)シンプソンズ-オープニング|聞く

5)レイトレイトショー-オープニング|聞く

必要に応じて、zip形式のフォルダ(opening_songs.zip)にプレイリストをダウンロードできます。

適切な機能をトリガーするために必要なUARTコマンドを知っている限り、Arduino Nano 33IoTでシリアルMP3プレーヤーを使用するのは簡単です。 OPEN-SMARTのスピーカー付きシリアルMP3プレーヤーモジュールを使用しました。そのため、異なるブランド名のシリアルMP3プレーヤーを使用している場合、以下に示すこれらのコマンドは機能しません。

ガイダンスの指示に従ってください:

「このモジュールは、高品質のMP3オーディオチップをベースにした一種のシンプルなMP3プレーヤーデバイスです。8kHz〜48kHzのサンプリング周波数MP3およびWAVファイル形式をサポートできます。ボードにはTFカードソケットがあります。 、オーディオファイルを保存しているマイクロSDカードを差し込むことができます。MCUは、曲の切り替え、音量や再生モードの変更など、UARTポートを介してモジュールにコマンドを送信することにより、MP3の再生状態を制御できます。 USB経由でモジュールをUARTモジュールにデバッグします。Arduino/ AVR / ARM / PICと互換性があります。 "

「マイクロSDカードがFAT16またはFAT32としてフォーマットされており、その中にいくつかの曲が含まれていることを確認してください。フォルダ「01」と「02」を作成し、001xxx.mp3 /002xxx.mp3という名前の曲をいくつか入れる必要があります。 /003xxx.mp3が含まれています。」

つまり、コマンドを正確に実行できるようにするには、曲を「01」という名前のフォルダに保存し、曲名に連続した番号を追加します-001One Piece-Opening.mp3、002My HeroAcademia-Opening.mp3など。

Arduino Nano 33 IoTを搭載したシリアルMP3プレーヤーにUARTコマンドを送信するために、 send_command_to_MP3_player という名前の関数を作成しました。 。要求されたコマンドの各バイトを、RX0ピンとTX1ピンの2番目のシリアルポート( Serial1 )を介してシリアルMP3プレーヤーに転送します。 -要求されたコマンドの長さに応じて-4、5、または6。

以下に示すように、シリアルMP3プレーヤーに送信するコマンドをバイト単位で区切ります-0x7e。すべてのコマンドは「7E」で始まり、「EF」で終わります。 2番目のバイトは、-'02'、 '03'、 '04'の間のバイト数です。以下で、OPEN-SMARTによるシリアルMP3プレーヤーのマニュアルをダウンロードして、すべてのコマンドを調べ、より詳細な手順を入手してください。

  //必要なMP3プレーヤーコマンドを定義します。
//プロジェクトページから指定されたすべてのコマンドを検査できます。
// TFカードにストレージデバイスを選択します
static int8_t select_SD_card [] ={0x7e、0x03、0X35、0x01、0xef}; // 7E 03 35 01 EF
//次のディレクトリで曲を再生します:// 001xxx.mp3
static int8_t play_song_1 [] ={0x7e、0x04、0x41、0x00、0x01、0xef}; // 7E 04 41 00 01 EF
//次のディレクトリで曲を再生します:// 002xxx.mp3
static int8_t play_song_2 [] ={0x7e、0x04、0x41、0x00、0x02、0xef}; // 7E 04 41 00 02 EF
//次のディレクトリで曲を再生します:// 003xxx.mp3
static int8_t play_song_3 [] ={0x7e、0x04、0x41、0x00、0x03、0xef}; // 7E 04 41 00 03 EF
//次のディレクトリで曲を再生します:// 004xxx.mp3
static int8_t play_song_4 [] ={0x7e、0x04、0x41、0x00、0x04、0xef}; // 7E 04 41 00 04 EF
//次のディレクトリで曲を再生します:// 005xxx.mp3
static int8_t play_song_5 [] ={0x7e、0x04、0x41、0x00、0x05、0xef}; // 7E 04 41 00 05 EF
//曲を再生します。
static int8_t play [] ={0x7e、0x02、0x01、0xef}; // 7E 02 01 EF
//曲を一時停止します。
static int8_t pause [] ={0x7e、0x02、0x02、0xef}; // 7E 02 02 EF
//次の曲。
static int8_t next_song [] ={0x7e、0x02、0x03、0xef}; // 7E 02 03 EF
//前の曲。
static int8_t previous_song [] ={0x7e、0x02、0x04、0xef}; // 7E 02 04 EF

ステップ7:Arduino Nano 33IoTのプログラミング

  • 必要なライブラリを含めます。
  • WiFi設定を定義します-SSIDとパスワード。
  • RaspberryPiのIPアドレスを入力します。
  • Raspberry Piでアプリケーション(query.php)の経路を定義します。
  • イーサネットクライアントライブラリを初期化します。
  • Nokia5110の画面設定を定義します。
  • 関連する画面モード(テレビと音楽)のグラフィックを定義します。
  • さまざまなグラフィック(モノクロ画像)を作成するには、モノクロ画像コンバータに移動します。
  • 必要なMP3プレーヤーコマンドを定義します。
  • 揮発性ブール値を使用してメニューオプションとモードを定義します。
  • コントロールボタンとRGBLEDピンを定義します。
  • 2番目のシリアルポートでシリアルMP3プレーヤーモジュールのシリアル通信を開始します- Serial1
  • WiFiネットワークに接続します。
  • シリアルモニターとNokia5110画面の両方で接続を確認します。
  • read_buttons() 機能、コントロールボタン(右、OK、左、終了)からデータを取得します。
  • change_menu_options() 、右ボタンと左ボタンを使用してオプション番号を増減します。
  • interface() 機能、インターフェース(メニュー)を印刷します。
  • Init Tracker の場合 モードが選択されたら、TV Series / Anime Release DateTrackerという名前のWebアプリケーションに接続します。
  • 使用可能な着信バイトがある場合は、Webアプリケーションから応答を取得します。
  • endsWith()の使用 関数、応答にパーセント記号(区切り文字)が含まれているかどうかを検出します。
  • 含まれている場合は、簡単な方法で事前定義された区切り文字で応答文字列を分割します。 '%'(パーセンテージ) このプロジェクトでは区切り文字として定義されています。
  • サブストリングとしてのクリーンな情報-Series_Name、Season、Episode、Episode_Name。
  • 情報を印刷し、リリースされたシリーズ/アニメのオープニングソングを終了するまで再生します。
  • 終了ボタンが押されるまで待ちます。
  • 空白の応答がある場合は、リリースされたエピソードが検出されませんでした:(
  • 新しいリクエストをカウントしながらTVアイコンを描画します。
  • 次のリクエストまで待ちます。
  • MP3プレーヤーモードの場合 が選択されている場合は、音楽プレーヤーのアイコンを描画します。コントロールボタン(右、左、OK)でMP3プレーヤーを制御します。
  • スリープモードの場合 が選択されている場合は、10秒後にスリープモードをアクティブにして、残りの秒数を印刷します。

Connections and Adjustments

// Connections
// Arduino Nano 33 IoT:
// Nokia 5110 Screen
// D2 -------------------------- SCK (Clk)
// D3 -------------------------- MOSI (Din)
// D4 -------------------------- DC
// D5 -------------------------- RST
// D6 -------------------------- CS (CE)
// RGB
// D9 -------------------------- R
// D10 -------------------------- G
// D11 -------------------------- B
// LEFT_BUTTON
// A0 --------------------------- S
// OK_BUTTON
// A1 --------------------------- S
// RIGHT_BUTTON
// A2 --------------------------- S
// EXIT_BUTTON
// A3 --------------------------- S
// DS3231 (Optional for Nano and Not Required for Nano 33 IoT)
// A4 --------------------------- SDA
// A5 --------------------------- SCL

After finishing and uploading the code to the Arduino Nano 33 IoT, I attached all required components to the board via headers.

I also provided a connection slot for a DS3231 RTC Module for those who want to change the Arduino Nano 33 IoT with the Arduino Nano. But, you need to enter release dates manually for each show to the Arduino Nano without being able to obtain data from the web application to create a countdown timer with the RTC.

Note:You can connect either a speaker or headphones to the Serial MP3 Player to listen to soundtracks in the playlist. I connected the speaker delivered in addition to the Serial MP3 Player (OPEN-SMART).

Modes and Features

1) While the device tries to connect to the WiFi network, it displays Waiting... Attempting to connect to WiFi

2) After establishing a successful connection, the device informs the user with this message - Connected to WiFi!!!

3) Then, the device prints the interface (menu) presenting available modes - A.Init Tracker, B.MP3 Player , and C.Sleep 。 To switch among modes, use the Right and Left buttons. Subsequently, press the OK button to select a mode.

A.Init Tracker

A.1) After selecting the A.Init Tracker mode, the device attempts to connect to the localhost hosted by the Raspberry Pi. If successful, it informs the user with this message - Connected to the server!!! Conversely, the device displays this message - Connection Error!!!

A.2) If the application (TV Series / Anime Release Date Tracker) sends a data string that of a released episode of a registered series/anime in the database, then the device:

  • Prints the episode information - Series Name, Season, Episode Number, and Episode Name:

One Piece, 10x54, Luffy's Determination

  • Plays the opening song of the released series/anime,
  • And, turns the RGB to the color assigned to the released series/anime.

For instance, I assigned these colors below for each show in my list:

  • One Piece -> Red
  • My Hero Academia -> Green
  • Westworld -> Blue
  • The Simpsons -> Yellow
  • The Late Late Show -> Purple

Unless the Exit button is pressed, the device keeps displaying the episode information and showing the assigned color.

The device notifies the user for once for each released episode to prevent any recurrence.

A.3) After the Exit button is pressed, the device draws the television icon while waiting for the next request to the application.

A.4) If there is no released episode of a registered series/anime in the database, the device displays this message - No Released Episode Detected :( - and then; draws the television icon until the next request to the application.

A.5) The device returns to the interface (menu) if the Exit button is pressed while displaying the television icon.

B. MP3 Player

I implemented this feature as a subsidiary and fun one to turn this device into an intriguing accessory for my room.

B.1) After selecting the B.MP3 Player mode, the device draws the music note icon and lets the user play all opening songs by using the control buttons:

  • Right - Next Song
  • Left - Previous Song
  • OK - Pause

B.2) The device returns to the interface (menu) if the Exit button is pressed.

C.Sleep

C.1) After selecting the C.Sleep mode, the device enables the sleep mode in 10 seconds and prints the remaining seconds on the screen.

C.2) While maintaining the sleep mode, the device applies a given color pattern to the RGB as a nightlight.

C.3) The device returns to the interface (menu) if the Exit button is pressed.

Videos and Conclusion

After completing all steps above, I decided to fasten the device to my bookcase by using a hot glue gun. It works stupendously :)

コード

  • Series_Release_Date_Notifier.ino
  • index.php
  • query.php
Series_Release_Date_Notifier.inoArduino
 //////////////////////////////////////////////////// // TV Series / Anime New Episode // // Release Date Notifier // // ------------------------- // // Arduino Nano 33 IoT // // by Kutluhan Aktar // // // ////////////////////////////////////////////////////// Get informed when new episodes of your favorite shows are on release with their opening songs via Nano 33 IoT and Raspberry Pi. //// I developed a corroborating web application in PHP for this project, named TV Series / Anime Release Date Tracker. // You can either use a Raspberry Pi as the server, explained in the project tutorial, or TheAmplituhedron with the real-time database interface if you are a member. //// For more information:// https://www.theamplituhedron.com/projects/TV-Series-Anime-New-Episode-Release-Date-Notifier/// // You can use the mentioned web application in free version on TheAmplituhedron as the host server if you are a subscriber:// https://www.theamplituhedron.com/dashboard/TV-Series-Anime-Episode-Tracker///// Connections// Arduino Nano 33 IoT:// Nokia 5110 Screen// D2 --------------------------- SCK (Clk)// D3 --------------------------- MOSI (Din) // D4 --------------------------- DC // D5 --------------------------- RST// D6 --------------------------- CS (CE)// RGB// D9 --------------------------- R// D10 --------------------------- G// D11 --------------------------- B// LEFT_BUTTON// A0 --------------------------- S// OK_BUTTON// A1 --------------------------- S// RIGHT_BUTTON// A2 --------------------------- S// EXIT_BUTTON// A3 --------------------------- S// DS3231 (Optional for Nano and Not Required for Nano 33 IoT)// A4 --------------------------- SDA // A5 --------------------------- SCL// Include required libraries:#include #include #include char ssid[] ="[_SSID_]"; // your network SSID (name)char pass[] ="[_PASSWORD_]"; // your network password (use for WPA, or use as key for WEP)int keyIndex =0; // your network key Index number (needed only for WEP)int status =WL_IDLE_STATUS;// Note:Uncomment equivalent connection settings provided under related lines for using the web application hosted on TheAmplituhedron if you are a subscriber.// Enter the IPAddress of your Raspberry Pi.IPAddress server(192, 168, 1, 22);/* // name address for TheAmplituhedron. Change it with your server if you are using a different host server than TheAmplituhedron.char server[] ="www.theamplituhedron.com";*/// Define the pathway of the application in Raspberry Pi.String application ="/TV-Series-Anime-Episode-Tracker/query.php";/*// Define your hedron if you are using TheAmplituhedron as the host server for this project:String HEDRON ="[_HEDRON_]";// Define the pathway of the web application. If you are using TheAmplituhedron as the host server for this project as I did, just enter your hedron. Otherwise, enter the pathway on your server.String application ="/dashboard/TV-Series-Anime-Episode-Tracker/" + HEDRON;*/// Initialize the Ethernet client libraryWiFiClient client;/* WiFiSSLClient client; */// Define screen settings.LCD5110 myGLCD(2,3,4,5,6);extern uint8_t SmallFont[];extern uint8_t MediumNumbers[];// Define the graphics for related screen modes.extern uint8_t tv[];extern uint8_t music[];// Define the required MP3 Player Commands.// You can inspect all given commands from the project page:// Select storage device to TF cardstatic int8_t select_SD_card[] ={0x7e, 0x03, 0X35, 0x01, 0xef}; // 7E 03 35 01 EF// Play the song with the directory:/01/001xxx.mp3static int8_t play_song_1[] ={0x7e, 0x04, 0x41, 0x00, 0x01, 0xef}; // 7E 04 41 00 01 EF// Play the song with the directory:/01/002xxx.mp3static int8_t play_song_2[] ={0x7e, 0x04, 0x41, 0x00, 0x02, 0xef}; // 7E 04 41 00 02 EF// Play the song with the directory:/01/003xxx.mp3static int8_t play_song_3[] ={0x7e, 0x04, 0x41, 0x00, 0x03, 0xef}; // 7E 04 41 00 03 EF// Play the song with the directory:/01/004xxx.mp3static int8_t play_song_4[] ={0x7e, 0x04, 0x41, 0x00, 0x04, 0xef}; // 7E 04 41 00 04 EF// Play the song with the directory:/01/005xxx.mp3static int8_t play_song_5[] ={0x7e, 0x04, 0x41, 0x00, 0x05, 0xef}; // 7E 04 41 00 05 EF// Play the song.static int8_t play[] ={0x7e, 0x02, 0x01, 0xef}; // 7E 02 01 EF// Pause the song.static int8_t pause[] ={0x7e, 0x02, 0x02, 0xef}; // 7E 02 02 EF// Next song.static int8_t next_song[] ={0x7e, 0x02, 0x03, 0xef}; // 7E 02 03 EF// Previous song.static int8_t previous_song[] ={0x7e, 0x02, 0x04, 0xef}; // 7E 02 04 EF// Define menu options and modes using volatile booleans.volatile boolean TV =false;volatile boolean Music =false;volatile boolean Sleep =false;volatile boolean Activated =false;// Define the control buttons.#define B_Exit A3#define B_Right A2#define B_OK A1#define B_Left A0// Define RGB LED pins.#define redPin 9#define greenPin 10#define bluePin 11// Define data holders:int Right, OK, Left, Exit;int selected =0;void setup() { // Buttons:pinMode(B_Exit, INPUT); pinMode(B_Right, INPUT); pinMode(B_OK, INPUT); pinMode(B_Left, INPUT); // RGB:pinMode(redPin, OUTPUT); pinMode(greenPin, OUTPUT); pinMode(bluePin, OUTPUT); adjustColor(0, 0, 0); // Black // Initiate screen. myGLCD.InitLCD(); myGLCD.setFont(SmallFont); Serial.begin(9600); // Initiate serial communication for the Serial MP3 Player Module. Serial1.begin(9600); // Select the SD Card. send_command_to_MP3_player(select_SD_card, 5); // check for the WiFi module:if (WiFi.status() ==WL_NO_MODULE) { Serial.println("Communication with WiFi module failed!"); myGLCD.print("Connection Failed!", 0, 8); while (true); } // attempt to connect to Wifi network:while (status !=WL_CONNECTED) { Serial.print("Attempting to connect to SSID:"); Serial.println(ssid); myGLCD.print("Waiting...", 0, 8); myGLCD.print("Attempting to", 0, 16); myGLCD.print("connect to", 0, 24); myGLCD.print("WiFi !!!", 0, 32); // Connect to WPA/WPA2 network. Change this line if using open or WEP network:status =WiFi.begin(ssid, pass); // wait 10 seconds for connection:delay(10000); } // Verify connection on both the serial monitor and Nokia 5110 Screen. Serial.println("Connected to wifi"); myGLCD.clrScr(); myGLCD.print("Connected to", 0, 8); myGLCD.print("WiFi!!!", 0, 16); delay(2000); myGLCD.clrScr();}void loop() { read_buttons(); change_menu_options(); interface(); if(TV ==true){ do{ myGLCD.invertText(true); myGLCD.print("A.Init Tracker", 0, 16); myGLCD.invertText(false); delay(100); if(OK ==HIGH){ myGLCD.clrScr(); Activated =true; while(Activated ==true){ // Connect to the web application named TV Series / Anime Release Date Tracker. Change '80' with '443' if you are using TheAmplituhedron as the host. if (client.connect(server, 80)) { Serial.println("connected to server"); // if you get a connection, report back via serial:myGLCD.print("Connected to", 0, 8); myGLCD.print("the server!!!", 0, 16); // Make an HTTP request:client.println("GET " + application + " HTTP/1.1"); //client.println("Host:www.theamplituhedron.com"); client.println("Host:192.168.1.22"); client.println("Connection:close"); client.println(); }else{ myGLCD.print("Connection", 0, 8); myGLCD.print("Error!!!", 0, 16); } delay(2000); // Wait 2 seconds after connection... // If there are incoming bytes available, get the response from the web application. String response =""; while (client.available()) { char c =client.read(); response +=c; } if(response !="" &&response.endsWith("%")){ // Split the response string by a pre-defined delimiter in a simple way. '%'(percentage) is defined as the delimiter in this project. int delimiter, delimiter_1, delimiter_2, delimiter_3, delimiter_4; delimiter =response.indexOf("%"); delimiter_1 =response.indexOf("%", delimiter + 1); delimiter_2 =response.indexOf("%", delimiter_1 +1); delimiter_3 =response.indexOf("%", delimiter_2 +1); delimiter_4 =response.indexOf("%", delimiter_3 +1); // Glean information as substrings. String Series_Name =response.substring(delimiter + 1, delimiter_1); String Season =response.substring(delimiter_1 + 1, delimiter_2); String Episode =response.substring(delimiter_2 + 1, delimiter_3); String Episode_Name =response.substring(delimiter_3 + 1, delimiter_4); // Print information. myGLCD.clrScr(); myGLCD.print(Series_Name, 0, 0); myGLCD.print(Season + " x " + Episode, 0, 16); myGLCD.print(Episode_Name, 0, 32); // Play the opening song of the released series / anime until ceased:if(Series_Name =="One Piece") { send_command_to_MP3_player(play_song_1, 6); adjustColor(255,0,0); } if(Series_Name =="My Hero Academia") { send_command_to_MP3_player(play_song_2, 6); adjustColor(0,255,0); } if(Series_Name =="Westworld") { send_command_to_MP3_player(play_song_3, 6); adjustColor(0,0,255); } if(Series_Name =="The Simpsons") { send_command_to_MP3_player(play_song_4, 6); adjustColor(255,255,0); } if(Series_Name =="The Late Late Show") { send_command_to_MP3_player(play_song_5, 6); adjustColor(80,0,80); } // Wait until the Exit button pressed... volatile boolean song =true; while(song ==true){ read_buttons(); if(Exit ==HIGH){ song =false; send_command_to_MP3_player(pause, 4); adjustColor(0,0,0); } } myGLCD.clrScr(); }else{ // Print information. myGLCD.clrScr(); myGLCD.print("No Released", 0, 0); myGLCD.print("Episode", 0, 16); myGLCD.print("Detected :(", 0, 32); delay(5000); // Wait 5 seconds to display information... myGLCD.clrScr(); } // Draw TV icon while counting to the new request... myGLCD.drawBitmap(8, 0, tv, 60, 48); delay(10 * 1000); // Wait until next request... myGLCD.clrScr(); // Exit. read_buttons(); if(Exit ==HIGH){ Activated =false; myGLCD.clrScr(); } } } }while(TV ==false); } if(Music ==true){ do{ myGLCD.invertText(true); myGLCD.print("B.MP3 Player", 0, 24); myGLCD.invertText(false); delay(100); if(OK ==HIGH){ myGLCD.clrScr(); Activated =true; while(Activated ==true){ read_buttons(); // Draw music player icon. myGLCD.drawBitmap(8, 0, music, 60, 48); // MP3 Player:if(Right ==true) send_command_to_MP3_player(next_song, 4); if(Left ==true) send_command_to_MP3_player(previous_song, 4); if(OK ==true) send_command_to_MP3_player(pause, 4); // Exit. if(Exit ==HIGH){ Activated =false; myGLCD.clrScr(); send_command_to_MP3_player(pause, 4); } } } }while(Music ==false); } if(Sleep ==true){ do{ myGLCD.invertText(true); myGLCD.print("C.Sleep", 0, 32); myGLCD.invertText(false); delay(100); if(OK ==HIGH){ // Activate the sleep mode in 10 seconds. myGLCD.clrScr(); myGLCD.print("Entering", CENTER, 0); myGLCD.print("Sleep Mode", CENTER, 8); myGLCD.print("in", CENTER, 16); myGLCD.print("Seconds", CENTER, 40); // Print remaining seconds. myGLCD.setFont(MediumNumbers); for (int s=10; s>=0; s--){ myGLCD.printNumI(s, CENTER, 24, 2, '0'); delay(1000); } myGLCD.enableSleep(); Activated =true; while(Activated ==true){ // Color Pattern:adjustColor(255,0,0); delay(500); adjustColor(0,255,0); delay(500); adjustColor(0,0,255); delay(500); adjustColor(255,255,0); delay(500); adjustColor(80,0,80); delay(500); // Exit. read_buttons(); if(Exit ==HIGH){ Activated =false; myGLCD.clrScr(); myGLCD.disableSleep(); myGLCD.setFont(SmallFont); adjustColor(0,0,0); } } } }while(Sleep ==false); }}void read_buttons(){ // Read the control buttons:Right =digitalRead(B_Right); OK =digitalRead(B_OK); Left =digitalRead(B_Left); Exit =digitalRead(B_Exit);}void send_command_to_MP3_player(int8_t command[], int len){ Serial.print("\nMP3 Command => "); for(int i=0;i 3) selected =1; delay(100); // Depending on the selected option number, change boolean status. switch(selected){ case 1:TV =true; Music =false; Sleep =false;壊す; case 2:TV =false; Music =true; Sleep =false;壊す; case 3:TV =false; Music =false; Sleep =true;壊す; }}void adjustColor(int red, int green, int blue){ red =255 - red; green =255 - green; blue =255 - blue; analogWrite(redPin, red); analogWrite(greenPin, green); analogWrite(bluePin, blue);}
index.phpPHP
 0) ? true :false;}function createTable($table_name, $conn){ if(!checkDatabase($table_name, $conn)){ $sql ="CREATE TABLE `$table_name`( id int(11) AUTO_INCREMENT PRIMARY KEY NOT NULL, series_name varchar(255) NOT NULL, tv_id varchar(255) NOT NULL, status varchar(255) NOT NULL );"; if(mysqli_query($conn, $sql)){ echo "Database Table Created!"; }else{ echo "Error!"; } }else{ echo "Database Table Found!"; }}createTable("series", $conn_database);?>
query.phpPHP
conn =$conn; $this->table_name =$table_name; } private function check_ep_release_date($API_ID, $series_name, $status){ $date =date("Y-m-d"); $URL =self::ROOT.$API_ID.self::PATH.$date; if($get_content =json_decode(file_get_contents((String)$URL))){ if($status !="Released"){ echo "%".$series_name."%".$get_content[0]->season."%".$get_content[0]->number."%".$get_content[0]->name."%"; $sql ="UPDATE `$this->table_name` SET `status`='Released' WHERE series_name='$series_name'"; mysqli_query($this->conn, $sql); } }else{ if($status !="Pending"){ $sql ="UPDATE `$this->table_name` SET `status`='Pending' WHERE series_name='$series_name'"; mysqli_query($this->conn, $sql); } } } public function track_db_entries(){ $sql ="SELECT * FROM `$this->table_name` ORDER BY `id` DESC"; if($result =mysqli_query($this->conn, $sql)){ $check =mysqli_num_rows($result); if($check> 0){ while($row =mysqli_fetch_assoc($result)){ $this->check_ep_release_date($row['tv_id'], $row['series_name'], $row['status']); } }else{ echo "No Entry Found!"; } }else{ echo "No Database Found!"; } }}// Define the connection settings and the table name.$conn_database =mysqli_connect("localhost", "root", "bot", "tvseries");$table ="series";// Define the object to check release date for each registered series / anime.$q =new query();$q->define_user($conn_database, $table);$q->track_db_entries();?>

カスタムパーツとエンクロージャー

gerber_ycEfXzZq6h.zip tv-series-anime-episode-tracker_gCfN0nFiA8.zip opening_songs_y2LCEw79tg.zip tv_Iz2isO8nGI.c music_SA2xR86cZw.c

回路図


製造プロセス

  1. シャフナーが新シリーズのRFIフィルターを発表
  2. ラズベリーパイユニバーサルリモコン
  3. ラズベリーパイのスライス
  4. サイクルチェイサー
  5. ラズベリーパイ泥棒検出器
  6. ラズベリーパイ温度センサー
  7. RASPBERRY PI HOME AUTOMATION
  8. 新しいRASPBERRYPI3モデルB +機能と購入
  9. ラズベリーパイCDボックスロボット
  10. RaspiRobot Board V2
  11. ローバー