MiniSigfox 武功秘笈第一彈技術大公開
This document copyright by MAKERPRO®柯大 KODA®
0928226125 kochingchang@gmail.com
KODA MinSigfox WISOL RC4
AT Module EVB
模組特色:
1. MiniSigfox 採用WISOL RC4 AT sigfox 晶片組製成Maker 物聯網開發專用sigfox通訊模組。
2. 以Grove 專用UART連接頭方便開發接線測試。
3. 以標準5V供電,並提供Deep sleep mode Wakeup 專用接腳。
4.本套件提供Grove to 杜邦公、Grove to杜邦母,方便Maker 可連接標準Arduino 板、Raspberry Pi、Seeed Grove 板等各種開發板。
4.本套件提供Grove to 杜邦公、Grove to杜邦母,方便Maker 可連接標準Arduino 板、Raspberry Pi、Seeed Grove 板等各種開發板。
.
l RF Specifications:
Parameter
|
Min
|
Typ.
|
Max
|
Unit
|
|
RF Frequency
|
Tx
|
920.8
|
MHz
|
||
Rx
|
922.3
|
MHz
|
|||
Tx output power(at “24” setting)
|
-
|
22.5
|
dBm
|
||
Frequency Error Tolerance(+25℃)
|
-2.5
|
+2.5
|
ppm
|
||
2nd Harmonics(conducted)
|
-
|
-44
|
-
|
dBm
|
|
3nd Harmonics(conducted)
|
-
|
-44
|
-
|
dBm
|
|
Rx Sensitivity(@600bps, GFSK)
|
-129
|
-
|
dBm
|
||
Rx Spurious Emission(30MHz~12.75GHz)
|
-
|
-54
|
dBm
|
l DC Characteristics
Symbol
|
Parameter
|
Min
|
Typ
|
Max
|
Unit
|
VCC
|
Gnd
|
3.3
|
5
|
5.5
|
V
|
Current
|
Tx Current(@
“24”setting, MOD)
|
200
|
mA
|
||
Rx Current
|
32
|
mA
|
|||
Sleep Current
|
2.5
|
uA
|
|||
LDO Enable =
Low , Shutdown mode
|
0.1
|
1
|
uA
|
l J101 Interface PIN Description
Pin(s)
|
Name
|
TYPE
|
Description
|
Note
|
1
|
Gnd
|
Power
|
Power Ground
|
Grove Connector
Pitch=2.0mm
|
2
|
VCC
|
Power
|
Power VCC input
3.3V ~ 5.5V
|
|
3
|
RX
|
Input
|
||
4
|
TX
|
Output
|
UART Transmit
(3.3V)
|
l RF Port
Pin(s)
|
Name
|
TYPE
|
Description
|
Note
|
1
|
RF_IO
|
I/O
|
SMA
input/output, RF Impedance of 50 ohm.
|
SMA female
|
l J102 Interface PIN Description
Pin(s)
|
Name
|
TYPE
|
Description
|
Note
|
1
|
3.3V
|
Power
|
3.3V Output
|
Pitch = 2.54mm
|
2
|
EN
|
Input
|
3.3V LDO
Enable, Active High(Internal pull high)
|
|
3
|
RST
|
Input
|
System Reset,
Active Low(Internal pull high)
|
|
4
|
IO9
|
Input
|
General purpose
IO, wakeup from deep sleep
|
|
5
|
GND
|
Power
|
Power Ground
|
l LED Indicator
Name
|
Description
|
Note
|
TX
|
Transmit
activity indicator
|
|
RX
|
Receive
activity indicator
|
|
RF
|
Radio activity
indicator
|
|
CPU
|
CPU activity
indicator
|
l Siggox module Block Diagram
l Power Modes電能省電運作模式
.
模組省電運作模式說明:
1.
模組供電或RESET_N (RST Pin)送LOW Level 電壓進入標準[Standby]模式。
2.
AT command <AT$P=1> 進入
[Sleep]模式,可利UART 指令再進入[Standby]模式,或利用
<AT$P=0> 喚醒模組並進入[Standby]模式。
3.
AT command <AT$P=2> 進入
[Deep Sleep]模式,此時模組進入深睡模式,只能利用模組重新供電或於GPIO9Pin
送LOW Level電壓重新喚醒模組並進入[Standby]模式。
l UART AT command list總整理
Command
|
Name
|
Description
|
AT
|
Dummy Command
|
Just returns ‘OK’ and does nothing else.
Can be used to check communication.
|
AT$SF=frame[,bit]
|
Send Frame
|
Send payload data, 1 to 12 bytes. Optional bit flag indicates if
WISOL−Sigfox should receive a downlink
frame.
|
AT$SO
|
Manually send out of band
message
|
Send the out−of−band message.
|
AT$IF=uint
|
Set TX Frequency
|
Set the output carrier macro channel for
Sigfox frames.
|
AT$IF?
|
Get TX Frequency
|
Get the currently chosen TX frequency.
|
AT$DR=uint
|
Set RX Frequency
|
Set the reception carrier macro channel for
Sigfox frames.
|
AT$DR?
|
Get RX Frequency
|
Get the currently chosen RX frequency.
|
AT$GI?
|
Get channel infomation
|
To get the information on current and next macro channel
usage in FCC.
//return X,Y
X: boolean value, indicating previous TX macro channel was in the SIGFOX
default channel
Y: number of micro channel available for next TX request in current
macro channel.
If X=0 or Y<3 send AT$RC AT command
|
AT$RC
|
Reset default channel
|
To reset the device on the default SIGFOX macro channel
(don't use with a duty cycle less than 20 seconds.
|
AT$CW=uint,bit[,uint_opt]
|
Continuous Wave
|
To run emission tests for Sigfox certification it is necessary to send a
continuous wave, i.e. just the base frequency without any modulation.
Parameters:
Name Range Description
Frequency 800000000− Continuous wave frequency in Hz.
999999999, 0 Use 868130000 for Sigfox or 0 to
keep previous frequency.
Mode 0, 1 Enable or disable carrier wave.
Power 0−14 dBm of signal | Default: 14
|
AT$CB=uint_opt,bit
|
Test Mode: TX constant byte
|
For emission testing it is useful to send a specific bit pattern.
Thefirst parameter specifies the byte to send. Use ‘−1’ for a (pseudo−)random pattern. Parameters:
Name Range Decsription
Pattern 0−255, −1 Byte to send. Use ‘−1’ for a
(pseudo−)random pattern.
Mode 0, 1 Enable or disable pattern test mode.
|
AT$T?
|
Get Temperature
|
Measure internal temperature and return it in 1/10th of a degree
Celsius.
|
AT$V?
|
Get Voltages
|
Return current voltage and voltage measured during the last
transmission in mV.
|
AT$I=uint
|
Information
|
Display various product information:
0: Software
Name & Version
Example Response: AX-Sigfox 1.1.2-FCC
1: Contact
Details
Example Response: support@axsem.com
2: Silicon
revision lower byte
Example Response: 8F
3: Silicon
revision upper byte
Example Response: 51
4: Major Firmware
Version
Example Response: 1
5: Minor
Firmware Version
Example Response: 1
7: Firmware
Variant (Frequency Band etc. (EU/US))
Example Response: FCC
8: Firmware
VCS Version
Example Response: 0
9: SIGFOX
Library Version
Example Response: UDL1-1.8.7
10: Device ID
Example Response: 00012345
11: PAC
Example Response: 0123456789ABCDEF
|
AT$P=uint
|
Set Power Mode
|
To conserve power, the WISOL−Sigfox can be put to sleep manually.
Depending on power mode, you will be responsible for waking up the
WISOL−Sigfox again!
0: software
reset (settings will be reset to values in flash)
1: sleep (send a break to wake up)
2: deep sleep
(toggle GPIO9 or RESET_N pin to wake up;
the WISOL−SIgfox is not running and all
settings will be reset!)
|
AT$WR
|
Save Config
|
Write all settings to flash (RX/TX frequencies, registers) so they
survive reset/deep sleep or loss of power.
Use AT$P=0 to reset the WISOL−Sigfox and
load settings from flash.
|
AT:Pn?
|
Get GPIO Pin
|
Return the setting of the GPIO Pin n; n can range from 0
to 9.
A character string is returned describing the mode of the pin, followed
by the actual value. If the pin is configured as analog pin, then
the voltage (range 0…1 V) is returned. The mode characters have
the following meaning:
Mode Description
0 = Pin drives low
1 = Pin drives high
Z = Pin is high impedance input
U = Pin is input with pull−up
A = Pin is analog input (GPIO pin 0…3 only)
T = Pin is driven by clock or DAC (GPIO pin 0 and 4 only)
The default mode after exiting reset is U
on all GPIO pins.
|
AT:Pn=?
|
Get GPIO Pin Range
|
Print a list of possible modes for a pin. The table below lists the
response.
Pin Modes
P0 0, 1, Z, U, A, T
P1 0, 1, Z, U, A
P2 0, 1, Z, U, A
P3 0, 1, Z, U, A
P4 0, 1, Z, U, T
P5 0, 1, Z, U
P6 0, 1, Z, U
P7 0, 1, Z, U
P8 0, 1, Z, U
P9 0, 1, Z, U
AT:Pn=
|
AT:Pn=mode
|
Set GPIO Pin
|
Set the GPIO pin mode.
For a list of the modes see the command
AT:Pn?
|
AT:ADC Pn[−Pn[(1V|10V)]]?
|
Get GPIO Pin Analog Voltage
|
Measure the voltage applied to a GPIO pin. The command also
allows measurement of the voltage difference across two GPIO pins.
In differential mode, the full scale range may also be specified as 1 V
or 10 V. Note however that the pin input voltages must not exceed
the range 0..VDD_IO. The command returns the result as fraction of
the full scale range (1 V if none is specified). The GPIO pins
referenced should be initialized to analog mode before issuing this
command.
|
l UART AT command Test
1.
RUN SerialPort
Test.exe Serial port communication test program.
2.
Select COM Port ,Serial Parameters: 9600, 8, N, 1
<OPEN COM port>
3.設定 AT command 指令加CR+LF 字元
4.Test AT
command
(1)
AT
Response :
OK
(2)
AT$P=0 // module software reset
Response :
OK
(3)
AT$P=1 // module sleep (send a break to
wake up)
Response
: OK
(4)
AT$P=2 // module deep sleep (toggle GPIO9 or
RESET_N pin to wake up;
Response
: OK
(5)
AT$T? // Query internal
temperature
Response
: 296
(6)
AT$V? // Query current voltage
and voltage (mV)
Response :
3340
(7)
AT$I=10 // Query Device ID
Response
: 0040D6BD
(8)
AT$I=11 // Query PAC
Response
: 7A035111C857431D
(9)
AT$IF? // Get the
currently chosen TX frequency
Response
: 902200000
(10)
AT$DR? // Get the currently chosen
RX frequency.
Response
: 922300000
(11)
AT$SF=aabb1234 // Send payload data, 1 to
12 bytes.
Response
: OK
(12)
AT$SF=aabb123466,1 // Send payload
data, 1 to 12 bytes. should receive a downlink frame.
Response : OK
(13)
AT$CB=0011223344,1 // sends a Sigfox frame containing { 0x00
: 0x11 : 0x22: 0x33 : 0x44 }, then waits for a downlink response telegram,which
in this example contains { 0xAA : 0xBB : 0xCC :0xDD }.downlink frame.
Response : OK
(14)
AT$CB=0xAA,1 // The
‘CB’ command sends out a continuous pattern of bits, in this case 0xAA =
0b10101010.
Response : OK)
(15)
AT$GI? // Get
channel infomation
Response : 1,6
(16)
AT$RC // Reset
default channel.
Response : OK
l 使用 Arduino UNO R3 + Mini-sigfox
Using Grove
Line connect to Arduino UNO R3
Arduino UNO
R3 Pin8=> Mini-sigfox TX , Pin 7=> Mini-sigfox RX ,5V=>5V Gnd =>
Gnd
l 使用 KODAIoTLAB MiniDuino + Mini-sigfox
Using Grove
Line connect Mini-sigfox to Miniduino Grove
socket( D8/D7)
Arduino SOURCE CODE:
sigfox-module-test-V1.ino
#include <SoftwareSerial.h>
SoftwareSerial mySerial(8, 7); // RX, TX
void setup() {
// Open
serial communications and wait for port to open:
Serial.begin(9600);
// while
(!Serial) {
// ; // wait for serial port to connect. Needed
for native USB port only
// }
mySerial.begin(9600);
initsigfox();
querysigfoxid();
querysigfoxpac();
querysigfoxtemp();
querysigfoxvolte();
}
void loop() { // run over and over
//
mySerial.println("AT\n");
// if (mySerial.available())
{
//
Serial.write(mySerial.read());
// }
// if
(Serial.available()) {
// mySerial.write(Serial.read());
// }
}
void initsigfox()
{
mySerial.write("AT"); //wake the module up
mySerial.write(10); //send chr(10) as the finish of current command
Serial.println("Init sigfox");
delay(100);
wait_response();
wakeupsigfox();
wait_response();
}
void wait_response()
{
while
(mySerial.available()) {
Serial.write(mySerial.read());
}
}
void querysigfoxid()
{
mySerial.write("AT$I=10"); //wake the module up
mySerial.write(10); //send chr(10) as the finish of current command
Serial.print("ID:");
delay(100);
wait_response();
}
void querysigfoxpac()
{
mySerial.write("AT$I=11"); //wake the module up
mySerial.write(10); //send chr(10) as the finish of current command
Serial.print("PAC:");
delay(100);
wait_response();
}
void querysigfoxtemp()
{
mySerial.write("AT$T?"); //wake the module up
mySerial.write(10);
//send chr(10) as the finish of current command
Serial.print("Temp:");
delay(100);
wait_response();
}
void querysigfoxvolte()
{
mySerial.write("AT$V?"); //wake the module up
mySerial.write(10); //send chr(10) as the finish of current command
Serial.print("Volte:");
delay(100);
wait_response();
}
void wakeupsigfox()
{
mySerial.write("AT$P=0"); //wake the module up
mySerial.write(10); //send chr(10) as the finish of current command
Serial.println("Sent AT to wake up");
delay(100);
}
l Using Raspberry Pi 3B + Mini-sigfox
1. Raspberry Pi3B connect Mini-sigfox Pin
map
(1)Connect Raspberry Pi3 to Mini-sigfox
(2)Pin map
ü Pin2 5V connet to Mini-sigfox 5V (Grove Line RED
line)
ü Pin6 GND
connet to Mini-sigfox GND (Grove Line Black line)
ü Pin8 UART0 TX
connet to Mini-sigfox RX (Grove Line White line)
ü Pin10 UART0 RX connet to Mini-sigfox TX (Grove Line
Yellow line)
(3)Disable TTY
ü Sudo nano /boot/cmdline.txt
Search statement :
dwc_otg.lpm_enable=0
console=serial0,115200 console=tty1 root=PARTUUID=44d53a48-02 rootfstype=ext4
elevator=deadline fsck.repair=yes rootwait splash plymouth.ignore-se$
Modify to :
dwc_otg.lpm_enable=0
console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait
(4)Using Mini-sigfox to USB2TTL and connect to Raspberry Pi3B
2. Install python
(1) Install python 2.7
$sudo
apt-get install python2.7
(2) Insyall Python 3.5
$ wget
https://www.python.org/ftp/python/3.5.0/Python-3.5.0.tgz
$ tar -zxvf Python-3.5.0.tgz
change directory to compile and make:
$ cd Python-3.5.0
$ ./configure
$ make
$ sudo make install
$ python3.5
Python 3.5.0 (default, Sep 27 2015, 20:39:38)
[GCC 4.6.3] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> print('Hello Python 3.5')
Hello Python 3.5
$ tar -zxvf Python-3.5.0.tgz
change directory to compile and make:
$ cd Python-3.5.0
$ ./configure
$ make
$ sudo make install
$ python3.5
Python 3.5.0 (default, Sep 27 2015, 20:39:38)
[GCC 4.6.3] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> print('Hello Python 3.5')
Hello Python 3.5
3. Install python Serial library
Sudo apt-get install python-serial
4. Using python write a test program to
test Mini-sigfox module
SOURCE CODE:
Ser.py
#!/usr/bin/env python
# author Tiger Ko
import serial
import time
def readlineCR(port):
rv = ""
while
True:
ch =
port.read()
rv +=
ch
if
ch=='\r' or ch=='':
return rv
port =
serial.Serial("/dev/ttyUSB0",baudrate=9600, timeout=3.0)
//if use UART0 change "/dev/ttyUSB0" to “/dev/ttyAMA0”
port.write("AT\r\n")
time.sleep(0.5)
rcv = readlineCR(port)
print( rcv)
port.write("AT$P=0\r\n")
time.sleep(0.5)
rcv = readlineCR(port)
print( rcv)
while True:
port.write("AT$I=10\r\n")
time.sleep(0.5)
rcv =
readlineCR(port)
print( rcv)
time.sleep(0.5)
port.write("AT$I=11\r\n")
time.sleep(0.5)
rcv =
readlineCR(port)
print( rcv)
time.sleep(0.5)
print("Send AT$SF=112233445566\n")
port.write("AT$SF=112233445566\r\n")
time.sleep(1.0)
rcv =
readlineCR(port)
print( rcv)
執行 python ser.py 測試:
$python ser.py
l Mini Sigfox module active and buy connectivity :
2.
Buy connectivity and Active device:
l Sigfox backend callback common variables:
² time (int): the event
timestamp (in seconds since the Unix Epoch)
² device
(string): device
identifier (in hexadecimal – up to 8 characters <=> 4 bytes)
² duplicate
(bool): «true» if the message is a duplicate one, meaning that
the backend has already processed this message from a different base station,
«false» otherwise. To receive duplicate messages, you have to check the «send
duplicate» box in the callback configuration page.
² snr (float): the signal to noise ratio (in dB – Float value with two maximum fraction
digits) .
² rssi (float): the RSSI (in dBm – Float value with two maximum fraction digits). If there
is no data to be returned, then the value is null.
² avgSnr (float):
the average signal to noise ratio computed from the last
25 messages (in dB – Float value with two maximum fraction digits) or «N/A».
The device must have sent at least 15 messages.
² station
(string): the base station identifier (in hexadecimal – 4
characters <=> 2 bytes).
² data (string): the user data (in hexadecimal).
² seqNumber
(int): the sequence number of the message if available.
沒有留言:
張貼留言