2013年11月14日 星期四

艾鍗學院 自平衡機器人專題開發幕後花絮

http://www.youtube.com/v/E5sLgBWVfHM?autohide=1&version=3&attribution_tag=9Oazx0VMv0yj5KMeu7bazg&autoplay=1&feature=share&autohide=1&showinfo=1

2013年11月11日 星期一

BeagleBoard系統安裝


BeagleBoard系統安裝 -

艾鍗學院筆記



1.SD卡格式化

參考網站

BeagleBoard-xM 教學筆記 - 安裝(重灌) Angstrom Demo microSD 格式化筆記 @ Ubuntu 10.04

a.下載mkcard.txt SD卡格式化,SD卡不一定在sdc的裝置上,要視情況更改。

sudo sh mkcard.txt /dev/sdc

b.有時候格式化完成之後還是會認不到SD卡上面的Boot的分割區,需要再下這行指令

sudo mkfs.msdos -F 32 /dev/sdc1 -n boot
sync

成功之後在PC插上SD卡,會看到兩個分個區/media/boot/media/Angstrom

2.安裝Angstrom LinuxOpenCV2.2

a.Narcissus網站http://narcissus.angstrom-distribution.org/自動產生MLOBootuImageroofts

可參考這個網站的設定,可根據需要自行調整。

Angstrom-Narcissus Online Image Builder running OpenCV

b.Narcissus產生的檔案複製到SD卡的boot分割區

# extract the files to the ./boot directory
tar --wildcards -xzvf [YOUR-DOWNLOAD-FILE].tar.gz  ./boot/*

# copy the files to sc-card boot partition.
cp boot/MLO-* /media/boot/MLO
cp boot/uImage-* /media/boot/uImage
cp boot/u-boot-*.bin /media/boot/u-boot.bin
sync

c.Narcissus產生的檔案複製到SD卡的Angstrom分割區

sudo tar -xvz -C /media/Angstrom -f [YOUR-DOWNLOAD-FILE].tar.gz
sync

sync
umount /media/boot
umount /media/Angstrom

SD卡插入BeagleBoard,第一次開機的時候會進行設定,要等一段時間才能夠開機成功。開機成功之後就可以在Beagleboard上面寫OpenCV相關應用程式。

可參考下列兩個網站

How To Install openCV on a BeagleBoard-XM with Angstrom OS
Installing Angstrom on the BeagleBoard-xM

3.安裝OpenCV2.4

只有OpenCV2.4才有提供人臉識別的功能,若要使用人臉識別功能就必須更新到OpenCV2.4

a.更換標頭檔案

OpenCV2.4資料夾下的opencvopencv2資料夾蓋過 /usr/include 下的opencvopencv2

b.更換lib檔案

可將OpenCV2.4資料夾下的lib資料夾中的檔案放到 /usr/lib

也可以自行重新編譯OpenCV2.4 Cross compile或直接在beagleboard板子上面編譯。

可以參考這個網站

Building OpenCV for ARM Cortex-A8

4.系統安裝參考資料

BeagleBoard-xM 教學筆記 - 安裝(重灌) Angstrom Demo microSD 格式化筆記 @ Ubuntu 10.04
How To Install openCV on a BeagleBoard-XM with Angstrom OS
Installing Angstrom on the BeagleBoard-xM
Angstrom-Narcissus Online Image Builder running OpenCV
Building OpenCV for ARM Cortex-A8

5.注意事項

l   若使用直接複製SD卡的方式安裝系統,登入idroot密碼為ittraining

l   Angstrom Linux預設螢幕保護程式,十分鐘以內沒有動作螢幕會沒有訊號。

l   要在 /etc/profile 加入 export DISPLAY:=0 Beagleboard的輸出設定為螢幕。

l   避免在接上電源的情況,在HDMI界面熱插拔,易造成板子損壞。

2013年11月8日 星期五

Differences between I2C and SMBus

Differences between I2C and SMBus

In general, the I2C bus and SMBus are compatible, but there are some subtle differences between the two that could cause some problems. The following table summarizes the differences between the two buses.
Clock Speed Comparison
I2C
SMBus
Minimumnone10 kHz
Maximum100 kHz (Standard mode)
400 kHz (Fast mode)
2 MHz (High Speed mode)
100 kHz
Timeoutnone35 ms

Electrical Characteristics Comparison
I2C
SMBus
VHIGHFixed Voltage: 3.0 to VDD_max + 0.5V
VDD Relative: 0.7 to VDD_max + 0.5V
2.1V to VDD
VLOWFixed Voltage: -0.5V to 1.5V
VDD Relative: -0.5 to 0.3VDD
to 0.8V
Max Current3 mA350 µA
For more detailed information, check out:

2013年10月31日 星期四

Busybox 啓動Telnte Daemon

Busybox選單有詳細的說明使用步驟,所以我下面列那些東西都是從busybox內的說明照抄的

建立步驟如下
(1)先確定linux kernel config中有UNIX98_PTYS和DEVPTS_FS
(2)確定busybox conifg有LOGIN和FEATURE SUID
(3)在目標板/dev資料夾下建立pts資料夾和製作ptmx character device node,範例如下


(4)下指令mount –t devpts devpts /dev/pts
(5)新增user root(adduser root)
(6)修改/etc/passwd(root::0:0:root,,,:/root:/bin/sh)
(7)啟動telnetd(telnetd &),然後從遠端telnet到你的目標板並輸入帳號root即可使用shell,畫面如下

2013年10月29日 星期二

C程式 平方根

C程式 平方桹

#include
#include
main(){
       float a,x=1,y;
       int i;
       printf("input a:\n");
       scanf("%f",&a);
       for(i=0;;i++)
       {
       y=x;
       x=(x+a/x)/2;
       if(fabs(y-x)<0 .0000001="" nbsp="" span="">
       break;
       }
        printf("sqrt(a)=%f",x);
       }

如何控制伺服馬達

如何控制伺服馬達
  


0°~180° Servo 

利用PWM控制角度

 Most servo motor will work well on 50 Hz of PWM frequency;
this mean the PWM signal should have a period of 20ms.
 
 
Servo Angle Schematic 180 3.8 
 
 
This servo can operate 180° when given a pulse signal ranging from 600usec to 2400usec. 
 
#define MIN_PULSE_WIDTH       600     // the shortest pulse sent to a servo 
#define MAX_PULSE_WIDTH      2400     // the longest pulse sent to a servo
#define DEFAULT_PULSE_WIDTH  1500     // default pulse width when servo is attached
#define REFRESH_INTERVAL    20000     // minumim time to refresh servos in microseconds
--------------
360° Servo 

利用PWM控制轉的方向與轉速

360° servo 是藉由0.5~2.5ms  HIGH  PULSE
50Hz的脈波訊號做控制霢1.5ms  HIGH  PULSE是
位於停止的狀態;小於1.5ms  時順時霢轉動霢愈
小愈快;大於1.5ms 時霢時霢轉動霢愈大愈快。

 
 
 
------------------
 S3C6410 的PWM 如何設定,才能得到20ms的週期 (50HZ)
如果 PCLK=83MHZ, 8-bit prescaler=255 and 4-bit divider=16
Frequency=PCLK/(255+1)/16   => 20.2KHz
1/20.2K=0.0495ms
 
20ms/0.0495=404 --> TCNTB
 
TCMPB setting?:
Get 2ms    High Pulse width: 2ms/0.0495=40
Get 1.5ms High Pulse width: 2ms/0.0495=30
Get 1ms    High  Pulse width: 1ms/0.0495=20
 

MIPS ? DMIPS ? 代表的意思?

MIPS isn't generally considered a useful measure of performance - it's typically quoted based on choosing the fastest (likely one of the least capable) instructions on a machine, with no regard to the capabilities of that machine. Consider, if I built a machine that could only execute NOP, but could execute 200 million NOPs a second, it would be a 200 MIPS machine, however, if I built an entire fully feature CPU that could execute only 100 million NOPs per second (and NOP was the fastest instruction) but could also execute loads, stores, adds, multiplies etc. etc., it would be a 100 MIPS machine - however, the NOP-only machine appears (using the MIPS measure) to be twice as "good" despite being useless.

DMIPS is based on the time taken to execute a particular benchmark, something which might be considered representative of a real workload, namely Dhrystone. The DMIPS figure for a given machine is the relative speed a VAX 11/780 (a particular "1 MIPS" machine) would have to run at to complete the benchmark in the same amount of time as the machine being measured. For example, if a 100MHz CPU completes the benchmark 200 times faster than the VAX 11/780 does, then it would be considered a 200 DMIPS machine. For CPUs that can be run at various frequencies, then you'll often see this value reported divided through by MHz, e.g. 2 DMIPS/MHz in this example.

So, the quick answer is that (unlike MIPS) DMIPS can't be calculated, it can only be measured.

There are further details, and a link to the Dhrystone source code here:http://en.wikipedia.org/wiki/Dhrystone

2013年8月27日 星期二

MEMS陀螺儀