自由軟體-Arduino互動裝置的基本知識與實作

應用:

空氣汚染感測

水質感測

厠所抽煙感測

游泳池更衣室使用時間感測

社區魚菜共生水質變化監測,馬達控制,光線控制

Youtube 上的範例

用Arduino 產生音樂

Arduino Air Drums

https://www.youtube.com/watch?v=jjvy_jzGlAQ

Arduino Gitar

https://www.youtube.com/watch?v=xkrGyFWPb5o

Arduino: how to build an electronic MIDI xylophone

https://www.youtube.com/watch?v=92VIEDtQKVI

4051 電路怎麼接(網路上找找看)

Arduino: how to build an electronic MIDI xylophone

https://www.youtube.com/watch?v=Ttm62RBdOuo

Robotic Drums

https://www.youtube.com/watch?v=uqecHPnvb6c

穿戴科技

CRAFT Video: LilyPad Arduino 101

https://www.youtube.com/watch?v=Yj639_ez6TM

Lilypad Arduino & Heartbeat from Pulse Sensor

https://www.youtube.com/watch?v=Tt649mcmi5Y

LilyPad Arduino Sensor Mat

https://www.youtube.com/watch?v=h84Y3rNPm2Y

Beating Heart Headband

https://www.youtube.com/watch?v=gbUVIZi9aLo

How-To: The Lonely Christmas Tree

https://www.youtube.com/watch?v=2FnnwmqvJKY

CRAFT Video: LilyPad Arduino Bike Patch

https://www.youtube.com/watch?v=0cRKdzIhbZM

Arduino High Speed Photography Trigger

https://www.youtube.com/watch?v=R8_dAgaBBdI

Arduino Project: Motion Sensor Camera

https://www.youtube.com/watch?v=ZkN-V2xBHrc

Arduino Controlled “Turntable” || Arduino + Hall Effect Sensor + “turntable”

https://www.youtube.com/watch?v=ib1IFEZxN04

ARDUINO WIRELESS HOME SECURITY SYSTEM

https://www.youtube.com/watch?v=VJaL1Nfm7PQ

Arduino Home Security System

https://www.youtube.com/watch?v=dRCnccv_dVE

Fish Tank with LARGE Temperature Gauge. Using Arduino, Servo and DS18B20 Digital Temp Probe

https://www.youtube.com/watch?v=oMyrRUObznI

Arduino controlled Aquarium

https://www.youtube.com/watch?v=9XExALUVDWA

Arduino Greenhouse mrk 2(科技農夫)

https://www.youtube.com/watch?v=qmSyfodR7E8

Weekend Projects – Potted Plant Protector

https://www.youtube.com/watch?v=B8F44CyJRRA

講師投影片在臉書的社團(IOT MAKER 2015_07_24)

rongfuh.day@gmail.com


接電路時把USB或電源拔掉(否則電腦USB可能會壞掉)。

ARDUINO UNO版子一片 700多左右

露天一片(非原廠)DCDUINO 等等 要另外裝驅動程式(約250-300)




https://www.facebook.com/groups/677123242418715/677136662417373/?notif_t=group_activity

實驗1

基本電路板(LED燈實驗)

驅動程式若無法自動找到,請GOOGLE 下載相關的型號(例如 VISDUNO)

ARDUINO 程式

Setup() :初始設定

Loop()迴圈

ICSHOP 可購買 ARDUINO 及感測器模塊

Sparkfun 有賣元件(國外)

程式一

void setup() {

// put your setup code here, to run once:

Serial.begin(9600);

}

void loop() {

// put your main code here, to run repeatedly:

Serial.write(“hello!! #13”);

}

程式二

int ledPin = 13; // LED connected to digital pin 13

void setup()

{

pinMode(ledPin, OUTPUT); // sets the digital pin as output

}

void loop()

{

digitalWrite(ledPin, HIGH); // sets the LED on

delay(1000); // waits for a second

digitalWrite(ledPin, LOW); // sets the LED off

delay(1000); // waits for a second

}

程式二 LED控制

LED燈接在GND和13

int ledPin = 13; // LED connected to digital pin 13

void setup()

{

pinMode(ledPin, OUTPUT); // sets the digital pin as output

}

void loop()

{

digitalWrite(ledPin, HIGH); // sets the LED on

delay(100); // waits for a second

digitalWrite(ledPin, LOW); // sets the LED off

delay(100); // waits for a second

}

程式三

int pininput =7; // LED connected to digital pin 13

void setup()

{

Serial.begin(9600);

pinMode(pininput, INPUT); // sets the digital pin as input

}

int val;

void loop()

{

val=digitalRead(pininput);

Serial.println(val);

delay(250);

}

一般接法


會有殘電

改良接法


(按下1,放掉0)

上位電阻接法


按下0,放掉1

讀取可變電阻值


程式

void setup()

{

Serial.begin(9600);

}

int val=0;

void loop()

{

val=analogRead(A0);

Serial.println(val);

delay(250);

}

換光敏電阻

電路圖


程式如上圖

調整LED燈光

int ledPin = 9; // LED connected to digital pin 9

int val = 0; // variable to store the read value

void setup()

{

pinMode(ledPin, OUTPUT); // sets the pin as output

}

void loop()

{

analogWrite(ledPin, 100); // analogRead values go from 0 to 1023, analogWrite values from 0 to 255

}

馬達控制


程式碼

#include <Servo.h>

Servo myservo; //setup servo

void setup()

{

myservo.attach(9);

}

void loop()

{

//角度=0~180度

myservo.write(80); //傳入90度

delay(20);

}

溫溼度控制

  1. 下載函式庫
  2. 使用範例程式
跳至工具列