Recent

Author Topic: Example: Reading HX711 ADC  (Read 1684 times)

ccrause

  • Sr. Member
  • ****
  • Posts: 481
Example: Reading HX711 ADC
« on: October 27, 2021, 09:57:28 pm »
Prompted by this question regarding reading the HX711 ADC on Raspberry Pi, I thought it would be interesting to try this on an atmega328p (a.k.a. Arduino Uno).  Since I bought an HX711 board a few years ago "just in case", this was a good excuse to solder some wires to the board and give it a test.

Code can be viewed on Github.

MarkMLl

  • Hero Member
  • *****
  • Posts: 3475
Re: Example: Reading HX711 ADC
« Reply #1 on: October 27, 2021, 10:04:56 pm »
I think you might have been better appending that to the original thread.

OK, so it looks like that's bit-banging it rather than using e.g. SPI.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

ccrause

  • Sr. Member
  • ****
  • Posts: 481
Re: Example: Reading HX711 ADC
« Reply #2 on: October 27, 2021, 10:59:29 pm »
I think you might have been better appending that to the original thread.
That refers to Linux on RPi, AVR code is a bit different.  I will post a cross reference, then the OP can decide whether to look at this.
Quote
OK, so it looks like that's bit-banging it rather than using e.g. SPI.
It seemed easier to just start with bit-bang.  At least reading the 3 data bytes should be possible over SPI, but on AVR the last 1 - 3 clock pulses used to configure the next conversion would need to be bit-banged. Maybe I'll test SPI sometime this weekend.

ccrause

  • Sr. Member
  • ****
  • Posts: 481
Re: Example: Reading HX711 ADC
« Reply #3 on: October 29, 2021, 10:38:51 pm »
Code can be viewed on Github.
OK, so it looks like that's bit-banging it rather than using e.g. SPI.
Updated example so that a user can select between using bit-bang or SPI. Even using SPI to read the 3 data bytes, the configuration for the next conversion needs to be bit-banged because the SPI peripheral can only work with 8 bit chunks of data.

MarkMLl

  • Hero Member
  • *****
  • Posts: 3475
Re: Example: Reading HX711 ADC
« Reply #4 on: October 29, 2021, 11:06:05 pm »
the SPI peripheral can only work with 8 bit chunks of data.

Bring back the 8523 :-)

...of course, that wouldn't really do the job, but broadly speaking it had more support for weird protocols than anything else known to man. Although I have a very vague recollection of an '80s device which could do everything from PWM waveform synthesis to Ethernet.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

 

TinyPortal © 2005-2018