Introduction: Arduino Medicine Alarm

This project is about how to make a alarm that will remind you to eat medicine.

這個報告是要做出一個可以提醒你要吃藥喇叭鬧鐘。

Step 1: Prepare Materials 準備材料

Materials:

1. Arduino Leonardo x1

2. Breadboard x1 (麵包板)

3. Arduino speaker with wires x1(帶線喇叭)

4. Supersonic sensor x1 (超音波感測器)

5. USB cable (connecting Arduino Leonardo and computer) x1 (USB杜邦電源線)

6. Several breadboard cables (about 10) (數個麵包板連接線,大概十個)

7. 6 Cardboards (厚紙板)

1. (21cm X 15cm)

2. (21cm X 15cm)

3. (21cm X 15cm)

4. (21cm X 15cm)

5. (15cm X 15cm)

6. (15cm X 15cm)

8. 6 colored-papers (色紙)

1. (21cm X 15cm)

2. (21cm X 15cm)

3. (21cm X 15cm)

4. (21cm X 15cm)

5. (15cm X 15cm)

6. (15cm X 15cm)

9. 1 Medicine box (藥盒)

10. Hot-melt adhesive gun/ Hot-melt adhesive x1 (熱熔膠槍/熱熔膠)

11. Utility knife x1 (美工刀)

12. Ruler x1 (尺)

Remember to leave a hole on the cardboards and colored-papers for Supersonic sensor(超音波感測器)and USB cable (connecting Arduino Leonardo and computer)(USB杜邦電源線) 記得厚紙板和色紙都要剪出超音波感測器和USB連接線的洞

Step 2: Install and Connect Circuits

Follow the picture to install the circuits.

根據圖片來連接電路。

Step 3: Making Outward Appearances

1. Use Hot-melt adhesive gun/ Hot-melt adhesive(熱熔膠槍/熱熔膠)and cardboards to create a box. So that we can put Arduino inside the box.

用厚紙板做做一個箱子,使用熱熔槍來將厚紙板黏起來。把Adruino 放在裡面。

2. Stick the colored-papers on the cardboards for decoration.

把色紙黏在厚紙板上進行裝飾,就不會太醜。

*Remember to leave a hole on the cardboards and colored-papers for Supersonic sensor(超音波感測器)and USB cable (connecting Arduino Leonardo and computer)(USB杜邦電源線)
記得厚紙板和色紙都要剪出超音波感測器和USB連接線的洞

3. Last, stick the medicine box on the top of the cardboard box.

將藥盒黏在厚紙板盒的上面

Step 4: Write the Program for Arduino

This is the program for this project.

這個報告的程式。

iint _1_i;

int ardublockUltrasonicSensorCodeAutoGeneratedReturnCM(int trigPin, int echoPin)

{

long duration;

pinMode(trigPin, OUTPUT);

pinMode(echoPin, INPUT);

digitalWrite(trigPin, LOW);

delayMicroseconds(2);

digitalWrite(trigPin, HIGH);

delayMicroseconds(20);

digitalWrite(trigPin, LOW);

duration = pulseIn(echoPin, HIGH);

duration = duration / 59;

if ((duration < 2) || (duration > 300)) return false;

return duration;

}

void setup()

{

digitalWrite( 6 , LOW );

}

void loop()

{

for (_1_i=1 ; _1_i<= ( 2.0 ) ; ++_1_i )

{

if (( ( 2.0 ) > ( ardublockUltrasonicSensorCodeAutoGeneratedReturnCM( 6 , 7 ) ) ))

{

noTone(11);

}

else

{

delay( 500.0 );

tone(11, 1318.0, 950.0);

delay( 350.0 );

tone(11, 1245.0, 950.0);

delay( 350.0 );

tone(11, 1318.0, 950.0);

delay( 350.0 );

tone(11, 1245.0, 950.0);

delay( 350.0 );

tone(11, 1318.0, 950.0);

delay( 350.0 );

tone(11, 988.0, 950.0);

delay( 350.0 );

tone(11, 1175.0, 950.0);

delay( 350.0 );

tone(11, 1046.0, 950.0);

delay( 350.0 );

tone(11, 880.0, 950.0);

delay( 700.0 );

tone(11, 523.0, 950.0);

delay( 350.0 );

tone(11, 659.0, 950.0);

delay( 350.0 );

tone(11, 880.0, 950.0);

delay( 350.0 );

tone(11, 988.0, 950.0);

delay( 700.0 );

tone(11, 659.0, 950.0);

delay( 350.0 );

tone(11, 831.0, 950.0);

delay( 350.0 );

tone(11, 988.0, 950.0);

delay( 350.0 );

tone(11, 1046.0, 950.0);

delay( 700.0 );

tone(11, 659.0, 950.0);

delay( 350.0 );

}

}

Step 5: Test It!

At last, connect Arduino and the computer and test if the it works properly.

做完後,將電路和電腦連接,就可以測是否有做好咯!