Skip to content

Instantly share code, notes, and snippets.

View nophead's full-sized avatar

Chris nophead

View GitHub Profile
@nophead
nophead / coolometer.py
Last active February 1, 2016 12:20
Coolometer data gathering script
import serial
probe_z = 45
x_range = [-40, 40]
y_range = [-30, 60]
step = 2
def do_command(port,s): # send command and look for ok reply
while True:
port.write(s)
@nophead
nophead / coolometer.gnu
Last active February 2, 2016 16:35
Gnuplot script for displaying results from coolometer.py
set style data lines
set pm3d implicit
set hidden3d
set grid
set contour base
set cntrparam levels auto 20
set xlabel "X"
set ylabel "Y"
set zlabel "mW"
set palette negative
set style data lines
set pm3d implicit
set hidden3d
set grid
set cntrparam levels auto 20
set xlabel "X"
set ylabel "Y"
set zlabel "mW"
set palette negative
set pm3d border
2014-10-23 16:58:02,141 - SERIAL - DEBUG - Enabling serial logging
2014-10-23 16:58:09,247 - SERIAL - DEBUG - Changing monitoring state from 'Operational' to 'Closed'
2014-10-23 16:58:13,303 - SERIAL - DEBUG - Connection closed, closing down monitor
2014-10-23 16:58:16,878 - SERIAL - DEBUG - Changing monitoring state from 'Offline' to 'Opening serial port'
2014-10-23 16:58:16,883 - SERIAL - DEBUG - Connecting to: /dev/ttyAMA0
2014-10-23 16:58:16,922 - SERIAL - DEBUG - Connected to: Serial<id=0x1ad8fb0, open=True>(port='/dev/ttyAMA0', baudrate=115200, bytesize=8, parity='N', stopbits=1, timeout=20.0, xonxoff=False, rtscts=False, dsrdtr=False), starting monitor
2014-10-23 16:58:16,926 - SERIAL - DEBUG - Changing monitoring state from 'Opening serial port' to 'Connecting'
2014-10-23 16:58:36,974 - SERIAL - DEBUG - Send: M105
2014-10-23 16:58:37,000 - SERIAL - DEBUG - Recv: ok T:21.5 /0.0 B:21.1 /0.0 @:0%
2014-10-23 16:58:37,005 - SERIAL - DEBUG - Changing monitoring state from 'Connecting' to 'Operational'
Send: M105
Recv: ok T:17.2 /0.0 B:17.6 /0.0 T0:17.2 /0.0 @:0.00 B@:0.00
Send: M20
Recv: Begin file list
Recv: SQUARE.GCO
Recv: E3DFAN~1.GCO
Recv: E3DUST~1.GCO
Recv: S_GEAR~1.GCO
Recv: ATXSHORT.GCO
Recv: DMOTORX2.G
@nophead
nophead / lcr_meter_screen.scad
Last active March 28, 2016 15:31
Screening for Elektor 500ppm LCR meter LCD PCB.
//
// Elektor 500ppm LCR meter PCB PCB screen
//
$fa = 6;
$fs = 0.5;
thickness = 0.75;
pcb_clearance = 1.5;
pcb_width = 79;
pcb_length = 100;
@nophead
nophead / corner_orbit.scad
Last active March 21, 2017 13:06
Demo of corner orbit paths for laser engraving without stopping
paths = [ // a house
[[-50, 0], [-50, 80], [0, 120], [50, 80], [50, 0], [8, 0], [8, 30], [-8, 30], [-8, 0],[-50, 0]],
[[-40, 50], [-40, 70], [-20, 70], [-20, 50], [-40, 50]],
[[ 20, 10], [ 20, 30], [ 40, 30], [ 40, 10], [ 20, 10]],
[[ 20, 50], [ 20, 70], [ 40, 70], [ 40, 50], [ 20, 50]],
[[-40, 10], [-40, 30], [-20, 30], [-20, 10], [-40, 10]],
];
home = [-150, 150]; // where to start from
//
// GNU GPL v2
// nop.head@gmail.com
// hydraraptor.blogspot.com
//
// Adapts ESP12 module to 0.1" grid.
//
eps = 1/128; // small fudge factor to stop CSG barfing on coincident faces.
layer_height = 0.25; // slicer layer height
extrusion_width = 0.5; // slicer extrusion width
@nophead
nophead / void_test.scad
Created April 3, 2018 15:42
OpenSCAD script to test squashed wall theory
layer_height = 0.25; // slicer layer height
extrusion_width = 0.5; // slicer extrusion width
nozzle = 0.45; // extruder nozzle aperture
squeezed_wall = extrusion_width - layer_height / 2 + nozzle / 2 + extrusion_width / 2;
wall = 2 * extrusion_width;
w = 20;
h = 10;
base = 1;
difference() {
@nophead
nophead / hspi_slave_begin.cpp
Last active March 31, 2019 06:55
How to set up ESP8266 HSPI to spy on a SPI bus
void hspi_slave_begin() {
pinMode(SCK, SPECIAL); // Both inputs in slave mode
pinMode(MOSI, SPECIAL);
SPI1C = 0; // SPI_CTRL_REG MSB first, single bit data mode.
SPI1S = SPISE | SPISBE | SPISCD | 0x3E0;// SPI_SLAVE_REG, set slave mode, WR/RD BUF enable, CMD define, enable interrupts
SPI1U = SPIUSSE; // SPI_USER_REG. SPI_CK_I_EDGE
SPI1CLK = 0; // SPI_CLOCK_REG
SPI1U1 = 7 << SPILADDR; // SPI_USER1_REG, set address length to 8 bits
SPI1U2 = 7 << SPILCOMMAND; // SPI_USER2_REG, set command length to 8 bits
SPI1S1 = (length * 8 - 1) << SPIS1LBUF; // SPI_SLAVE1_REG, SPI_SLV_BUF_BITLEN = 12 bytes