最終課題-Project note


目覚まし時計⏰


共同制作者

   タッカンマリ
   muku

使用した "FabLab" の機械


   ・3Dプリンター





使用したモノ


・Arduino Uno
・USBケーブル
・ブレッドボード
・リアルタイムクロックモジュール (DS1302)
・マザーボード内部ミニスピーカー (DR-YM-038)
・ジャンパーワイヤー (Male-to-Female)
・ジャンパーワイヤー (Male-to-Male)
・パソコン (MacBook Air)
・リチウムコイン電池 (CR 2032)
・USBハブ-Type-C (U3HC-A430BXBK)
・目覚まし時計ケース (3Dプリンターで制作)


プロジェクトマネジメント

(プロセスメモープロセス・必要なモノやステップ・やるべきこと)


・・・・・・・・・・・・・・・・・・・・
■ は考えないといけないこと、疑問等
● は具体的にやること
→ はやったこと
・・・・・・・・・・・・・・・・・・・・


■ 現役大学生に寄り添ったものを作りたい!


■ 現役大学生は何が不便だろうか。(やはり朝、?)
● 現役の大学生にアンケートをとる。
● このサービスを作る上で必要なものを買う。





→ マザーボード内部ミニスピーカー (DR-YM-038)の購入
→ リアルタイムクロックモジュール (DS1302)の購入
→ ジャンプワイヤーの調達
→ 公式LINEアカウントを開設


● 電車の交通情報のAPIを取得するために、申請をする。

【6月25日】

→ 電車の運行時刻のAPIwo使用しようとして、コードまで取得しましたが、上手く情報を読み取ることができず、失敗。
■ APIが使えないため、最初に考えていたサービスは期限内での完成が難しい。
■ 他の案を考える。(目覚まし時計はどうだろうか。)






【7月1日】

→ 目覚まし時計のArduinoコード完成。


  1. #include <ThreeWire.h>
  2. #include <RtcDS1302.h>
  3. const int IO = 4; // DAT
  4. const int SCLK = 5; // CLK
  5. const int CE = 2; // RST
  6. const int buzzerPin = 8; // ピエゾブザーの接続ピン
  7. ThreeWire myWire(4, 5, 2); // IO, SCLK, CE
  8. RtcDS1302<ThreeWire> Rtc(myWire);
  9. void setup() {
  10.   pinMode(buzzerPin, OUTPUT); // ピエゾブザーのピンを出力に設定
  11.   Serial.begin(9600);
  12.   Serial.print("compiled: ");
  13.   Serial.print(__DATE__);
  14.   Serial.println(__TIME__);
  15.   Rtc.Begin();
  16.   RtcDateTime compiled = RtcDateTime(__DATE__, __TIME__);
  17.   printDateTime(compiled);
  18.   Serial.println();
  19.   if (!Rtc.IsDateTimeValid()) {
  20.     Serial.println("RTC lost confidence in the DateTime!");
  21.     Rtc.SetDateTime(compiled);
  22.   }
  23.   if (Rtc.GetIsWriteProtected()) {
  24.     Serial.println("RTC was write protected, enabling writing now");
  25.     Rtc.SetIsWriteProtected(false);
  26.   }
  27.   if (!Rtc.GetIsRunning()) {
  28.     Serial.println("RTC was not actively running, starting now");
  29.     Rtc.SetIsRunning(true);
  30.   }
  31.   RtcDateTime now = Rtc.GetDateTime();
  32.   if (now < compiled) {
  33.     Serial.println("RTC is older than compile time! (Updating DateTime)");
  34.     Rtc.SetDateTime(compiled);
  35.   } else if (now > compiled) {
  36.     Serial.println("RTC is newer than compile time. (this is expected)");
  37.   } else if (now == compiled) {
  38.     Serial.println("RTC is the same as compile time! (not expected but all is fine)");
  39.   }
  40. }
  41. void loop() {
  42.   RtcDateTime now = Rtc.GetDateTime();
  43.   printDateTime(now);
  44.   Serial.println();
  45.   if (!now.IsValid()) {
  46.     Serial.println("RTC lost confidence in the DateTime!");
  47.   }
  48.   // 設定時刻 (例: 12:00:00)
  49.   int alarmHour = 22;
  50.   int alarmMinute = 13;
  51.   int alarmSecond = 0;
  52.   if (now.Hour() == alarmHour && now.Minute() == alarmMinute && now.Second() == alarmSecond) {
  53.     // 5秒間音を鳴らす
  54.     tone(buzzerPin, 2000, 5000); // 2kHzの音を5秒間鳴らす
  55.   }
  56.   delay(1000); // one second
  57. }
  58. #define countof(a) (sizeof(a) / sizeof(a[0]))
  59. void printDateTime(const RtcDateTime& dt) {
  60.   char datestring[20];
  61.   snprintf_P(datestring,
  62.              countof(datestring),
  63.              PSTR("%02u/%02u/%04u %02u:%02u:%02u"),
  64.              dt.Month(),
  65.              dt.Day(),
  66.              dt.Year(),
  67.              dt.Hour(),
  68.              dt.Minute(),
  69.              dt.Second());
  70.   Serial.print(datestring);
  71. }





→ 3Dプリンターで外側の入れ物を作成。







発表資料





紹介動画