Customisation - DeeEmm/DIY-Flow-Bench GitHub Wiki

Customising the code

If you want to integrate different MAF or Pressure sensors or compile for different platforms, then you can use the following guides to help you to customise the code.

Creating a custom PIN mapping

If you are not using a supported ESP board you may need to create a custom pin mapping for your board. The reason for this is that despite many ESP32 boards sharing the same physical Arduino UNO board layout, not all pin location functions are the same. This is especially pertinent if you are using an ESP that does not use the UNO layout. You may come across this issue if you try to compile the code for your hardware and come across compilation errors such as

E (28) gpio: GPIO can only be used as input mode
[    44][E][esp32-hal-gpio.c:130] __pinMode(): GPIO config failed

Which is telling us that GPIO 28 cannot be used as an input.

To create a custom pin mapping, copy the entire #ifdef WEMOS_D1_R32 section within pins.h, rename it and reassign the pins accordingly. To do this you will need to compare the schematic of your board against that of the Wemos D1 and reassign the pins so that the functionality is correct. For example some pins cannot be used as analog inputs as they are shared with other system functions. Some pins are also reserved for system functions. Which pins these are differs between manufacturers. The Wemos D1 R32 is tested and working and so can be used as a guide.

Once you have remapped the pins you will need to add the board choice to the 'SELECT BOARD TYPE' section within configuration.h and comment out the other board selectors to enable your board.

Adding a new MAF sensor

Please refer to the section on MAF Data Files

Changing I2C Addresses

If your I2C device uses a different address to the default values set in the code it will be necessary to change the I2C address. The I2C addresses are set within the configuration.h file.

Scanning for the I2C address of your device

When the flow bench is starting it scans the I2C bus and prints a list of device addresses to the serial monitor.

You can easily check to see what I2C addresses your devices use by connecting the serial monitor and then instigating a reset.