Uncategorized

Circuit Python Discussion Notes

Asked 
Active 2 months ago
Viewed 94 times
0

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

Question

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

Answer

  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

circuitpython

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 😦

References

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 May 18 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 May 18 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 May 18 at 14:15
  • Comments are not for extended discussion; this conversation has been moved to chat. – goldilocks May 20 at 10:45
=============================================
A: can Raspberry Pi work exactly like Arduino? uploding arduino codes into raspberry pi

tlfong01Question How to use Rpi to read AD8232 heart rate signal? How to use Arduino IDE to upload Arduino code to Rpi? Answer 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 bu…

goldilocks
goldilocks
“Rpi has its own IDE which is called Raspbian.” == Incorrect and misleading.

tlfong01

tlfong01
@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.

goldilocks

goldilocks
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 😉

tlfong01

tlfong01
1920
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, …
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.
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.
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, …
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?

goldilocks

goldilocks
125k
Using a list of individual practices or wholesale conventions you believe are misleading (intentionally or otherwise) does not really provide moral or logical support for you doing it intentionally.
By analogy, producing a list of well known killers when on trial for murder is no form of defence. I also think you are feeding the “lack of common ground” problem, not remedying it.
BTW “black hole” makes sense to me 😉 I think you are being humorous a bit with this, esp. the bit about EMF not really being associated with “one of the four fundamental forces of nature”.
Please don’t sign up to be a wikipedia editor, lol.
Meanwhile poor Sheegillshah may still be looking around for the “compile and run” button on the lxde taskbar.
2 hours later…

tlfong01

tlfong01
1920
May 20, 20:43
@goldilocks Ah what is ” Sheegillshah”? Google does not tell me anything. Is it a disease or something?
About the EMF thing, I was serious.
And to level our grounds a bit, let me tell you more about myself. Ages ago I completed a master degree in semiconductor physics (Brunel) , and I was in first position in the final exam of the only one paper in semiconductor/quantum physics.
@goldilocks Years went by, I am still interested in physics, enjoying and excited reading about Higgs Particle, gravity wave, and God/Angel’s particle etc. A couple of months ago, I still blogged about my happy readings on EMF things about Oliver Heaviside, and other scientists I admire, .. (I shall give you the web link later).
@goldilocks I also have a degree in [Western] Philosophy and [Western] History. I still vividly remember the joy when reading what Ludwig Wittgenstein says about “The meaning of a word is in its use”. I also enjoyed learning the meaning of words (actually mathematics) when studying formal language and specification, using predicate calculus and data driven language Prolog.
@goldilocks Only a couple of months ago I played with NodeMCU Lua and found it very interesting, so I bought the eBook and happily reading it. Now I am writing python, but I am indeed writing Prolog data driven programming style (using python dictionary and Lua Table), based on the spirit Scheme I learnt from googling MIT Lisp/Sceme and Harvard Haskell, and doing OO without OO, but FP. Actually I am doing Agile without Agile tools, …
I am not trying to show off my academic qualifications, but as I said, to construct a common ground for more efficient and effective discussion or argument (philosophy by the way, is all about arguments, arguments, arguments, …)
@goldilocks And let me tell you more about my knowledge in OS and IDE.
I started programming using IBM OS360 JCL, Algol60, APL, Simula67, Fortran 4 (77 not yet born!) , CDC6600 with IBM punching machine model 26 or 29 I forgot, yes, ICL at that time only had a few video terminals, …
In those days, OS books by Deitel and Siblershaz (I can never spell his name correctly) in unheard of, We used “System Programming” by JJ Donovan. I learnt system program and predicate calculus from Kowaski, who taught Chmosky’s language things, ah, I remember, “context sensitive” and “context insensitive” syntax and semantics.
After ICL with a master in computing, I went back to my city and started teaching in CU as a young assistant lecturer, and the subjects I taught were systems programming (actually operating systems in latter days terms) and programming languages. I still remember the test book I used was by Pratt, … I did write my own IDE utilities such as text editor using my favourite language Modula 2.
Fast forwarding a bit, I have been teaching computing and electronics engineering on and off, for decades. Before starting my second curve as a freelancer, my last position was Assnt Prof, in a Applied Computing Dept.
Ah, I forgot I need to build the ILI9341 touch LCD kernel this evening. So see you later.

tlfong01

tlfong01
1920
May 20, 21:31
Before I forgot, some of my old blog posts on the engineers I admire.
Thevenin, Norton, Kirchhoff
raspberrypi.org/forums/…
1 hour later…

goldilocks

goldilocks
125k
May 20, 23:16
@tlfong01 That’s neat. My original degree is a double in English and Humanities; I intended to do philosophy but at my school the department was all anglo-analytic stuff (prop logic and Leibniz, etc) which I had no interest in then, but the people I liked (Nietzsche, Heidegger, Derrida) were taught by English and Humanities profs.
I just finished a CS course in artificial intelligence (loved deep neural nets!) where we had to learn prop/prep logic and Prolog. And lisp, which is what I mostly used. They are both interesting languages (although I can’t see using them for much myself).
Physics and math I am not strong in, although I did well in the minimum for my CS cert, a 200 level finite course. After learning derivatives for the DNN stuff I’ve started to read some books, I’d like to grasp calculus enough to grasp Newtonian stuff then quantum mechanics (which I am told is actually simpler math wise).
1 hour later…
goldilocks
goldilocks
May 21, 0:27
@tlfong01 The OP of the question in question.
17 hours later…

tlfong01

tlfong01
May 21, 17:27
@goldilocks Thank you. I have slight dyslexia and prosopagnosia. I have no impression on “Sheegillshah”, because it is too long a phonetic string. I can recognize ideographic characters with less problems.
15 days later…
Feeds
Feeds
Jun 5, 8:01
The last message was posted 51 days ago.
.END

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: