CS1237/CS1238 ADC

Hi, has anyone used a CS1237 ADC? There are some incredibly cheap boards on AliExpress. These have a TL431 chip to provide a excitation voltage set at 2.5V so seem ideal for a 3.3V power supply. The CS1237/1238 also has a built in thermometer which is a definite advantage over the hx711. 1238 is the two channel version and slightly more expensive.

Code is here GitHub - CuriousScientist0/CS1237-Arduino: An Arduino-compatible code for the CS1237 24-bit analog-to-digital converter. with a nice writeup and video here CS1237 24-bit AD Converter with Arduino ā€” Curious Scientist

AliExpress also has similar boards with the hx711 and tl431 combination. Iā€™m not an electronics person, what do others think of these boards? Cheers

2 Likes

I wasnā€™t expecting links to work. Here are some AliExpress examples:

CS1237/1238: https://www.aliexpress.com/item/1005005412117918.html

Hx711: Hx711 24-Bit-ADC-Modul an Bord tl431 externe Referenz spannung Zweikanal-WƤge zelle 24Bit - AliExpress 502

Havenā€™t heard about this IC until now, thanks. And obviously, it seems to be around since yearsā€¦ :\

This is a part made for bathroom scales, not more (like the HX711 always was/is, but thatā€™s another story). It might be able to operate in the full industrial temperature range as announced, but the ā€œSPIā€ might fail in hot summers or cold winters (see below). Donā€™t expect accuracy for outdoor usage on a beehive with this.

  • First odd thing when I look at the datasheet, is a typical Chinese cheating thing: there is an image, which was clearly not from the CN-based manufacturer (better: designer; as Chipsea Technologies is a fabless company).

    They just took a picture out of the Texas Instrumentsā€™ ADS1232/1234 datasheet, removed something (PGA gain factor) and exchanged another one (name of third OPAmp ā€œA3ā€ was exchanged with ā€œBufferā€):

    Image in CS1237 datasheet, PGA detail (both images not fully cropped for surrounding details):

    original image in TIā€™s AD1232/1234 datasheet, PGA detail:

    What is even more ā€˜funnyā€™, is that in the ā€˜borrowedā€™ figure there are two terminal drawn with the name CAP (cross-connecting a cap there forms a low-pass to reduce analog bandwidth of this input stage). These pins only exist on the ADS1232/1234, - but not on the CS1237! They even explain its function as done in the TI datasheetā€¦
    So, what purpose they think does this figure serve there? Gain more reliance on the datasheet? mm(

  • the datasheet claims that the internal oscillator of 5,2 MHz is integrated with an Xtal (quartz crystal). While this is possible, it is unusual for such a low-cost thing (while in such a small package). And: they state a temperature drift of 200ppm/Ā°C (!), this is magnitudes off a reasonable xtal oscillator design. So I must assume that their xtal is very bad, or they just simply integrated an RC oscillatorā€¦
    While this is not critical for the ICā€™s state machine to function, is has implications for the serial communication from and to the IC. We had this also here in the forum with unreliable HX711 communication, and one impact came from their untrimmed RC oscs: when they are already off by 20% nom. freqency at room temperature, youā€™ll lose connection when outside temperature is e.g. much less. Many lines of code have been uselessly written alone to circumvent this problem, only to see that in another case those functions didnā€™t help someone elseā€™s HX711 at allā€¦

  • the term SPI is used in that datasheet for an interface which clearly is not an SPI as defined being a 4wire bus and specific signalling. What they implement is something else, but not something one should call an SPI: you need dedicated handling of GPIO pins for this, and canā€™t connect it to a generic SPI peripheral on an MCU and use that hardware SPI. Again, annoying.

  • the library GitHub - SiBangkotan/CS1237-ADC-cpp-library: a library for ChipSea ADC CS1237 (for Arduino) mentions that it is made for ESP8266 ā€œwith some timing critical sections in assembly [language]ā€.
    This lib also mentions ā€œAble to capture 11th harmonics of 50Hz electricity supplyā€. While this is nice, but totally unneeded for weighting purposes, this means: no inbuilt power line-cycle interference rejection, like even the HX711 features one.
    Your linked lib BTW requires the adaption of the length of a certain delay (with NOPs, like 40 years ago ;) ), MCU-dependant, not very portable code, like my finding aboveā€¦

I am, and can say, that I donā€™t miss these kind of chinese parts and their what-they-call datasheets at all TBH. Lots of lifetime has been wasted by many others not only here (including myself) to not only support ICs like the HX711, but especially for debugging and to circumvent all these ICā€™s quirks and flaws, just only because someone keen to save some coins where this shouldnā€™t have been done.

I consider this IC worse than the HX711. This might make no difference when used for bathroom/body scales, but do yourself a favour and donā€™t use it for ā€˜seriousā€™ applications.


BTW, your 2nd link in the post before leads to CS1237/1238 break-out PCBAs as well, and not to HX711 onesā€¦?

2 Likes

Wow! thank you for such a detailed response. Itā€™s taken me most of the day to digest it.

I totally get what you are saying about wasting huge amounts of time to save a small amount of money. Iā€™m inclined to be a penny pincher and I do have to stop myself often from doing this.

Having said that, there is a lot of satisfaction to be had from making something from low cost items. Making weight monitors for my beehives is my winter project so Iā€™m prepared to spend quite a bit of time on it. If it was all just plug and play then Iā€™ll end up filling my time with boring DIY, painting rooms etc. Iā€™d like to get back into programming so the project ticks a few boxes for me.

I have 10 garden hives and the goal Iā€™ve set myself is to monitor their weight for under 20 pounds per hive (~24 euros). This means sharing as many components as possible between hives and cutting all unnecessary things. I donā€™t need it to be super accurate because ultimately all Iā€™m interested in is swarm detection. My provisional design is a bar scale that weighs half the hive. Iā€™ve got a set of cheapo bathroom load cells to play with, but I may upgrade them to the steel version that the commercial beehive monitoring guys seem to use (which various Chinese sellers sell under different load cell model names SC134, GML670, AM21A, TAL107, M-001 etc with full/half-bridge versions).

To cut costs one idea Iā€™ve been toying with is to use the microcontroller internal thermometer instead of buying a dedicated thermometer. Initial testing though has shown the thermometer on the ESP32-C6 to be way off. Itā€™s at least 18 degrees too low. Whether that is just a simple offset or some huge calibration issue I have yet to investigate. Iā€™ve got it uploading data to beep.nl via code from Prusa Hive.

So that is some background to why Iā€™m interested in the CS1237 with its built in thermometer. Another option is the HX710A which apparently also has a temperature sensor. The TM7711 is listed as an alternative for the latter, but Iā€™ve yet to see a reference to a temperature sensor (although I havenā€™t gone as far yet as translating data sheets). Boards for all of these are around the same price.

ADS1220 boards are not too expensive if sourced from aliexpress, but whether they are genuine, who knows?

The lack of power line cycle interference rejection shouldnā€™t be a problem on battery power? Presumably the TL431 is there to solve some of the CS1237ā€™s deficiencies? I couldnā€™t find the ppm/Ā°C for the HX711, maybe it is just as bad?

The second link takes me to a HX711 board, but if it still isnā€™t working then you should be able to find it by searching ā€œtl431 hx711ā€.

Cheers

Adam