Nicole Chow
Posts: 4
Joined: Fri May 18, 2018 8:48 am

Problem on MAX30105 sensor on Raspberry Pi 3

Fri May 18, 2018 9:00 am

Hi, I'm a beginner of using a Raspberry Pi 3. My project requires to use a Sparkfun Max30105 particle sensor on Raspberry pi 3 and measure the heart beat reading, but it only has arduino library code (github) that provided by the company. Can I know how to connect this sensor to Raspberry pi 3 by using python or any ways to make use of this library?

Here is the link for details of this sensor: https://learn.sparkfun.com/tutorials/ma ... 1516765232

Please reply me and I will appreciate for your help. Thank you.

wh7qq
Posts: 921
Joined: Thu Oct 09, 2014 2:50 am

Re: Problem on MAX30105 sensor on Raspberry Pi 3

Fri May 18, 2018 9:33 pm

You piqued my curiosity on the MAX30105...I haven't used it yet but it reminded me of a product my R&D group had made custom by a Texas fabricator years ago. From what I see, the information on Sparkfun's side is all based on the Arduino so the code they refer to is also arduino based and in their modified C++ code and would have to be translated to the RPi....not trivial. I am unaware of RPi code to run the 30105 but you might find it with a google search.

The MAX30105 board connections are clearly marked and would correspond to RPi board GPIO connections with one SERIOUS exception. The RPi GPIO pins will not tolerate 5V levels so you would have to power the 30105 from the RPis 3.3 volt supply....unsure of the current requirements...or use level translation on these lines. I also do not know where the INT connection would go on an RPi. Your best bet might be to invest in an Arduino...the clones are very cheap...and follow Sparkfun's connections and code and plug the Arduino USB into your RPi, extracting the USB data from that.

In any case, do not connect the 30105 to 5 volts and then connect the SDA and SCL or INT lines to the RPi unless you want to "bake your Pi". Everything on the 30105 board will work with 3.3 volts except the green LED might need more. It won't interfere with pulse or sp02 functions. Good luck.
Sent by WH7QQ from an RPi3/Raspbian/pixel desktop.

User avatar
DougieLawson
Posts: 32339
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: Problem on MAX30105 sensor on Raspberry Pi 3

Sat May 19, 2018 6:47 am

wh7qq wrote:
Fri May 18, 2018 9:33 pm

In any case, do not connect the 30105 to 5 volts and then connect the SDA and SCL or INT lines to the RPi unless you want to "bake your Pi". Everything on the 30105 board will work with 3.3 volts except the green LED might need more. It won't interfere with pulse or sp02 functions. Good luck.
The I2C interface on pin#3 & pin#5 has 1.8KOhm resistors so that it's 5V safe. The secondary interface on pin#27/pin#28 doesn't have that hardware so is NOT 5V safe.
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

2012-18: 1B*5, 2B*2, B+, A+, Z, ZW, 3B*3, 3B+

Please post ALL technical questions on the forum. Do not send private messages.

User avatar
rpdom
Posts: 12397
Joined: Sun May 06, 2012 5:17 am
Location: Essex, UK

Re: Problem on MAX30105 sensor on Raspberry Pi 3

Sat May 19, 2018 7:02 am

DougieLawson wrote:
Sat May 19, 2018 6:47 am
The I2C interface on pin#3 & pin#5 has 1.8KOhm resistors so that it's 5V safe. The secondary interface on pin#27/pin#28 doesn't have that hardware so is NOT 5V safe.
How does a pull-up to 3.3V make the pins "5V safe"?

User avatar
DougieLawson
Posts: 32339
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: Problem on MAX30105 sensor on Raspberry Pi 3

Sat May 19, 2018 7:24 am

Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

2012-18: 1B*5, 2B*2, B+, A+, Z, ZW, 3B*3, 3B+

Please post ALL technical questions on the forum. Do not send private messages.

User avatar
rpdom
Posts: 12397
Joined: Sun May 06, 2012 5:17 am
Location: Essex, UK

Re: Problem on MAX30105 sensor on Raspberry Pi 3

Sat May 19, 2018 7:29 am

DougieLawson wrote:
Sat May 19, 2018 7:24 am
Because I2C is open drain.
That doesn't make it "5V safe" at all. Put 5V on it and it dies. If any device on the bus has pull-ups to 5V then you risk frying the GPIO.

User avatar
DougieLawson
Posts: 32339
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: Problem on MAX30105 sensor on Raspberry Pi 3

Sat May 19, 2018 7:41 am

I have two I2C RTCs and a BMP180 temp sensor all running at 5V. I use 5V for MCP23017s.

