As part of a desire to learn about ESP8266 as standalone

I thought about a project to connect pulse sensor and transmit the BPM to the computer by TCP connection.

During the construction i came across some problems.

The problems by my opinion, will help some of you to build your next project.

Step 1: Components

List of all components:

1. esp8266 (wifi transmmiter) any esp will be good, i am using esp8266-12.


2. Pulse sensor: http://pulsesensor.com/

the sensor cost is 25$.

diy heart pulse sensor(cheap)


3. battery housing X2:


4. 2 resistors : 4.7K,10K.

5. 1 - capacitor :

6. 1 voltage regulators:http://www.ebay.com/itm/QTY-15-MIC2940A-12BT-MICRE...

7. usb ttl for programming the esp http://www.banggood.com/New-Upgrade-PL2303HX-USB-T...

Step 2: Programming Environment

Comfortable environment in my opinion is the best way to succeed in what you are trying to achieve.

i came accross few environment and tutorials (LUA script).

i didnt find any nice and easy environment until i found

"Arduino-compatible IDE with ESP8266 support".


all the data i was needed is ther with a loving and helping commuinty.

1. download the IDE. grab your copy

linux : https://github.com/esp8266/Arduino/releases/downlo...

windows : https://github.com/igrr/Arduino/releases/download/...

osx: https://github.com/esp8266/Arduino/releases/downlo...

calibrate your ide to burn the esp8266:

next STEP!

Step 3: Prepare Your ESP to Burn Your Code

ESP8266 is a Heavy consumer of current and very sensitive to the input voltage.

To run it correctly you will need to provide him 3.3 v the current can be 250mAh max.

arduino will not provide him Enough current.

I recommend connecting it to the benefit of the trials and burn to a stabilized power supply or alternatively connect it through a voltage regulator.

minimal wiring for burn:


vcc - > stabilized power supply

ch_pd -> stabilized power supply (High)

GND-> usb ttl GND & stabilized power supply GND.

RX -> TX on usb ttl

TX -> RX on usb ttl

gpio0 -> GND

after your burn your ESP the minimal wiring needed is:

vcc-> stabilized power supply VCC OR battery with voltage regulator VCC/VOUT

ch_pd -> vcc

gnd -> stabilized power supply GND OR battery with voltage regulator GND.


Step 4: Pulse Sensor With Analog (adc) in ESP8266

the pulse sensor have analog output.

the output voltage is Depending on the Input voltage.

the pulse sensor input voltage range is 3-5 volt.
in this tutorial input voltage = 3.3 (connected to ESP vcc)

the output range is 0-3.3 volt.

ESP8266 ADC: (10bit value range 0-1024)

ESP8266 have 1 analog input, the problem is the range, Between 0-1 volt.

it cant damage your ESP to provide values between 0-3.3v but every pulse above 1 volt will be the same as 3 volt.

to fix that issue i will connect the sensor output to voltage divider to ensure the the max range will be 0-1 volt.

after i set the voltage divider i was getting wrong value/heart BPM.

the pulse was very Noisy and my code didnt understant if its noise or heart pulse.
i hade to add capacitor as low-Pass filter to decrease the noise.

Step 5: How Its Work?!

the esp8266 can be standalone chip with wifi.
1. the esp is set to find Specific wifi router.
2. Connecting Success.
3.every 2ms a timer is taking sample from ADC(pulse sensor)
4.calculate BPM (the code for the calc is the original code from the pulse sensor website).
5. every 2 sec the bpm is sent via tcp/ip protocol to my_pc.
6.my pc is wating in port number 80 to recive the data from the esp.
7. my pc get avg bpm and show it.

Step 6: Code.


filename: wificlient.ino;
dont forget to set you ssid(routher name) & password
dont forget to your pc ip address.

c# project, create tcp/ip server (port:80) and wait for the BPM from the esp.

a runnig server that work without any think else (mabey .net if its missing from your pc)
note: to close the application click on the BPM number in black.

