ECG comments


may i know what is the code you used for heart rate sensor using raspberry pi? may i get explanation on how can we use raspberry to run and show output of heart rate signal? i’m just entering pi, your advise and explanation would be much helpful. I have tried uploading code from arduino ide to raspberry pi, it prompted to enter passsword. but the root password i entered did’t work. can anyone help?

closed as unclear what you’re asking by MilliwaysjoanIngoGhanima May 11 at 0:20

Please clarify your specific problem or add additional details to highlight exactly what you need. As it’s currently written, it’s hard to tell exactly what you’re asking. See the How to Ask page for help clarifying this question.If this question can be reworded to fit the rules in the help center, please edit the question.

  • Welcome to Raspberry Pi! Please take the tour and visit the helpcenter to see how things work here. Note that Stackexchange tries to answer specific question instead of providing tutorials, which seems to be what you’re looking for. – Ghanima May 11 at 0:21



  1. How to use Rpi to read AD8232 heart rate signal?
  2. How to use Arduino IDE to upload Arduino code to Rpi?


  1. AD8232 ECG module outputs analog signal. Rpi does not have any analog to digital pin to entertain analog signals (I feel jealous that Arduino has many built in ADC pins!). So you need to use an ADC chip/module such as PCF8591/MCP3008/MCP3208/ADS115/HX711/ADS1256 (8 bit to 24 bit resolution) etc to do the conversion for Rpi to handle.
  2. You cannot use Arduino to upload code to Rpi. Rpi has its own IDE which is called Raspbian. You might like to google newbie tutorials to start learning Rpi. You may also like to read MagPi, a free magazine for Rpi newbies and ninjas alike. As said earlier, Arduino might use its built in ADC pins to talk to AD8232. So it is very unlikely that the Arduino code can be directly used by Rpi. Of course you can study the Arduino code and try to translate it to Rpi python.

ad8232 setup

You may like to read the references to get a very rough idea of how Rpi controls the AD8232 ECG chip.

Warning to Rpi and electronics newbies learning the AD8232 ECG module

ECG signal is analog and often has big noise problems as mentioned in the referenced post below. Newbies for sure find things difficult. You may need a small team of basic Rpi hardware and software beginners to do a long term, say at least three months to one year (depending on your background) to complete a college level group project. You also need a US$300 digital storage oscilloscope to help displaying signals (especially the nose signals).

Recommending CircuitPython for Rpi to newbies

The learning curve of Rpi Raspbian for newbies is very deep. I did find it discouraging and depressing learning linux terminal commands when I first tried Rpi a couple of years ago. At that time I already had 5 hobbyist years experience on Arduino but still find Rpi linux very newbie unfriendly. Yes, Rpi GUI Desktop is much newbie friendly now. But for those electronics newbies, trying things beyond blinking a led to reading ECG signals is still a long and winding journey.

To shorten the long journey, I would recommend CircuitPython for Rpi. You may like to read Lady Ada’s tutorials to know more.

CircuitPython overview – Lady Ada

CircuitPython for Rpi – Lady Ada

Installing CircuitPython for Rpi – Lada Ada


Tip to poor hobbyists who cannot afford AdaFruit and SparkFun stuff

I am a huge fan of both AdaFruit and SparkFun, and I am very grateful that I have been learning so many DIY stuff from them.

But I have never bought any of their products because I cannot afford.

Fortunately almost all their stuff are open source, and as SparkFun proudly and happily claims, their new open source hardware products get copied some 6 weeks after announcement.

In other words, I need only to wait for one and half months or so, to get copycat, legal, but a bit lower quality versions from TaoBao (sort of AliExpress). And I have never bought anything from eBay or Amazon, because TaoBao is often many times cheaper. For those who are jealous that I can buy cheap things, I must point out that the minimum hourly wage (US$5) in my place is also many times lower, and what is worse, house price and rent is ridiculously many times higher. In other words I don’t have much money left to buy high class SparkFun and AdaFruit stuff 😦


