-
Notifications
You must be signed in to change notification settings - Fork 5
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
Reading out sensor-values #2
Comments
If I had to guess, you are seeing power fluctuations. SD cards have a power consumption in the order of microwatts when they sleep, a write may draw several hundred mA (cards vary a lot). That's a rather massive load step for the voltage regulator. The analog reference is by default using the 3.3V supply voltage, so any supply voltage fluctuation will show up in measurements. Try using the internal voltage reference, if things look different. Check the AREF pin, if the 3.3V analog reference voltage is stable. |
Thank you for the fast response! I don't really understand what you mean.. do you think having an external AREF for analogRead could improve the signal? For example using another voltage source? |
Since you are seeing AREF fluctuations that are correlated with the signal fluctuation, yes, an external reference would help a lot. If you look at the Teensy schematic: Teensy has a 1.2V bandgap reference built in that you can try first. E.g. look at: The 1.2V internal reference isn't great, but it should do better than the fluctuations you are getting. A different reference won't solve the problem completely, since the Teensy analog VDDA will still fluctuate (tied to 3.3V via a ferrite). So if it doesn't work well enough, I would power the SD card with a separate power supply. E.g., there are SD card extension cables, where you could splice in power. |
Thanks again for your answer. I removed the 470 Ohm resistor and used an external 3.3 V regulator for AREF. |
Hello again, after using your logger for a lot of measurements I came across another problem: Best regards, |
I just saw your comment. No, I have no idea why the file would be empty. Everything is working fine in my tests. I've had issues with the SdFat library in the past, where it was unable to read some valid file systems. The library comes with an example for formatting the SD card. You might want to use that to start with a clean file system. If you can reproduce the issue, please post an example. |
Hey there,
I was really excited when I found your code for sampling at a constant rate and even more excited when I got the "SdFatSDIO_low_latency_logger.ino"-example running for my purpose.
I (simply) want to log the signal of a PIR-sensor (motion-sensor). So I actually just changed the ISR-part like this (storage is my struct for the data that has to be saved):
void captureData() { storage.logTime = micros(); for (uint8_t i = 0 ; i < 2 ; i++) { storage.data[i] = analogRead(i); } logEntry( {storage.logTime, storage.data[0], storage.data[1]}); }
Now, when I looked at the logged data, the sample rate was perfectly constant at 1 kHz. But although I made a test measurement inside an empty room (where there was no movement at all) there were these strange peaks in the signal:
These peaks seem to appear just when the Teensy is actually writing. While the code was running I simultaneously measured the signal with an oscilloscope. During the first 20 secs, where the Teensy is just waiting until it is mounted, the signal was constant and the peaks began to appear right after the start of the saving process.
The rate of peaks (from one peak to the next) is about 800 mHz, or every 1.2 seconds.
Any ideas, how to avoid the peaks?
Best regards and thank you for your time!
The text was updated successfully, but these errors were encountered: