Skip to content

Instantly share code, notes, and snippets.

@Dvorson
Dvorson / gist:aaee85fb6370d61dbf0530146fb62f94
Created January 12, 2018 19:46
ESP32 deep sleep & wakeup on PIR & post 1 to thingspeak
#include <ThingSpeak.h>
#include <WiFi.h>
#include <WiFiMulti.h>
#define BUTTON_PIN_BITMASK 0x200000000 // 2^33 in hex
unsigned long myChannelNumber = ******;
const char * myWriteAPIKey = "******";
RTC_DATA_ATTR int bootCount = 0;
WiFiMulti wifiMulti;
@Dvorson
Dvorson / MPU9250.ino
Created January 13, 2018 21:28
MPU9250 10DoF sensor I2C readings
/* MPU9250_MS5637_t3 Basic Example Code
by: Kris Winer
date: April 1, 2014
license: Beerware - Use this code however you'd like. If you
find it useful you can buy me a beer some time.
Demonstrate basic MPU-9250 functionality including parameterizing the register addresses, initializing the sensor,
getting properly scaled accelerometer, gyroscope, and magnetometer data out. Added display functions to
allow display to on breadboard monitor. Addition of 9 DoF sensor fusion using open source Madgwick and
Mahony filter algorithms. Sketch runs on the 3.3 V 8 MHz Pro Mini and the Teensy 3.1.
@Dvorson
Dvorson / hmdt.ino
Created January 21, 2018 19:02
Esp8266 Soil humidity deepsleep thingspeak
/*
* This sketch trys to Connect to the best AP based on a given list
*
*/
#include <ESP8266WiFi.h>
#include <ESP8266WiFiMulti.h>
#include <ThingSpeak.h>
unsigned long myChannelNumber = *;
@Dvorson
Dvorson / sht21.ino
Last active March 18, 2019 18:56
sht21 + bmp280 + esp8266 wifi thigspeak weather station
/****************************************************************
* SHT21_Demo
*
* An example sketch that reads the sensor and prints the
* relative humidity to the serial port
*
***************************************************************/
#include <Wire.h>
#include "SHT21.h"
@Dvorson
Dvorson / gps_gsm_2560.ino
Last active February 12, 2018 17:06
gsm + gps + voltmeter + mega2560
#include <MicroNMEA.h>
String input;
String lastValidTime = "";
String gpsInfo = "";
bool isGpsLockSent = false;
char bufferGPRS_Serial[200];
char bufferGPS_Serial[200];
byte RST = 2;
char nmeaBuffer[200];
@Dvorson
Dvorson / neom8n_nodeMCU_ssd1306.ino
Created February 27, 2018 09:20
NodeMCU + GPS + LCD
#include "SSD1306.h"
#include <SoftwareSerial.h>
#include <MicroNMEA.h>
SSD1306 display(0x3c, D3, D4);
SoftwareSerial gps(D8, D7, false, 256);
char nmeaBuffer[100];
MicroNMEA nmea(nmeaBuffer, sizeof(nmeaBuffer));
long cntr = 0;
HardwareSerial& GSM = Serial1;
byte RESET_PIN = 2;
String lastNum = "";
/* String readSerial() {
Serial.println("readSerial");
int _timeout = millis() + 10000;
while (!GSM.available() && millis() < _timeout ) {
Serial.println("GSM is not available... repeating");
}
#include <SoftwareSerial.h>
#include <Wire.h>
SoftwareSerial SIM800(8,9);
byte RESET_PIN = 6;
byte ELC = A1;
byte LOAD_PIN = 4;
byte REF_PIN = A3;
byte GPSI2CAddr = 8;
#include <SoftwareSerial.h>
#include <MicroNMEA.h>
#include <Wire.h>
SoftwareSerial GPS(4, 3);
char nmeaBuffer[100];
MicroNMEA nmea(nmeaBuffer, sizeof(nmeaBuffer));
String lastRegisteredLatitude = "";
String lastRegisteredLongitude = "";
String lastRegisteredSpeed = "";
#include <Wire.h>
byte GPSI2CAddr = 8;
String I2CRequest(String cmd, byte numBytes) {
Wire.beginTransmission(8);
Wire.write(cmd.c_str());
Wire.endTransmission();
Wire.requestFrom(GPSI2CAddr, numBytes);
String resp = "";