Raspberry Pi Rover + Scratch = IMAOCACH

21
Raspberry Pi Rover + Scratch Imaocach Scratchで動作する Raspberry Pi Rover

description

CEDEC2014

Transcript of Raspberry Pi Rover + Scratch = IMAOCACH

Page 1: Raspberry Pi Rover + Scratch = IMAOCACH

Raspberry Pi Rover + Scratch

Imaocach

Scratchで動作するRaspberry Pi Rover

Page 2: Raspberry Pi Rover + Scratch = IMAOCACH

Raspberry Pi Rover

Page 3: Raspberry Pi Rover + Scratch = IMAOCACH
Page 4: Raspberry Pi Rover + Scratch = IMAOCACH
Page 5: Raspberry Pi Rover + Scratch = IMAOCACH
Page 6: Raspberry Pi Rover + Scratch = IMAOCACH
Page 7: Raspberry Pi Rover + Scratch = IMAOCACH
Page 8: Raspberry Pi Rover + Scratch = IMAOCACH

Pi VNC Server Scratch

wifi

breadboard

Battery for Pi

Motor gear

Battery for motor

PC Windows,Linux or MacVNC Client

Wifi

Wifi/VNC Prot.

Imaocach system overview

Page 9: Raspberry Pi Rover + Scratch = IMAOCACH

Imaocach Schematic

Page 10: Raspberry Pi Rover + Scratch = IMAOCACH

Screen shot Scratch on Pi

Page 11: Raspberry Pi Rover + Scratch = IMAOCACH

Braodcast pin7lowBraodcast pin11high

Page 12: Raspberry Pi Rover + Scratch = IMAOCACH

Braodcast pin7lowBraodcast pin11high

Page 13: Raspberry Pi Rover + Scratch = IMAOCACH

Pi VNC Server Scratch

wifi

breadboard

Battery for Pi

Motor gear

Battery for motor

AndroidVNC Viewer

Wifi/VNC Prot.

Imoacach system overview for Android

Page 14: Raspberry Pi Rover + Scratch = IMAOCACH

部品表部品名 数量 参考価格 参考購入先など

Raspberry PI Type AWith SD CARD

1 3350 RSコンポーネンツ

Wifi USBドングルWLI-UC-GNM バッファロー

1 758 Www.amazon.co.jp

タミヤ ツインモータギヤーボックス

1 907 www.amazon.co.jp

タミヤ トラック&ホイールセット

1 459 Www.amazon.co.jp

ブレッドボード EIC-301 1 150

電池ボックス 単三X2 SW付

1 60

電池ボックス 単三X4 USBコネクタ付

1 250

フォトカプラ TLP621-1 2 40

トランジスタ 2sc2120 4 10 20個購入時

抵抗 100Ω 2 1 100個購入時

コンデンサー 0.1μF 2 10 20個購入時

ジャンパー線

Page 15: Raspberry Pi Rover + Scratch = IMAOCACH

他社製品とImaocachとの比較LEGO Mindstorms EV3

Page 16: Raspberry Pi Rover + Scratch = IMAOCACH

せっかくなのでもう少しAndroidらしい使い方

そこで加速度センサーを使ってAndroidデバイスをImaocachのリモコンにしてみました

なるべくありもの利用しました。書いたコードは28行

Page 17: Raspberry Pi Rover + Scratch = IMAOCACH

Pi Pythonwifi

breadboard

Battery for Pi

Motor gear

Battery for motor

AndroidsensorUdp

Wifi/UDP

System overview

Page 18: Raspberry Pi Rover + Scratch = IMAOCACH

sensorUDP

このプログラムは、Androidデバイスの各種センサーをCSV形式にてUDPで送信し続けるというものです。

Page 19: Raspberry Pi Rover + Scratch = IMAOCACH

Format

A,シリアルナンバー、時間、加速度センサーX軸、加速度センサーY軸、加速度センサーZ軸となっています。

Page 20: Raspberry Pi Rover + Scratch = IMAOCACH

import RPi.GPIO as GPIOimport socketUDP_IP = ""UDP_PORT = 12345sock = socket.socket(socket.AF_INET,socket.SOCK_DGRAM)sock.bind((UDP_IP, UDP_PORT))GPIO.setmode(GPIO.BCM)GPIO.setup(4, GPIO.OUT)GPIO.setup(17,GPIO.OUT)GPIO.output(4,False)GPIO.output(17,False)while True: data, addr = sock.recvfrom(1024) l = data.split(",") print l[3] f = float(l[4]) #Y軸 r = float(l[3]) #X軸

if f>1: #両方のモータを駆動 GPIO.output(4,True) GPIO.output(17,True) if r>1: #右のモータのみ駆動 GPIO.output(4,False) if r<-1: #左のモータのみ駆動 GPIO.output(17,False) if f<-1: #両方のモータを停止 GPIO.output(4,False) GPIO.output(17,False)

Page 21: Raspberry Pi Rover + Scratch = IMAOCACH

まとめと今後の課題

-Raspberry Pi Rover Imaocach-Scratch VNC-Android Device & Python

-Sensor,Camera,Auto drive-Game, Education, Contest