Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
3420655
albert_ic-first version
albertqu May 25, 2018
544d6fd
name_change
albertqu May 25, 2018
46b75bc
change
albertqu May 25, 2018
93ca8b5
structure-change
albertqu May 25, 2018
a1fa6c8
Organized
albertqu May 25, 2018
2c1daf6
Delete img_capture.py
albertqu May 25, 2018
09c8c4f
update .gitignore
albertqu May 25, 2018
ecf3d5b
Update .gitignore
albertqu May 25, 2018
d0f412b
delete .idea and changed .gitignore
albertqu May 25, 2018
7b796be
Merge branch 'albert-camera-v1.0' of github.com:albertqu/bridge_settl…
albertqu May 25, 2018
9b6c854
changes
albertqu May 29, 2018
8aa58c9
img_rec
albertqu Jun 7, 2018
bf75f78
changes resolved
albertqu Jun 7, 2018
610570c
conflicts resolved
albertqu Jun 7, 2018
8b3b24b
Update .gitignore
albertqu Jun 7, 2018
c9b0901
clean up repo
albertqu Jun 7, 2018
20d3794
steady sockets
albertqu Jun 8, 2018
a9ecf95
updates
albertqu Jun 12, 2018
2ad0529
changes
albertqu Jun 12, 2018
46c963c
ip-check shell script
albertqu Jun 12, 2018
9253db1
shell script
albertqu Jun 12, 2018
301f17c
expedite the algorithm
albertqu Jun 12, 2018
a10530e
yes
albertqu Jun 12, 2018
9441ac9
project setup
albertqu Jun 12, 2018
e2da9f6
sensor units
albertqu Jun 19, 2018
c96ba23
sensor units
albertqu Jun 19, 2018
2d5692c
problems fixed
albertqu Jun 20, 2018
811a2d8
fixed merging
albertqu Jun 20, 2018
db52da6
fixed sockets
albertqu Jun 20, 2018
b107df5
keep it clean
albertqu Jun 20, 2018
779bf0a
fixed
albertqu Jun 20, 2018
c90acef
updates for server step 1
albertqu Jun 25, 2018
ba64e38
server update
albertqu Jun 26, 2018
ca6adf1
server-v-1.0 finished
albertqu Jun 26, 2018
ff27a05
update img capt
albertqu Jun 27, 2018
397c013
server com first version prototype
albertqu Jun 28, 2018
58ee8c7
changes
albertqu Jul 5, 2018
4fdcef1
update img_rec
albertqu Jul 10, 2018
0c312e8
update img_rec
albertqu Jul 10, 2018
cbc2f6a
update img_rec
albertqu Jul 10, 2018
0ed19c1
camera
albertqu Jul 11, 2018
3771c51
resolve compatibility issues
albertqu Jul 27, 2018
2c714be
NEW VERSION
albertqu Jul 29, 2018
003e3c7
NEW VERSION
albertqu Jul 29, 2018
7e84f7c
NEW VERSION
albertqu Jul 29, 2018
43e834e
right
albertqu Jul 29, 2018
5fa02bb
finalized sig_proc version1
albertqu Jul 30, 2018
5e8e630
finsihed
albertqu Jul 30, 2018
7538a1c
yes again
albertqu Jul 30, 2018
7ecc06a
sigproc change
albertqu Nov 25, 2018
bf54e3e
rpi
hteng1995 Nov 27, 2018
9c2df1e
head fix
albertqu Jan 7, 2019
7c4d6c4
head fix
albertqu Jan 7, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
17 changes: 16 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
# markdown
# img file
testpic/
dataplot/
*.png
*.jpeg
*.jpg
*.bmp
*.gif

# OS
.DS_Store

# IDE file
.idea/

# Markdown files
*.md

