This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
now=$(date +"%m_%d_%Y_%H_%M_%S") | |
echo "Start time" | |
echo $now | |
cat /dev/ttyACM0 > chanA_$now.csv & | |
cat /dev/ttyACM1 > chanB_$now.csv & | |
echo "Logging script running" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Cosmic Pi fully integrated script mk1 | |
Designed for Arduino Due, sampling performance <500ksps (to be measured) | |
untested. Runs on interrupt to pins 50 (time reset) and 49 (event detection) | |
*/ | |
#include <Adafruit_GPS.h> | |
#include <Adafruit_Sensor.h> | |
#include <Adafruit_L3GD20_U.h> | |
#include <Adafruit_BMP085_U.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int x; // read value | |
int adcloopctr; | |
unsigned long values[100]; | |
const int eventtrigger = 49; | |
boolean eventhappened = false; | |
int sampledepth = 10; | |
int printctr = 0; | |
int readoutctr; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
A (neat) cheat way of getting the HC-SR04 distance sensor working on an Arduino Uno | |
put it in the end, with the GND aligned with the GND pin next to pin 13 and AREF | |
This example code is in the public domain. | |
*/ | |
// Pin 13 has an LED connected on most Arduino boards. | |
// give it a name: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//this works from the electronics crate, reads out Ch 6 and Ch7 fast enough, peak samples generally occur at 4th position on readback. | |
//Shotky diodes are used to prevent negative voltage hurting the ADC. | |
int x; // read value | |
int adcloopctr; | |
unsigned long values[200]; | |
const int eventtrigger = 49; | |
boolean eventhappened = false; | |
int sampledepth = 10; | |
int printctr = 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Adafruit_BMP085_U.h> | |
#include <Adafruit_GPS.h> | |
#include <Adafruit_Sensor.h> | |
#include <Adafruit_L3GD20_U.h> | |
#include <Adafruit_LSM303_U.h> | |
#include <Adafruit_10DOF.h> | |
#include <Adafruit_HTU21DF.h> | |
#include <Wire.h> | |
#define mySerial Serial1 | |
#define GPSECHO true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//upwards voltage ramp from 40V to 68.8V, takes approx 60 seconds to reach | |
//03 10 15 Jdevine | |
#include <SPI.h> | |
const int slaveAPin = 52; | |
void setup() { | |
pinMode (slaveAPin, OUTPUT); | |
digitalWrite(slaveAPin, LOW); | |
SPI.begin(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Adafruit_BMP085_U.h> | |
#include <Adafruit_GPS.h> | |
#include <Adafruit_Sensor.h> | |
#include <Adafruit_L3GD20_U.h> | |
#include <Adafruit_LSM303_U.h> | |
#include <Adafruit_10DOF.h> | |
#include <Adafruit_HTU21DF.h> | |
#include <Wire.h> | |
#define mySerial Serial1 | |
#define GPSECHO true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Adafruit_BMP085_U.h> | |
#include <Adafruit_GPS.h> | |
#include <Adafruit_Sensor.h> | |
#include <Adafruit_L3GD20_U.h> | |
#include <Adafruit_LSM303_U.h> | |
#include <Adafruit_10DOF.h> | |
#include <Adafruit_HTU21DF.h> | |
#include <Wire.h> | |
#include <SPI.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*notes to Team Cosmic Pi | |
I just got this working in Cosimo's lab using a TTi TG5011 LXI function generator and a Tektronix TDS2024 scope. | |
It took a lot of fine tuning to get the right buffer read out, so that the rising edge can be consistently seen in the samples. | |
The buffer index (i.e. how many buffers back in time you need to go) will definitely change based on the rest of the code, but the principle is here | |
Don't forget that we're interleaving channels 1 and 2, therefore the nth sample is channel 1 and the n+1th sample is channel 2 etc. and if we're reading out 50, it's actually 25 from channel A etc. | |
Also note that the ADC seems to top out (4096) around 2.3V, I was expecting 3.3V, so maybe there's another setting to tweak here. | |
If you are testing this code independently here are your parameters for connection: | |
Set up a SAW wave, with a vertical rising edge, then monotonically decreasing | |
Amplitude (max) 2.3V, never above 3.3V or you'll cook the DUE |