We have a problem. Everytime anyone type in
load cell arduino, it's always return HX711. I mean, it works if you don't need accuracy just a ball park figure as a trigger for other things, say like a pet feeder. If weight less than 50g, move servo to X until weight is more than 100g. Then it doesn't matter, you might feed 20g more food to your dog. However, for more interesting projects, say a smart cutting board that can weight things according to ingredients listed on your phone, then HX711 is definitely not good enough.
Enters ADS1232, while it is more expensive than HX711, it is not prohibitively so. And the datasheet is quite overwhelming for most. It is not like using HX711 where you plug one end to the load cell and the other end to the micro controller, drop in a library and BAM you've got weighs. So, let's make it like that.
Pictured on top is the simplest form of the ADS1232. On the left side, blob together CLKIN, A0, TEMP, and GND. Then bridge GND across to another GND. Bridge across 3.3V and 5V, then link GAIN0, GAIN1, SPEED, and REFP to 5V. That's it, the ADS1232 is ready to be used like HX711.
- PDMN, DOUT, and SCLK connect to 3 pins on your µC.
- VCC and GND out of µC are connected to both the ADS1232 and load cell excitation voltage (red and black).
- Load cells signal voltage (green and white) connected to AINP1 and AINN1 on ADS1232.
On this mode, you'll need to use my simplified library for Whey. Just download and drop in the
ads1232.cpp onto Arduino IDE.
That's it, you can now use ADS1232 like HX711. Next let's dive a bit deeper so we can use this 24-bit analog to digital converter much better.
- You'll need 4 more pins out of your µC for A0, GAIN0, GAIN1, SPEED.
- SPEED pins is how you control the reading samples rate. Set it LOW for 10 samples per seconds, and HIGH for 80 samples per seconds.
- 1x: GAIN0 and GAIN1 to LOW
- 2x: GAIN0 to HIGH, and GAIN1 to LOW
- 64x: GAIN0 to LOW, and GAIN1 to HIGH
- 128x: GAIN0 and GAIN1 to HIGH
- A0 is used to read the second channel. LOW reads channel 1 (AINP1 and AINN1). HIGH reads channel 2 (AINP2 and AINN2).
IMO, these things can be decided prior to soldering things together and simplified your schema. Now that the ADS1232 has been configure, let's get some data out of it.
- Power it up: set PDMN pin to LOW and SCLK to HIGH. Reverse values to power down.
- Wait until new data is ready: wait until DOUT change from LOW to HIGH and back to LOW.
- Next you just need to read the raw 24-bit data. Refer to the library if needed.
Once you have the raw data, it's basically done. To calibrate the scale:
- Prepare a known weight, say 100g weight. But don't put it on the weight.
- Reset the calibration value
SCALE value to 1.
- Read and store the value to
OFFSET. It's to tare off your platform
- Put on the known weight.
- Read the
value again. Now you can get the new calibration value.
SCALE = (value - OFFSET) / 100, if the known weight is 100g.
- Store the
SCALE value to EEPROM.
Bonus: if you expose all those pins to Arduino, you'd better use the original library by HammidSaffari, it's just plug and play.
The prototype was done wrong. If you clicked through, you can see my original design. After the load cells arrived, I've spent almost 2kg of PETG to get that design to work. But it just doesn't. First, plastic flex. That design would probably work if I can laser cut aluminium (I've actually looked into a laser cutting service). But I have another problem when I mounted the OLED on the platform, when I put something heavy, the wires actually pushing the platform up making the measurement not accurate. Which made me not wanting to pursue this design any further with aluminium or other means.
On to the final design. Well, "final". I went with 2-part concept, the controller was the best I can come up with quickly, without desoldering or making any other changes to the electronics part. If you were to build this, I highly recommend you redesign this part. This has wires rat nest inside, which I believe it becomes the source of the noise (which makes it still jitters at ±0.1g). I have better stability on the original design when it worked. Which means, a better controller should be coming soon.
Build guide, codes, and STLs are available on GitHub.
Load Cell: I bought 2 from Ali, a $15 one and a $25. Neither are stable enough at 0.01g. The $25 one are more sensitive to noise. I went with the cheaper one because it is shorter, I'll have more room below the portafilter.
TTGO mini32: went with this one, mainly for a couple reason. Mainly, it has the LiPo charging circuit built in. And it's ESP32, so it has WiFi and Bluetooth built-in. WiFi is useless in a scale, but Bluetooth was great in MK1. I can't use the same app as before, but I do have plan for it in the future.
ADS1232: faster and less prone to noise than HX711 makes it a no brainer option. It should be way more popular because of it. The lack of resources online makes me think that it deserves its own post.
That's it. Put those 3 things together, add a battery, and you're done. With the exception of the controller, I'm quite proud of the design. It has 3 modes:
- Filter mode, which as a platform that fits the silicone cover from my old scale.
- Portafilter mode, a diffrent clip that can hold the portafilter.
- Espresso mode, just look that the picture. Super happy with it.
This design also means that I can just get a super accurate (and very cheap) 500g/0.01g load cell and just plug it into the controller. 10 seconds to recalibrate, and it's done. Another bonus since I code things myself (and the fact that ESP32 has built in RTC), I added a countdown for the timer. Technically unnecessary to brew a good coffee, but it very much soothes my OCD bone.
Final thought, now that I'm not size bound, it'll definitely worth it to work on a better controller. Maybe even just make the exact ADS1232 reference design or add a bunch of filters. Or simply just solder them together instead of rats nest in a box.
I need a bit of break first, this build was much harder and took waay longer than expected. I'm glad that it works, have made many delicious coffee with it. The countdown totally makes the brewing feels less hectic, especially when pulling espresso shots. Again, the build guide, codes, and STLs are available on GitHub.
A small but significant update. I ordered a few photo resitors, aka LDR (Light Dependant Resistor) right after I finished writing MK1. It’s quite common for me to get ideas pop into my head as soon as I write things down.
Adding the LDR to the controller is a super easy task. I just modified the enclosure lid to have 2 tiny holes towards the edge, so it’ll pick up on the room light. The energy saving with this tiny sensor is significant. MK1 will automatically turn itself from 5pm to 11am, this will cut that on time by at least 50%.
Wire it to the ESP32 is also simple, just remember that we can’t use ADC1 when we need the WiFi. Any pins on ADC2 will work. On the code I also added more colours, so it’ll also lit up if I darken the room for nap time.
Sidebar: if you notice in the sketch, I also tried to use the mounting screw as capacitor button to turn all the LEDs into bright white (all 255s) to quickly brighten the room for a bit. But I'm having issues that it won't turn off consistently. I left the code in, I just don't wire the pins to the mounting screws.
Updated code and enclosure are at the same links: GitHub & Thingiverse.
About 5 years ago, I made this BLE coffee scale. It's hacked off of a scale I had. It was good enough to be used daily. The problem is that it's a bit tiring to have to use my phone as the screen, even though I have the calculator built into the app, sometimes I just want to pop open YouTube and watch something while brewing my coffee.
And here we are, a re-do of a project I did half a decade ago. The goal this time is:
- Speed / responsiveness.
- Fit underneath my espresso machine.
- 2-3 kg capacity.
- 0.01g accuracy if possible.
- App optional
As you can see from the pic on top, the prototype is pretty much ready. In reality, when brewing coffee, we don't need 0.1g accuracy. Definitely do not need 0.01g, but as a project goal, it's nice to aim high. The problem at this time is, the load cell I have lying around was the shitty one. Even worse than MK1's. It was just added to cart when I bought other things on Ali. It swings and wobbles at ±3g. Not practical as any kitchen scale, definitely not good enough for brewing coffee. I don't even know why they sell these. So what I did next was look for a good load cell. After I found it, I printed an adapter so I have a functioning place holder load cell as I design and print the enclosure. Pictured below. The load cells are ordered and on a slow boat from China. So, the expected project completion will be in 2-4 weeks.
1. Screen (and 6. App optional)
No 1 and 6 go hand in hand. But I don't plan on adapting this project with the previous app. I have other plans for the app side of things and it is very low on the totem pole atm. Screen just to address MK1 pain point. Also, as I mentioned in my Sous Vide post, it's a household device that only I can use. It is annoying.
Sidebar: I notice there were a surge of people making IOT window blinds. It has the same issues. No one else can open or close the blinds. If you want to make IOT devices, the app has to be optional.
2. Speed / responsiveness
Easy, dump HX711 and use ADS1232. This is the biggest hurdle of this project, there aren't many examples or tutorial that we can just simply follow to get numbers out of our load cell sensors. I plan on making a dedicated post for ADS1232. It is much much more responsive than HX711, and totally not as succeptible to noise compared to HX711.
3. Fit underneath my espresso machine.
Now that I have a 3D printer, I can print the enclosure in any shape I like. As you can see the picture, I made it "sideway". The screen is on the bottom right, because I'm left handed. I pour with the kettle on my left hand, so I still can clearly see the screen.
4 and 5. 2-3kg 0.01g accuracy
2-3 kg because my main brewing device is the 6-cup Chemex. The Chemex alone is 600ish grams. Most days, I brew 45g of coffee with 750g of water. That's almost 1.5kg total. 3kg limit gives be a bit of headroom, and I can still use it for baking or something.
0.01g are technically unrealistic unless I spent serious dollars on the load cells. Like getting a special order class C6 load cell. But that's entering the unlimited budget project territory. I'm not that crazy. In the end I ordred these load cells (Ali link: one and two). One is larger footprint but shorter, the other is smaller footprint but taller. Both are 3kg, both are class C3, and we'll see which of these fare better at 0.01g (or even at 0.1g) after they arrive.
This is not Project Libra I mentioned in the last post. It’s just a really simple project, I started and finish it in a day. Including the enclosure design and printing it.
A little background, a bit over a year ago I watched this youtube video and thought that it’s a good idea. I love having a night light that’ll lit up a room but not shining into your eyes during the night. However I have a low bed, no way I can put a PIR sensor all around without getting the wires become tripping hazard. So what I’ve done is just getting a cheap LED strip kit (with power supply and remote) and stick it around the bed.
Enters ESP32. I still can’t use a PIR sensor, but turning it on/off everyday becomes a chore. Often I’ve just left it on 24 hours. As you know, I’ve been playing with ESP a lot. Another great thing that ESP has is that it has RTC (Real Time Clock) built in. Along with WiFi, it check with current time with ntp server and will retain time accuracy even after power loss. Which is the example project called “Simple Time”.
This project, as you can see it’s just a remix of 2 guides. Simple Time and RGB LED Controller. All you need is an ESP32 Dev Board, and 3 N-channel MOSFET to run the LED. I just use the 30N06 that I already have plenty of. I added a sweet fade to the sketch so the LED won’t just snap into another color. Oh, and we’ll need a buck converter because the ESP can’t handle 12VDC input.
So, just load up the sketch. Plug everything together. Close the box. Plug everything in. And we’re done. This is one of those project that everything went smoothly. I only need to print the enclosure once. And the code just works. I added the fade later in the afternoon, and everything just went swimmingly.
Github & Thingiverse
Another idea I have was to check for sunset and sunrise time, but I opted against it. What I’d like to add in the future is a light sensor, so the LED strip will only light up when the room is dark.
1. Sous Vide
The main difference of Katara compared to the predecessors is the use of a true water heating element (instead of a crockpot or rice cooker) and the water pump. It is a true immersion circulator. It can retain water temperature within 0.1ºC swing. It as 1500 Watt water heater, so 16 litre room temperature water can reach 60ºC within 15 mins or so. Anyway, Sous Vide is Sous Vide are so 5 years ago, but perfect steak, everytime. Let’s move on.
2. Over The Air (OTA) Update
My favourite feature, by far. Thanks to the AutoConnect library, this thing is amazing. There are many WiFi manager for the ESP32, but it’s the only one I’ve found that has the captive server out of the box.
Sidebar: if you don’t know what captive server is, it’s the pop-up you get when you joined a free wifi in airports or cafe.
It’s the most intuitive way. First you connect to the device’s WiFi, then it pop-up a thing so you can set it to connect to your home WiFi. You don’t need to memorise any IP address. The only downside, this and Blynk took like 70-something % of the ESP32 flash memory. That brings us to the next feature.
Blynk is like an app (both iOS and Android) for your DIY IOT device for “free” and with minimal coding. You don’t need to roll your own API and server (in a way, I’ll get back to this later), and you most definitely do not need to code your own app. Blynk itself is quite confusing to use and a tad buggy, one thing in my code still causes a kernel panic. And you do
BLYNK_WRITE() to read some values off of the app.
Blynk is “free”, upon registering, you get something like 2000 energy. And energy is their currency for buttons, LED, graphs, etc. If you need more, there’s IAP to get more energy. Unless, you roll your own blynk server, it’s dead simple. Just cut and paste a couple of things from the docs, I have mine run on my OctoPi.
And more importantly, I added a Blynk tab on AutoConnect with custom server support.
These are the major features that bring Katara works like a commercial product. Technically you can get everything from BOM. Follow the build guide. Figure out the water heater. Upload the released firmware as is. And it’ll work.
However, this is one of those projects you can’t cheap out on. It has been about a month long journey for me. Stressful but fun project I did in awhile. The final tally for the BOM is a bit under $60 (almost triple my original budget goal). Compared to an Anova (about $130) or a Joule (about $200), it’s a bit of money saving project. Especially over here, Anova is sold for almost $300 in local marketplace.
There are people who are selling these DIY Sous Vide “kit”, a death trap kit is what that is. If you were to build this, approach it with caution and respect. As with any other project that uses the AC line.
There we go, another CoronaCraft in the bag. Be safe, wear mask, and enjoy your steaks.
- Enclosure Design
- Water Heating Element
- Back to Drawing Board
- Build Guide
Bonus: my next project is called Libra, should be obvious of what it is. Another revisit of my project from 5 years ago. Should be easy and fun.
Pictured is my simplified (read: sad attempt at) drawing the whole wiring diagram. The wiring is relatively simple. Just make sure you solder it nice and tidy, and crimp things tight.
- ESP32 dev board — $5
- 0.96” OLED — $5
- R10 800 L/h aquarium pump — $5
- KY-040 rotary encoder module — $0.50
- Switch with LED — $1
- IEC320 C14 Male Socket with fuse and switch — $1
- AC to DC 5V 3.6A — $5? (I found this around the house)
- Waterproofed DS18B20 — $1
- Water heating element. Choose carefully — $13
- Good Solid State Relay — $20
- Total: $56.50 + wires, screws, connectors, etc.
- Plus a pair of M7 nut and bolt, and a bunch of M3s screws
As you can see, the water pump is controlled directly by the switch and completely skip the ESP. I don’t find it necessary to have it controlled by ESP. I’ll need a button to control it anyway. It is simpler this way.
I have an LED indicator that shows when the water heater is on. I put it in as the same pin as the internal LED pin so it’ll blinks when updating the firmware via OTA. And for simplification, I just get a switch with LED in it. Less things to mount. My pinouts are:
- DS18B20 — D27
- OLED — D21 (sda), D22 (scl)
- KY040 Encoder — D32(clk), D34(sw), D35(dt)
- SSR — D23
- LED — D2 (same as the ESP32 dev internal LED).
Use the exact pins and you can just upload the firmware as is. Remember to upload it to you ESP at least once (. And you can connect it to your home wifi and use the OTA update.
Thingiverse & GitHub
Print the things. I highly recommend a 1mm nozzle to speed things up. These are mostly square shaped. Support is not needed, and it should be obvious where the print orientations are (hint: just select the largest flat surface as bottom).
I’ve left the centre blank so you can design your own mounting points / holes.
Putting it together is easy. First do the centre, mount everything inside. Next screw bottom to centre with a transparency plastic in between. Then mount the water heater, pump and DS18B20 to bottom. Clamp both things together.
Plug everything from top, and snap it shut. And you’re done. Get a container / a bucket. Clamp it to a side. Pour water. Plug it in. Turn it on. Turn pump on. Start PID.
Also configure WiFi, the default SSID is the one with “SV-“ prefix. default password is “SousVide” (note the case). Click “Configure new AP” to assign the ESP to your home WiFi.
Then configure Blynk if you like. Start from the app, you’ll need the auth code first. At the minimum you’ll need 800 energy. Graph (super chart) +900, another label for ESP temp +400, and heater LED indicator +100. Definitely not enough for everything without paying for more energy. But the graph is not necessary, and you can just use the “Value Display” instead to save some energy. Or self host blynk server for unlimited energy.
Next will be the final post, the official release of Katara: Open Source Sous Vide Cooker. Yeah, I kinda married to the name.
… mostly. I’ve failed to achieve the $20 Anova since the heating element price jumped almost 10x. I planned on using the one that costs $1.50, but it was zappy and splodey, so scratched that. This project felt cursed, it’s one problem after another. But I’ve spent a lot of time designing in Fusion 360, and writing codes. Weeks worth of work, and those are sunk cost. I want to see this through.
As posted in Build Log 3, I have soldered all the components and all the connectors, after my 1mm nozzle arrived, I decided to redesigned and reprint the enclosure so the new parts have their proper mounts. I have to reprint the bottom part because of the new water heater anyway. And oh boy 1mm nozzle is fast, 0.5mm layer height. Cut my 12 hours print down to 6 hours.
After that’s done. Putting it back together, that god-dammed Fotek SSR decides to bite me in the ass… again. That shit leak current. During testing I noticed the water temperature kept on rising despite it has reached the target temp. So I stop the PID. Still rising. Kill everything. Put the main wire through an amp-meter, it pulled 3 amp when idle. It’s only supposed to power the ESP32. ESP32 doesn’t need 3 amp on 220V. But when I turn on the PID I saw the current draw jumped to 6ish amp. So confirmed FOTEK is the problem. Some leaks are common with SSR, but 50%?!
The very next day I decided to test it with one of my good SSR. It’s a dual SSR, so quite an overkill, but it’s the only non-Fotek SSR I have. Night and day. 15mA on idle, 40mA when I turn the pump on, and 6-ish amp when everything is on. Which is about right, 1500 Watt / 240V = 6.25 A. MK3 is finally done.
Next post: Build Log 6: Build Guide.