PIC18F25K22 UART ERROR

For general Flowcode discussion that does not belong in the other sections.
SILVESTROS
Posts: 90
http://meble-kuchenne.info.pl
Joined: Tue Dec 13, 2022 9:04 pm
Has thanked: 24 times
Been thanked: 1 time

Re: PIC18F25K22 UART ERROR

Post by SILVESTROS »

Hi,
many thanks for info...I made the update in MAX30100 component...now I have no data in terminal nor at simulator...also at sensor MMA8452 data as it seems in terminal is not normal with pcb at horizontal dimension. normally at x must have about 1 , and y,z near to 0..when change pcb orientation (90 deg.), I have small changes in x,y,z with no change of polarity..
in tarminal , data are : FSR, MMA8452 x,y,z, MAX30100.
regards
Attachments
DATA2.png
DATA2.png (307.53 KiB) Viewed 3895 times

chipfryer27
Valued Contributor
Posts: 1213
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 297 times
Been thanked: 429 times

Re: PIC18F25K22 UART ERROR

Post by chipfryer27 »

Hi

I would first concentrate on trying to communicate with the oximeter to establish what's going wrong with that, before looking at the rest.

Download the sniffer and run that with only your oximeter connected (no FSR or accelerometer). Use Medelec35's new component and be sure to place it exactly where he states or FC won't see / use it. Don't update any components or it will revert to the old version.

If I remember correctly it sends out details on what it finds over the UART, so you will see the results in your terminal program. If it doesn't return the address of your oximeter then you need to establish why.

Regards

SILVESTROS
Posts: 90
Joined: Tue Dec 13, 2022 9:04 pm
Has thanked: 24 times
Been thanked: 1 time

Re: PIC18F25K22 UART ERROR

Post by SILVESTROS »

Hi,
after a new update of MAX30100 component I have data...the problem was the component and pulling up of SDA,SCL of module..MAX30100 data is with finger on optical sensor..about data values are these raw ? accelerometer data is normal ? if so, how can we convert that in g for MMA8452 and heart rate / HbO2 % ?
regards
Attachments
S1.png
S1.png (332.81 KiB) Viewed 3888 times

chipfryer27
Valued Contributor
Posts: 1213
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 297 times
Been thanked: 429 times

Re: PIC18F25K22 UART ERROR

Post by chipfryer27 »

Hi

Great to hear you have it all talking and sending data values. I shall have some Raki with my breakfast to celebrate :)

As mentioned before I don't have those sensors, so the following is just a guess.

I think you send out HR then Ox which equates to the 65535 and 40152 values shown (last line), and these are the Read IR and Read Red respectively. From the above it shows that the IR reading is constantly returning its maximum value. Does this change if you have your finger on the sensor then off or is it constant?

If constant, perhaps saturation is occurring? Perhaps try lowering IR current? The default component values for IR / Red are 50mA (max) and 27.5mA (about 50%). Personally I think the IR might be too high, but I have no direct experience with the sensor.

From the data sheet you can see that Pulse Width and Sample Rate are intertwined (p19). The component default values allow for that combination to be used but you will need to experiment a bit with settings to get optimum results for your application. These settings can be changed to suit your specific application and trial and error should give you the best settings for your usage. Try adjusting IR/Red currents and Pulse Width / Sample Rates to see if you can fine tune.

Hope this helps.

Regards

SILVESTROS
Posts: 90
Joined: Tue Dec 13, 2022 9:04 pm
Has thanked: 24 times
Been thanked: 1 time

Re: PIC18F25K22 UART ERROR

Post by SILVESTROS »

Hi,
I would like to thank you very much for your help...after that, it's time for some good wine...you said raki?..do you mean the local wine that we have here in Greece, in Crete island ? about MAX30100 output values , when take off my finger from optical sensor values are as at screenshot..I think that must change the settings of current and after that a conversion to get numbers of heart rate/HbO2 %..what about accelerometer values ?
I think that it's not normal to have almost the same g value in 3 axis...or these values must converted ?
regards
Attachments
S2.png
S2.png (283.6 KiB) Viewed 3875 times

chipfryer27
Valued Contributor
Posts: 1213
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 297 times
Been thanked: 429 times

Re: PIC18F25K22 UART ERROR

Post by chipfryer27 »

Hi

I had the good fortune to spend about five months in Xania back in 2017 or thereabouts. No meal was complete without the complimentary flask of Raki. Fond memories indeed :)

From the above it seems like the Oximeter is working, but you will probably have to fine tune IR/Red current values etc. I see from a quick search that Red current values can be around 7.5mA and that IR of 50mA can cause issues. Also you will probably want to do some DSP filtering but as you are intending to feed the values into Excel it could do the calculations for you (freeing up your PIC to gather the info). If you do a search for "implementing a MAX30100" or the like you should find lots of information.

Briefly you will need to do a bit of DSP of the raw IR data to look for peaks (which equates to a heartbeat) then time the interval between such to get a BPM. The reflectance changes depending on how much O2 is in the blood. Deoxygenated blood absorbs more Red, while oxygenated blood absorbs more IR and by measuring the ratio of IR to Red received, the oxygen level (SpO2) can be calculated, but as I have no experience of this I couldn't begin to say what an obtained value actually equates to other than "more/less O2 than before" :)

As for the accelerometer I did have a brief play with one a few years back but then found a tilt sensor that suited my purpose better.

Off hand I don't have the data sheet for that sensor but I'll grab one later. Readings looks quite stable though. I assume if you slowly lift it up or turn it over then things change before settling again? Perhaps a bit of calibration calculations are required?

I'm sure other forum members will be able to assist with this aspect.

It seems you just need to interpret your captured data now.

Regards

SILVESTROS
Posts: 90
Joined: Tue Dec 13, 2022 9:04 pm
Has thanked: 24 times
Been thanked: 1 time

Re: PIC18F25K22 UART ERROR

Post by SILVESTROS »

Hi,
ok...thanks for info... now when I was tried to change current and reload the code to PIC I have no data from
MAX30100..component was updated...what's wrong? what can I do to check if component is updated ?
regards

chipfryer27
Valued Contributor
Posts: 1213
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 297 times
Been thanked: 429 times

Re: PIC18F25K22 UART ERROR

Post by chipfryer27 »

Hi

What happens if you change the values back to what they were before? It could be you "went too far" with one or more.

Regards

SILVESTROS
Posts: 90
Joined: Tue Dec 13, 2022 9:04 pm
Has thanked: 24 times
Been thanked: 1 time

Re: PIC18F25K22 UART ERROR

Post by SILVESTROS »

Hi,
small changes...I return to previous , but no data....it seems that component revert to old version...but how?
the only that I've done before make the changes, is to download MAX30100 component from library updates..Is
that wrong?
regards

chipfryer27
Valued Contributor
Posts: 1213
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 297 times
Been thanked: 429 times

Re: PIC18F25K22 UART ERROR

Post by chipfryer27 »

Hi

That's the issue.

Until the new component is part of the next official update, the library will contain the old component and overwrite the new one. Just download the one from Medelec35 again and place it in the folder he documented. That should fix things.

Regards

Post Reply