-
Back to life, back to reality
08/05/2019 at 08:28 • 0 commentsI've had a bit of a crisis in the past few months. Both of our (very) old cats decided it was their time to pass - which they did with only a couple of weeks between them. It was heart breaking, both for me and for my wife. But mostly, it made me stop working on anything that mattered to me. That included the scale, but also caused me to abandon my sourdough altogether. Sort of a "leaving the past behind" thing, I suppose.
Anyway, since I did not make any progress and had no progress in the past few months, I decided to publish the source code in its present state, with all its flaws. I'll list here some of the things I think should be addressed, in no particular order:
- Documentation is really horrible. That's got to be fixed.
- Also, Arduino sketch can be separated to several files to help readability and modularity.
- Since all testing was done with the esp32 connected to USB, I did not include any provision for battery powered operation in software - i.e. I need to add some code to power down the screens, then after some more time go to the esp32's ultra-low-power core for prolonging battery life. I should probably add some transistor to power down the load cell as well.
- The ULP core can be now programmed in C, and from most environments! That's great news, and I'll test it out shortly.
- On that note, I'll probably have to add some way to measure voltage level, then a battery level GATT service, and a battery level indicator on one of the screens.
- Most of the effort was given to the esp32 code, but there are (at least) two other components to the system: a pseudo-database (Google Sheets), and a configuration app to handle the connection and WiFi credentials.
- The Google app script should probably be configured as a plug in, for people to easily use it. That requires diving into Google's Oauth2 documentation, and I haven't done any of that yet.
- At the moment I'm using Bernd Giesecke's ESP32 WiFi setup over BLE (ESP32 code) as the basis for configuring WiFi credentials, and used his Android configuration app, or, alternatively, Nordic's nRF connect app. Since I no close to nothing about Java and Android app development, I decided to create a basic web-ble web app to replace the native Android app. The advantage for me is that I'm more comfortable with JS than Java, and this app will be able to run on many more platforms - such as from a desktop PC or any smartphone that supports web-ble, including iOS devices.
- Even more than that, I will also be able to configure server side access using Google's 'server-side flow' to define Oauth2 credentials on the esp32, and will probably try and venture into creating a progressive web app from that, which will allow me to use this app as a remote display for the scale as well, even without a working network connection.
Anyway, I really hope to dive into this project soon. You can check out the Github repo for the esp32 code, and have a go with my version of Akshaya Niraula's (further development by Allan schwartz here) Google app script.
-
Prototyping setup
04/30/2019 at 16:59 • 0 commentsAs I wrote in the introduction section, I started this project by hacking together a discarded scale, an ESP32 dev board (Lolin32 clone), a HX711 breakout board, and a monochrome 0.96" OLED screen. At first, I used the serial port for mode changes, etc., but soon after I added a few buttons for menu navigation and typical counter-top scale functions such as Tare and unit swap (g, kg, pound). The display also seemed a bit crammed on a single 0.96" screen (128x64), so I added a second one - now one screen displays measured weight, and the other can display, for example, the currently selected ingredient I pulled from my formula spreadsheet, and it's relative percentage.
As this first update on the project is about the prototyping setup I use, I created a Fritzing breadboard scheme so others can follow along. I couldn't find a load cell object, so I created my own - you can find that in the files section above, if you're interested. Also, I used simpler OLED I2C screen objects, since they're much easier to handle than the 6 pin versions I have. With the 6 pin versions, the board is configured for SPI but does not break out the CS pin, and changing to I2C is quite a pain.
For the firmware, I settled on developing it using Visual Studio code with the Arduino extension (+ Arduino-ESP32 core), I find it much nicer to use than the Arduino IDE.
I hope to have the firmware stable enough by end of next week. Then I can go into more detail about the code, and maybe even start with mechanical + electronic design considerations.