-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 71ef8c8
Showing
29 changed files
with
3,459 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.pio/ | ||
.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
================================================================================ | ||
Wio Tracker 1110 Examples | ||
================================================================================ | ||
|
||
MIT License | ||
|
||
Copyright (C) 2023 Seeed K.K. | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# Wio Tracker 1110 Examples | ||
|
||
Code examples for Wio Tracker 1110. | ||
|
||
## Folder Structure | ||
|
||
`/examples` | ||
|
||
Contains examples for the Arduino IDE platform. | ||
|
||
|Folder|Summary|LoRaWAN|Note| | ||
|:--|:--|:--|:--| | ||
|[Grove/adc_gain](/examples/Grove/adc_gain)|Output Grove - Analog (P1) voltage to Grove - UART.||Grove - Analog| | ||
|[Grove/iic_scan](/examples/Grove/iic_scan)|Scan I2C and output the I2C address that responded to Grove - UART.||Grove - I2C| | ||
|[Grove/mma7660_gain](/examples/Grove/mma7660_gain)|Output the accelerometer(MMA7660) value to Grove - UART.||MMA7660| | ||
|[Grove/temperature_gain](/examples/Grove/temperature_gain)|Output the temperature and humidity sensor(SHT4x) value to Grove - UART.||SHT4x| | ||
|[BLE/ble_scan_advanced](/examples/BLE/ble_scan_advanced)|||| | ||
|[LoRaWAN/SenseCAP/sensecap_uplink](/examples/LoRaWAN/SenseCAP/sensecap_uplink)||SenseCAP Cloud|| | ||
|[LoRaWAN/SenseCAP/sensecap_gnss_uplink](/examples/LoRaWAN/SenseCAP/sensecap_gnss_uplink)||SenseCAP Cloud|| | ||
|[LoRaWAN/SenseCAP/sensecap_wifi_uplink](/examples/LoRaWAN/SenseCAP/sensecap_wifi_uplink)||SenseCAP Cloud|| | ||
|[LoRaWAN/SenseCAP/sensecap_ble_uplink](/examples/LoRaWAN/SenseCAP/sensecap_ble_uplink)||SenseCAP Cloud|| | ||
|[LoRaWAN/TheThingsNetwork/ttn_uplink](/examples/LoRaWAN/TheThingsNetwork/ttn_uplink)||The Things Network|| | ||
|[LoRaWAN/TheThingsNetwork/ttn_geolocation_gnss](/examples/LoRaWAN/TheThingsNetwork/ttn_geolocation_gnss)||The Things Network|| | ||
|
||
`/platformio` | ||
|
||
Contains examples for the PlatformIO platform. | ||
|
||
|Folder|Summary|LoRaWAN|Note| | ||
|:--|:--|:--|:--| | ||
|[Grove/io_test](/platformio/Grove/io_test)|||| | ||
|[LoRaWAN/TheThingsNetwork/ttn_geolocation_gnss](/platformio/LoRaWAN/TheThingsNetwork/ttn_geolocation_gnss)||The Things Network|| | ||
|[LoRaWAN/TheThingsNetwork/ttn_geolocation_wifi](/platformio/LoRaWAN/TheThingsNetwork/ttn_geolocation_wifi)||The Things Network|| | ||
|[LoRaWAN/TheThingsNetwork/ttn_uplink](/platformio/LoRaWAN/TheThingsNetwork/ttn_uplink)||The Things Network|| | ||
|[LoRaWAN/TheThingsNetwork/ttn_uplink_with_beacon](/platformio/LoRaWAN/TheThingsNetwork/ttn_uplink_with_beacon)||The Things Network|| | ||
|
||
|
||
`/src` | ||
|
||
Contains a dummy header file for display in the Examples menu of the Arduino IDE. | ||
|
||
## Technical Notes | ||
|
||
### Firmware Overview | ||
|
||
<img width="400" src="media/1.png"> | ||
|
||
### Internal Flash Memory Map | ||
|
||
<img width="400" src="media/2.png"> | ||
|
||
## License | ||
|
||
[MIT](LICENSE.txt) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
#include <Arduino.h> | ||
#include <Adafruit_TinyUSB.h> // for Serial | ||
|
||
#include <bluefruit.h> | ||
|
||
|
||
#define BEACON_DATA_LEN 0x15 | ||
#define BEACON_DATA_TYPE 0x02 | ||
#define COMPANY_IDENTIFIER 0x004C | ||
|
||
|
||
void setup() | ||
{ | ||
Serial1.begin(115200); | ||
while ( !Serial1 ) delay(10); // for nrf52840 with native usb | ||
|
||
Serial1.println("Bluefruit52 Central ADV Scan ibeacon"); | ||
Serial1.println("------------------------------------\n"); | ||
|
||
// Initialize Bluefruit with maximum connections as Peripheral = 0, Central = 1 | ||
// SRAM usage required by SoftDevice will increase dramatically with number of connections | ||
Bluefruit.begin(0, 1); | ||
Bluefruit.setTxPower(4); // Check bluefruit.h for supported values | ||
|
||
/* Set the device name */ | ||
Bluefruit.setName("Bluefruit52"); | ||
|
||
/* Set the LED interval for blinky pattern on BLUE LED */ | ||
Bluefruit.setConnLedInterval(250); | ||
|
||
/* Start Central Scanning | ||
* - Enable auto scan if disconnected | ||
* - Filter out packet with a min rssi | ||
* - Interval = 100 ms, window = 50 ms | ||
* - Use active scan (used to retrieve the optional scan response adv packet) | ||
* - Start(0) = will scan forever since no timeout is given | ||
*/ | ||
Bluefruit.Scanner.setRxCallback(scan_callback); | ||
Bluefruit.Scanner.restartOnDisconnect(true); | ||
Bluefruit.Scanner.filterRssi(-80); | ||
//Bluefruit.Scanner.filterUuid(BLEUART_UUID_SERVICE); // only invoke callback if detect bleuart service | ||
Bluefruit.Scanner.setInterval(160, 80); // in units of 0.625 ms | ||
Bluefruit.Scanner.useActiveScan(true); // Request scan response data | ||
Bluefruit.Scanner.start(0); // 0 = Don't stop scanning after n seconds | ||
|
||
Serial1.println("Scanning ..."); | ||
} | ||
|
||
void scan_callback(ble_gap_evt_adv_report_t* report) | ||
{ | ||
PRINT_LOCATION(); | ||
uint8_t len = 0; | ||
uint8_t buffer[32]; | ||
memset(buffer, 0, sizeof(buffer)); | ||
|
||
|
||
/* Check for Manufacturer Specific Data */ | ||
len = Bluefruit.Scanner.parseReportByType(report, BLE_GAP_AD_TYPE_MANUFACTURER_SPECIFIC_DATA, buffer, sizeof(buffer)); | ||
if (len) | ||
{ | ||
uint8_t beacon_data_len = 0; | ||
uint8_t beacon_data_type = 0; | ||
uint16_t company_identifier = 0; | ||
beacon_data_len = buffer[3]; | ||
beacon_data_type = buffer[2]; | ||
memcpy(( uint8_t * )( &company_identifier ), buffer, 2 ); | ||
if( beacon_data_type == BEACON_DATA_TYPE ) | ||
{ | ||
if( company_identifier == COMPANY_IDENTIFIER ) | ||
{ | ||
if( beacon_data_len == BEACON_DATA_LEN ) | ||
{ | ||
Serial1.printBufferReverse(report->peer_addr.addr, 6, ':'); | ||
Serial1.print("\n"); | ||
Serial1.printf("%14s %d dBm\n", "RSSI", report->rssi); | ||
Serial1.printf( "iBeacon: " ); | ||
for( uint8_t i = 0; i < len; i++ ) | ||
Serial1.printf( "%02x ", buffer[i] ); | ||
Serial1.printf( "\r\n" ); | ||
|
||
} | ||
} | ||
} | ||
|
||
|
||
memset(buffer, 0, sizeof(buffer)); | ||
} | ||
|
||
Serial1.println(); | ||
|
||
// For Softdevice v6: after received a report, scanner will be paused | ||
// We need to call Scanner resume() to continue scanning | ||
Bluefruit.Scanner.resume(); | ||
} | ||
void loop() | ||
{ | ||
delay(10000); | ||
Bluefruit.Scanner.stop(); | ||
delay(10000); | ||
Bluefruit.Scanner.start(0); | ||
// nothing to do | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#include <Arduino.h> | ||
#include <Adafruit_TinyUSB.h> // for Serial | ||
|
||
#include <grove_sensor.hpp> | ||
|
||
int adcin = D6; | ||
int adcvalue = 0; | ||
float mv_per_lsb = 3600.0F/1024.0F; // 10-bit ADC with 3.6V input range | ||
|
||
void setup() { | ||
digitalWrite(PIN_POWER_SUPPLY_GROVE, HIGH); //grove power on | ||
pinMode(PIN_POWER_SUPPLY_GROVE, OUTPUT); | ||
|
||
Serial1.begin(115200); | ||
while ( !Serial1 ) delay(10); // for nrf52840 with native usb | ||
} | ||
|
||
void loop() { | ||
// Get a fresh ADC value | ||
adcvalue = analogRead(adcin); | ||
|
||
// Display the results | ||
Serial1.print(adcvalue); | ||
Serial1.print(" ["); | ||
Serial1.print((float)adcvalue * mv_per_lsb); | ||
Serial1.println(" mV]"); | ||
|
||
delay(1000); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#include <Arduino.h> | ||
#include <Wire.h> | ||
#include <Adafruit_TinyUSB.h> // for Serial | ||
|
||
#include <grove_sensor.hpp> | ||
|
||
TwoWire *wi = &Wire; | ||
|
||
void setup() | ||
{ | ||
//power on | ||
digitalWrite(PIN_POWER_SUPPLY_GROVE, HIGH); //grove power on | ||
pinMode(PIN_POWER_SUPPLY_GROVE, OUTPUT); | ||
|
||
|
||
Serial1.begin(115200); // start serial for output | ||
while ( !Serial1 ) delay(10); // for nrf52840 with native usb | ||
wi->begin(); // join i2c bus (address optional for main) | ||
} | ||
|
||
void loop() | ||
{ | ||
Serial1.println("Scanning address from 0 to 127"); | ||
for (int addr = 1; addr < 128; addr++) | ||
{ | ||
wi->beginTransmission(addr); | ||
if ( 0 == wi->endTransmission() ) | ||
{ | ||
if(addr==0x44) | ||
{ | ||
Serial1.print("Found sht40 slave addr: 0x"); | ||
Serial1.print(addr, HEX); | ||
Serial1.println(); | ||
} | ||
else if(addr==0x44) | ||
{ | ||
Serial1.print("Found mma7660 slave addr: 0x"); | ||
Serial1.print(addr, HEX); | ||
Serial1.println(); | ||
} | ||
else | ||
{ | ||
Serial1.print("Found: 0x"); | ||
Serial1.print(addr, HEX); | ||
Serial1.println(); | ||
} | ||
} | ||
} | ||
|
||
delay(5000); | ||
} | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
#include <Arduino.h> | ||
#include <Wire.h> | ||
#include <Adafruit_TinyUSB.h> // for Serial | ||
|
||
#include <grove_sensor.hpp> | ||
|
||
int interruptPin = D0; | ||
|
||
MMA7660 accelemeter; | ||
|
||
void digital_callback(void) | ||
{ | ||
MMA7660_DATA data; | ||
Serial1.print("Pin value: "); | ||
Serial1.println(digitalRead(interruptPin)); | ||
|
||
Serial1.print("TILT: "); | ||
accelemeter.getAllData(&data); | ||
Serial1.print(data.TILT); | ||
|
||
} | ||
|
||
|
||
void setup() | ||
{ | ||
//power on | ||
digitalWrite(PIN_POWER_SUPPLY_GROVE, HIGH); //grove power on | ||
pinMode(PIN_POWER_SUPPLY_GROVE, OUTPUT); | ||
Serial1.begin(115200); | ||
|
||
delay(1000); | ||
|
||
accelemeter.init(MMA7660_SHINTX|MMA7660_SHINTY|MMA7660_SHINTZ); | ||
|
||
pinMode(interruptPin, INPUT_PULLUP); | ||
attachInterrupt(interruptPin, digital_callback, ISR_DEFERRED | FALLING); | ||
|
||
} | ||
void loop() | ||
{ | ||
int8_t x; | ||
int8_t y; | ||
int8_t z; | ||
float ax,ay,az; | ||
accelemeter.getXYZ(&x,&y,&z); | ||
|
||
Serial1.print("x = "); | ||
Serial1.println(x); | ||
Serial1.print("y = "); | ||
Serial1.println(y); | ||
Serial1.print("z = "); | ||
Serial1.println(z); | ||
|
||
accelemeter.getAcceleration(&ax,&ay,&az); | ||
Serial1.println("accleration of X/Y/Z: "); | ||
Serial1.print(ax); | ||
Serial1.println(" g"); | ||
Serial1.print(ay); | ||
Serial1.println(" g"); | ||
Serial1.print(az); | ||
Serial1.println(" g"); | ||
Serial1.println("*************"); | ||
delay(500); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#include <Arduino.h> | ||
#include <Wire.h> | ||
#include <Adafruit_TinyUSB.h> // for Serial | ||
|
||
#include <grove_sensor.hpp> | ||
|
||
|
||
SensirionI2CSht4x sht4x; | ||
|
||
void setup() { | ||
//power on | ||
digitalWrite(PIN_POWER_SUPPLY_GROVE, HIGH); //grove power on | ||
pinMode(PIN_POWER_SUPPLY_GROVE, OUTPUT); | ||
|
||
Serial1.begin(115200); | ||
while (!Serial1) { | ||
delay(100); | ||
} | ||
|
||
Wire.begin(); | ||
|
||
uint16_t error; | ||
char errorMessage[256]; | ||
delay(1000); | ||
|
||
sht4x.begin(Wire); | ||
|
||
uint32_t serialNumber; | ||
error = sht4x.serialNumber(serialNumber); | ||
if (error) { | ||
Serial1.print("Error trying to execute serialNumber(): "); | ||
errorToString(error, errorMessage, 256); | ||
Serial1.println(errorMessage); | ||
} else { | ||
Serial1.print("Serial Number: "); | ||
Serial1.println(serialNumber); | ||
} | ||
} | ||
|
||
void loop() { | ||
uint16_t error; | ||
char errorMessage[256]; | ||
|
||
delay(1000); | ||
|
||
float temperature; | ||
float humidity; | ||
error = sht4x.measureHighPrecision(temperature, humidity); | ||
if (error) { | ||
Serial1.print("Error trying to execute measureHighPrecision(): "); | ||
errorToString(error, errorMessage, 256); | ||
Serial1.println(errorMessage); | ||
} else { | ||
Serial1.print("Temperature:"); | ||
Serial1.print(temperature); | ||
Serial1.print("\t"); | ||
Serial1.print("Humidity:"); | ||
Serial1.println(humidity); | ||
} | ||
} |
Oops, something went wrong.