The code we created for counting the number of beeps it does in a period of time was quite short. One pertinent addition to the code was the PinChangeInt function found in the Arduino website. It triggers on an inputs RISING and FALLING signal edges, very suitable to counting the number of beeps/blinks the sensor does in a period of time. Once we were able to pinpoint the period of each bleep/blink using a digital oscilloscope with Professor Mason's help, we experimented on putting just the right delay after each instance of the loop for more accurate counts of the blinks/beeps. We found that the signal noise's length was below 3 milliseconds. Here is the code that outputs number of beeps in a period of 3 seconds:
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#include <PinChangeInt.h>
#include <PinChangeIntConfig.h>
#define PIN 2 // the pin we are interested in
volatile byte bleep=0; // a counter to see how many times the pin has changed
byte cmd=0; // a place to put our serial data
void setup() {
Serial.begin(57600);
Serial.print("PinChangeInt test on pin "); //starter message to indicate that the program's working
Serial.print(PIN);
Serial.println();
pinMode(PIN, INPUT); //set the pin to input
digitalWrite(PIN, HIGH); //use the internal pullup resistor
PCintPort::attachInterrupt(PIN, bleepcount,RISING); // attach a PinChange Interrupt to our pin on the rising edge
// (RISING, FALLING and CHANGE all work with this library)
// and execute the function bleepcount when that pin changes
}
void loop() {
cmd++;
if (cmd==3)
{
Serial.print("bleepcount:\t");
Serial.println(bleep, DEC);
cmd=0; //makes sure that the code outputs every 3 seconds
bleep=0; //resets counter so that each output starts from 0 to a number
}
delay(1000);
}
void bleepcount()
{
bleep++;
delay(3);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
The purpose of the High-Altitude Balloon is to go up to an altitude of 20-30 km. After learning about its previous flight usage, we learned that it reached space conditions. As such, the radiation sensor did not warrant further testing. This was quite a relief because its bulky appearance could have made it harder to conduct the tests done to other sensors.
Because of its independence with its 9V power source, its interface with the Arduino was as simple as it could get. There were no misgivings concerning this sensor in this project. It worked perfectly, partly because it was subjected to milder conditions in this project relative to its first purpose. If it were again to be included in an outer space project, it might be fair to warrant a new coating of acrylic.
LINKS:
RockOn! project in Professor Mason's site: http://profmason.com/?s=rockon
Trello Electrical Board: https://trello.com/c/nmANDSyo/19-radiation-sensor
Trello Science Board: https://trello.com/c/wyg6YSSq/30-investigate-test-the-particle-detector
Geiger Tube (LND 712) Data Sheet: http://www.lndinc.com/products/pdf/711/
No comments:
Post a Comment