Skip to content

Instantly share code, notes, and snippets.

View Tech-TX's full-sized avatar

StanJ Tech-TX

  • Dallas
View GitHub Profile
@Tech-TX
Tech-TX / PWM_test.ino
Last active November 21, 2020 19:44
generic test of the various PWM functions for the ESP8266 Arduino
// A simple test to exercise PWM, Tone and Servo functions, all controlled from the terminal.
// All PWM sources and WiFi are initially disabled, individually enabled from the terminal.
// If you have an RC filter on one of the PWM pins, you can read it at the A0 analog input.
// A 200-3K res & 10uf cap R-C work @ 500-40KHz PWM. Make sure your board supports 3.3V Ain!
//
// This code is released to the public domain with no guarantees whatsoever
// "If it breaks in half, you get to keep both halves." ~ George Carlin
#include <core_esp8266_waveform.h> // so we can independently disable PWM sources
#include <ESP8266WiFi.h> //the main WiFi routines
@Tech-TX
Tech-TX / design_details.txt
Created December 11, 2020 01:06
Development code for PMS5003, BME280 and TFT LCD for a dirt cheap particle counter
Objective of the design: use inexpensive components to produce a cleanroom-style particle counter that can be run semi-continuously, monitored from outside the cleanroom.
The 攀藤 (PlanTower) PMS5003 (fifth generation) or PMS7003 (seventh generation) dust sensor costs $15 to $22 on eBay from Shenzhen suppliers. It samples 0.1 liter and calculates dust particles in > 0.3um, 0.5um, 1um, 2.5um, 5um and 10um bins. In order to get a useful reading in a cleanroom, we need to add the results from 100 samples (10 liters of air) or the counts are too small to be reliable. ISO 14644-1:1999 specifies counts in 1 cubic metre of air, which would require 10,000 samples from this small sensor. 100 samples takes roughly 300 seconds to process, so sampling 1 m3 would take 500 minutes (8.3 hours). As this device is not intended to be a NIST-traceable particle counter, sampling at 1% should give a reasonable estimate of the cleanroom quality. Note that the two smallest particle bins have up to 50% uncertainty; the larger
@Tech-TX
Tech-TX / AutoSleepDemo.ino
Created April 17, 2021 13:03
Auto Sleep tests
#include <ESP8266WiFi.h>
#include <Schedule.h>
#include <PolledTimeout.h>
const char* AP_SSID = ""; // your router's SSID here
const char* AP_PASS = ""; // your router's password here
void setup() {
Serial.begin(74880);
while (!Serial);
@Tech-TX
Tech-TX / ForcedSleepDemo.ino
Last active April 17, 2021 21:19
Forced Sleep demo
#include <Schedule.h>
#include <PolledTimeout.h>
#define WAKE_UP_PIN D3 // D3/GPIO0, can also force a serial flash upload with RESET
// you can use any GPIO for WAKE_UP_PIN except for D0/GPIO16 as it doesn't support interrupts
void IRAM_ATTR wakeupPinIsr() {
schedule_function([]() { Serial.println("GPIO went from HI to LO"); });
}