anyshake / explorer

🌏 Detecting seismic wave using 3 geophones or accelerometer, pack & send data to AnyShake Observer by RS232 / RS485 serial.
https://anyshake.org
MIT License
27 stars 3 forks source link

Code Review: Understanding Bitwise Right Shift Operation on Line 54 of main.cpp #1

Closed WhiteSong666 closed 7 months ago

WhiteSong666 commented 7 months ago

Look at lines 54, 59, 64 in this file. main.cpp This is line 54, I'll paste it down here. packet.EHZ[i] = EHZ.data >> 5; I don't know why we're moving 5 bits to the right here. Because after my actual measurement, I found that this will lead to the actual measurement value smaller, will be smaller by 32 times.

bclswl0827 commented 7 months ago

The ADS1262 may not be "REAL 32-BIT ADC" as you think, there will be some noise, drift, and non-linearity.

According to the benchmark by xdevs.com/review/ti_ads1262_p1, ADS1262 may have "Slightly better" data quality than general 24-Bit ADCs, and the remaining bits are basically random noise.

To summarize, discard 5 of the 32 bits is a compromise that allows Explorer to output data in 27 bits, and can still get pretty good results.

WhiteSong666 commented 7 months ago

I'm using the ads1256 and I don't think I need to give up those 5 bits of data. But if I don't shift 5 bits to the right, the anyshake Observer's waveform is 32 times smaller, but the gal is normal. If I shift 5 bits to the right, the anyshake Observer's waveform is normal, but the gal is 32 times larger.

bclswl0827 commented 7 months ago

You need to change the attributes of adc_settings field in AnyShake Observer's configuration to adapt your actual settings.

bclswl0827 commented 7 months ago

You need to change the attributes of adc_settings field in AnyShake Observer's configuration to adapt your actual settings.

See docs: https://anyshake.org/docs/AnyShake%20Observer/Configuration/adc