Discussion in "Project Doubts" started by    Peter_Parker    Dec 11, 2013.
Tue May 13 2014, 11:04 am
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.
Mon May 19 2014, 10:15 am

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.


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?

[ Edited Mon May 19 2014, 10:40 am ]
Tue May 20 2014, 03:02 am

Would this do the job?


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.

write a simple test program for the micro to send a simple message, say
one a second, to be read in your terminal program .

write a simple test program for the micro to echo back anything received,
when it all works your link is good.

write a program for the micro, to send test data to develop your PC
program .
Wed May 21 2014, 05:39 am
I ended up testing it out before I read here again and it worked although not initially,I had to create a virtual com port first,then I was able to use the above program to send random data to my C# program which was then able to read from the com port and display the data in a text box.
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.
Fri May 23 2014, 07:08 am
Right well I've been over going the heart sensor code again and I'm just looking for some clarification on some points in it
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
=3500){tick=0;} // tick are limited to less trhan 255 for valid calculation
if(sec100 >
=100) // 1 sec = sec100 * 100

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()
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 ]
Fri May 23 2014, 11:42 am
with 11.0592Mhz crystal timer resolution is 1.085uS I suggest you use 12Mhz so you get 1uS exact with 1 timer tick. In 16-bit mode max delay will be 65536uS. load timer for only 50000 counts so you get 50ms delay. So for 1 sec timer, You will only need to count 20 times.
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.
Sat May 31 2014, 11:34 pm

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


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.


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
Mon Jul 07 2014, 09:59 pm
So went back to square one,bought a heartbeat sensor,its one for an arduino but I hope its compatible with the 8051 too.

Using a different code taken from this datasheet

// 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-- >
 for (j=0; j<125; j++){;} 
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 
// -=-=-=-=- Main Program -=-=-=-=-=-=-= 
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 
void main() 
// -=-=- Intialize variables -=-=-= 
beatms=0; // will store duration between two pulses 
// -=-=- Program Loop -=-=-= 
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 >
// 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
Thu Jul 10 2014, 05:53 pm
Thats hurting... keep us updated...
Sat Jul 12 2014, 01:19 am

Thats hurting..


Is this how you kids speak these days ?
Can I have a translation ?

Get Social


Powered by e107 Forum System



Tue Jun 18 2024, 04:38 pm
Tue Jun 18 2024, 04:24 pm
Tue Jun 18 2024, 08:38 am
Tue Jun 18 2024, 05:44 am
Mon Jun 17 2024, 09:22 pm
Mon Jun 17 2024, 07:17 pm
Mon Jun 17 2024, 03:13 pm
Mon Jun 17 2024, 06:23 am