• squaring up the reservoir

    helge09/09/2018 at 14:48 0 comments

    Our journey has long left the mere "reservoir" part behind. Sometimes it appears things are growing into each other, often displacing features, sometimes acting synergistically.

    This time the reservoir housing has become something between an enclosure for reservoir, pump and controller, a holder for the reservoir vessel and a fancy desk lamp. The scale / strain gauges aren't integrated at this point but we'll get there in due time.

    Note this prototype has been implemented with translucent PMMA while later version will be made from opaque white PMMA. With the lights out, the thing still looks rather shiny:

    The wide open and simple lid should make pouring in without spills an easy feat. The food safe stainless steel vessel is a GN 1/6 200 mm container holding up to 3.4 L. It's a multi-sourced standard part and the dimensions are more or less guaranteed. They also come in translucent plastic.

    White PMMA is a much better diffusor. Here are the rough target dimenions of the part estimated from measurements and later confirmed to almost perfectly fit the container (note the circumferential step, the mantle has to sit behind that.

    Bending PMMA

    I was about to say the rest is as easy as bending PMMA in shape. In practice we built the strip heater first, created bends on 3 mm test pieces (same thickness as the mantle) and measured the resulting inside and outside lengths of the specimen to base the model on them.

    The bending device consists of a 600W IR heater (~45cm in length) occluded with aluminium T profiles and a flat profile wrapped in Al foil and tape in a haphazard attempt to control convective heating of those rails. It works for now but requires cooldown after each bend, so consider a water-cooled solution.

    The unfolded surface model considers bend allowance to some degree. The pro forma way to calculate bend allowance is shown here,

    but there is no straight-forward way to calculate yielding under compressive or tensile strain in a part transiently heated from one side.

    1. PMMA glass transition temperature Tg is at 105 °C
    2. PMMA melting point(?) is at 160 °C

    Anything between these temperatures is fair game for bending. with a distance of around 20 mm from the quartz heater and the rear reflector still in place a heating cycle time of about 2 min 15 sec (starting cold with no pre-heat) softens the material on one side sufficiently and seems to keep the other side near Tg so it will yield only slightly,

    Initially a "compressive yield bend" - towards the heated side - was intended, but due to a minor oversight the first bend was made the other way ;-) As it turns out the "tensile yield bend" doesn't produce an unsightly wrinkle but slightly lengthens the material, once again owed to the inhomogenous thermal profile throughout the thickness of the sheet.

    With a bit of over-bending (about 10 .. 30° held for 1-2 sec) springback is eliminated. A right angle fixture is mandatory to control the resulting angle and the 45° facet is eyeballed and tweaked in the early moments of cooling.

    Minor adjustments are possible by re-heating one bend line at a time, all the while softening is tested by observation and feeling how the part reacts to slightly bending the zone back and forth.

    The unfolded surface has been designed in OpenSCAD, adding small notched that help aligning the bend line to the heater slots with two drill bits. Works a treat.

    The OpenSCAD export to .svg has been used to create suitable files which, once checked and modified for proper scaling are fed to the lasersaur web interface.


  • MAX6126 knows how to VREF

    helge08/27/2018 at 10:45 0 comments

    Let's cut to the chase and figure out how to treat an ultra low noise reference like MAX6126.


    As found previously both bypassing the internal reference as well as providing proper output capacitance goes a long way in silencing LDOs. The improvement from no bandgap reference bypass to 100 nF is significant and about the same is gained by using a large 100 µF capacitor on top of it (e.g. F930J107KBA ).
    It has to be determined experimentally how much improvement is needed here in the context of other noise contributions. One can start out with maximum capacitance and investigate individual noise contributions one by one.

    capacitor selection
    Solid electrolyte tantalum capacitors are more stable in that regard but exhibit higher leakage current.


    temperature compensation

    It will be annoying to add a temperature sensor to the load cell, e.g. by glueing an NTC to the element and judging by our previous set of experiments the single point load cell type does not seem to be overly sensitive to temperature variations and satisfies temperature stability requirements without further compensation and software calibration. Absolute measurements however are degraded by reference drift:

    An HX711 next to substantial heat sources (such as the NodeMCUv2 board with 5V-3.3V LDO) in an enclosure will likely see a 10 .. 20 K temperature rise. Additionally the on-board DCDC might contribute with lateral heat diffusion when in operation.
    Counter measures include distance, thermal isolation slots and use of software calibration based on digital temperature sensor readings, e.g. from

    TC74, AT30TS74, TMP100 (cheap to expensive)

    temperatue effects

    Once again it's easier to not cause disturbances than to deal with them later on.

    But to quote DaveEvans on temperature calibration ( https://forum.arduino.cc/index.php?topic=365107.0 ):

    I'm not especially happy with the results.  Subsequent tests showed that it improves accuracy somewhat, but not as much as I'd hoped.

    Once more we'e left with the need to perform more experiments to see where the 80-20 trade-off is. Maybe we're already there, or maybe integrating HX711 and subjecting it to heat and switch-mode converter noise will be a big deal.

    next up we'll finally use HX711 data to determine the effects of PNP transistor selection, output bypassing, reference bypassing and power supply ripple rejection.

  • HX711 vs. ADS1231

    helge08/26/2018 at 21:40 0 comments

     Having a look around for layout recommendations initially chips like MAX4196, MAX1452 and MAX1455 cropped up - preamp and signal conditioner ICs for strain gauge measurements. But that's a bit beside the point so here's just a reference for further reading.


    More intriguingly there's ADS1231 for ten times the price of an HX711. Check out its features:

    • 24 bit 3rd order ratiometric sigma-delta ADC , 4th order sinc filter
    • 10 SPS / 80 SPS with 50 / 60 Hz and harmonic suppression
    • 128x gain (20mV FS, AVDD up to 5V)
    • 2-wire SPI-ish synchronous interface (SCLK, DOUT)
    • "no register progamming"
    • sleep mode induced by keeping SCLK high
    • internal oscillator and external clock input option




    While HX711 provides the same features (except the datasheet doesn't go into detail as to how the 50 / 60 Hz suppression is implemented, possibly due to patent issues) - it expands the capabilities by adding an input multiplexer with different gain options, a bit-counting command decoder for the new config options and sadly eliminates both the filter / bw limit capacitor after the PGA stage as well as the differential reference input.

    ADS1231 relies on an external voltage reference and implements sleep mode with a low side switch while HX711 has an integrated LDO with external PNP pass transistor and its power-down capability.

    general LDO noise

    Since we're talking 20-100 nV precision it's very interesting to see this seeming neglect of differential reference implementation in the HX711 design. ADS1231 design choices also seem to hint at a possibility that integrated LDOs are usually not good enough - even dedicated external "ultra low noise" LDOs like http://www.ti.com/lit/ds/symlink/lp5907.pdf still feature 10µVrms (10 Hz .. 100 kHz BW, *with* 1µF output capacitance?) with a substantial 1/f-noise contribution in the 10-100 Hz band

    This leads to suspect that just hooking up excitation and AVDD to some LDO will  in both cases not be enough for proper performance. Capacitors themselves contribute some noise (kTC noise https://en.wikipedia.org/wiki/Johnson%E2%80%93Nyquist_noise#Thermal_noise_on_capacitors ) and depending upon the dielectric possibly some piezoelectric noise as well (hopefully no pyroelectric effects though), but bigger is essentially better here, as long as the LDO doesn't go unstable.

    LDO stability has to be ensured via output capacitor selection - both capacitance and ESR must be in a certain  range and the input capacitor should match the output capacitor by some factor (stick to typical ratio from datasheet). Larger capacitors can be added when they are decoupled with R or L elements but resistors will again contribute some noise ( https://daycounter.com/Calculators/Thermal-Noise-Calculator.phtml : 5.185k: 346 nV vs. 667R: 117 nV) - and regulation and bandwidth are not preserved. When using inductors, resonances have to be controlled by adding RC series elements. Implementing an RC pi filter is very similar to adding an output resistor to an opamp to re-establish stability in capacitive loading scenarios.

    BJT noise considerations for HX711

    According to


    the primary noise source of an LDO is its reference, so proper bypassing of the voltage reference pin might be just as effective as increasing the LDO output capacitance. This is particularly relevant...

    Read more »

  • HX711 layout considerations

    helge08/25/2018 at 17:44 0 comments


    There's a lot of room for paranoia when stepping from the digital domain with its noise margins, supply ripple and voltage tolerances into areas of analog and mixed signal circuitry.

    Connectors, analog switches, scaling networks, voltage reference and supply filtering components are situated in the analog domain while dedicated ADCs and controllers with integrated multiplexers, programmable gain amplifiers and ultimately ADCs are mixed-signal ICs.

    Suddenly there are concerns about internal electromagnetic compatibility, identification of sources of - and ways to mitigate - interference. There are also selected aspects of systematic measurement errors which will not be discussed in this log (temperature effects like bias current / voltage shifts, reference voltage drift, thermoelectric voltages; mechanical effects like strain hardening, yielding or just creep, hysteresis of sensing elements, non-ideality of summed sensing elements and so on).

    There are a few coupling mechanisms for EMI to consider when creating a new layout or fixing an existing one.

    Obviously the effects - noise currents into or noise voltages added to analog nodes of the circuit (including supply rails) - are the same no matter the way they were created. The above nomenclature helps pointing at the causes of interference while looking at the interaction of electric and magnetic fields yields ideas how to address susceptibility.

    A brief detour through classic electromagnetism.

    Furthermore it feels to me like the distinction between "coupled" and "radiated" EMI often doesn't make a lot of sense at the component or PCB trace level.

    If part of the circuit picks up interference, it's susceptible to the local values of the electric or magnetic fields while "radiated" only suggests to me that there are electromagnetic waves involved which in turn means that one is only supposed to be concerned with field components that are able to propagate through space.

    To quote https://en.wikipedia.org/wiki/Near_and_far_field on the distinction of field zones,

    "Far-field E (electric) and B (magnetic) field strength decreases inversely with distance from the source, resulting in an inverse-square law for the radiated power intensity of electromagnetic radiation. By contrast, near-field E and B strength decrease more rapidly with distance: part decreases by the inverse-distance squared, the other part by an inverse cubed law, resulting in a diminished power in the parts of the electric field by an inverse fourth-power and sixth-power, respectively. The rapid drop in power contained in the near-field ensures that effects due to the near-field essentially vanish a few wavelengths away from the radiating part of the antenna."

    Usually the near field is a complicated mess (topologically) but what matters is the net induced current or voltage. surfaces act as capacitors, loops and slots act as inductors which couple to alternating fields, constituting capacitive and magnetic coupling respectively.

    Inversely, purely magnetic (loop antennas) or purely dielectric (DRA) structures work fine while predominantly coupling to one of the fields. The complementary field is being regenerated as per

    But I digress. Take-away: open conductor loop areas act as magnetic noise pick-ups while free standing conductors sample the local electric field.

    So "just make bad antennas". Minimize susceptible loop areas, block AC magnetic flux paths by adding ground planes and if possible arrange components to they provide Faraday shielding against electric fields (e.g. stacked PCBs or dedicated shielding cans).

    Even if high frequency fields are outside the frequency bands of relevance, they might still interact non-linearly with the circuit and can thus be rectified into voltage offsets or bursts. This is where the dimensions come into play, at least in...

    Read more »

  • Inverse Midas

    helge08/18/2018 at 09:34 0 comments

    The hardest part about running an experiment is to resist messing with it as it's running and there is time to figure out what things need to be changed or improved.

    It's a bit counter-intuitive: A consistent measurement is better than one conducted under spontaneously changing conditions. It's easy to restart measurements when they're done within a matter of half an hour. With measurements that run for days on end it's a different story.

    In the following graph two abrupt changes are recorded. The first one is due to the identification of a possible source of error and subsequent mitigation attempt:

    • suspected heating effects of the multimeter underneath the device under test
    • D.U.T. unloaded and set up in a different location next to the multimeter
    • slight slack in the power and sensing cables ensured so they don't pull on the underside of the scale

    The second change was caused merely by moving the cables around a bit, causing a 0.5% jump in the reading. The change equals ~25 g load change which can hardly be explained by a few 0.14 mm² IDC ribbon cables pushing in a different way. So beside thermoelectric effects, noise pickup seems a likely cause.

    A third run will use just the HX711 front ends, the scale electronics and the four pairs of sense cables will be removed to monitor just the unperturbed load cell elements.

    Adding the transformer to sample mains voltage variations was still a valid idea to quantify DMM transformer + LDO loss influences and understand the other measurements in retrospect.

    So on the one hand it's always worth investing a couple more hours improving the experimental setup to get better and more credible results. On the other hand, part of cunducting experiments is to identify all the things that have been overlooked or to been considered.

    We shall be doing this again. For science :)

  • banana for scale

    helge08/16/2018 at 18:31 0 comments

    Say hello to these shiny 3.4 L reservoirs made from stainless steel. They're completely off the shelf and a set of those GN 1/6-200mm containers with a cut-out lid cost me about 11€. Custom made stainless steel vessels and tanks are going to be way more expensive and I love the fact that these are multi-sourced, clean-cut standard parts. Living in an area where tap water is basically liquid limestone and wanting to add a whiff of fertilizer to the water is bound to spell precipitation and algal troubles, so I'll hope to keep the annoying cleaning part for more important pieces of the kit, i.e. the tubing.

    These reservoirs can be inserted into a rectangular mantle with 150 mm x 162 mm outer dimensions. Since I only have 500 mm x  600 mm stock material for the mantle this is going to be rather interesting. I'm aiming for a good fit but will add 45° corner truncations, moving them inwards by 20 mm. I've only done PMMA bending once and found it to be rather much of a pain, what with it bending back again and taking quite a few minutes to freeze in place.

    More experimentation will surely be required to get the mantle right.

    On youtube different versions of "acrylic bending table" builds are presented that are competing in their ability to set your place on fire.

  • plans and execution

    helge08/13/2018 at 22:35 0 comments

    More testing to be done.

    • characterize a single point load cell
    • characterize a 5 kg kitchen scale with those four strain gauges on its feet
    • acquire correlated measurements with the precision multimeter and HX711 via SPI
    • characterize drift over temperature (fridge vs. room temperature)

    load cycles: 24h loaded to 100% nominal load, then 24h recovery

    temperature cycles: RT (as part of the 24h no-load phase), fridge, RT (~12h each)

    seems like now is the time to hook up SPI.

    No precision voltage sources will be used this time because HX711 supplies the reference voltage and the measurement scaled to AVDD.

    ps. single point cell - temperature drift

    The single point cell sense voltage drift looks pretty much the same as that of the 5 kg scale elements one.

    Once calibrated for excitation voltage drift however...
    Let's try that again for the 5 kg scale.
    I guess we'll have to have a look at the compensated scale01 sense voltage in the 68h run next...

    pps... some time later....

    Let's look at the data again, but this time both dividing the sense voltage by the excitation voltage and then normalizing it to the starting value to display drift.
    With twice the acquisition time the single point load cell is still just casually walking away from us while the 5 kg kitchen scale is somewhat inspired by daily cycles. I'm not sure whether to call it a temperature effect yet.

    Let's also revisit the prior long dataset with just the 5 kg scale:
    With the kitchen scale having an HX711 board glued onto it vs. the single point scale setup more or less floating in the air, some differences in behaviour are to be expected.
    Heh Sensepeek, bet you didn't see that coming.
    Just doing a very rough calibration of the mains voltage level it becomes evident that it's not exactly stable even over the course of half an hour:
    I expect some more drastic day-night variations. What's with the mains voltage? Well.. there's a transformer in the multimeter on which the scale rests, varying in heating power ... I just had to include this data channel. Next I'm pretty sure I'll also have to hook up a hot wire anemometer... driven by an HX711 board... deeper, ever deeper down the rabbit hole :D

    I'm beginning to feel what it must have been like to set up the pitch drop experiment.

    ppps. waking up at night

    it appears I mistakenly closed the console window running the logging application when going to bed. However I woke up around 330h and found, as one does, the measurement to be terminated. A restart was in order - but I forgot about the scale switching off again. Hello, 25-30 µV offset. One might as well just discard the initial chunk of data.

    Fuzzy trends:
    ignoring the wrong starting time for the normalized plot we're not at a point where the far-fetched mains-induced temperature variations are in the graph as well.. and they tell us... nothing? Mains voltage variation induced temperature changes are still minuscule deviations in the mW range.
    Maybe I'll just.. hold on  a a sec...
    there, I just removed the kitchen scale (01) from the top of the multimeter around 1534442178.2930505. The single point cell can stay there because it's mostly thermally decoupled from the instrument and in convective exchange with the room air.
    The scale is again back to sleep to keep the measurements compatible with prior ones.

    This will have to end, one way or another ;-)

  • side quest: temperature measurement

    helge08/12/2018 at 12:28 0 comments

    I must confess I haven't spent much time looking at NTC curves before. My prior knowledge was that they are somewhat ill-defined and can only deliver reliable measurements when calibrated individually.

    source: https://support.belimo.us/Documentation/Standards-Compliance/957165601/What-is-the-difference-between-NTC-10K-Type-2-and-Type-3-sensors.htm

    The temperature characteristics of NTCs can be fitted using the Steinhart-Hart (S-H) equation to a practical degree of precision:


    As it turns out, I seem to have bought 10k NTCs of the K164 type and I don't know their R/T number. Apparently they're made by EPCOS / TDK and offered in a whole array of curve shapes / coefficients.



    At first glance, 1014, 2903 and 2904 characteristics seem to match the quick&dirty calibration values:

    • 33.6 k (sensor in plastic foil, dipped into ice slush, ~1..2°C)
    • 10.0 k (nominal at 25°C)
    • 0.62 k (sensor in plastic foil, dipped into boiling water ~98°C)

    Mouser only seems to stock B57164K0103K052 which is listed as having the 2904 characteristics (from EPCOS/TDK datasheet above), and the datasheet only states 2904 for the 10k type.

    The Steinhart-Hart-coefficients can be fitted after some OCR gore as follows:

    Final set of parameters            Asymptotic Standard Error
    =======================            ==========================
    a0              = 0.00130396       +/- 2.557e-006   (0.1961%)
    a1              = 0.000214209      +/- 4.56e-007    (0.2129%)
    a3              = 9.80175e-008     +/- 1.801e-009   (1.837%)
    correlation matrix of the fit parameters:
                    a0     a1     a3
    a0              1.000
    a1             -0.991  1.000
    a3              0.935 -0.968  1.000

    note that the S-H equation needs absolute resistance in Ohm.

    There was also an error in prior graph formulas... but now the temperature calculation looks much better:

    I could in principle take one of the NTCs to work and properly characterize it over its temperature range against a known PT100 element but for the sake of brevity I'm inclined to trust the datasheet values to within 2 Kelvin.

  • strain gauge stability under load

    helge08/11/2018 at 16:06 0 comments

     Sensors deployed in industrial applications tend to work quite reliably, until they don't. Typical failure modes include

    • cable breaks
    • water ingress and electrocorrosion
    • contamination with process media
    • range and drift (mechanical, electrochemical)
    • wear (abrasive, temperature cycles, cyclic bending, vibrations)
    • mishandling / contact with other components / machinery
    • voltage surges

    Transferring these expectations to the reservoir scale scenario, a few points seem seem rather likely right out the gate:

    • cable damage / unplugged conntectors: consumer products will have cheaper cables and connectors
    • water ingress: sealed connectors are expensive, so unless there is some intrinsic protection against spashes, this may well be an issue
    • electrocorrosion: moist contamination spells trouble while conformal coating and sealed assemblies add cost. Keep peripherals powered off most of the time, only activate for brief periods. Maybe also add simple means to detect moisture if possible.
    • changes in full-scale value and drift: depending upon the measurement principle, yielding of metal and plastic parts is to be expected, changing the output. To be evaluated at design time.
    • plastic deformation: parts subjected to static or cyclic loads can accumulate strain, leading to dimensional changes and hardening. To be evaluated at design time if possible.

    Assuming proper handling and controlled conditions, temperature and deformation effects can be investigated... and that's what we're going to do now.

    Measurement setup

    One of the modified scales is set up on the windowsill and loaded with 5kg to investigate loss of calibration after a few days of static loading with the maximum permissible weight.

    Another scale with both the internal electronics and a HX711 board connected is powered with 5V into the HX711 (SCK needs to be pulled to GND to enable AVDD). This device has four cable pairs connected to the sense and excitation pins.

    All are connected to a multichannel digital multimeter:

    1. excitation voltage (E+ | E-)
    2. sense voltage (S+ | S-)
    3. partial voltage (S+ | E+)
    4. partial voltage (S- | E+)
    5. 10k NTC (rear panel PCB / air temperature)
    6. reference short circuit for 300mV range (same as 2.)

    A rear panel PCB has screw terminals to hook up wires and an NTC sensor. In a later measurement, an additional short circuit on channel 6 was added to investigate instrument drift error during the measurement sequence.

    a python script initializes and periodically reads values from individually configured input channels. Git repository:



    A first run is conducted through the night to determine offsets and intial settling under full load. The measurement consists of three parts to measure initial offset without any applied voltage, no-load offset of the load cell and fullscale output with a 5kg weight placed on the scale. note the strain gauge output is in millivolt while the excitation voltage is displayed in Volt.

    In this graph the instrument error of 74 µV has already been compensated for to better represent the strain gauge output. Y axes ranges are chosen arbitrarily to highlight relative changes over the measurement period after power-up.

    The measurement was halted to add a 10k NTC senor and test changes to the code, then restarted. Restart might cause the multimeter to calibrate zero, although it is later found that the offset remained at around 74 µV.

    Note the restarted strain gauge sense voltage appears to be slightly higher than in the initial run.

    There is hardly a change between the 2nd and 3rd run:

    The last plot shows both sense voltage and temperature over time, illustrating the 25..30 µV jump upon restart.

    To better...

    Read more »

  • more of the same

    helge07/21/2018 at 15:07 0 comments

    With the Silvercrest SKWD-A1 inspected and found to be nicely hackable it is reasonable to get enough scales to make it through the first iterations without yet again having to gamble and possibly ending up with a less elegant solution.

    Futhermore it's hard to beat the 17 mm of this low profile scale. Buying online also made it possible to select a slightly less obtrusive pattern and colour scheme.

    It is worth noting that while designs may vary over time the internal construction should be kept more or less consistent once settled upon. It also seems doubtful that there is a lot more room left for further simplification and price reduction so hopefully it'll just stay as is in the next 1-3 years.

    In the previous post it has been found that HX711 enters power down when CLK is high for longer than 60 µs and a high to low transition occuring after power down will trigger a reset.

    When used behind an I2C multiplexer, DOUT connected to a third data line and SCK connected to SCL, HX711 will see SCK high for a long time before selection (I2C pull-up), followed by bitbanged SCL waveforms which will be composed of the following sequences:

    • SCL high-to-low transition: this triggers HX711 reset, followed by a delay period during which reset is executed and presumably the first sampling + conversion with default settings is performed as part of normal continuous sampling operation with channel A and gain of 128 configured.

    [ side note: Completion of the first sampling + conversion is indicated by DOUT high-to-low transition. The datasheet only states, "When output data is not ready for retrieval, digital output pin DOUT is high. Serial clock input PD_SCK should be low. When DOUT goes to low, it indicates data is ready for retrieval." which leads to conclude that this also applies to the first conversion after reset. ]

    • 25-27 active-high clock pulses on SCL will read the first conversion result and set up for the next conversion with one's choice of channel and gain values.
    • After one or more read operations, the bus will have to revert to I2C operation. HX711 will inevitably see an I2C SCL waveform as the I2C multiplexer is reconfigured to disconnect from HX711. This is however irrelevant when the device is disconnected for more than 100 ms as any errorenous conversion will be completed by then and power down is re-established due to secondary SCL being pulled high.

    The protocol co-existence described above is enabled by routing DOUT via a third line so it does not interfere with SDA. If connected to SDA, DOUT could create start conditions and lead to invalid I2C command interpretation and lockup.

    If only I2C lines are available, one could generate clock pulses to trigger the DOUT high "no new data" state to follow up with I2C multiplexer de-selection but this would also demand converting DOUT to open drain with a diode or MOSFET.

    Connecting it to a MOSFET and effectively inverting the output level will have further implications: as long as DOUT is high, SDA will be pulled low so the I2C bus will be in lockup during conversion and possibly also during HX711 power down (not specified in the datasheet).

    Next a bit of hardware will be needed to demonstrate the functionality. Ideally the I2C peripheral could be temporarily deactivated and the pins reconfigured for GPIO. Alternatively SCL could be bridged with another GPIO configured as open drain or push-pull if it is guaranteed that I2C will not be driven in the meantime.