-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
uart-sps #63
Comments
Well this looks like compilation did work, no? Have you tried to continue with the next step and run the executable as in the guide? So run |
oh sorry Now the sensor is finally working. Perfect Is it possible to stop the application automatically after e.g. 10 measurements? Thanks a lot. Sometimes you don't see the forest in front of trees. Michael PS: i would like to start and stop the application via node-red and display the output in a debug window. |
You have to modify the sps30_example_usage.c file and replace the int16_t i;
for (i = 0; i < 10; i++) {
sensirion_sleep_usec(SPS30_MEASUREMENT_DURATION_USEC); /* wait 1s */
ret = sps30_read_measurement(&m);
if (ret < 0) {
printf("error reading measurement\n");
} else {
printf("measured values:\n"
"\t%0.2f pm1.0\n"
"\t%0.2f pm2.5\n"
"\t%0.2f pm4.0\n"
"\t%0.2f pm10.0\n"
"\t%0.2f nc0.5\n"
"\t%0.2f nc1.0\n"
"\t%0.2f nc2.5\n"
"\t%0.2f nc4.5\n"
"\t%0.2f nc10.0\n"
"\t%0.2f typical particle size\n\n",
m.mc_1p0, m.mc_2p5, m.mc_4p0, m.mc_10p0, m.nc_0p5, m.nc_1p0,
m.nc_2p5, m.nc_4p0, m.nc_10p0, m.typical_particle_size);
}
} |
Good to hear :)
Well you could replace the endless loop in the example with a for loop like @psachs suggested. Do you intend to let the sensor running in the background? Because if you stop measurements after just 10s, precision won't be that good since the device should be measuring for more than 30s to achieve good results. But to leave it running you'd may need to change the code in the beginning as well to only start measurements if they aren't running already.
I don't have any experience with node-red. But I'm curious how your setup looks like and what you try to achieve 🙂 |
Hello, first of all thank you for the great support. So regarding the measurement, I think that the sensor does not necessarily have to run 24/7. It would be enough for me, for example, or does it not matter that the sensor is running 24/7? I did that with the code from Unfortunately:
1000 thanks my sps30_example_usage.c file: #include "sensirion_uart.h" /**
int main(void) {
} |
Hi @mike197678 It seems that you're using v3.0.0, could you try with the latest release https://github.com/Sensirion/embedded-uart-sps/releases/latest ? The sensor is made for continuous operation but there are various reasons to not wanting to do this (e.g. power savings or longevity). However, due to internal calibrations it will yield more precise values when running continuously. Thus, as @rnestler suggested, you should run the sensor for at least 30s (and even more is better) before trusting the values. |
Hi @abrauchli hello, yes exactly, version 3.1.0 works with a minute break. Perfect. So now I just have to get the values somehow in node-red.!? |
Great, thanks for the reply! I'm closing the issue since we won't be able to support you with node-red. |
Hello,
Sorry I'm a total beginner at raspberry pi.
I saw your code regarding the SPS30 sensor.
I installed your files as best I could
Unfortunately I don't get any values.
if I do "make" I get
but not any more.
sorry for my bad English
can you help me?
The text was updated successfully, but these errors were encountered: