Crimping connectors isn’t my favorite job. But nicely braided cables with connectors make your projects so much cleaner! Definitely worth it.
seen from United States

seen from Malaysia
seen from United States

seen from South Korea
seen from United States
seen from United States

seen from China
seen from China
seen from Thailand
seen from Netherlands

seen from United States
seen from China
seen from United States
seen from Germany

seen from United States
seen from Canada
seen from United States
seen from Taiwan

seen from Netherlands
seen from Lebanon
Crimping connectors isn’t my favorite job. But nicely braided cables with connectors make your projects so much cleaner! Definitely worth it.
Raspberry PiにハードウェアWatchdogを設定してみましょう
Raspberry PiとRaspbian OSには、Watchdog Timer(ウォッチドッグタイマー、以下Watchdogと記します)と呼ばれる機構が入っています。これは、システムが動作していないと判断された時に、自動的にRaspberry PiがOS再起動をを行うというものです。
Raspbian Jessieより前のバージョンでは、Watchdogを設定するためにすでに確立したやり方があったようです。しかし、Raspbian Jessieになってからは、モジュールの名前が変わったりしたほか、Watchdogを有効にさせる方法も変わったりしていて、これというやり方がすぐには見つからないようです。Raspberry Piのフォーラムでもいくつか投稿があるようですが、その中で他の方法に比べてとてもシンプルな方法が投稿されていました。この投稿の内容をを実際に試したところ、うまく動作しましたのでこちらで紹介します。この方法の良いところは、追加でソフトウェアを入れる必要がないところです。設定ファイルの変更や作成だけでハードウェアWatchdogを実現できてしまいます!
本記事の前半は、CANDY Pi Lite(下の写真の基板です)に関係なくRaspberry Pi共通の話題としてWatchdogの設定方法を紹介します。また、後半はCANDY Pi Liteを利用される方向けに、Raspberry Piで簡単にハードウェアWatchdogをセットアップする方法を紹介します。
Watchdog設定方法
【対象となるOS】
これから紹介するWatchdogを有効化する方法は、Raspbian JessieとStretchのみ対応しています。それよりも古いOSでは動作しません。 なお、こちらの検証ではRaspbian Stretchを使いました。
【検証したハードウェア】
こちらの検証では、Raspberry Pi 3 Model Bを使っています。他の機種は試していませんが、Raspberry Piはどれも同じチップ(BCM2835/BCM2836)を使っていますから、Raspberry Pi Zeroなどでも動作するでしょう。
【具体的なやり方】
まず最初に、/boot/config.txtにWatchdogを有効にする設定を追加します。 エディターでファイルを開いて、以下の行を追加してください。
dtparam=watchdog=on
続いてWatchdogを動かすカーネルモジュールの設定を行います。 /etc/modprobe.d/bcm2835-wdt.confというパスにファイルを作成しましょう。 初めて設定するときはこのファイルは存在していませんので、新たに作成する必要があります。 このファイルは、特権ユーザーで作成しなければなりません(例えばsudo gedit /etc/modprobe.d/bcm2835-wdt.confのようにsudoが必要です)。
ファイルを作成したら、以下の1行を入力します。
options bcm2835_wdt heartbeat=14 nowayout=0
これは、14秒のハートビートをWatchdogが期待するという設定になります。14秒以内にハートビートが来ないときは、システムが異常であると判断するというものです。
最後に、systemdの設定を変更します。systemdは、そのハートビートを行う機能を持っています。ただ初期設定では無効になっていますのでこれを有効にします。
設定変更するファイルは/etc/systemd/system.confとなります。これもsudoを使うなど特権ユーザーで編集します。
エディターでファイルを開いたら、下記のようなコメントアウトされている設定を探しましょう。
#RuntimeWatchdogSec=0
これを以下のように変更します。
RuntimeWatchdogSec=14
これにより、systemdが14秒以内の間隔でハートビートを行うようになります。
変更して保存したら、準備は完了です。
【実際に動かしてみましょう】
設定を全て行ったら、Raspberry Piを再起動させましょう。再起動コマンドの代わりに電源OFF、電源ONでも大丈夫です。
再起動を行ったらまずはWatchdogが有効になっているかみてみましょう。ターミナルを開いて次のコマンドを実行してください。
dmesg | grep bcm2835-wdt
これを実行して以下のように表示されていればOKです。左側のカッコ内の数字は必ずしも同じとは限りませんので数字違いについては気にしないでください。 ただ、もし何も出て来ないときは、うまく設定できていないので、もう一度上記のやり方を見直してみましょう。
[ 0.722030] bcm2835-wdt 3f100000.watchdog: Broadcom BCM2835 watchdog timer
それでは、実際にWatchdogによる再起動を発動させてみましょう。 ターミナルに以下のコマンドを入力して実行してみてください。
⚠️きけん・ちゅうい⚠️ Watchdogを設定せずに行うと、電源を落とす以外に元に戻す方法はなくなります‼️
:(){ :|:& };:
この顔文字のようなコマンドは、フォークボム(フォーク爆弾)と呼ばれるもので、システムの内部で新しいプロセスをどんどん増殖させる極めて危険なコマンドです。 通常はこのようなコマンドを使うことはありませんが、今回はシステム上の問題を引き起こすために使用します。
さて、これを入力すると徐々にシステムの動作が遅くなっていきます。最終的にコマンド入力に反応しなくなり、約2分程度経過すると再起動されます(再起動までの時間は、システムの負荷の状況によるので、負担の大きいシステム稼働状況ではもっと早く再起動するかもしれません)。
なぜ14秒と指定したのに2分も再起動までかかるのでしょうか? それは、このフォークボムが行われている間も、システム自体はなんとか動き続けているためです。フォークボムによって、いよいよリソースがなくなって14秒以内にハートビートができなくなるという瞬間になるまで、約2分の時間がかかっているのです。
【Watchdogを無効にするには?】
もし、なんらかの理由でWatchdogを再び無効にしたいときはどうすれば良いでしょうか。
この場合は、単純に/boot/config.txtにおいてonとした箇所をoffにするだけで良いです。/bootの下にあるファイルなので直接SDカードリーダーからPCなどでファイルを変更することもできますね。
dtparam=watchdog=off
設定を変更した後は再起動してください。
【前半まとめ】
以上が、Raspberry Piを利用したハードウェアWatchdogの設定有効化、無効化のやり方です。 以前のRaspbianのバージョンでは、Watchdogを使うために別のソフトウェアをインストールしなければならなかったのですが、このように設定を変更したり作成したりするだけで簡単にハードウェアWatchdog機能を使うことができるようになっています。
RaspberryPiを長期間、ずっと動かし続けるような運用を考えている方にとってはとても強力な機能になるでしょう。
続いて後半編です。
CANDY Pi Liteのセットアップ時にWatchdogを設定してみましょう
ここからは、CANDY Pi Liteをお使いの場合にWatchdogを簡単に設定できるようにする方法を紹介します。
CANDY Pi Liteをお使いの場合、専用のソフトウェアcandy-pi-liteサービスを利用します。バージョン1.6.0から、このソフトウェアをインストールする時に、Watchdogの設定も同時に行えるようになりました。
今回はこのバージョン1.6.0のソフトウェアをインストールして、同時にWatchdogの設定も行ってみましょう。
【インストールしてみましょう】
CANDY Pi LiteをRaspberry Piに取り付けて電源をいれてみてください。起動したら、ログインしてターミナルを開くか、SSHでログインしましょう。
もしすでに以前のバージョンのcandy-pi-liteサービスをいれている場合は、最初にアンインストールします。 初めてインストールする方は、この手順は不要です。
candy-pi-liteのアンインストール
sudo /opt/candy-line/candy-pi-lite/uninstall.sh
アンインストールしたら一旦再起動しましょう。
sudo reboot
candy-pi-liteのインストール
それでは、最新のcandy-pi-liteサービスを入れてみましょう。
curl -sL https://git.io/v7bXx | sudo ENABLE_WATCHDOG=1 bash
これを実行すると、、、
Collecting candy-board-cli Installing collected packages: candy-board-cli Successfully installed candy-board-cli-2.0.0 Collecting candy-board-qws (途中省略) [INFO] Configuring ufw... Firewall stopped and disabled on system startup Skipping adding existing rule Skipping adding existing rule (v6) Skipping adding existing rule Skipping adding existing rule (v6) Skipping adding existing rule Skipping adding existing rule (v6) Firewall is active and enabled on system startup [INFO] Configuring SC16IS7xx... [INFO] SC16IS7xx configuration done [INFO] Configuring Hardware Watchdog... [INFO] Hardware Watchdog configuration done [ALERT] *** Please reboot the system (enter 'sudo reboot') ***
こんな風に出てきます。最後に再起動を促されますから、再起動を行いましょう。
sudo reboot
Watchdog機能が有効かどうかをチェック!
先ほど記したように、以下のコマンドで有効になっているかどうかを調べることができます。 再起動してターミナルへ入ることができたら、以下のコマンドを実行してみましょう。
dmesg | grep bcm2835-wdt
以下のようなメッセージは見つけられますか?
[ 0.722030] bcm2835-wdt 3f100000.watchdog: Broadcom BCM2835 watchdog timer
見つかれば成功です!
これで、3GやLTEを付けっ放しにしても、不測の事態がRaspberryPiで起きて止まったままになることを避けられるようになります。 SDカードのデータがおかしくなってしまったり、電源が落ちてしまったらどうしようもないんですけど、とは言ってもこれでRaspberryPiがだいぶ頼りになる存在になりますよ!
Ground control to makers?... ideas come and go. What you do with your idea is important. Stop looking to the big payoff or super stars. Life is about you and what you can offer to others. So next time you are saying how come that never happens to me.... it's because you are not then and it's as easy as that. I'm not anything thing to you be somebody for others and there is no what you can know this. Start today with making your bed, then looking in the mirror and say tom95076 you are right. I am ugly...(lol) wait I'm just checking to see if you read this far down the page... look in the mirror and say. I'm ok with you. Now what can I do that would help others. Don't over do it dummy! Trying calling someone and just listening or email to others that you are just wishing the hope and happiness in these hard times. You don't have to be a celebrity to be normal to others. Social media distorts our views of each other. Just be human, just be you today. #satellite #windowsillsatellites #arduinoprojects #raspberypi #maker #makers #made #maked #inspire #instagood #picoftheday #tincan #solar #electical #engineering #code #code #programming #iot #stem #atmel #intel #stem #learning #athome #stayshelterinpkace #2020 https://www.instagram.com/p/B_IB1q-j4UL/?igshid=1dl5dj6bl4inc
The #ionosphere. Shoot!. I left my #topRamon in the #microwave again. (Static over the com)let it go Hendrix.. We need you to focus on getting off Mother Earth 🌏. I had Devin pack extras this time. (Static..long pause) Jessi!! Do you copy???😳 where are they.. this #raspberypi radar is has lost the #gpio setttings we are flying blind until we pull away from the earths gravity.. hey!? It that a john Mayer song?...(static..crackled noise) baby! I'm just now inverting the ship. We are #coding the coordinates into the #arduino box. Next time remind me to have #Streamerj add more comments into the interval functions. (Static.. ) "cut the chatter red leader" (static) #moth did you just use a reference from #star wars....you better lookout. Some lawyer might be listen to the radio looking for copyright infringements..(static) will you guys quit fooling around.. we have to hit the #hyperloop in 2 minutes. Lock-in and contact the others waiting.. we are almost clear of the gravitational pull.... . . #Sciencefiction #syfy #scene #action #space #stories #scifi #journey #instapicture #love #advneture #sfx #fx #differentworld https://www.instagram.com/p/BvwSLBonKN0/?utm_source=ig_tumblr_share&igshid=ondz5oyjy5j4
ご注意 💡最新のバージョンが出ている場合がありますので、アップデート情報の一覧から一番新しいバージョンをご確認の上ダウンロードしてください CANDY Pi Lite専用 Raspbian Stretch Lite OSイメージ v6.0.1をリリースしました。本バージョンでは、CANDY Pi Lite ボード用ソフトウェア v6.5.0、CANDY RED v8.2.2をご利用いただけます。 以下の2種類のファイルがあります。用途に応じてご利用いただけます。 ☝ダウンロードしてから動かすまでの一連の流れについて、簡単にブログ記事で紹介しています。ぜひご覧下さい。 日本語版イメージファイルのダウンロード(477MB) US英語版イメージファイルのダウンロード(477MB) ご注意)上記いずれもデスクトップ環境はインストールされていません。 日本語版について 日本語版では、日本語言語設定、日本語106キーボードレイアウト、日本標準時が設定されています。 US英語版について US英語版では、US英語言語設定、USキーボードレイアウト、UTCタ...
CANDY Pi Lite専用 Raspbian OSイメージをリリースしました。
CANDY REDにていくつかのプリインストールノードが出現しない問題を修正しました。
The #bot. (Static over the com). I told you guys. Look... it's just up ahead. That drone can't keep its eyes open. Let me handle the talking. He and I go way back... Once inside, don't make a move without me. We have to upload the #raspberypi code to unlock the load lock on that ship. Hendtrix and Moth are waiting... lets go. #sci-fi #syfy #sciencefiction I just is what I awoke to. It not my fault. Blame it on Saturday morning cartoons when I was a kid. Go be you and help others today. Don't ask for a rewards.. we know this will come later in our lives in other forms. #innovate and create your future #makers. No one will hand you their hard work. You have to build your own foundation to stand on. 🙌🏻 https://www.instagram.com/p/BqxDM2MnBg1/?utm_source=ig_tumblr_share&igshid=qtt15yjj79wl
RaspberryPi awesome list
Nowy adapter I2C do LCD
W naszej ofercie pojawił się nowy adapter I2C do wyświetlaczy znakowych opartych o HD44780. Korzystna cena i wygoda w podłączeniu do Arduino czy Raspberry :)