鐘犬小叭

tags: 創新原型實作

作品介紹

賴床到鬧鐘叫不起來的時候,就交給鐘犬小叭吵你起來吧。保證你在關掉鬧鐘前,睡意全消。
簡報連結

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

作品進度

2022.05.22

上傳影片與作品專頁的 deadline
由於過程中經常因為馬達轉速及出力不足,不得已只好重新製作(超傷心的),當日下午買了PP瓦楞板、快乾、鹼性電池,為了保留原本的設計,新的小叭有很多地方來自原型機,由0.3及0.5mm的PP瓦楞紙板製作,由於非常時期,僅搭載兩座1.5v電池、3座9v電池,非常的耗能。

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

(晚上開了燈之後,多了小夜燈的功能)

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

為了發便拆解維修,小叭的身體跟底座可分離,雖然沒法像雷切那樣工整好看,但多了繽紛的顏色
Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

為了後續方便改造電源,所有的電池僅用膠帶固定,原本想用行動電源供電給Arduino板,但實在太重而改成用dc接頭及9v電池,除此之外,由於原本的L9110s問題有點多,一氣之下騎較踏車衝去金華電子買L298n驅動版,其好處是能夠方便外接9~12v電源,接線方面,N1~N4接9、10、12、11,ENA、ENB(可控制馬達轉速)接有PWN之pin腳。
L9110S馬達驅動板範例
L298N馬達驅動模組介紹

2022.05.17

(預計: 跟昨天一樣,雷切零件 & 組裝完成)
(實際: 看似完成了 80% ?)

繼昨日進度停滯後,今天中午前就切完木板了,也完成部分黏接。我們使用木工膠和強力膠黏接,後來由於強力膠乾的快又方便,加上不太需要強度,便多使用強力膠。

下午實作中心關門後,便到一樓的桌子區繼續製作。

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

(剛組裝完的小叭臉部)

好在昨天已經完成馬達部分,這次就把他們黏上去就好 (雖然也不是很好黏。)

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

外觀上看起來還不錯!

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

不過裡面的線還沒佈好,咬合用馬達跟電力供應都還沒確定。所以在同一側的上下各留下一片沒黏死的板子,製作、維修用。

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

中途還遇到板子連接處量錯、臨時需要更動,但沒有切割工具,只好用筆刀來切密集板,雖然技術性不高,但實在很耗時呢

2022.05.16

(預計: 雷切完零件 & 組裝測試)
(實際: 完成馬達測試)

今天在上課時間到實作中心,原定要雷切好外殼,開始組裝。沒想到雷切使用的時間比想像長,沒有排到,便認真測試馬達。
然而一直都很配合的馬達驅動板的燈竟然不亮! 幾經測試後,我們推測是驅動板壞了,於是到隔壁尋找替代的驅動板,最後找到 l298n (下圖綠色板子)。

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

雖然查到它的輸入格式 (兩邊腳位直接代表輸入高/低電位,速度另外控制),卻遲遲無法成功。

巧合下換了一條線來測試原驅動板,沒想到竟然亮燈了! 我們實在沒料到,原本測試過好端端的線,用一用會壞掉。總之,虛度了一兩個小時 - 但學到教訓 : 出問題先懷疑線! (大誤)

2022.05.13

這周進度為程式碼編寫、接線測試及雷切繪圖,在接線的過程中,忘了準備螺絲起子,無法將馬達及驅動版良好的連接,所以決定先暫停等下禮拜解決。

#include <avr/sleep.h>

/* arrangements */
/* motor, A (right) and B (left) */
int ma_pin = (int)8;
int ma_speed = (int)9;
int mb_pin = (int)10; // mb 數值再看你接幾號腳位改
int mb_speed = (int)11;
/* photoresistance */
// ref: http://www.gammon.com.au/forum/?id=11497
int pr_interrupt = (int)2; //or 3, Uno 板 interrupt 腳位

/* parameters for movements */
int mtspeed = (int)(150); // 跑的速度
int runtime = 30; // 幾毫秒切換一次動作模式
/* other variables */
int turns = 10; //目前先這樣,讓它能停下來


// function for interupt - wake up by light!
void wake() {
  sleep_disable(); //關掉 sleep
  noInterrupts(); //關掉 interrupt
}

void setup() {
  //light R init
  digitalWrite(pr_interrupt, LOW);
  //motor init
  pinMode(ma_pin, OUTPUT);
  pinMode(ma_speed, OUTPUT);
  pinMode(mb_pin, OUTPUT);
  pinMode(mb_speed, OUTPUT);
  //sleep init
  set_sleep_mode (SLEEP_MODE_PWR_DOWN);
  sleep_enable();
  noInterrupts ();
  attachInterrupt(digitalPinToInterrupt(pr_interrupt), wake, RISING);
  interrupts ();
  sleep_cpu (); //sleep until there's light
}

void loop() {
  // wake up from wake()
  randomwalk(); //按亂數決定方向,目前前後左右機率 = 2:1:1:1
  turns--;
  if (!turns) exit(0); //小叭停下來吧
}

// functions controlling the direction
void randomwalk(){
  long mode = random(0, 1); //產生隨機亂數
  if (mode <= 0.4) forward();
  else if (mode <= 0.6) right();
  else if (mode <= 0.8) left();
  else backward();
}
void right() {
  digitalWrite(ma_pin, HIGH);
  digitalWrite(mb_pin, HIGH);
  analogWrite(ma_speed, mtspeed); //右邊動
  analogWrite(mb_speed, 0); //左邊不動
  delay(runtime);
}
void left() {
  digitalWrite(ma_pin, HIGH);
  digitalWrite(mb_pin, HIGH);
  analogWrite(ma_speed, 0); //右邊不動
  analogWrite(mb_speed, mtspeed); //左邊動
  delay(runtime);
}
void forward() {
  digitalWrite(ma_pin, HIGH);
  digitalWrite(mb_pin, HIGH);
  analogWrite(ma_speed, mtspeed); //右邊動
  analogWrite(mb_speed, mtspeed); //左邊動
  delay(runtime);
}
void backward() {
  digitalWrite(ma_pin, LOW); //反轉
  digitalWrite(mb_pin, LOW); //反轉
  analogWrite(ma_speed, mtspeed);
  analogWrite(mb_speed, mtspeed);
  delay(runtime);
}
void stop(){
  // empty
}

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

2022.05.06

討論出小叭的基本型態跟所需零件。