nRF51 Development Kit
開發環境安裝…
安裝 Keil 5
Keil - Pack Installer / Update
安裝 Device Family Pack
https://developer.nordicsemi.com/nRF5_SDK/
e.g. NordicSemiconductor.nRF_DeviceFamilyPack.8.11.1.pack
安裝 CMSIS pack
https://github.com/ARM-software/CMSIS/releases
e.g. ARM.CMSIS.4.5.0.pack
Keil 選單 project/manage/select software packs
2017年6月5日 星期一
2017年5月5日 星期五
Bluetooth GPS Tracer
一個簡單有趣的 GPS 應用,可以拿來用在尋機…
結合現成的三種模組 GPS Module、HC12 RF Module、HC-05 Bluetooth Module 再加上簡單的 App 解 MNEA GPS 格式,就能實現遠距 GPS 追蹤,類似防丟器的概念,但即時距離可達 1 公里。
Combine "CRIUS GPS Module"、"HC12 - Long Range RF Wireless SERIAL Module" and "HC-05 Bluetooth Module",make remote location trace with 433mhz RF and Bluetooth comunication
App...
https://play.google.com/store/apps/details?id=com.longfellowchen.bluetoothgpstracer
系統架構 - System Architecture…
GPS--[UART]-->HC12-->~~[RF433MHZ]~~-->HC12-->HC-05-->~~[BT2.4G]-->SmartPhone
硬體線路 - Hardware circuit...
基本上只是把模組 UART 線路全串在一起…
Remote device...
GPS-TX ---------------->HC12-RX
GPS-RX ---------------->HC12-TX (option)
Local device
HC05-TX ---------------->HC12-RX(option)
HC05-RX ---------------->HC12-TX
All Module..
VCC ----------------> +5V
GND ----------------> GND
注意事項…
*All module should set the same baud-rate (default is 9600)
*HC12 Module can set transmit power to what you want. (see it's documents)
結合現成的三種模組 GPS Module、HC12 RF Module、HC-05 Bluetooth Module 再加上簡單的 App 解 MNEA GPS 格式,就能實現遠距 GPS 追蹤,類似防丟器的概念,但即時距離可達 1 公里。
Combine "CRIUS GPS Module"、"HC12 - Long Range RF Wireless SERIAL Module" and "HC-05 Bluetooth Module",make remote location trace with 433mhz RF and Bluetooth comunication
App...
https://play.google.com/store/apps/details?id=com.longfellowchen.bluetoothgpstracer
系統架構 - System Architecture…
GPS--[UART]-->HC12-->~~[RF433MHZ]~~-->HC12-->HC-05-->~~[BT2.4G]-->SmartPhone
硬體線路 - Hardware circuit...
基本上只是把模組 UART 線路全串在一起…
Remote device...
GPS-TX ---------------->HC12-RX
GPS-RX ---------------->HC12-TX (option)
Local device
HC05-TX ---------------->HC12-RX(option)
HC05-RX ---------------->HC12-TX
All Module..
VCC ----------------> +5V
GND ----------------> GND
注意事項…
*All module should set the same baud-rate (default is 9600)
*HC12 Module can set transmit power to what you want. (see it's documents)
2017年4月15日 星期六
Convert NMEA format data to latitude and longitude for GMap Latlng
Reference...
http://aprs.gids.nl/nmea/
Format...
$GPRMC,hhmmss.ss,A,llll.ll,a,yyyyy.yy,a,x.x,x.x,ddmmyy,x.x,a*hh
1 = UTC of position fix
2 = Data status (V=navigation receiver warning)
3 = Latitude of fix
4 = N or S
5 = Longitude of fix
6 = E or W
7 = Speed over ground in knots
8 = Track made good in degrees True
9 = UT date
10 = Magnetic variation degrees (Easterly var. subtracts from true course)
11 = E or W
12 = Checksum
Formula...
Latitude / Longitude = ddmm.mmmm = dd + (mm.mmmm/60) (* -1 for W and S)
Java code...
String str = "$GPRMC,182807.036,A,3731.9404,N,10601.6986,W,0.078542,40.74,050107,,*20"
if( str.startsWith( "$GPRMC" ) )
{
String[] tags = str.split(",");
if( tags[2].equals("A") ) {
String lotdd = tags[3].substring( 0, tags[3].indexOf(".") - 2 );
String lotmm = tags[3].substring( tags[3].indexOf(".") -2 );
float lot = Float.valueOf( lotdd ) + Float.valueOf( lotmm )/60;
if( tags[4].equals("S") )
lot = -lot;
String lngdd = tags[5].substring( 0, tags[5].indexOf(".") - 2 );
String lngmm = tags[5].substring( tags[5].indexOf(".") -2 );
float lng = Float.valueOf( lngdd ) + Float.valueOf( lngmm )/60;
if( tags[6].equals("W") )
lng = -lng;
LatLng pos = new LatLng( lot, lng );
} else {
// Invalid $GPRMC
}
}
2017年3月26日 星期日
python 透過 google smtp server 發信的方法
python code‧‧‧
import smtplib
to = 'where@gmail.com'
server = "smtp.gmail.com"
#port = 465 # ssl
port = 587 # tls
gmail_user = 'youraccount@gmail.com'
gmail_pwd = 'yourpassword or application password'
#smtpserver = smtplib.SMTP_SSL(server, long(port)) # ssl
smtpserver = smtplib.SMTP(server, long(port)) # tls
smtpserver.ehlo()
smtpserver.starttls() # tls
smtpserver.login(gmail_user, gmail_pwd)
header = 'To:' + to + '\n' + 'From: ' + gmail_user + '\n' + 'Subject:test \n'
print header
msg = header + '\n this is test \n\n'
smtpserver.sendmail(gmail_user, to, msg)
print 'done!'
smtpserver.quit()
import smtplib
to = 'where@gmail.com'
server = "smtp.gmail.com"
#port = 465 # ssl
port = 587 # tls
gmail_user = 'youraccount@gmail.com'
gmail_pwd = 'yourpassword or application password'
#smtpserver = smtplib.SMTP_SSL(server, long(port)) # ssl
smtpserver = smtplib.SMTP(server, long(port)) # tls
smtpserver.ehlo()
smtpserver.starttls() # tls
smtpserver.login(gmail_user, gmail_pwd)
header = 'To:' + to + '\n' + 'From: ' + gmail_user + '\n' + 'Subject:test \n'
print header
msg = header + '\n this is test \n\n'
smtpserver.sendmail(gmail_user, to, msg)
print 'done!'
smtpserver.quit()
*如果你有使用兩階段驗證,必須先到 google 個人設定頁,增加應用程式密碼,smtp 才會驗證通過…
https://myaccount.google.com/apppasswords
2017年3月1日 星期三
網頁後台使用 php 執行 python 操作 serial (uart) 權限的設定
uart0.php... (透過 shell_exec 執行 python 碼)
===============================================
$cmd = escapeshellcmd ( '/usr/bin/python uart0.py' );
$output = shell_exec ( $cmd );
echo $output;
===============================================
===============================================
import serial
serialport = serial.Serial("/dev/ttyAMA0", 9600, timeout=0.5)
serialport.write( "TEST" )
response = serialport.readlines(None)
print response
===============================================
=1=暫時-reboot後無效==============================
sudo chmod 777 /dev/ttyAMA0
=2=============================================
sudo adduser youruser dialout
usermod -aG dialout youruser
===============================================
2016年10月18日 星期二
AFS ReVersiNG
AFS ReVersiNG Guide
-working with MAZDA CX5、Cadillac ATS
STEP0. Hardware Analyze - connector defination、power line、data line…
STEP1. Use Linbus/Canbus Analyzer
STEP2, Stage by stage mining Linbus data records, in the meantime watch over AFS's action
- ACC OFF
- ACC ON
- ENGINE START
- TURN ON THE HEADLIGHT
- GEAR SHIFT TO P/N/D/R/...
- TURN WHEEL LEFT/RIGHT
- TURN OFF THE HEADLIGHT
- STOP ENGINE
- ACC OFF
STEP3. Find out the valuable changing with wheel turning
STEP4. Figure out which record is writing and which is reading and what is there meaning
STEP5. Is there any initial progress at beginning ?
STEP6. Hardware implement
STEP7. Firmware implement
STEP8. Cut off KD module and replace with reversing one
- Attention: Do not run to this step until you figure out the ECU's every read / write procedure
STEP9. See what happens :)
2016年4月26日 星期二
Xilinx Virtual Download Cable using Raspberry Pi
based on this project below…( Thanks this great project )
https://github.com/tmbinc/xvcd
just replacement following function calls…
======== gipo.c ========
#include
#define GPIO_TDI 3 /// JTAG TDI pin
#define GPIO_TDO 12 /// JTAG TDO pin
#define GPIO_TCK 13 /// JTAG TCK pin
#define GPIO_TMS 14 /// JTAG TMS pin
void gpio_init(void)
{
if (wiringPiSetup() == -1)
return;
gpio_output(GPIO_TDI, 1);
gpio_output(GPIO_TMS, 1);
gpio_output(GPIO_TCK, 1);
gpio_output(GPIO_TDO, 0);
}
void gpio_close(void)
{
}
================
======== gipo_inline.h ========
static inline void gpio_output(int i, int dir)
{
if (dir)
pinMode (i, OUTPUT);
else
pinMode (i, INPUT);
}
static inline void gpio_set(int i, int val)
{
if (!val)
digitalWrite (i, 0) ; // Off
else
digitalWrite (i, 1) ; // On
}
static inline int gpio_get(int i)
{
return (digitalRead( i )!=0);
}
================
https://github.com/tmbinc/xvcd
just replacement following function calls…
======== gipo.c ========
#include
#define GPIO_TDI 3 /// JTAG TDI pin
#define GPIO_TDO 12 /// JTAG TDO pin
#define GPIO_TCK 13 /// JTAG TCK pin
#define GPIO_TMS 14 /// JTAG TMS pin
{
if (wiringPiSetup() == -1)
return;
gpio_output(GPIO_TDI, 1);
gpio_output(GPIO_TMS, 1);
gpio_output(GPIO_TCK, 1);
gpio_output(GPIO_TDO, 0);
}
void gpio_close(void)
{
}
================
======== gipo_inline.h ========
static inline void gpio_output(int i, int dir)
{
if (dir)
pinMode (i, OUTPUT);
else
pinMode (i, INPUT);
}
static inline void gpio_set(int i, int val)
{
if (!val)
digitalWrite (i, 0) ; // Off
else
digitalWrite (i, 1) ; // On
}
static inline int gpio_get(int i)
{
return (digitalRead( i )!=0);
}
================
Tested with NetBeans IDE 8.1 + Raspberry Pi 1 & 2 + Xilinx XC3S400AN
訂閱:
文章 (Atom)
VirtualBox 空間減肥
@windows vm sdelete64 -z c: @macos VBoxManage modifymedium disk "/Users/fellow/VirtualBox VMs/Win10/Win10.vdi" --compact *.vdi...
-
ARis... ARis 是日本一間公司出品的產品,應用了 ARToolKit 技術。 展示影片在這… http://www.youtube.com/watch?v=yCCx7zANsGE YouTube上可以找到更多類似的影片。 這邊是我用 FLARToolK...
-
install… sudo apt-get install bluez sudo hciconfig hci0 up scan… sudo hcitool lescan or scan if no response... sudo bluetoothctl ...
-
由於ASSEMBLA即將開始收費,因此要把所有的SVN進行大搬家,連帶的一些教學文件也跟著搬家了,看來還是GOOGLE的窩最舒適(重點是免費) FPPA實驗平台教學教材-使用C語言 FPPA實驗平台簡介 實驗(一) 8位元LED輸出單元 與 模組設計總論 實驗(二) 按鍵開關輸入...
