Skip to content

Instantly share code, notes, and snippets.

@pingud98
pingud98 / CPiThreshold.ino
Last active December 18, 2016 17:43
Cosmic Pi Threshold readback
#include <Wire.h>
//this code sets values in the MAX5387LAUD+ via I2C.
//it then reads back those values over A1 and A2 inputs
//The ADC is set to 12 bits for the DUE
//Channels are scanned in parallel (0 to 255)
//then alternatively ascending and descending.
//Output is a CSV over serial at 9600bps.
//this test works when testing with board 2
@pingud98
pingud98 / CosmicChannel0read
Created December 20, 2016 20:59
Read the ADC values from Cosmic Pi whilst a Vbias is applied.
unsigned long start_time;
unsigned long stop_time;
unsigned long values[1000];
const int SS_pin = 42; //tbc
const int SCK_pin = 44;
const int MISO_pin = 22;
const int MOSI_pin = 43;
String intextbuf;
String extextbuf;
@pingud98
pingud98 / CosmicScanner
Last active December 31, 2016 01:09
Cosmic Pi voltage scanner and ADC histogram production in CSV format.
//Cosmic Pi histogram program
//this compiles histograms from the ADC for different HV Bias levels
//it is used to profile the detection of muons and noise
//updated to give horizontal row output rather than columns, easier to process
//only prints values from 500 to 1500
//the first set of samples seem to be noisy for some reason (?)
unsigned long start_time;
unsigned long stop_time;
unsigned int values[2000];
@pingud98
pingud98 / OneTimePadInstructions.txt
Last active February 11, 2017 18:50
Version 1 of One Time Pad specification.
Specification for one time pad use.
One Time Pad must be smaller than 4Gb!
File format for transmission data (cyphertext):
Part 0 - 32 bits, the MD5 hash of the OTP used for encoding (before encoding)
Part 1 - 32 bits, indicating the address of the start bit.
Part 2 - The message, no minimum length imposed.
Message input format: Ascii text (for starters)
@pingud98
pingud98 / MD5SUMS
Created February 12, 2017 22:07
MD5 Sums for my One Time Pads
d465fd28e22ed9f083dc51bbbf802d9b *file1.zip
eb92e26bbff0fe135b96d9859ea8979b *file2.zip
@pingud98
pingud98 / RFIDtest.ino
Created May 31, 2017 17:48
Grove RFID reader - recognise a tag and blink LED
//Based on example code from SEEED studio wiki
//for 125kHz GROVE RFID reader
//GPL V3
/*
link between the computer and the SoftSerial Shield
at 9600 bps 8-N-1
Computer is connected to Hardware UART
SoftSerial Shield is connected to the Software UART:D2&D3
*/
@pingud98
pingud98 / dirstruct.bat
Last active August 7, 2017 09:50
Create the directory structure for a project (Windows)
@echo Project Directory Structure Creation
@echo J.Devine 07/08/17
@echo Version 0.1
@echo off
md 01_Meeting_Minutes
md 02_Drawings
cd 02_Drawings
md 02_01_Sketches
md 02_02_Received_Drawings
md 02_03_Sent_Drawings
@pingud98
pingud98 / CosmicPiTrigger
Created September 14, 2017 12:48
An Arduino DUE script that sets the trigger levels for Cosmic Pi
#include <Wire.h>
//this code sets values in the MAX5387LAUD+ via I2C.
//it then reads back those values over A1 and A2 inputs
//The ADC is set to 12 bits for the DUE
//Channels are scanned in parallel (0 to 255)
//then alternatively ascending and descending.
//Output is a CSV over serial at 9600bps.
//this test works when testing with board 2
@pingud98
pingud98 / Hydroponicsmeasure.ino
Last active March 21, 2023 17:32
Hydroponics measurement system for Arduino
/*
* Hydroponics system monitor
* J. Devine
* Runs on Arduino Pro 5V
* Sensors:
* DFRobot pHmeter V1.1
* Waterproof DS18B20 water temperature sensor
* TMP36 air temperature sensor
* HC-SR04 distance sensor (for water level..)
* A european two pin plug for EC measurements
@pingud98
pingud98 / ArduinoSerialEchoTest.ino
Created September 28, 2017 13:22
Create a 'bypass' on the serial port for Arduino.
//this can be used to test a uart connected GPS.
void setup() {
// initialize both serial ports:
Serial.begin(9600);
Serial1.begin(9600);
}
void loop() {
// read from port 1, send to port 0: