Skip to content
Home » Articles » Uploading the Sketch to Samovar

Uploading the Sketch to Samovar

Uploading the Samovar sketch to ESP32 takes 10–15 minutes using Arduino IDE or PlatformIO. The steps: (1) install Arduino IDE 2.x and add ESP32 board support through Board Manager (Espressif URL); (2) select the “ESP32 Dev Module” board and the COM port; (3) download the latest firmware version from GitHub (releases); (4) open the .ino file and install the OneWire, DallasTemperature and LiquidCrystal_I2C libraries; (5) click Upload. On the first upload you may need to hold down the BOOT button on the ESP32. After a successful flash the controller creates a “Samovar” Wi-Fi access point for the initial network setup. Alternative: PlatformIO, for those who want to compile from source and take part in development. Minimum requirements: a USB data cable (not just a charging one) and an ESP32 with 4 MB of flash.

If you have an ESP32, you can already upload the sketch and test how Samovar works.

To upload the sketch to the ESP32, you need to install the Arduino IDE program. It is used as a sketch editor, as a sketch compiler, and also for uploading the compiled program to the ESP32

How to install Arduino IDE

More about working with Arduino IDE

After installing Arduino IDE you need to teach it to work with ESP32; by default it cannot. Read about it here: Installing and Setting Up the ESP32 Board in Arduino IDE

If you managed to compile the example and upload it to the ESP32, you can move on to configuring, compiling and uploading Samovar.

Icon of the number 1: program step Download from GitHub the archive with the latest stable version of the sketch.

Icon of the number 2: program step Check the Documents/Arduino/ folder. Inside it there must be no folders named  Samovar,  libraries or tools.
Warning icon: safety precautionsAttention! Every time you install a new version of Samovar, you must delete the folders named above from Documents/Arduino/ or move them elsewhere.

Icon of the number 3: program step Unpack the downloaded archive to a convenient location.  Enter the newly created folder and go down to the last folder  Samovar x.xx (where x.xx is the version number). Rename the  Samovar x.xx folder to  Samovar and copy it to Documents/Arduino/.

Icon of the number 4: program step From the  Samovar folder, copy the libraries and tools folders  to Documents/Arduino/. In the end, the Documents/Arduino/ folder should contain 3 folders: Samovar,  libraries and tools.

Check that the file  esp32fs.jar in the tools folder is located at the following path: tools/ESP32FS/tool/esp32fs.jar. If the folder structure is different, it must be corrected, otherwise you will not be able to upload the web interface to the ESP32.

Warning icon: safety precautions Please note! You must use the libraries that are downloaded together with Samovar. The code of some of the libraries has been modified (bugs fixed, support for ESP32 added).

Icon of the number 5: program step If Arduino IDE is running, you must close it and open it again.

Icon of the number 6: program step In Arduino IDE, open the Samovar.ino file from the Documents/Arduino/Samovar folder.

Icon of the number 7: program step Upload the sketch to the ESP32: click the Upload button, and Samovar will be uploaded to the ESP32. During the upload various warning messages may be displayed; ignore them. If the message Connecting appears but the upload does not start and dots keep appearing on the screen, press and hold the Boot button on the ESP32 for 3 seconds. If it succeeds, you can open the COM port monitor (check that the speed is set to 115200); in the monitor you should see messages about Samovar starting up and the IP address with which Samovar connected to your network. If Samovar could not connect to the network, it will create its own wifi access point named Samovar, without a password. More about connecting to wifi below.

Icon of the number 8: program step Install the web interface on the ESP32: in the “Tools” menu, select ESP32 Sketch Data Upload, and the contents of the Samovar/data folder will be installed on the ESP32 (this is the web interface).

Icon of the number 9: program step Additional information on Blynk settings is available here, and on using the charts here

How to set up the A4988 stepper motor driver

How to set up the DRV8825 stepper motor driver

A voltage of 0.6V is enough for the pump to work. If you don’t have a voltmeter, you can set the trimmer resistor on the driver to the middle position. If the pump does not turn, you can increase the voltage a little.

Warning icon: safety precautions Please note that it is best to change the trimmer resistor setting with the power off, as there is a high risk of burning out the driver. It is also advisable to lubricate the pump rollers with silicone grease. This will reduce friction, and therefore the load on the stepper motor, and will increase the service life of the silicone tubing.

For Samovar with the A4988 driver, you need to connect the MS1, MS2, MS3 and VCC pins together, and also connect the SLP, RST and VCC pins (on the board this is connector H1) and in the Samovar settings in the browser specify an approximate value of steps per ml of liquid: 16000. You can pick the steps precisely in the settings, under pump calibration.

Adjustment icon: fine tuning Moving on to configuring the Samovar sketch

After the test upload, open the Samovar_ini.h file in Arduino IDE. It contains the main sketch settings that you can change. Without programming experience, it is better not to change anything in the other files.

Warning icon: safety precautions If you are not using a flow sensor, be sure to disable its use in the sketch. To do this, in the Samovar_ini.h file change the line

#define USE_WATERSENSOR

to

//#define USE_WATERSENSOR

If you do not plan to use a controllable voltage regulator, the line

#define SAMOVAR_USE_POWER

must be changed to

//#define SAMOVAR_USE_POWER

If you do not plan to use Blynk, the line

#define SAMOVAR_USE_BLYNK //use Blynk in the project

must be changed to

//#define SAMOVAR_USE_BLYNK //use Blynk in the project

If you want to use the emergency button, you need to enable its use in the sketch. To do this, the line

//#define USE_ALARM_BTN

must be changed to

#define USE_ALARM_BTN

After making the necessary changes you need to upload the sketch to the ESP32 once more, and then you can move on to configuring Samovar itself.

Wi-Fi icon: remote access over the network On first start Samovar will create its own wifi access point named Samovar, without a password. When you connect to this wi-fi access point, a portal should open. If the portal did not open automatically, open a page in the browser of the device you connected to Samovar with, at the address 192.168.4.1, and a form with wi-fi connection parameters will open.

Uploading the Samovar sketch: selecting the board in Arduino IDE

You need to select the “Configure WiFI” item

Uploading the Samovar sketch: flashing the ESP32

Then select your home wi-fi network in the settings and enter the password.

Gear icon: main settings If you plan to use Blynk, you can enter its token in the third line. The token can also be entered later in the Samovar settings: Settings – Other – Blynk token. If you change the Blynk token in the settings, you must reboot Samovar for Blynk to start working with the new token. If the token was entered while setting up the network connection, there is no need to reboot Samovar; the entered token will be initialized correctly right away.

Antenna icon: ESP32 wireless connection After wifi is set up successfully, Samovar should connect to the local network. If that did not happen, it needs to be rebooted. You can connect to Samovar in two ways:

Icon of the number 1: program step Follow the link http://samovar.local (it may not always work, depending on your router settings).

Icon of the number 2: program step Connect by IP address, which can be seen in the Arduino IDE serial monitor: Tools – Serial Monitor. To do this, open the serial monitor, set the speed to 115200 baud, disconnect the ESP32 from the computer and connect it again. The Samovar boot status will appear in the serial monitor, including the IP address with which Samovar connected to your router. If a display is installed, the IP address can be seen on the display on the fourth screen.

Leave a Reply