# Byte-compiled / optimized / DLL files
Expand Down
Binary file added Nov_27/Full/Arduino/timer/._timer.ino
Binary file not shown.
111 changes: 111 additions & 0 deletions Nov_27/Full/Arduino/timer/timer.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
// Global Variables
int timer = 0;
int on = 0;
int minInterval = 5;
float val;
float time2;
float time3;

void setup() {
// Setup pins for pin activated interrupts: p8, p7
pinMode(3,INPUT);//digitalWrite(8,HIGH);
pinMode(2,INPUT);//digitalWrite(7,HIGH);
//pinMode(2, INPUT_PULLUP);

// Setup pin for timer activated interrupts: p13
pinMode(13,OUTPUT);//`******digitalWrite(13,LOW);
pinMode(12,OUTPUT); // Open the relay to shut of RPi


// Setup the timer interrupt configuration for 1 Hz
/*
cli();
TCCR1A = 0;// set entire TCCR1A register to 0
TCCR1B = 0;// same for TCCR1B
TCNT1 = 0;//initialize counter value to 0
// set compare match register for 1hz increments
OCR1A = 15624;// = (16*10^6) / (1*1024) - 1 (must be <65536)
// Set CS12 and CS10 bits for 1024 prescaler
TCCR1B |= (1 << CS12) | (1 << CS10);
// enable timer compare interrupt
TIMSK1 |= (1 << OCIE1A);
// Normally would turn on, but this is left for the p8 interrupt to do:
// turn on CTC mode
// TCCR1B |= (1 << WGM12);
//
sei();
*/

// Setup p3 and p2 interrupt code
attachInterrupt(digitalPinToInterrupt(2),ISR_p2,FALLING);
//attachInterrupt(digitalPinToInterrupt(2),ISR_p2,RISING);
attachInterrupt(digitalPinToInterrupt(3),ISR_p3,RISING);

// Turn on the RPi pin to start the flow of energy to the RPi so it
// can be configured to run the system and eventually activate p8 and
// p9 interrupt ISR's which will begin the total system operation.
digitalWrite(13,HIGH); // this flips a relay energizing the RPi
digitalWrite(12,LOW);

Serial.begin(9600);
Serial.println("Running...");
}

// timer1 interrupt service routine
ISR(TIMER1_COMPA_vect){
// turn on the RPi, as the time interval has elapsed
if(timer == 60*minInterval){
//if(timer == 10){
digitalWrite(12,LOW);
digitalWrite(13,HIGH);
timer = 1;
Serial.println(timer);
} else {
timer += 1;
Serial.println(timer);
}
}

// pin2 interrupt service routine
void ISR_p2(){
// turn off RPi, as the signal pin has lifted saying it is shutdown
//if (timer > 1){
//if (timer > 5){
// digitalWrite(13,LOW);
// digitalWrite(12,HIGH);
// Serial.println("pin 2 lifted");
delay(10000);
digitalWrite(13,LOW);
digitalWrite(12,HIGH);
Serial.println("pin 2 lifted");
//}
}

// pin3 interrup service routine
void ISR_p3(){
// start the timer1, as the signal pin has been lifted saying the clocks are synchronized
cli();
TCCR1A = 0;// set entire TCCR1A register to 0
TCCR1B = 0;// same for TCCR1B
TCNT1 = 0;//initialize counter value to 0
// set compare match register for 1hz increments
OCR1A = 15624;// = (16*10^6) / (1*1024) - 1 (must be <65536)
// Set CS12 and CS10 bits for 1024 prescaler
TCCR1B |= (1 << CS12) | (1 << CS10);
// enable timer compare interrupt
TIMSK1 |= (1 << OCIE1A);
TCCR1B |= (1 << WGM12);
sei();
Serial.println("pin 3 lifted");
detachInterrupt(3);
}



void loop() {
// put your main code here, to run repeatedly:
//int pinstate = digitalRead(2);
//Serial.println(pinstate);
//delay(1);

}
112 changes: 112 additions & 0 deletions Nov_27/Full/Arduino/timer_polls/timer_polls.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
// Global Variables
int timer = 0;
int minInterval = 5;
int syncInterval = 1;
int flag_sync = 0;
//int timer_sync = 0;

int CurrentStatePin2 = LOW;
int PrevStatePin2 = LOW;
int CurrentStatePin3 = LOW;
int PrevStatePin3 = LOW;

void setup() {
// Setup pins for pin activated interrupts: p8, p7
pinMode(3,INPUT);//digitalWrite(8,HIGH);
pinMode(2,INPUT);//digitalWrite(7,HIGH);

// Setup pin for timer activated interrupts: p13
pinMode(13,OUTPUT);//`******digitalWrite(13,LOW);
pinMode(12,OUTPUT); // Open the relay to shut of RPi

// Turn on the RPi pin to start the flow of energy to the RPi so it
// can be configured to run the system and eventually activate p8 and
// p9 interrupt ISR's which will begin the total system operation.
digitalWrite(13,HIGH); // this flips a relay energizing the RPi
digitalWrite(12,LOW);

Serial.begin(9600);
Serial.println("Running...");
}

// timer1 interrupt service routine
ISR(TIMER1_COMPA_vect){
// turn on the RPi, as the time interval has elapsed
if(timer == 60*minInterval && flag_sync == 0){
digitalWrite(12,LOW);
digitalWrite(13,HIGH);
timer = 1;
Serial.println(timer);
} else if (timer == 60*syncInterval && flag_sync == 1){
digitalWrite(12,LOW);
digitalWrite(13,HIGH);
timer = 1;
Serial.println(timer);
flag_sync = 0;
Serial.println("flag_sync off");
//} else if (timer_sync == 1) {
// timer = 1;
// timer_sync = 0;
// Serial.println("timer_sync off");
} else {
timer += 1;
Serial.println(timer);
}
}

// pin2 interrupt service routine
void ISR_p2(){
// turn off RPi, as the signal pin has lifted saying it is shutdown
delay(1000);
digitalWrite(13,LOW);
digitalWrite(12,HIGH);
Serial.println("pin 2 lifted");
}

// pin3 interrup service routine
void ISR_p3(){
// start the timer1, as the signal pin has been lifted saying the clocks are synchronized
cli();
Serial.println("l1");
TCCR1A = 0;// set entire TCCR1A register to 0
TCCR1B = 0;// same for TCCR1B
TCNT1 = 0;//initialize counter value to 0
Serial.println("l2");
// set compare match register for 1hz increments
OCR1A = 15624;// = (16*10^6) / (1*1024) - 1 (must be <65536)
//OCR1A = 15614;// for Laser Module
Serial.println("l3");
// Set CS12 and CS10 bits for 1024 prescaler
TCCR1B |= (1 << CS12) | (1 << CS10);
// enable timer compare interrupt
TIMSK1 |= (1 << OCIE1A);
TCCR1B |= (1 << WGM12);
Serial.println("l4");
sei();
Serial.println("l5");
timer = 0; // initialize or reset timer (first execution, or re-sync)
Serial.println("pin 3 lifted");
}


void loop() {

PrevStatePin2 = CurrentStatePin2;
PrevStatePin3 = CurrentStatePin3;

delay (10);

CurrentStatePin2 = digitalRead(2);
CurrentStatePin3 = digitalRead(3);

if ((PrevStatePin2 == HIGH) && (CurrentStatePin2 == LOW)){
ISR_p2();
}
if ((PrevStatePin3 == LOW) && (CurrentStatePin3 == HIGH)){
ISR_p3();
flag_sync = 1;
//timer_sync = 1;
Serial.println("flag_sync on");
//Serial.println("timer_sync on");
}
}
Binary file added Nov_27/Full/Camera/RPiCam/._RPiCM.py
Binary file not shown.
Binary file added Nov_27/Full/Camera/RPiCam/._img_capture.py
Binary file not shown.
Loading