HX-Dumb to Smart

Introduction

My project to make my Expobar Office Control HX espresso machine smart. Added sensors, monitoring and ability to control pump power with three ESP32's and an arduino. Note that my HX is older and a little different from one in the link.

Fairly complicated project, lots of different pieces I had to get working. I worked them as sub-projects over some months.

This project is highly customized for my HX machine, and what I wanted to do. Not a copy and paste thing, but hopefully there is info here that can help others that want to make similar changes.

Links to info, and SW on gitlab for each processor

Note that this page has a little generic information that applies to all ESP32's. All the details are in the links above.

Used the Wemos Lolin32 type ESP32 boards

Arduino nano was an old one I had in my closet, any arduino type board would have worked.

Probably could have used fewer processors, but it made it easier for me this way, and these boards are inexpensive.

Webpage screenshot

Example of Shot Data

Serial Driver

You may need to install a serial driver if you haven't used an ESP32 board before. Otherwise you won't be able to communicate with your ESP32 to load it over the USB port.

https://www.silabs.com/developers/usb-to-uart-bridge-vcp-drivers

Select downloads, then select driver for your OS and install

For mac, unzip file, double click .dmg file, then double click Install Driver file. Follow instructions

Installing Libraries

These are all the libraries I used to build the programs in this project.

Used the Arduino program for this project. Some people prefer Platformio but I think Arduino is the most popular.


From Arduino library manager. Search then install these in Arduino, Tools > Manage Libraries

AsyncElegantOTA

ESP32 Mail Client

Arduino_JSON

TelnetStream


Download these zip files:

https://github.com/me-no-dev/ESPAsyncWebServer/archive/master.zip

https://github.com/me-no-dev/AsyncTCP/archive/master.zip

https://github.com/marcoschwartz/LiquidCrystal_I2C Only need if using I2C LCD

https://github.com/taranais/NTPClient 1/1/2023. had compilation errors installed latest from this link and it fixed them

Download files from the links, then from Arduino, Sketch > Include Library > Add .zip Library


Select an esp32 type board, and these libraries will just work:

#include <esp_now.h>

#include <WiFi.h>


To setup the "ESP32 Sketch data upload" function in a mac

Open applications directory, select arduino then open package contents

go to Contents>Java>Tools

Then copy ESP32FS>tool>esp32fs.jar to that directory per https://randomnerdtutorials.com/install-esp32-filesystem-uploader-arduino-ide/

Download file from here


Over that Air programming (OTA)

Both of the ESP's support OTA programming. I used the AsyncElegantOTA library, using this for reference for setting up library and implementing

Random Nerd OTA Tutorial

I need to use the AsyncElegantOTA library so I could use the ESPAsyncWebServer library for an async web protocol and OTA. With the normal ESP OTA program (from example), I was getting compiler errors.

It is also a nicer user interface.

One thing I do differently from what you see in OTA examples is you have to actively choose to go into OTA mode.

For the Sensor ESP32, I turn on power while holding the left button, and that makes it go into OTA mode. Then it will sit in OTA mode until you send a new program via the webpage, or power cycle the ESP. You need to figure out the IP address of this ESP32, then go to go to 192.168.xxx.xxx/update.

On the WebServer ESP32, there is a button on the bottom of the webpage that you have to push, then go to 192.168.xxx.xxx/update. This will bring up the Elegant OTA webpage

On the Bluetooth scale ESP32, you have to ground pin 15 then reset it. Then go to 192.168.xxx.xxx/update. This will bring up the Elegant OTA webpage.

More information on the Webserver OTA function on its webpage, I can also OTA upload the HTML files for the webpage.

The Webserver ESP32 is the one that changes the most, by far.

Debugging

I used a few tools to help debug my programs. This is in addition to using a lot of Serial.println and Serial.print statements in the code as I developed it.

Wokwi is a online arduino simulator. Let's you easily test arduino code, helped me test generic logic and going between different types, like integer to char

Jsfiddle is an online html simulator. So when I made the webpage, I could run it there first, to get it to look right before programming it into the ESP32. Saved a lot of time on making a webpage.

After I installed the ESP32's, it was difficult to connect a USB cable to get a serial connection.
I also eventually added the "TelnetStream" library. With it, I could create a telnet connection from my PC to the esp32. It connects over wifi, but using the telnet protocol. You may need to install a telnet client on your PC, I needed to use brew to install telnet on my macbook.
Once installed, you can send to telnet instead of to the serial port.
https://github.com/jandrassy/TelnetStream


//telnet used for debugging over wifi

TelnetStream.begin();
TelnetStream.println("test telnet");


telnet 192.168.1.114



Power

Power comes from a 5V, 1 amp walwart. It actually generates a little more than 5VDC. This is enough to power everything I'm using. The walwart plugs into the case that houses the Sensor ESP32. There are two switches for the 5V, one on the front that turns on the Sensor ESP32, LCD, and power to the flow sensor and pressure sensor.

A switch on the back turns on the 5V that is wired to the Webserver ESP32 and the pump control arduino.


On the Webserver ESP32, I used the little connector to bring power to the board, but I had to add a jumper from the 5V pin to + pin on the connector. Bypasses a circuit on the board that didn't allow it to power up.


Right now, the Bluetooth Scale ESP32 is wired to get power from the Webserver ESP32. It works fine, but I may move the BT scale ESP since its wireless and can be anywhere.