Skip to content
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

improving sample rate #2

Open
gaeljaton opened this issue Nov 25, 2022 · 0 comments
Open

improving sample rate #2

gaeljaton opened this issue Nov 25, 2022 · 0 comments

Comments

@gaeljaton
Copy link

gaeljaton commented Nov 25, 2022

hi, great work, I eventually succed to work this lib on teensy hardware, but sample rate was slow (default 10SPS) and get hard to open monitor.
so I look at .cpp and I was intrigued by line 133 (read function) :
for (unsigned int i = 0; i < 128; i++) { digitalWrite(PD_SCK, HIGH); #if ARCH_ESPRESSIF delayMicroseconds(1); #endif digitalWrite(PD_SCK, LOW); #if ARCH_ESPRESSIF delayMicroseconds(1); #endif }
why do you produce 128 pulses? according to datasheet, hx710b need between 25 an 27 pulse to properly work
PD_SCK / Pulses Input / Data Rate
25 / Differential input / 10 Hz
26 / Temperature / 40 Hz
27 / Differential input / 40 Hz
so I done some change (I work on teensy LC, I guess I need some timing between pulse) :
for (unsigned int i = 0; i < 3; i++) { digitalWrite(PD_SCK, HIGH); //#if ARCH_ESPRESSIF delayMicroseconds(1); //#endif digitalWrite(PD_SCK, LOW); //#if ARCH_ESPRESSIF delayMicroseconds(1); //#endif }
It seem's to work properly and I double at least the sample rate near 25-30SPS (I guess serial routine slow down a bit the theorical 40SPS).
I'm not sure my butcher's code will work on other boards so I let you (or community) to pull this crap properly :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant