PIDrone Documentation - YuKyungKim/GitTest02 GitHub Wiki

PIDrone

Overview

Raspberry-PI + Drone = PIDrone
Drone + Linux = PIDrone

Superman์€ linux ๊ธฐ๋ฐ˜ Drone OS์ด๋‹ค.

Raspberry pi์— Superman์„ ์˜ฌ๋ฆฐ ๊ฒƒ์„ ์ฝ”์–ด๋กœ ํ•˜์—ฌ ๋งŒ๋“  Drone์„ PIDrone์ด๋ผ ํ•œ๋‹ค.

PIDrone์„ ๋งŒ๋“œ๋Š” ๋ฒ•์— ๋Œ€ํ•ด ๊ธฐ์ˆ ํ•œ ๋ฌธ์„œ์ด๋‹ค.

....

table of contents

  • ํ•„์š”ํ•œ ๋ถ€ํ’ˆ
  • Raspberry pi pin ์—ฐ๊ฒฐ
  • Sensor Board
  • N100mini๋ฅผ ์ด์šฉํ•ด Raspberry pi๋ฅผ ap๋กœ ๋งŒ๋“ค๊ธฐ

ํ•„์š”ํ•œ ๋ถ€ํ’ˆ

PIDrone์„ ๋งŒ๋“ค๊ธฐ ์œ„ํ•ด ํ•„์š”ํ•œ ๋ถ€ํ’ˆ์„ ์„ค๋ช…ํ•œ๋‹ค.

์ „์ฒด ๋“œ๋ก ์˜ ๋ฌด๊ฒŒ, ์ „์›์˜ ์ถœ๋ ฅ๊ณผ ์šฉ๋Ÿ‰, ๋ชจํ„ฐ์˜ ์ถœ๋ ฅ, ๋‚ ๊ฐœ์˜ ํฌ๊ธฐ, ์„ผ์„œ ๋“ฑ์„ ๋ชจ๋‘ ๊ณ ๋ คํ•˜์—ฌ ๊ฐ ๋ถ€ํ’ˆ์„ ์„ ํƒํ•ด์•ผํ•œ๋‹ค.

  • Raspberry pi
  • Mini-wireless lan dongle(ex. IPtime n100 mini)
  • ๋“œ๋ก  ํ”„๋ ˆ์ž„
  • Brushless Motor
  • ESC(Electric Speed Controller)
  • ๋“œ๋ก  ๋‚ ๊ฐœ 4๊ฐœ
  • Battery
  • ๊ฐ€์†๋„-์ž์ด๋กœ ์„ผ์„œ (ex. MPU-6050, MPU-9150)
  • ๊ธฐํƒ€ ์„ผ์„œ ๋“ฑ

Raspberry pi pin ์—ฐ๊ฒฐ

Sensor Board

N100mini๋ฅผ ์ด์šฉํ•ด Raspberry pi๋ฅผ ap๋กœ ๋งŒ๋“ค๊ธฐ

์ฐธ๊ณ 
http://www.rasplay.org/?p=6769
http://askubuntu.com/questions/180733/how-to-setup-an-access-point-mode-wi-fi-hotspot

PIDrone๊ณผ Contoller Android Application์€ Wifi๋ฅผ ํ†ตํ•ด ์†Œ์ผ“ ํ†ต์‹ ์„ ํ•œ๋‹ค.

PIDrone๊ณผ Android ๊ธฐ๊ธฐ๋ฅผ ๊ฐ™์€ AP(Access Point)์— ์—ฐ๊ฒฐํ•˜์—ฌ ์‚ฌ์šฉํ•˜๋Š” ๋ฐฉ๋ฒ•๋„ ์žˆ์œผ๋‚˜,
์‹ค์™ธ์—์„œ Drone์„ ์กฐ์ข…ํ•  ๊ฒฝ์šฐ ๋”ฐ๋กœ AP๋ฅผ ์ค€๋น„ํ•˜๊ธฐ ์–ด๋ ค์šด ๋ฉด์ด ๋‹ค์†Œ ์žˆ๊ธฐ ๋•Œ๋ฌธ์—
Wireless lan์„ ์ด์šฉํ•ด PIDrone ์ž์ฒด๋ฅผ AP๋กœ ๋งŒ๋“ค์–ด ๊ทธ AP๋กœ Android ๊ธฐ๊ธฐ๋ฅผ ์—ฐ๊ฒฐํ•˜๋Š” ๋ฐฉ๋ฒ•์„ ์‚ฌ์šฉํ•œ๋‹ค.

N100mini - RTL8188CUS ์‚ฌ์šฉ.

$ ifconfig

๋ช…๋ น์–ด๋ฅผ ์ด์šฉํ•ด N100mini๊ฐ€ ์—ฐ๊ฒฐ๋˜์–ด ์žˆ๋Š”์ง€, wlan0ํ˜น์€ wlan1์œผ๋กœ ์—ฐ๊ฒฐ๋˜์–ด ์žˆ๋Š”์ง€ ํ™•์ธํ•œ๋‹ค.
์•„๋ž˜์˜ ์„ค์ •์€ wlan0์— ์—ฐ๊ฒฐ๋œ ๊ฒƒ์„ ๊ธฐ์ค€์œผ๋กœ ํ•˜์˜€๋‹ค.

