TCRT1000 sensor... i really need help.

:~ hello. can u help me how to program heart rate sensor using TCRT1000 sensor? i need HELP! :(((( Thanks

When you say help, that should mean you've tried something already, so what have you tried so far? Circuit? Code?

Or when you say help, do you mean you want a solution from scratch?

What does the sensor's datasheet say? Have you Googled something like "tcrt1000 arduino"?

here is our ckt. thank you for your response. :))

and here's our base code.. i don't know how to troubeshoot our code. we based our codes in arduino cookbook. thank you so much :)) can help us for our thesis?

/*

  • InputCapture
    18.8 Measuring Pulses More Accurately | 621
  • uses timer hardware to measure pulses on pin 8 on 168/328
    /
    /
    some interesting ASCII bit patterns:
    u 01010101
    3 00110011
    ~ 01111110
    @ 01000000
    /
    const int inputCapturePin = 8; // input pin fixed to internal Timer
    const int ledPin = 13;
    const int prescale = 8; // prescale factor (each tick 0.5 us @16MHz)
    const byte prescaleBits = B010; // see Table 18-1 or data sheet
    // calculate time per counter tick in ns
    const long precision = (1000000/(F_CPU/1000)) * prescale ;
    const int numberOfEntries = 64; // the max number of pulses to measure
    const int gateSamplePeriod = 1000; // the sample period in milliseconds
    volatile byte index = 0; // index to the stored readings
    volatile byte gate = 0; // 0 disables capture, 1 enables
    volatile unsigned int results[numberOfEntries]; // note this is 16 bit value
    /
    ICR interrupt vector /
    ISR(TIMER1_CAPT_vect)
    {
    TCNT1 = 0; // reset the counter
    if(gate)
    {
    if( index != 0 || bitRead(TCCR1B ,ICES1) == true) // wait for rising edge
    { // falling edge was detected
    if(index < numberOfEntries)
    {
    results[index] = ICR1; // save the input capture value
    index++;
    }
    }
    }
    TCCR1B ^= _BV(ICES1); // toggle bit to trigger on the other edge
    }
    void setup() {
    Serial.begin(9600);
    pinMode(ledPin, OUTPUT);
    pinMode(inputCapturePin, INPUT); // ICP pin (digital pin 8 on Arduino) as input
    TCCR1A = 0 ; // Normal counting mode
    TCCR1B = prescaleBits ; // set prescale bits
    TCCR1B |= _BV(ICES1); // enable input capture
    bitSet(TIMSK1,ICIE1); // enable input capture interrupt for timer 1
    Serial.println("pulses are sampled while LED is lit");
    Serial.print( precision); // report duration of each tick in microseconds
    Serial.println(" microseconds per tick");
    }
    // this loop prints the number of pulses in the last second, showing min
    // and max pulse widths
    void loop()
    {
    digitalWrite(ledPin, LOW);
    delay(gateSamplePeriod);
    digitalWrite(ledPin, HIGH);
    gate = 1; // enable sampling
    delay(gateSamplePeriod);
    gate = 0; // disable sampling
    if(index > 0)
    {
    Serial.println("Durations in Microseconds are:") ;
    for( byte i=0; i < numberOfEntries; i++)
    {
    long duration;
    duration = results _
    precision; // pulse duration in nanoseconds_
    if(duration >0)
    Serial.println(duration / 1000); // duration in microseconds
    }
    index = 0;
    }
    }

And what happens when you run this sketch ?

try this code

int sensorPin = A0;
int sensorValue = 0;
int count=0;
unsigned long time1=0;
unsigned long time2;

void setup()
{
pinMode(sensorPin,INPUT);
Serial.begin(9600);
}

void loop()
{
if(count==0)
{
time1=millis();
}
time2=millis();
sensorValue=analogRead(sensorPin);
if(sensorValue>156)
{
increment();
}
if(time2>=time1+1000)
{
counter();
}
}

void increment()
{
count++;
while(sensorValue>156)
{
Serial.print("Sensor Value is greater than .75V\n");
}
}

void counter()
{
count=count*6;
Serial.print("Heart beat is");
Serial.print(count);
Serial.print(" per min\n");
time1=0;
time2=0;
count=0;
}

@ michinyon

it didn't work. could you suggests any alternative solutions because im having a hard time.

@ cdelig / voldemort_18:
Two newbies registering on the same day, from the same IP address, posting on the same thread, with the same allergy to code tags.
What are the chances of that?

AWOL:
@ cdelig / voldemort_18:
Two newbies registering on the same day, from the same IP address, posting on the same thread, with the same allergy to code tags.
What are the chances of that?

Quite high I think, if they are both students, working from the same accommodation building (hence through the same router), who have just been given the same assignment.

@cdelig / voldemort_18 :

Please use code tags.

Read this before posting a programming question

plz help me the circuit posted by the guy is not working.giving lot of noise XD

amruth:
plz help me the circuit posted by the guy is not working.giving lot of noise XD

That is nowhere near enough information. What is your application, what is the material that you are reflecting the IR from, and what is the distance between the TCRT1000 and the material you are trying to detect?

The schematic published earlier in this thread is suitable for detecting at quite long distances, but only if the system is well-shielded from sunlight and incandescent artificial light (otherwise the detector will saturate). For detection at shorter ranges, ditch the op amp, reduce the detector load resistor to about 3K3, and feed the detector output directly into an ADC pin.

hi can you help me how to program arterial pressure sensor using TCRT1000 ? i need HELP! Thanks