Skip to content

Pinouts

tinySniff uses the following tinyCore pins. These pins are in use whenever the HAT is mounted, so avoid assigning them to other peripherals in your own sketches.



SignalPinSensorMeasures
H2SA0GM-602BHydrogen sulfide
COA1GM-702BCarbon monoxide
CH4A2GM-402BMethane / combustible gas

Each sensor sits in a voltage divider, so reading one is a plain analogRead():

#define PIN_H2S A0
#define PIN_CO A1
#define PIN_CH4 A2
void setup() {
analogReadResolution(12); // 0 to 4095
pinMode(PIN_H2S, INPUT);
pinMode(PIN_CO, INPUT);
pinMode(PIN_CH4, INPUT);
}
void loop() {
int h2s = analogRead(PIN_H2S);
}

The A0/A1/A2 aliases come from the tinyCore board library. Use them rather than raw GPIO numbers so your sketch stays portable across board revisions.



SignalPinDescription
BUZZER13Digital pin 13

Pin 13 is labeled as a digital pin on the tinyCore, but every GPIO on the ESP32-S3 can do PWM, so tone() works here without any special setup:

#define PIN_BUZZER 13
pinMode(PIN_BUZZER, OUTPUT);
tone(PIN_BUZZER, 2600, 120); // 2.6 kHz for 120 ms
noTone(PIN_BUZZER); // silence it early


SignalPinDescription
BTNRXActive-low, internal pull-up enabled via INPUT_PULLUP
#define PIN_BUTTON RX
pinMode(PIN_BUTTON, INPUT_PULLUP);
if (digitalRead(PIN_BUTTON) == LOW) {
// pressed
}

No external resistor is needed. The ESP32’s internal pull-up holds the pin HIGH, and pressing the button shorts it to GND.

Every demo debounces it the same way, because a mechanical switch bounces for a few milliseconds and would otherwise register as several presses:

int reading = digitalRead(PIN_BUTTON);
if (reading != lastButtonState) lastDebounceTime = millis();
if ((millis() - lastDebounceTime) > 50) {
static int buttonState = HIGH;
if (reading != buttonState) {
buttonState = reading;
if (buttonState == LOW) {
// real press, act here
}
}
}
lastButtonState = reading;

The pattern is: note the moment the reading last changed, and only believe it once it has held still for 50 ms.

The RX pin doubles as the ESP32’s UART receive line. In practice this rarely causes trouble, since the button is open (HIGH) by default. Just avoid holding it down while uploading firmware.



PinHAT FunctionNotes
A0H₂S sensorAnalog input, GM-602B
A1CO sensorAnalog input, GM-702B
A2CH₄ sensorAnalog input, GM-402B
13BuzzerDigital out / PWM via tone()
RXButtonActive-low, internal pull-up

All other tinyCore pins stay available for your own use when the tinySniff HAT is mounted, including A3, A4, and A5, and the SD card interface that SD Card Logger uses.