hostapd๋ฅผ ์„ค์น˜.

$ sudo apt-get install hostapd

AP์˜ ์ •๋ณด๋ฅผ ์„ค์ •ํ•œ๋‹ค. ์ด ์„ค์ •์—์„œ๋Š” ๋ณด์•ˆ ์„ค์ •์„ ํ•˜์ง€ ์•Š์œผ๋‚˜ ๋ณด์•ˆ ์„ค์ •์ด ํ•„์š”ํ•œ ๊ฒฝ์šฐ ์ƒ๋‹จ ์ฐธ๊ณ ์˜ ๋งํฌ๋ฅผ ์ฐธ๊ณ ํ•˜๋ฉด ๋œ๋‹ค.

$ sudo vi /etc/hostapd/hostapd.conf
	interface=wlan0
	driver=rtl871xdrv
	ssid=SSID_Name(์„ค์ •ํ•  ap์˜ ์ด๋ฆ„ ์ž…๋ ฅ)
	channel=1

rtl871xdrv(๋“œ๋ผ์ด๋ฒ„)๋Š” ๊ธฐ๋ณธ์œผ๋กœ ์„ค์น˜๋˜์–ด ์žˆ์ง€ ์•Š๊ธฐ ๋•Œ๋ฌธ์—, ๋“œ๋ผ์ด๋ฒ„๋ฅผ ํฌํ•จํ•˜์—ฌ ์ปดํŒŒ์ผ๋œ hostapd๋กœ ๊ต์ฒดํ•ด์•ผ ํ•œ๋‹ค.

$ cd /usr/sbin
$ sudo cp /usr/sbin/hostapd /usr/sbin/hostapd.bak
$ sudo rm -f hostapd
$ sudo wget http://dl.dropbox.com/u/1663660/hostapd/hostapd
$ sudo chown root:root hostapd
$ sudo chmod 755 hostapd
$ sudo vi /etc/network/interfaces
	auto lo
	iface lo inet loopback

	auto eth0
	allow-hotplug eth0

	iface eth0 inet manual
		auto wlan0
	iface wlan0 inet static
	address 10.10.0.1
	netmask 255.255.255.0

(์ฃผ์˜) ์•„๋ž˜ ์ฝ”๋“œ ํŽธ์ง‘ ์‹œ โ€ ๋ชจ์–‘์˜ ์Œ๋”ฐ์˜ดํ‘œ๊ฐ€ ์•„๋‹Œ " ๋ชจ์–‘์˜ ์Œ๋”ฐ์˜ดํ‘œ๋ฅผ ์‚ฌ์šฉํ•ด์•ผ ํ•œ๋‹ค.

$ sudo vi /etc/default/hostapd
	DAEMON_CONF="/etc/hostapd/hostapd.conf"

dhcp server ์„ค์น˜

$ sudo apt-get install isc-dhcp-server
$ sudo vi /etc/default/isc-dhcp-server
	INTERFACES="wlan0"

์•„๋ž˜์™€ ๊ฐ™์ด ์„ค์ •ํ•˜๋ฉด PIDrone์˜ IP๋Š” 10.10.0.1์ด ๋˜๊ณ , PIDrone์œผ๋กœ ์ด 15๊ฐœ๊นŒ์ง€ ์—ฐ๊ฒฐ์ด ๊ฐ€๋Šฅํ•ด์ง„๋‹ค.
ํ•„์š”ํ•œ ๊ฒฝ์šฐ ํ•ด๋‹น ๋ถ€๋ถ„์„ ๋ณ€๊ฒฝํ•˜๋ฉด ๋œ๋‹ค.

$ sudo vi /etc/dhcp/dhcpd.conf
	ddns-update-style none;
	ignore client-updates;
	authoritative;
	option local-wpad code 252 = text;

	subnet 10.10.0.0 netmask 255.255.255.0 {
		range 10.10.0.2 10.10.0.16; // 15๊ฐœ๊นŒ์ง€ ์—ฐ๊ฒฐ ๊ฐ€๋Šฅ
		option domain-name-servers 8.8.8.8, 8.8.4.4;
		option routers 10.10.0.1;
		option broadcast-address 10.10.0.17;
		default-lease-time 600;
		max-lease-time 7200;
	}

	์™ธ์—๋Š” ๋ชจ๋‘ ์ฃผ์„์ฒ˜๋ฆฌ

Raspberry Pi๋ฅผ ์žฌ๋ถ€ํŒ…ํ•œ ๋’ค ๋‹ค์Œ ๋ช…๋ น์„ ์‹คํ–‰ํ•œ๋‹ค.

$ sudo service isc-dhcp-server start
$ sudo service hostapd start

Android ๊ธฐ๊ธฐ์—์„œ Wifi๋ฅผ ์ผœ๊ณ , hostapd.conf์— ์ž…๋ ฅํ–ˆ๋˜ AP ์ด๋ฆ„์œผ๋กœ ์—ฐ๊ฒฐํ•˜๋ฉด ๋œ๋‹ค.

โš ๏ธ **GitHub.com Fallback** โš ๏ธ