Bluetooth heart rate monitor?
HC-XX series uses Bluetooth Serial Port Profile which means as soon as your pair your device a COM port will be created in your PC. you can use any terminal software e.g. Tera Term or Hyper terminal to send/receive data to your board via bluetooth. and for C# or VB.net like any other serial port software you can write simple program for this too.ajay_bhargav
Ya I paired it up with my laptop,its using com port 10.Also I followed the steps in my previous post and wrote the C# program(only took a few minutes).The program was able to detect the com port being used(as in when I clicked search available ports I was given the option of picking port 10) but once selected it didn't read in any data, as was expected my sensor isn't working correctly.
So for the time being I was thinking I could use some sort of emulator to replace the sensor(whilst I'm working on that) on the serial port so I could view the data on the program
On the vid I viewed the guy used a combination of programs called "Virtual serial port Emulator" and another program(Proteus) which simulated a temperature sensor circuit.
So maybe not even that just something that could send a stream of data that could be viewed.
Would this do the job?
http://www.aggsoft.com/com-port-emulator.htm
[ Edited Mon May 19 2014, 10:40 am ]
Would this do the job?
http://www.aggsoft.com/com-port-emulator.htmPeter_Parker
I think it could just add another layer of uncertainty.
Link the Rx and Tx pins on the Bluetooth module (disconnected from micro).
Use a simple terminal program to confirm that you get back what you send.
Then..
write a simple test program for the micro to send a simple message, say
one a second, to be read in your terminal program .
Then..
write a simple test program for the micro to echo back anything received,
when it all works your link is good.
Then..
write a program for the micro, to send test data to develop your PC
program .
Next I was thinking of trying to graph it,seen a few examples so far of graphing in C# but they're mostly one's where you put in the values of the axis's yourself in code before you graph it,haven't seen any as of yet that graph data from the port.
void extrint (void) interrupt 0 // external Interrupt to detect the heart pulse { bt=tick; // number of ticks are picked tick=0; // reset for next counting }
So this section is where the sensor is connected to the interrupt of the mirco,so is bt or tick equal to the number of pulses(or changes in light intensity) the sensor reads when a finger is placed over it?
And resets back when the finger is removed?
void timer0 (void) interrupt 1 using 1 // Timer 0 for one second time { TH0 = 0xdc; //The value is taken for Ssc/100 at crystal 11.0592MHz sec100++; // It is incremented every Ssc/100 at crystal 11.0592MHz tick++; // This variable counts the time period of incoming pulse in Sec/100 if(tick> =3500){tick=0;} // tick are limited to less trhan 255 for valid calculation if(sec100 > =100) // 1 sec = sec100 * 100 { sec++; sec100=0; } }
Not sure on this one,is this a timing reference for the pulses? or something to work out a 1 second timer as it says in comment,I'm a bit lost here
void main() { P0=0xff; P1=0xff; P2=0xff; P3=0xff; rw=0; EA = 1; TMOD = 0x21; IT0 = 1; EX0 = 1; ET0 = 1; TR0 = 1;
These are all just enabling the timers and interrupts I think
[ Edited Fri May 23 2014, 07:16 am ]
Also for pulse counting dont wait for finger to be placed, if finger is not there you will get 0 which is right. and if person places a finger on sensor then bps will be calculated. so no need to detect whether finger is placed on sensor or not.
Never seen/used a digital oscilloscope before,looks interesting.
I'm presuming I'll have to build some some sort of circuit to protect the sound card and also to probe my own circuit along the line of something like this
http://www.ledametrix.com/oscopePeter_Parker
Well there is no need to use screened cable for what you're doing.
You only need one channel ,so two core will do.
I think the resistors (18k and 82k) are the wrong way round.
Apart from that it's perfect
For extra protection fit back to back LEDs/diodes between sound card input and
ground to limit the voltage swing.
For debug ,write a simple program to monitor (poll) the input pin.
Turn a LED on when high and off when low.ExperimenterUK
So went back to do some hardware testing,built the soundcard protection circuit as above although I did leave the resistors the way there were.
I first tested the circuit with a multimeter before connecting it the pc,I tried the makezine ir pulse circuit first,so connected it at the channel A input and measured it at the channel A output with the multimeter and it read 1.19 volts,great I thought but then I decided to check the output before it went through the protection circuit and it only read 1.6 volts,should it be that low?
Also the other circuit I have,the one with the led and LDR,I checked the output voltage on that too,on the pin going to the micro and it read 0 volts,so I presume that due to short on that somewhere
Using a different code taken from this datasheet
http://www.sunrom.com/media/files/p/202/1181-datasheet.pdf
// Compiler: Keil, Target Chip AT89S52 or similar sbit SENSOR = P3^7; //sensor is connected to this pin, can be any other pin also unsigned int beatms; //Calculate time between two high going pulses in ms float bpm; // Beats per minute calculated from beatms variable above /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Delay x Milisecond =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/ void delay_ms(unsigned int x) // delays x msec (at fosc=11.0592MHz) { unsigned char j=0; while(x-- > 0) { for (j=0; j<125; j++){;} } } // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= // -=-=-=-=- Main Program -=-=-=-=-=-=-= // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= void main() { // -=-=- Intialize variables -=-=-= beatms=0; // will store duration between two pulses // -=-=- Program Loop -=-=-= while(1) { while(SENSOR==0);// wait for high pulse from sensor delay_ms(10); // 10ms delay so that it does not listen to any noise beatms = 10; // start counting beatms from 10ms since we have delay above while(SENSOR==1)// wait until signal is high { delay_ms(1); //wait 1msec beatms++; //keep incrementing counter each 1ms } while(SENSOR==0) //keep looping till signal goes back high, wait for next { delay_ms(1); //wait 1msec beatms++; //keep incrementing counter each 1ms } // beatms variable will now have time in ms between two high edge pulse bpm = (float)60000/beatms; // see document of #1181 for this calculation if(bpm > 200) { // Invalid, Wait for next cycle } else { // Display reading in BPM, print variable BPM to LCD Display or Serial port. } } }
So all thats needed is to add a lcd code to view the results I think
Thats hurting..ajay_bhargav
Is this how you kids speak these days ?
Can I have a translation ?