Skip to content

Instantly share code, notes, and snippets.

View YongHuax's full-sized avatar

hooi yong hua YongHuax

View GitHub Profile
@YongHuax
YongHuax / LG01_P_JSON_AWSIOT.ino
Last active February 28, 2018 14:48
LG01_P_JSON_AWSIOT
//References
//https://jsonlint.com/
//https://forums.aws.amazon.com/thread.jspa?threadID=239208
//https://arduinojson.org/assistant/
//https://arduinojson.org/faq/how-to-reuse-a-jsonbuffer/?utm_source=github&utm_medium=issues
//https://github.com/bblanchon/ArduinoJson/issues/508
//https://github.com/bblanchon/ArduinoJson/blob/master/examples/StringExample/StringExample.ino
//https://github.com/bblanchon/ArduinoJson/tree/master/examples/JsonGeneratorExample
#include <ArduinoJson.h>
@YongHuax
YongHuax / LG01-P_AWS.ino
Created February 10, 2018 20:57
LG01-P Send data from ESP32 LoRa to AWSIot
#include <SPI.h>
#include <LoRa.h>
#include <Console.h>
#include <Process.h>
#define PABOOST true
#define BAND 433E6
void uploadData();
@YongHuax
YongHuax / testmqttvar
Last active February 10, 2018 20:28
Shell script for testing mqtt with data sent from ESP32 LoRa to LG01-P
#!/bin/sh
#The following code demonstrates a sending mqtt messages with data variables
# publish to topic yhtest with message data from LoRa
#$1 refers to the first data sent from the arduino MCU to the Linux module in the LG01-P ( data sent from ESP32 LoRa )
DATA=$1
@YongHuax
YongHuax / Lora_Receiver_LG01_P_Mqtt_var.ino
Created February 10, 2018 20:20
Final_Fyp_LoRa_Receiver_LG01_P_Mqtt_var
#include <SPI.h>
#include <LoRa.h>
#include <Console.h>
#include <Process.h>
#define PABOOST true
#define BAND 433E6
void uploadData();
@YongHuax
YongHuax / testmqtt
Last active February 10, 2018 19:41
Test for LG01-P to Mqtt
#!/bin/sh
#The following code demonstrates a basic command using mosquitto client to connect to public broker hivemq using port 1883
# publish to topic yhtest with message "ok"
#it is possible to copy and paste the following line of code to Dragino Linux cli to run command .
mosquitto_pub -h broker.hivemq.com -p 1883 -t yhtest -m "ok"
@YongHuax
YongHuax / Lora_Receiver_LG01_P_Mqtt.ino
Last active February 10, 2018 20:15
Final_Fyp_LoRa_Receiver_LG01_P_Mqtt
#include <SPI.h>
#include <LoRa.h>
#include <Console.h>
#include <Process.h>
#define PABOOST true
#define BAND 433E6
void uploadData();
@YongHuax
YongHuax / testAWS
Last active February 15, 2018 06:01
LG01-P Linux Script to AWSIot
#!/bin/sh
#when connecting to AWSIOT , a cert , privatekey and certificate authority file is required .
#after downloading the cert files when creating a thing , it is possible rename the files so that it is easier to
#call the file when writing the script and cli
#also note that aws things shadow update requires message to be in json to update
#to catch messages sent to things but are rejected due to improper json format , subscribe to things shadow update through mqtt.
# do remember to check the activity page for the AWsiot " thing" u have created to see whether the message is accepted or rejected
HOST="a1k3lzqvylq236.iot.ap-southeast-1.amazonaws.com"
@YongHuax
YongHuax / Final_OLED_LoRa_Sender.ino
Created February 8, 2018 23:05
FYP_Final_LoRa_Sender
/*
This is a simple example show the LoRa sended data in OLED.
The onboard OLED display is SSD1306 driver and I2C interface. In order to make the
OLED correctly operation, you should output a high-low-high(1-0-1) signal by soft-
ware to OLED's reset pin, the low-level signal at least 5ms.
OLED pins to ESP32 GPIOs via this connecthin:
OLED_SDA -- GPIO4
OLED_SCL -- GPIO15
@YongHuax
YongHuax / ESP32_LoRa_Wifi_Oled_Send
Created January 17, 2018 23:08
ESP32_LoRa_Wifi Send with OLED functionality
/*
This is a simple example show the LoRa sended data in OLED.
The onboard OLED display is SSD1306 driver and I2C interface. In order to make the
OLED correctly operation, you should output a high-low-high(1-0-1) signal by soft-
ware to OLED's reset pin, the low-level signal at least 5ms.
OLED pins to ESP32 GPIOs via this connecthin:
OLED_SDA -- GPIO4
OLED_SCL -- GPIO15
@YongHuax
YongHuax / ESP32_LoRa_Wifi_Oled_Send
Created January 17, 2018 23:08
ESP32_LoRa_Wifi Send with OLED functionality
/*
This is a simple example show the LoRa sended data in OLED.
The onboard OLED display is SSD1306 driver and I2C interface. In order to make the
OLED correctly operation, you should output a high-low-high(1-0-1) signal by soft-
ware to OLED's reset pin, the low-level signal at least 5ms.
OLED pins to ESP32 GPIOs via this connecthin:
OLED_SDA -- GPIO4
OLED_SCL -- GPIO15