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?

  • 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
    Commented May 11, 2019 at 0:21

1 Answer 1



  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
    Commented May 18, 2019 at 11:42
  • @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
    Commented May 18, 2019 at 13:23
  • 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
    Commented May 18, 2019 at 14:15
  • Comments are not for extended discussion; this conversation has been moved to chat.
    – goldilocks
    Commented May 20, 2019 at 10:45

Not the answer you're looking for? Browse other questions tagged or ask your own question.