No changes between revisions
/Designs/Data_loggers/GPSRL04C/GPSRL04A_Small.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/Designs/Data_loggers/GPSRL04C/PrjInfo.txt
0,0 → 1,14
 
[InfoShortDescription.en]
Ionisation Radiation Logger with battery power supply
 
[InfoShortDescription.cs]
Zapisovač intenzity kosmického záření s bateriovým napájením
[InfoLongDescription.en]
It can log intensity and specrum of deposited energy of ionising radiation with GPS coordinates on an SD card.
 
[InfoLongDescription.cs]
Zaznamená intenzitu společně deponovanou davku a polohou na SD kartu.
 
[End]
/Designs/Data_loggers/GPSRL04C/SW/Labduino/Datalogger/Datalogger.ino
0,0 → 1,207
/*
SD card datalogger GPSRL04A
The circuit:
* analog sensors are connected to analog ins PC0, PC1
* SD card attached to SPI bus as follows:
** MOSI - pin PB3
** MISO - pin PB4
** CLK - pin PB5
** CS - pin PD4
*/
 
#include <SD.h>
 
const int chipSelect = 4; // CS is PD4
int LED = 5; // LED is conected from PD5 to LED at GPS module
unsigned int n = 0; // measurement counter
char inChar; // input character from GPS
String dataString = ""; // concantenated string with NMEA messages and measured values
String filename = "log.csv"; // generated filename for log file
int coll = 0; // collons counter in NMEA messages
 
void setup()
{
// Open serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {;}
 
Serial.print("Initializing SD card..."); // inserting a SD Card always reset the processor and call setup
// make sure that the default chip select pin is set to
// output, even if you don't use it:
pinMode(10, OUTPUT); // PB2
pinMode(LED, OUTPUT);
 
// see if the card is present and can be initialized:
if (!SD.begin(chipSelect))
{
Serial.println("Card failed, or not present");
for(n=0; n<10; n++)
{
digitalWrite(LED, HIGH); // turn the LED on (HIGH is the voltage level)
delay(2000); // wait for a while
digitalWrite(LED, LOW); // turn the LED off by making the voltage LOW
delay(100);
}
asm volatile (" jmp 0");
// don't do anything more:
return;
}
Serial.println("card initialized.");
 
dataString = "";
ReadGPRMC(); // read time from GPS
if (dataString[10]!='A')
{
Serial.println("no fix");
for(n=0; n<10; n++)
{
digitalWrite(LED, HIGH); // turn the LED on (HIGH is the voltage level)
delay(20); // wait for a while
digitalWrite(LED, LOW); // turn the LED off by making the voltage LOW
delay(20);
}
asm volatile (" jmp 0");
// don't do anything more:
}
 
// derive file name fom time (YYMMDDHH.CSV)
int len = dataString.length()-1;
filename = dataString.substring(len-2,len) + dataString.substring(len-4,len-2) + dataString.substring(len-6,len-4) + dataString.substring(0,2) + ".CSV ";
}
 
void loop()
{
dataString = ""; // make a string for assembling the data to log
ReadGPRMC(); // read NMEA sentences from GPS
ReadGPGGA();
digitalWrite(LED, HIGH); // turn the LED on (HIGH is the voltage level)
delay(20); // wait for a while
digitalWrite(LED, LOW); // turn the LED off by making the voltage LOW
delay(20); // wait for a while
 
// make a string for assembling the data to log:
dataString += String(n++);
dataString += ",";
 
// read analog values from sensors and append to the string:
for (int analogPin = 0; analogPin < 2; analogPin++)
{
int sensor = analogRead(analogPin);
dataString += String(sensor);
if (analogPin < 1) // suppress last coma
{
dataString += ",";
}
}
 
// open the file. note that only one file can be open at a time,
// so you have to close this one before opening another.
char fileNameCharArray[filename.length()];
filename.toCharArray(fileNameCharArray, filename.length());
File dataFile = SD.open(fileNameCharArray, FILE_WRITE);
 
// if the file is available, write to it:
if (dataFile)
{
dataFile.println(dataString);
dataFile.close();
// print to the serial port too:
Serial.println(dataString);
}
// if the file isn't open, pop up an error:
else {
Serial.println("error opening datalog.CSV");
for(n=0; n<10; n++)
{
digitalWrite(LED, HIGH); // turn the LED on (HIGH is the voltage level)
delay(20); // wait for a while
digitalWrite(LED, LOW); // turn the LED off by making the voltage LOW
delay(20);
}
asm volatile (" jmp 0");
// don't do anything more:
 
}
}
 
 
// function for reading $GPRMC NMEA message
void ReadGPRMC()
{
// $GPRMC,091451.00,A,4915.64143,N,01441.50397,E,0.053,,090215,,,A*74
 
coll = 0;
while(1) // wait for $GPRMC
{
// get incoming byte:
while (!Serial.available());
if (Serial.read() != '$') continue;
while (!Serial.available());
if (Serial.read() != 'G') continue;
while (!Serial.available());
if (Serial.read() != 'P') continue;
while (!Serial.available());
if (Serial.read() != 'R') continue;
while (!Serial.available());
if (Serial.read() != 'M') continue;
while (!Serial.available());
if (Serial.read() != 'C') continue;
while (!Serial.available());
if (Serial.read() != ',') continue;
break;
}
do
{
while (!Serial.available());
inChar = (char)Serial.read();
if (inChar == ',') coll++;
dataString += inChar;
}
while (coll < 9); // read only 9 coma separated values
}
 
 
// function for reading $GPGGA NMEA message
void ReadGPGGA()
{
// $GPGGA,091451.00,4915.64143,N,01441.50397,E,1,09,0.90,443.2,M,44.0,M,,*50
 
coll = 0;
while(1) // wait for $GPGGA
{
while (!Serial.available());
if (Serial.read() != '$') continue;
while (!Serial.available());
if (Serial.read() != 'G') continue;
while (!Serial.available());
if (Serial.read() != 'P') continue;
while (!Serial.available());
if (Serial.read() != 'G') continue;
while (!Serial.available());
if (Serial.read() != 'G') continue;
while (!Serial.available());
if (Serial.read() != 'A') continue;
while (!Serial.available());
if (Serial.read() != ',') continue;
break;
}
do
{
while (!Serial.available());
inChar = (char)Serial.read();
if (inChar == ',') coll++;
if (coll > 4) dataString += inChar; // skip first 5 coma separated values
}
while (coll < 12); // read only 7 coma separated values
}
 
 
 
 
/Designs/Data_loggers/GPSRL04C/SW/PIC/Spectrometer/main.c
0,0 → 1,68
#include "main.h"
 
 
#define LED PIN_D7
 
#define RECORDS 100
 
void main()
{
 
int16 time, time_new;
int16 log[RECORDS];
int16 n;
setup_adc_ports(AN0_TO_AN7|VSS_VDD);
setup_adc(ADC_CLOCK_DIV_2);
setup_psp(PSP_DISABLED);
setup_spi(SPI_SS_DISABLED);
setup_wdt(WDT_OFF);
setup_timer_0(RTCC_EXT_H_TO_L);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_timer_3(T3_DISABLED|T3_DIV_BY_1);
setup_ccp1(CCP_OFF);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
 
output_low(LED);
/*
while(true)
{
output_low(LED);
delay_ms(1);
output_high(LED);
delay_ms(1);
printf("%u\n\r", 0x55);
}
//*/
n=0;
while(true)
{
set_timer0(0);
time = 0;
time_new = 0;
while(time_new == 0)
{
time_new=get_timer0();
}
output_high(LED);
while(time != time_new)
{
time=time_new;
time_new=get_timer0();
delay_us(5);
}
if (time>3){ log[n++]=time;}
if (n==RECORDS)
{
for (n=0; n<RECORDS; n++) printf("%Lu,", log[n]);
printf("\n\r");
n = 0;
}
output_low(LED);
}
}
/Designs/Data_loggers/GPSRL04C/SW/PIC/Spectrometer/main.h
0,0 → 1,35
#include <18F4550.h>
#device adc=8
 
#FUSES NOWDT //No Watch Dog Timer
#FUSES WDT128 //Watch Dog Timer uses 1:128 Postscale
#FUSES HS //High speed Osc (> 4mhz for PCM/PCH) (>10mhz for PCD)
#FUSES NOPROTECT //Code not protected from reading
#FUSES NOBROWNOUT //No brownout reset
#FUSES BORV20 //Brownout reset at 2.0V
#FUSES NOPUT //No Power Up Timer
#FUSES NOCPD //No EE protection
#FUSES STVREN //Stack full/underflow will cause reset
#FUSES NODEBUG //No Debug mode for ICD
#FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOWRT //Program memory not write protected
#FUSES NOWRTD //Data EEPROM not write protected
#FUSES IESO //Internal External Switch Over mode enabled
#FUSES NOFCMEN //Fail-safe clock monitor enabled
#FUSES PBADEN //PORTB pins are configured as analog input channels on RESET
#FUSES NOWRTC //configuration not registers write protected
#FUSES NOWRTB //Boot block not write protected
#FUSES NOEBTR //Memory not protected from table reads
#FUSES NOEBTRB //Boot block not protected from table reads
#FUSES NOCPB //No Boot Block code protection
#FUSES MCLR //Master Clear pin enabled
#FUSES LPT1OSC //Timer1 configured for low-power operation
#FUSES NOXINST //Extended set extension and Indexed Addressing mode disabled (Legacy mode)
#FUSES PLL1 //Divide By 12(48MHz oscillator input)
#FUSES CPUDIV1 //System Clock by 4
//#FUSES USBDIV //USB clock source comes from PLL divide by 2
//#FUSES VREGEN //USB voltage regulator enabled
//#FUSES ICPRT //ICPRT enabled
 
#use delay(clock=20000000)
#use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8)