I haven't fried a RPi yet. So the pull-up on the open drain is 5V safe.
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

2012-18: 1B*5, 2B*2, B+, A+, Z, ZW, 3B*3, 3B+

Please post ALL technical questions on the forum. Do not send private messages.

User avatar
rpdom
Posts: 12397
Joined: Sun May 06, 2012 5:17 am
Location: Essex, UK

Re: Problem on MAX30105 sensor on Raspberry Pi 3

Sat May 19, 2018 8:05 am

DougieLawson wrote:
Sat May 19, 2018 7:41 am
I have two I2C RTCs and a BMP180 temp sensor all running at 5V. I use 5V for MCP23017s.

I haven't fried a RPi yet. So the pull-up on the open drain is 5V safe.
That's got nothing to do with it.

5V never appears on the i2c lines, no matter what the other devices are powered at. They are NOT 5V SAFE!

I could plug an i2c device that runs of 10000V in, as long as it uses open collector/open drain outputs and can accept 3.3V as input. That doesn't make the pins 10000V safe.

User avatar
DougieLawson
Posts: 32339
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: Problem on MAX30105 sensor on Raspberry Pi 3

Sat May 19, 2018 8:08 am

Stop being a grammar nazi.
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

2012-18: 1B*5, 2B*2, B+, A+, Z, ZW, 3B*3, 3B+

Please post ALL technical questions on the forum. Do not send private messages.

Nicole Chow
Posts: 4
Joined: Fri May 18, 2018 8:48 am

Re: Problem on MAX30105 sensor on Raspberry Pi 3

Sat May 19, 2018 8:29 am

wh7qq wrote:
Fri May 18, 2018 9:33 pm

The MAX30105 board connections are clearly marked and would correspond to RPi board GPIO connections with one SERIOUS exception. The RPi GPIO pins will not tolerate 5V levels so you would have to power the 30105 from the RPis 3.3 volt supply....unsure of the current requirements...or use level translation on these lines. I also do not know where the INT connection would go on an RPi. Your best bet might be to invest in an Arduino...the clones are very cheap...and follow Sparkfun's connections and code and plug the Arduino USB into your RPi, extracting the USB data from that.

In any case, do not connect the 30105 to 5 volts and then connect the SDA and SCL or INT lines to the RPi unless you want to "bake your Pi". Everything on the 30105 board will work with 3.3 volts except the green LED might need more. It won't interfere with pulse or sp02 functions. Good luck.
Hi, thanks for your reply! From your opinion, the only way to solve is to connect the sensor on Arduino and communicate with raspberry pi ? Because the data collected will be needed to convert into CSV file for analyzing and compared. I had tried the sensor on Arduino and the green LED also on at 3.3V, does it mean it also can work on raspberry pi 3.3V? At first, I thought the raspberry pi can supply 5V to the sensor as it has the 5V pins ( pin 2&4) :?: SDA and SCL pins also cannot withstand the 5V and it will bake the Pi too? ( Sorry, I'm really a beginner on this microcontroller...)

Do you know the steps for the Arduino to communicate with Pi ?

Thank you.

Nicole Chow
Posts: 4
Joined: Fri May 18, 2018 8:48 am

Re: Problem on MAX30105 sensor on Raspberry Pi 3

Sat May 19, 2018 8:36 am

rpdom wrote:
Sat May 19, 2018 8:05 am
DougieLawson wrote:
Sat May 19, 2018 7:41 am
I have two I2C RTCs and a BMP180 temp sensor all running at 5V. I use 5V for MCP23017s.

I haven't fried a RPi yet. So the pull-up on the open drain is 5V safe.
That's got nothing to do with it.

5V never appears on the i2c lines, no matter what the other devices are powered at. They are NOT 5V SAFE!

I could plug an i2c device that runs of 10000V in, as long as it uses open collector/open drain outputs and can accept 3.3V as input. That doesn't make the pins 10000V safe.
Hi Lawson and rpdom,
Thanks for your reply. It means that if I really supply the 5V to the sensor, the 5V will burn my SDA or SCL pins of raspberry pi?

User avatar
rpdom
Posts: 12397
Joined: Sun May 06, 2012 5:17 am
Location: Essex, UK

Re: Problem on MAX30105 sensor on Raspberry Pi 3

Sat May 19, 2018 8:42 am

Nicole Chow wrote:
Sat May 19, 2018 8:36 am
Hi Lawson and rpdom,
Thanks for your reply. It means that if I really supply the 5V to the sensor, the 5V will burn my SDA or SCL pins of raspberry pi?
As long as the sensor doesn't have pull-ups to 5V on board (and most don't), you'll be OK. However, from the schematic it appears that board does have pull-ups enabled. On the back of the board is an area marked PU with three pads joined together. Cutting the joins with a sharp hobby knife or similar will remove the 5V pulls.

