2017年3月4日 星期六

電燈分段的電子開關接法


物聯網專題: 電燈分段的電子開關接法


有三段開關: 
                 

第一段 黃、橙線過電=>亮2燈
第二段 橙線過電=>亮1燈
第三段 白線過電=>亮1燈





改變成第一動灯全開的方法: 
  1. 讓橙線接到兩個燈具, 當第二段橙線過電時==> 亮2燈
  2. 把黃線接到白線, 讓黃白線短路, 使第一段橙、黃線過電時==> 亮3燈
第一段 橙、黃線過電=>亮3燈
第二段 橙線過電=>亮2燈
第三段 白線過電=>亮1燈




參考: http://bbs.pigoo.com/thread-61832-1-1.html

2017年3月3日 星期五

TDMA 中的兩種機制



Aloha


Aloha : 沒有coordinate , 想送就送,撞了再重傳
Slotted Aloha: 加入time slot, 要大家同步在同一個time slot 傳送, 但仍然想送就送, 撞了再重傳
Aloha: G exp(-2G)  (G:  mean  arrival rate) if G=1, 1/(e^2)=0.168
Slotted Aloha: G exp(-G)  , if G=1, 1/e=0.36

Slotted Aloha 約是 Aloha 兩倍throughput

CSMA (Carrier Sense Multiple Access) 

"Listen before talk"
CSMA 可以被分類為三種:

  1. non-persistent CSMA: channel busy, 等一段random backoff time, 再偵測channel idle 就送
  2. 1-persistent CSMA: channel busy 不等一段random backoff time, 仍持續偵測channel , idle 就送
  3.  p-Persistent CSMA: channel busy 不等一段random backoff time, 仍持續偵測channel , channle ide , 擲一骰子(機率p) 決定是否要傳送。若是落在'(1-p) 不送,

2017年2月20日 星期一

SIMCOM 4G LTE Module



參與'3/25 本班同學, 若專題做IoT相關的部份, 將可使用由禾申堂所代理的SIMCOM的 4G LTE Module。


SIM7500SA LTE cat1 GNSS module

• Control Via AT Commands
• Supply voltage range: 3.4V~ 4.2V
• Operation temperature: -40℃ to +85℃
• Dimension: 24*27*2.75mm
• Weight: 4.0g

Specifications  for  Data transfer
• LTE CAT1
- Uplink up to 5Mbps,
- Downlink up to 10Mbps
• HSPA+
- Uplink up to 5.76 Mbps,
- Downlink up to 42 Mbps
• WCDMA
- Uplink/Downlink up to 384Kbps
• CSD
- WCDMA data rate 57.6Kbps
- WCDMA 64kbps CSD for Video call


Download



What's GNSS?

GNSS的全稱是全球導航衛星系統(Global Navigation Satellite System),它是泛指所有的衛星導航系統,包括全球的、區域的和增強的,如美國的GPS、俄羅斯的Glonass、歐洲的Galileo、中國的北斗衛星導航系統,以及相關的增強系統,如美國的WAAS(廣域增強系統)、歐洲的EGNOS(歐洲靜地導航重疊系統)和日本的MSAS(多功能運輸衛星增強系統)等。


2017年1月29日 星期日

機率




Erlang distribution

The Erlang distribution is a two parameter family of continuous probability distributions with support . The two parameters are:
  • a positive integer 'shape'  
  • a positive real 'rate' ; sometimes the scale , the inverse of the rate is used.
The Erlang distribution with shape parameter  equal to 1 simplifies to the exponential distribution. It is a special case of the Gamma distribution. It is the distribution of a sum of  independent exponential variables with mean 1/ λ each.
The Erlang distribution was developed by A. K. Erlang to examine the number of telephone calls which might be made at the same time to the operators of the switching stations. T


Events that occur independently with some average rate are modeled with a Poisson process.
The waiting times between k occurrences of the event are Erlang distributed. 
The Erlang distribution, which measures the time between incoming calls, can be used in conjunction with the expected duration of incoming calls to produce information about the traffic load measured in erlangs.
The number of events in a given amount of time is described by the Poisson distribution.


Probability density plots of Erlang distributions
Cumulative distribution plots of Erlang distributions

Poisson distribution

統計機率學裡常見到的離散機率分佈,由法國數學家西莫恩·德尼·帕松(Siméon-Denis Poisson)在1838年時發表。
Poisson分佈適合於描述單位時間內隨機事件發生的次數的機率分佈。如某一服務設施在一定時間內受到的服務請求的次數,電話交換機接到呼叫的次數、汽車站台的候客人數、機器出現的故障數、自然災害發生的次數、DNA序列的變異數、放射性原子核的衰變數、雷射的光子數分佈等等。

An event can occur 0, 1, 2, … times in an interval. The average number of events in an interval is designated  (lambda). Lambda is the event rate, also called the rate parameter. The probability of observing k events in an interval is given by the equation

probability mass function (PMF) for a Poisson distribution.
where
  •  is the average number of events per interval
  • e is the number 2.71828... (Euler's number) the base of the natural logarithms
  • k takes values 0, 1, 2, ….
Poisson分佈的參數λ是單位時間(或單位面積)內隨機事件的平均發生次數。
期望值 決定常態分配的曲線外觀
Plot of the Poisson PMF

=1, 0*0.37+1*0.37+2*0.19+3*0.07+5*0.000+6*0.0000=~1
=10, 平均值在中間 (0~20) 為一個常態分配

Examples of probability for Poisson distributions[edit]

On a particular river, overflow floods occur once every 100 years on average. Calculate the probability of k = 0, 1, 2, 3, 4, 5, or 6 overflow floods in a 100-year interval, assuming the Poisson model is appropriate.
Because the average event rate is one overflow flood per 100 years, λ = 1




Pareto distribution

Consider a population of households and suppose sampling household incomes is like sampling from a Pareto[10000,2]. What proportion of people earn more than $100000? From the form of the survival function, it should be obvious that the answer is 1%: only 1 in 100 households earn more than $100000. 

X is a random variable with a Pareto (Type I) distribution,[1] then the probability that X is greater than some number x, i.e. the survival function (also called tail function), is given by

Pareto Type I probability density functions for various α

Pareto Type I cumulative distribution functions for various α



Exponential distribution


  1. In probability theory and statistics, the exponential distribution (a.k.a. negative exponential distribution) is the probability distribution that describes the time between events in a Poisson process, i.e. a process in which events occur continuously and independently at a constant average rate. 
  2. It is a particular case of the gamma distribution. It is the continuous analogue of the geometric distribution, and it has the key property of being memoryless. In addition to being used for the analysis of Poisson processes, it is found in various other contexts.


2017年1月14日 星期六

Pi GPIO 輸出電流其實有30mA.



今天做了一個實驗: 量測Pi GPIO的輸出電流, 經查資料都說是 16mA, 今天量測GPIO輸出,
用三用電錶梯電流檔量測, 輸出電流是30m~40mA (在只有一根輸出的情況下)






2017年1月6日 星期五

使用Wireshark 用過濾Wi-Fi 802.11的封包


使用Wireshark 用過濾Wi-Fi 802.11的封包

filter 語法: 

# 過濾 MAC 來源位址
wlan.sa == xx:xx:xx:xx:xx:xx 

# 過濾 MAC 目的位址
wlan.da == xx:xx:xx:xx:xx:xx


# 過濾 MAC 位址 (不管出現在來源或目的位址) 
wlan.addr == xx:xx:xx:xx:xx:xx