While I made this for my Commodore C64, it is applicable for many things.
It started with some cheap displays from Ali, and some leftover Wemos D1 from my Pressure Lab project.
I Started measuring the audio output from sound devices and from my C64. I soon discovered that I needed some way to get the offset and amplification correct for the analogue input of a Wemos. (0-3v3)
So a little op-amp circuit was born, but not without some struggles. I forgot many things about amplifiers. It was one of the first school books I got rid of. (Sorry mister Rafaela)
After searching the internet and posting a question on Reddit I ended up with the following.
R1 and R2 are 100M. The potentiometer P1 allows me to set the offset. R3 is 1M C1 is 100nF to decouple the audio signal from the RCA.
R4 is 47K and C2 is 330nF (thanks tycho205) Cimportant=1/(2πfR2) where f is the lowest frequency of interest. In this case Cimportant should be about 330nF
LM324 is a quad amplifier, leftover from another project. Note, the SINGLE RAIL power.
P2 potentiometer is 2M (leftover) and gives me a variable amplifying opportunity.
A = Audio input
B = Setting the offset with P1
C = Setting the amplification
Below input signal (note negative values) above amplified signal with offset!
The displays are 3 Wemos controllers with a cheap I2C display. These are just fast enough to do FFT.
Analogue in is the output from the OP-amp offsetter ..
CODE
Needs cleaning up, and a better stabilize routine.
A while ago I made a little notify thingy using an LCD display, LED, button and a buzzer.
V1V2
Some friends of mine made one also, and today I was talking to a new guy. I could not find this project on my site .. again .. so I’ll post it now.
Some things it does right now
Front door opens
Door bell rings (because my lab is in the garden)
Girlfriend is 10Km away, so let’s start cooking
Garage door opens (friend of mine uses this to know when kids arrive)
More .. because it’s very easy to customize in Home Assistant
Doorbell pressed: Led starts blinking, backlight LCD enabled, text displayed on LCD, Buzzer sounds (or plays a RTTTL ringtone) LCD backlight on and buzzer beep until acknowledge button pressed.
Heating for brewing: temperature on display, led on when temperature reached. Press acknowledge to start timer.
I was planning to make a RSS reader using this display, but I came across a weather display project I wanted to check out. (So I probably end up buying another one)
There are many questions and issues around this project using the S3.
Combining a GPS module, compass, a LED ring and some code, I want to make a little device which shows you the way to the nearest … something.
To make it completely standalone, I have to use a SIM module. (Same as I have used before) This POC will use my phone as hotspot.
The LED ring will show the direction to go.
Edit: Maybe not a LED ring but a little display.
GPS moduleCompass moduleLedring
As previously posted, I was playing with Overpass turbo. Using an API, I can use code to query this.
Arduino sends latitude, longitude to my webserver
Webserver queries API for neastest POIs and calculates distance.
Send data from webserver to arduino
Arduino uses heading data to light up direction LED (also on secondary display with distance info?) edit: and shop info
Test code for my web server to query the data
import overpy
import math
api = overpy.Overpass()
# This location will be filled with data from GPS module on Arduino.
latitude = 52.2270745 # Center latitude (e.g. Berlin)
longitude = 5.177519 # Center longitude
box_size = 0.05 # Box size in degrees (about ~5 km)
south = latitude - box_size
north = latitude + box_size
west = longitude - box_size
east = longitude + box_size
def haversine(lat1, lon1, lat2, lon2):
R = 6371 # Earth radius in km
phi1 = math.radians(lat1)
phi2 = math.radians(lat2)
d_phi = math.radians(lat2 - lat1)
d_lambda = math.radians(lon2 - lon1)
a = math.sin(d_phi / 2)**2 + math.cos(phi1) * math.cos(phi2) * math.sin(d_lambda / 2)**2
c = 2 * math.atan2(math.sqrt(a), math.sqrt(1 - a))
return R * c # Distance in kilometers
# Calculate bearing in degrees (0-360)
def bearing(lat1, lon1, lat2, lon2):
phi1 = math.radians(lat1)
phi2 = math.radians(lat2)
delta_lon = math.radians(lon2 - lon1)
x = math.sin(delta_lon) * math.cos(phi2)
y = math.cos(phi1) * math.sin(phi2) - math.sin(phi1) * math.cos(phi2) * math.cos(delta_lon)
initial_bearing = math.atan2(x, y)
compass_bearing = (math.degrees(initial_bearing) + 360) % 360 # Normalize to 0–360
return compass_bearing
# Overpass QL query
query = f"""
[out:json];
node
["shop"="alcohol"]
({south}, {west}, {north}, {east});
out body;
>;
out skel qt;
"""
try:
result = api.query(query)
# Collect and sort places by distance
places = []
for node in result.nodes:
node_lat = float(node.lat)
node_lon = float(node.lon)
distance = haversine(latitude, longitude, node_lat, node_lon)
direction = bearing(latitude, longitude, node_lat, node_lon)
name = node.tags.get("name", "Unnamed")
places.append((distance, direction, name, node_lat, node_lon))
places.sort()
print(f"Found {len(places)} alcohol-related places sorted by distance:")
for dist, dir_deg, name, lat, lon in places:
print(f"- {name} at ({lat:.5f}, {lon:.5f}) — {dist:.2f} km, {dir_deg:.0f}°")
except Exception as e:
print(f"Error: {e}")
Output:
Found 10 alcohol-related places sorted by distance:
- The Skiff at (52.22583, 5.17860) — 0.16 km, 152°
- Onzewijnen at (52.22612, 5.17045) — 0.49 km, 258°
- Gall & Gall at (52.23244, 5.19204) — 1.15 km, 59°
- Gall & Gall at (52.21536, 5.16735) — 1.48 km, 208°
- Eric's Beer Craft at (52.21549, 5.16632) — 1.50 km, 211°
- Slijterij at (52.21082, 5.15692) — 2.29 km, 218°
- Gall & Gall at (52.21590, 5.14074) — 2.80 km, 244°
- Gall & Gall at (52.25422, 5.22705) — 4.53 km, 48°
- Gall & Gall at (52.26808, 5.18348) — 4.58 km, 5°
- Il DiVino at (52.27507, 5.16414) — 5.41 km, 350°
Example using Overpass Turbo to find breweries
Other ideas
Geocaching (Thanks Vincent)
Find each other at festivals?
UPDATE
Building the hardware : First design
Screen programming (First setup)
Some test code
#include "SPI.h"
#include "Adafruit_GFX.h"
#include "Adafruit_GC9A01A.h"
// Overrule stuff
#define TFT_CS 18 // Chip select
#define TFT_DC 5 // Data/command mode
#define TFT_BL 4 // Backlight control
#define TFT_MOSI 12 // SPI Out AKA SDA
#define TFT_SCLK 13 // Clock out AKA SCL
#define TFT_MISO -1 // pin not used
#define TFT_RST 23 // Reset ################# IMPORTANT, won't work without!! Took me a hour!
// Need this changed from example also
Adafruit_GC9A01A tft(TFT_CS, TFT_DC,TFT_MOSI,TFT_SCLK,TFT_RST,TFT_MISO);
float angle = 0;
void setup() {
tft.begin();
tft.setRotation(0);
tft.fillScreen(GC9A01A_BLACK);
drawCompassFace();
}
void loop() {
drawNeedle(angle, GC9A01A_RED);
delay(1000);
drawNeedle(angle, GC9A01A_BLACK); // Erase previous needle
angle += 15;
if (angle >= 360) angle = 0;
tft.setCursor(60, 100);
tft.setTextColor(GC9A01A_WHITE); tft.setTextSize(2);
tft.println("230 Meters");
}
// Draw static compass face
void drawCompassFace() {
int cx = tft.width() / 2;
int cy = tft.height() / 2;
int radius = 100;
tft.drawCircle(cx, cy, radius, GC9A01A_WHITE);
tft.setTextColor(GC9A01A_WHITE);
tft.setTextSize(1);
tft.setCursor(cx - 3, cy - radius + 5); tft.print("N");
tft.setCursor(cx - 3, cy + radius - 10); tft.print("S");
tft.setCursor(cx - radius + 5, cy - 3); tft.print("W");
tft.setCursor(cx + radius - 10, cy - 3); tft.print("E");
}
// Draw compass needle
void drawNeedle(float angleDeg, uint16_t color) {
int cx = tft.width() / 2;
int cy = tft.height() / 2;
float angleRad = angleDeg * DEG_TO_RAD;
int x = cx + cos(angleRad) * 90;
int y = cy + sin(angleRad) * 90;
tft.drawLine(cx, cy, x, y, color);
}
Its SSID started with ESP. So I probably am the one responsible for its existence. I’ve got a sh*tload of ESPs/NodeMCUs/8266 turned on 24-7.
Using a Wifi analizer I could narrow it down to my livingroom. Checked all devices, and they are all connected to my AccessPoint. (So no fallback AP mode)
The problem with this method is that you can’t figure out a direction.
So I used this on my Laptop.
See graphs on the left
This is a directional antenna.
Using Wireshark and wavemon, I could find the direction.
There were only two devices in the direction with the strongest signal. My photo viewer remote, and my mini turntable controller with RFID.
But these devices are working just fine! .. So lets disconnect the power. So it IS the mini recordplayer!
Lets look at the code. (part of)
WiFi.mode(WIFI_AP_STA);
I should have used
WiFi.mode(WIFI_STA);
Now it was a client AND an Access Point!
Mystery solved!
"If something is worth doing, it's worth overdoing."