Nicole Chow
Posts: 4
Joined: Fri May 18, 2018 8:48 am

Re: Problem on MAX30105 sensor on Raspberry Pi 3

Sat May 19, 2018 10:11 am

[quote=rpdom post_id=1317281 time=1526719327 user_id=1704
As long as the sensor doesn't have pull-ups to 5V on board (and most don't), you'll be OK. However, from the schematic it appears that board does have pull-ups enabled. On the back of the board is an area marked PU with three pads joined together. Cutting the joins with a sharp hobby knife or similar will remove the 5V pulls.
[/quote]
Thanks rpdom! Does it means that if I supply the 3.3v to sensor, the pull-up resistor will also cause it become 5v on board ?

wh7qq
Posts: 921
Joined: Thu Oct 09, 2014 2:50 am

Re: Problem on MAX30105 sensor on Raspberry Pi 3

Sat May 19, 2018 11:45 pm

Nicole Chow wrote
From your opinion, the only way to solve is to connect the sensor on Arduino and communicate with raspberry pi ? Because the data collected will be needed to convert into CSV file for analyzing and compared. I had tried the sensor on Arduino and the green LED also on at 3.3V, does it mean it also can work on raspberry pi 3.3V? At first, I thought the raspberry pi can supply 5V to the sensor as it has the 5V pins ( pin 2&4) :?: SDA and SCL pins also cannot withstand the 5V and it will bake the Pi too? ( Sorry, I'm really a beginner on this microcontroller...)

Do you know the steps for the Arduino to communicate with Pi ?
By no means is this the only way....you can connect directly to the SCL/SDA lines on the RPi (again using 3.3V on the 30105) but the coding is something else again. I have not found it but I haven't spent much time looking. Using the Arduino gets you some easy to use code as opposed to coding it yourself.

Arduino communications, whether to RPi or another computer, can be done with the USB port or the serial port. You can also obtain network connection (wifi or ethernet) add-on boards but I have no idea of how they work. I have just gotten into the communications thing so I am not the best one to advise you on this but it should be easy to put the data into a CSV file using python or another language. The Arduino has a selection of code examples that make it pretty easy to output data.
Sent by WH7QQ from an RPi3/Raspbian/pixel desktop.

ghellquist
Posts: 64
Joined: Thu Aug 02, 2012 8:47 am
Location: Stockholm Sweden

Re: Problem on MAX30105 sensor on Raspberry Pi 3

Sun May 20, 2018 8:03 am

To other posters answering. There is a link to the actual bord the OP wants to use. As OP stated beting a beginner, we could be slightly more helpful here.


The board can be directly attached to the Pi. The site says that you can run the board from 3,3V. One of the LED-s on the board will not work, but that might not be a problem in your application. Connect 0V to the PI, 5V to a 3,3V output on the PI, SDA and SDL to one of the I2C connections on the PI. Stay away from connecting the INT pin at the moment.

Now comes the part of writing software for the system. The Arduino system is meant to be easy for a "beginner" to use. It relies heavily on a number of library functions supposed to hide complexity. When you want to move this to the Pi you need to somehow get the same behaviour in a totally different software environment. It is definitely double, and a really interesting software project in itself. But for a short project it might simply be too much. In order to use the libraries a good suggestion is connect the sensor to an Arduino, and then transfer the information to the Pi.

If you want to try moving the code, it might help to know that the Arduino "language" is a subset of C++ with a number of restrictions. You are not allowed to write the main function as it is already in the system, and it is a good idea to keep to a limited subset of C++ functions. You could possible write the code in any language, often Python is suggested on the PI because it already has number of library functions in place.

If you want to run the board from 5V it is possible. But you need to open up the PU jumpers on the board. The PU jumpers connect to 5V which the Pi will not like on its input. The Pi might, or might not break, but we do not want to risk that. Instead we want to connect pullups to 3,3V.

https://cdn.sparkfun.com/assets/learn_t ... X30105.jpg

The PU jumpers connect to 5V which the Pi will not like on its input. The Pi might, or might not break, but we do not want to risk that. Instead we want to have pullup resistors to 3,3V. Pin #3 and #5 on the Pi already has those.

Return to “General discussion”

Who is online

Users browsing this forum: bettsr67, epoch1970, gkaiseril, jerrm, Marlor, W. H. Heydt and 15 guests