Skip to content

Instantly share code, notes, and snippets.

View futureshocked's full-sized avatar

Peter Dalmaris futureshocked

View GitHub Profile
@futureshocked
futureshocked / frequency_response_RC_low-pass_filter.py
Created May 17, 2025 03:57
This Python script visualizes the frequency response (Bode magnitude plot) of a first-order RC low-pass filter.
import numpy as np
import matplotlib.pyplot as plt
# Define resistor and capacitor values
R = 1e3 # Resistance in ohms
C = 1e-6 # Capacitance in farads
# Calculate the cutoff frequency
fc = 1 / (2 * np.pi * R * C)
@futureshocked
futureshocked / first_order_rc_filters_activity_4.py
Created May 15, 2025 04:30
This Python script analyzes and visualizes the behavior of an RC high-pass filter across various input signal frequencies.
import numpy as np
import matplotlib.pyplot as plt
R = 2e3
C = 100e-9
fc = 1 / (2 * np.pi * R * C)
print(f"Cutoff frequency: {fc:.2f} Hz\n")
frequencies = [200, 500, 1000, 2000, 5000, 10000]
@futureshocked
futureshocked / SH1106_128x64_i2c_QTPY.ino
Created February 26, 2025 03:02
I2C header tested using a SH1106 128x64 OLED for techexplorations.com/blog/course/advanced-pcb-design-kicad
/*********************************************************************
This is an example for our Monochrome OLEDs based on SH110X drivers
This example is for a 128x64 size display using I2C to communicate
3 pins are required to interface (2 I2C and one reset)
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!
@futureshocked
futureshocked / sd_card_v1.ino
Created February 26, 2025 03:01
SD card module tester for techexplorations.com/blog/course/advanced-pcb-design-kicad
#include <SPI.h>
#include <SD.h>
#define SD_CS_PIN 0 // Chip Select (CS) pin for SD card (GPIO0)
void setup() {
// Initialize serial communication for debugging
Serial.begin(115200);
while (!Serial);
@futureshocked
futureshocked / photosensor_v1.ino
Created February 26, 2025 03:00
Photosensor tester for techexplorations.com/blog/course/advanced-pcb-design-kicad
#define TEMT6000_PIN 1 // GPIO pin connected to the TEMT6000X01 sensor
void setup() {
// Start the serial communication
Serial.begin(115200);
while (!Serial);
// Configure the analog pin
pinMode(TEMT6000_PIN, INPUT);
}
@futureshocked
futureshocked / microphone.ino
Created February 26, 2025 02:59
Audio sensor tester for techexplorations.com/blog/course/advanced-pcb-design-kicad
#define MIC_PIN 5 // GPIO 5 is connected to the microphone
void setup() {
// Start serial communication for debugging
Serial.begin(115200);
while (!Serial);
// Configure GPIO 5 as input for the microphone signal
pinMode(MIC_PIN, INPUT);
}
@futureshocked
futureshocked / LED_blink.ino
Created February 26, 2025 02:58
LED tester for the exposed GPIOs for techexplorations.com/blog/course/advanced-pcb-design-kicad
@futureshocked
futureshocked / i2c_addrs_finder.ino
Created February 26, 2025 02:57
I2C address scanner for techexplorations.com/blog/course/advanced-pcb-design-kicad
#include <Wire.h>
#define SDA_PIN 4 // SDA pin connected to GPIO 04
#define SCL_PIN 3 // SCL pin connected to GPIO 03
void setup() {
// Start serial communication for debugging
Serial.begin(115200);
while (!Serial);
@futureshocked
futureshocked / flash_v1.ino
Created February 26, 2025 02:56
Flash memory tester (SPI) for techexplorations.com/blog/course/advanced-pcb-design-kicad
#include <EEPROM.h>
#define EEPROM_SIZE 512 // Size of the EEPROM (in bytes)
#define CS_PIN 10 // Chip Select (CS) pin for SPI flash (GPIO10)
void setup() {
// Initialize serial communication for debugging
Serial.begin(115200);
while (!Serial);
@futureshocked
futureshocked / bme280_v1.ino
Created February 26, 2025 02:56
BME280 tester for techexplorations.com/blog/course/advanced-pcb-design-kicad
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h> // Include the Adafruit BME280 library
#define SDA_PIN 4 // SDA pin connected to GPIO 04
#define SCL_PIN 3 // SCL pin connected to GPIO 03
#define BME280_ADDRESS 0x76 // Specify the I2C address of the BME280 sensor
Adafruit_BME280 bme; // Create an instance of the BME280 sensor