<p>Thank you very much for your instructions, I would like to ask something about using pin as Vcc for all components like your circuit, so that &quot;How long could I use pin as Vcc ? (1 day or more or less). Thank you again. </p>
I didn't understand your question.
<p>Oh, sorry for my unclear question, I would like to ask somethings:</p><p>1/ Did you use 2 batteries CR2032 with voltage regulator VCC/VOUT as the picture at the beginning of website ?</p><p><br>2/ If I take &quot; Vcc connect to battery with voltage regulator VCC/VOUT and GND connect to battery with voltage regulator GND &quot;, How long could I use the circuit with using 2 batteries CR2032 ?</p><p>Because I use ESP8266-NodeMCU CP2012 (please refer the attached image) then just connect it to my computer through UART to supply Vcc for whole circuit.</p>
<p>Thanks a lot for this post. Are there any related videos as well?</p>
<p>thanks alot.</p><p>i dont have any videos :(</p>
<p>Not a problem. As part of our search and rescue project , we wanted to transmit the pulse in a digital form, indicating a 1 for a beat and 0 for no heartbeat. We want to transmit this data over the network created by ESP8266. However, since the output of Pulse sensor is in digital form, I was wondering if we could use a comparator to do the same. An A/D converter is difficult as we are trying to make a watch sized wearable. Would a comparator suffice or do you have any other suggestions for the same?</p><p>PFA the image of the wearable consisting of an ESP8266 , voltage regulator and a reset logic.</p>
<p>However, since the output of Pulse sensor is in *analog form</p>
<p>Can i use ESP - 01 instead of ESP-12? </p>
<p>Hi Can you please let us know how to create the tcp/ip server?</p>
<p>hey,</p><p>you can download the tcp/ip source code heartBeat.rar</p><p>and open it with visual studio.</p>
<p>i use esp8266ex where the ADC in esp8266ex :v</p><p>pulse use vcc input 5v? and the esp8266 input 3.3v ?</p>
<p>please read step 4,</p><p>the input is going down from 5v to 1v</p>
<p>i got an error while compiling your esp8266 code.</p><p>says Test not declared in this scope on line no. 89</p><p>please help.</p>
hey, thanks alot for your comment.<br>you should add the line<br>&quot;void test();&quot; <br>to somewhere before the &quot;void loop&quot;.<br>or you can copy the entire test function to the same place.
<p>Thank you for your great instruction. I set up everything as described but getting all 0 readings.</p><p>I think the only thing I am not sure is the capacitor you used. From the diagram it says 10 micro farad, but what is the voltage? The only 10uf capacitor I found on SparkFun is 25V and called &quot;Electrolytic Decoupling capacitors - 10uF/25V&quot;</p><p><a href="https://www.sparkfun.com/products/523" rel="nofollow">https://www.sparkfun.com/products/523</a></p><p>I think that might be wrong? if so which one should I use? </p><p>Thanks you very much!</p><p>J-</p>
<p>hey jian,</p><p>its very nice that some one is trying to make this thing :).<br>i am using 10Micro F/50Volt.<br>so it should work for you with the 25V cap.<br>you can try to remove the capacitor and check if data is comming throw the tcp port, it will help you to understand if the capacitor is the problem or somthing else.<br>please keep me updated in any step or Questions.</p>
<p>another thing difference is that I am using a nodemcu board. </p><p>In this case I don't need to connect CH_PD to vcc and gpio15 to GND?</p><p>Thanks!</p>
<p>Hi <a href="https://www.instructables.com/member/yakirmalka/" rel="nofollow">yakirmalka</a>,</p><p>Thanks for you reply.</p><p>I bought a 50v capacitor anyways and also will try to take your suggestion to debug it.</p><p>Will post the result later!</p>
<p>Great first instructable, thank you for sharing this!</p>

About This Instructable




More by yakirmalka:Clock with life Wearable heart beat sensor ESP8266+Pulse sensor 
Add instructable to: