Skip to content

Instantly share code, notes, and snippets.

@pinski1
pinski1 / I2C Master
Created June 20, 2012 14:45
An I2C Master peripheral written in VHDL.
LIBRARY ieee;
USE ieee.std_logic_1164.all;
USE ieee.std_logic_arith.all;
ENTITY i2c IS
PORT(
clock_L : IN STD_LOGIC; -- 400kHz
scl_H : INOUT STD_LOGIC;
sda_H : INOUT STD_LOGIC;
int_i2c_L : OUT STD_LOGIC;
/* Pin Map */
#define MOTOR_L_IN_1 16
#define MOTOR_L_IN_2 15
#define MOTOR_L_PWM 22
#define MOTOR_STBY 14
#define MOTOR_R_IN_1 17
#define MOTOR_R_IN_2 18
#define MOTOR_R_PWM 23
#define MOTOR_L_A 11
#define MOTOR_L_B 12
@pinski1
pinski1 / BasicGroundStation.ino
Last active September 28, 2015 06:43
Basic sketches to send and receive VGA camera images (as jpgs) via an RFM22 radio.
// rf22_server.pde
// -*- mode: C++ -*-
// Example sketch showing how to create a simple messageing server
// with the RH_RF22 class. RH_RF22 class does not provide for addressing or
// reliability, so you should only use RH_RF22 if you do not need the higher
// level messaging abilities.
// It is designed to work with the other example rf22_client
// Tested on Duemilanove, Uno with Sparkfun RFM22 wireless shield
// Tested on Flymaple with sparkfun RFM22 wireless shield
// Tested on ChiKit Uno32 with sparkfun RFM22 wireless shield
@pinski1
pinski1 / ESP8266_Dash_Button.ino
Last active October 16, 2015 13:49
An Amazon Dash-like button tied into IFTTT
/**
* Simple IoT button using the If This Then That(IFTTT) Maker Channel, an
* ESP8266-01 and lit arcade button.
*
* For connections advice:
* http://iot-playground.com/2-uncategorised/38-esp8266-and-arduino-ide-blink-example
*/
#include <ESP8266WiFi.h>
@pinski1
pinski1 / BatteryTester.ino
Last active March 21, 2019 16:54
eBike Battery Capacity Tester with LTC4151 & LCD Shield
/** Battery Characteriser
Arduino ???
LTC4151 power monitor
Load, 2x paralleled 10Ω 200Watt power resistors
DS18B20, 4x temperature sensors
Fans, 2x 120mm PWM-controlled PC FANs
SD Card, for logged data
LCD Display and keypad http://www.hobbytronics.co.uk/arduino-lcd-keypad-shield?keyword=LCD%20Shield
@pinski1
pinski1 / Wheel_Tester.ino
Last active June 5, 2016 13:53
Counts encoder ticks in order to enable motor characterisation.
/** Sketch to characterise motors.
*
* Needs the following libaries:
* https://github.com/PaulStoffregen/Encoder
* https://github.com/pololu/dual-vnh5019-motor-shield
* https://github.com/PaulStoffregen/MsTimer2
*/
#define ENCODER_OPTIMIZE_INTERRUPTS
#include <Encoder.h>
#include <DualVNH5019MotorShield.h>
/** @brief RC Mixer
* @detailed Takes 2 RC signals and mixes them to produce tank style steering. The results are scaled to ensure no stick travel is wasted.
*
* Algorithm copied from here: http://electronics.stackexchange.com/questions/19669/algorithm-for-mixing-2-axis-analog-input-to-control-a-differential-motor-drive
*
* @param inThrottle The throttle channel RC value, constrained to -255 and +255
* @param inYaw The steering channel RC value, constrained to -255 and +255
* @param outLeft The left motor output, constrained to -255 and +255
* @param outRight The right motor output, constrained to -255 and +255
*/
@pinski1
pinski1 / ButtonTest.py
Created May 16, 2017 19:40
Quick script to test the 4 buttons for my Sinclair Cpi display.
#!/usr/bin/env python
from signal import pause
import gpiozero
# pins = 4, 17, 24, 25
print("Testing buttons")
buttonOne = gpiozero.Button(4)
@pinski1
pinski1 / MemberStorage.md
Created June 8, 2017 21:44
Some musings on member storage.

I'm a member of Cambridge Makespace (where I live) and London Hackspace (where I used to live). Both spaces are fairly mature and have a reasonable number of members for their available space. At a Makespace new member induction each new member is told that they may have a Really Useful 35L box to store items in (less solvents/flammables). This works really well as they are cheap (~£13), robust and store quite a lot of stuff. We have shelving units in our corridors which take ~15 of these boxes so storing the 200 odd boxes doesn't take up too much room.

However we now have enough members that problems with the system are beginning to show. These seem to be: claiming of permanent workstations, excessive personal storage and large item storage. The first two problems largely seem to be solved with tellings off, we've not progressed to formal disciplinary actions yet. We're currently working on using some unused underfloor 'rooms' as large project sto

#!/usr/bin/env python3
"""
something
https://piwars.org/2018-competition
"""
import sys
import time