Raspberry Pi 3B+ interface with Heart Monitor AD8232 using MCP3008 and SPI pins

CircuitPython – Wikipedia

CircuitPython is an open source derivative of the MicroPython programming language targeted towards the student and beginner. Development of CircuitPython is supported by Adafruit Industries. It is a software implementation of the Python 3 programming language, written in C. It has been ported to run on several modern microcontrollers.

CircuitPython is a full Python compiler and runtime that runs on the microcontroller hardware. The user is presented with an interactive prompt (the REPL) to execute supported commands immediately. Included are a selection of core Python libraries. CircuitPython includes modules which give the programmer access to the low-level hardware of Adafruit compatible products as well as higher level libraries for beginners.

  • “Rpi has its own IDE which is called Raspbian.” == Incorrect and misleading. – goldilocks yesterday
  • @goldilocks Ah let me see. (1) Raspbian is an variant of Linux. (2) Linux is an OS. (3) An OS is not IDE. (4) Therefore Raspbian is not an IDE. So if I say Rpi has an IDE called Raspbian is nonsense. Thank you for pointing out my mistake. Let me see how should I correct my mistake with an errata and apology in my answer. – tlfong01 yesterday   
  • I understand that you perhaps meant that figuratively (‘Your “IDE” will be Raspbian…’), but someone asking this question could easily take that literally leading to pointless confusion. So anyone who shows up asking about the “Raspbian IDE” I will send your way 😉 – goldilocks yesterday
  • Haha. I agree. If someone asks what is OS? I would casually reply “Ah, just a big set of system utilities”. If someone asks what is IDE? I would say: “Ah, just a compiler with a small set of tools”. So I can say: “Ah, Rpi have many OS’s, and each OS has many IDEs, eg python, Arduino. Of course I would be in big trouble causing total confusion. I think what is correct or misleading depends on “common ground” and “context”. As Lady Ada says: “OK, I know, our Rpi compatible USB/TTL cable is actually not TTL technology, but CMOS, and not standard 5V TTL logic, but Rpi 3V3 logic, … – tlfong01 yesterday   
  • About “Common Ground” problem – I think Stephen Hawkin is incorrect and misleading in saying that the Black Hole is a hole, and the hole is black. His says so because there is no common ground between mathematicians and ordinary guys, so he lowers his ground so that both grounds level. Yes, I agree what you say that, I might be using figurative speech for OS and IDE, but the underlying reason is to fix the no common ground problem. – tlfong01 9 mins ago   
  • About the “Out of Context” problem – I think Issac Newton is incorrect and misleading when stating his 3 famous classic mechanical laws in physics, because he only knows about his classic mechanics world, ignorant about the quantum mechanics world which his laws don’t apply. What I am trying to point out is the following. If someone says something in the context he implies, you can always say he is incorrect and misleading if you move out of his context, or in everyday language, you move the goal in during a football match. – tlfong01 8 mins ago   
  • About Ludwig Wittgenstein’s “Meaning of a Word is in its Use” problem. OP’s ECG question reminds me when I read the original ECG papers published some 100 or 200 years ago, I also read comments on those papers that those pioneers then did not understand much about electrostatics, so they say wrongly that EMF is a “Force”, which is incorrect and misleading, because static charge has no mechanical “force”, only electric “potential”. I actually once for a while, worked with a medical radiologists and practised 12 lead ECG. / to continue, … – tlfong01 2 mins ago   Edit   
  • I actually once for a while, worked with a medical radiologist and practised 12 lead ECG. The medical doctor/professor told me that my electronics engineering and pattern recognition theory about ECG applications is much higher than almost all the radiologists. I agreed without any shame. I also pointed out to him that many of the ECG terms and even concepts were actually incorrect and misleading. To conclude, if ECG professionals save lives everyday, why bother them saying incorrect and misleading things? – tlfong01just now   Edit   

Categories: Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: