Skip to content

Instantly share code, notes, and snippets.

@Lukelectro
Lukelectro / main.c
Last active March 1, 2023 13:33
Atmega328p-based DC-AC converter to ring a T65 phone
/*
* Atmega328p-based DC-AC converter to ring a T65 phone.
* http://www.eluke.nl for schematic
*/
#include <avr/io.h>
#include <avr/interrupt.h>
#define F_CPU 8e6
#include <util/delay.h>
[Unit]
Description="run web radio receiver"
After=multi-user.target
[Service]
Type=simple
User=USERNAME_HIER_INVULLEN
Group=USERGROUP_HIER_INVULLEN
ExecStart=/usr/bin/python3 /home/USERNAME/runradio.py
/*
simple example for optical distance sensor with IR LED and BPW40
LED has 470R series resistor and is connected to pin given as IRLED (Pin 8 / PB0)
BPW40 is wired with collector to +5V, emitor to 1k8 to ground.
Emitor of BPW40 is capacitively coupled with 100 nF to pin given as BPW40 (pin A1, PC1)
That pin also has a 100k resistor to ground
(D8) + 5V
| |
470R |
@Lukelectro
Lukelectro / runradio.py
Last active July 27, 2025 09:45
radio stream receiver for raspi, bodged together from url mentioned in comments and a few other sources: A website with streaming urls (https://hendrikjansen.nl/henk/streaming.html) and a few adafruit / sparkfun tutorials on audio-to-usb-soundcard and readonly OS. (strangely, after routing audio to card 1 which is the usb card and setting the FS…
#!/usr/bin/env python3
# https://raspberrytips.nl/internet-radio-luisteren-raspberry-pi/
# modified to use vlc and a simple hd44780lcd + 3 buttons
# Re-modified 10-2024 to use --loop and --https-reconnect hoping to fix a 'sometimes stops playing' issue
# Re-modifief 07-2025 to use ffplayer instead of vlc. vlc --loop loops the playlist, should use --repeat to use the item, but --http-reconnect seems not to work an it is a known wont fix issue anyway: https://bugs.launchpad.net/ubuntu/+source/vlc/+bug/790216 so I'll simply use ffplay which is included on raspbian. And put it in a loop to restart when crashed:.
# while true; do ffplay -i https://icecast.omroep.nl/radio1-bb-aac -nodisp -vn -autoexit; sleep 5; done
#should also split all hd44780 to another file, but hey...
# generated by Slic3r 1.3.0 on 2022-01-30 13:05:52
adaptive_slicing = 0
adaptive_slicing_quality = 75%
avoid_crossing_perimeters = 0
bed_shape = 0x0,190x0,190x190,0x190
bed_temperature = 0
before_layer_gcode =
between_objects_gcode =
bottom_infill_pattern = rectilinear
bottom_solid_layers = 0
@Lukelectro
Lukelectro / DemoReel100_modified.ino
Created January 7, 2022 20:51
Showreel for 241 pixel nested LED-rings, based on FastLED's showreel100, includes a modified Fire2012
#include <FastLED.h>
FASTLED_USING_NAMESPACE
// FastLED "100-lines-of-code" demo reel, showing just a few
// of the kinds of animation patterns you can quickly and easily
// compose using FastLED.
//
// This example also shows one easy way to define multiple
// animations patterns and have them automatically rotate.
@Lukelectro
Lukelectro / main.c
Created November 6, 2021 21:07
Solar lamp msp430
#include <msp430.h>
#include <stdbool.h>
/**
* slim solarlampje.
* Doel:
* aan net voor zonsopgang tot zonsopgang,
* aan na zonsondergang, maar beperkte tijd (niet hele nacht)
* dus de "vorige" zonsondergang/opgang onthouden.
*
@Lukelectro
Lukelectro / 7003_asy.ino
Created July 18, 2021 15:09
Demo on 7003 asy board
/*
* 10x PD2437 display module
* aangepast vanaf het voorbeeld van Aart
*
* Logic board:
*
* 34_pin function register function
*
* 1,2,3,4 V+
*
/*
* 10x 9443 display module
* Aart 06-2021
*
* Logic board:
*
* 34_pin function register function
*
* 1,2,3,4 V+
*
@Lukelectro
Lukelectro / E-ink spielerei
Last active July 18, 2020 19:49
E-Ink ED060SC7 differs from ...SC4 (Swap X & Y). STM32F103 has less RAM, so only Proof of Concept.
[empty file, added to change gist title]