html5 templates

Microclimate sensor

displays RV's internal temperature and humidity


Main components:
- Bluetooth 4.0 LE module,
- humidity and temperature sensor,
- DC-DC 14-3.3V converter,
- camper's single-board computer with a 4.0 Bluetooth USB dongle and MQTT broker installed,
- the camper's router.

Artekit SI7021 humidity and temperature sensor was used for measure microclimate parameters within a camper. This sensor was connected to the Bluetooth LE controller that translates the microclimate data via the camper's MQTT broker to any computer or camper's crew gadget within the camper's network. Looks like, but wasn’t tested, any microclimate module with Silicon Labs Si7021 chip will works like here described too.

Main part of actions and all software in this article is analogous to acts for Ventilation fan' controller, is good idea to make them both together.

The Bluetooth Nordic nRF52832 4.0 LE module was used (the version with no block for an user firmware flashing). In one time this module controls the microclimate sensor and broadcast (advertise in therms of Bluetooth) measured humidity and temperature parameters via Bluetooth. Looks like, but wasn’t tested, the Bluetooth module with Nordic nRF52840 will work like here described too.

Any DC-DC converter can step down power from 14V to 3.3V for both the Bluetooth Nordic nRF52832 4.0 LE module and Artekit SI7021 sensor.

All settings were made via Windows PC (64 bit is preferred) with toolchain was installed on:

  • the MinGW was deployed in folder C:\MinGW. While installing under Basic Setup, were chosen packages mingw-developer-toolkit, mingw32-base, mingw32-gcc-g++, msys-base. Then Installation.Apply Changes.Apply was approved.
  • for the Windows PATH environment variable was added substring C:\MinGW\bin;C:\MinGW\msys\1.0\bin.
  • the SDK archive (version 15.2.0_9412b96) for nRF52832 was extracted in the workspace named C:\Users\%username%\Documents\nRF5 in folder nRF5SDK15209412b96.
  • the GNU-ARM-GCC package was deployed with the checked on "Add path to environment variable" while installing process. In that time 8.2.1 version was installed.
  • as known bug of v.8 GNU-ARM-GCC package, file arm-none-eabi-objcopy.exe from C:\Program Files (x86)\GNU Tools ARM Embedded\8 2018-q4-major\bin folder was replaced on this one from GNU-ARM-GCC package v.6.
  • the Geany text editor was used for edit the source code of the Bluetooth Nordic nRF52832 module firmware (only one string with the global UUID need to edit). That editor can be deployed anyplace.
  • then in to file C:\Users\%username%\Documents\nRF5\nRF5SDK15209412b96\components\toolchain\gcc\
    being opened in a text editor were updated strings ("/" here is right):

GNU_INSTALL_ROOT := C:/Program Files (x86)/GNU Tools ARM Embedded/8 2018-q4-major/bin/

GNU_VERSION := 8.2.1

GNU_PREFIX := arm-none-eabi

Black Magic Probe (BMP) programmer was used for the software flashing of the Bluetooth Nordic nRF52832 module in this case, this one programmer can be used for the flashing any Bluetooth nRF controllers for the Camper assistant. BMP programmer was connected to the PC via USB. Then Device Manager was opened on the PC:


devmgmt.msc, Enter

In Device Manager in "Ports (COM & LPT)" topic was found "Black Magic GDB Server" device (this name is in Windows 7, but in Windows 10 here will be two "USB Serial Device", between them the device with minor COM-port number is sought for), and it's COM-port number was noted.


The Black Magic Probe programmer was connected to Bluetooth Nordic nRF52832 module with Test Hooks Clips for Logic Analyzers as this wiring diagram with only four wires:

Black Magic Probe programmer pinnRF52832 BT module pin
VCC 3.3V10 (VCC)

Next steps were on the PC in order to flash Bluetooth Nordic nRF52832 module:

  • this main.c file was placed instead of the existing one in
  • this Makefile file was placed instead of the existing one in
  • this sdk_config.h file was placed instead of the existing one in
  • then on site was generated global unique identifier (UUID) for this one Bluetooth Nordic nRF52832 module exemplar. Then just generated UUID was converted on other one site to the byte-string (uuid_byte_array). This byte-string was rewrited with Geany text editor in file main.c placed in C:\Users\%username%\Documents\nRF5\nRF5SDK15209412b96\examples\ble_peripheral\ble_app_uart instead string "0x6D,0x19,0x7F,0x81,0x08,0x08,0x12,0xE0,0x2B,0x14,0x95,0x71,0xAB,0xCD,0x31,0xB1". This UUID must be changed in reason to not confluence will with some other camper assistants or other Bluetooth devices on a road or on a parking lot.
  • then file main.c was saved and no other modification need to make within.
On the PC was opened the command-line terminal:


cmd, Enter

Then in the PC command-line terminal were entered one by one:

mkdir c:\Users\%username%\temp

cd C:\Users\%username%\Documents\nRF5\nRF5SDK15209412b96\examples\ble_peripheral\ble_app_uart\pca10040\s132\armgcc


cd C:\Users\%username%\Documents\nRF5\nRF5SDK15209412b96\examples\ble_peripheral\ble_app_uart\pca10040\s132\armgcc\_build

copy nrf52832_xxaa.hex C:\Users\%username%\temp

copy C:\Users\%username%\Documents\nRF5\nRF5SDK15209412b96\components\softdevice\s132\hex\s132_nrf52_6.1.0_softdevice.hex C:\Users\%username%\temp

cd C:\Program Files (x86)\Nordic Semiconductor\nrf5x\bin\

mergehex -m c:\Users\%username%\temp\s132_nrf52_6.1.0_softdevice.hex c:\Users\%username%\temp\nrf52832_xxaa.hex -o c:\Users\%username%\temp\out.hex

cd C:/Users/%username%/temp


(gdb) target extended-remote com4

Note: here com4 is COM-port number of "Black Magic GDB Server" that was noted above. If number of COM-port more than 10, then \\.\COM1x is used instead of COMx.

(gdb) monitor swdp_scan

(gdb) attach 1

(gdb) file out.hex

(gdb) y

(gdb) load C:/Users/%username%/temp/out.hex

(gdb) quit

(gdb) y

From this point, the Bluetooth Nordic nRF52832 module was ready for works with Artekit SI7021 sensor. The Black Magic Probe programmer was disconnected to Bluetooth Nordic nRF52832 module and to the PC.


The Bluetooth Nordic nRF52832 module was soldered to Artekit SI7021 as this wiring diagram with only two wires:

nRF52832 BT module pinArtekit SI7021 pin
3 (P0.27)SCL
2 (P0.26)SDA

All components were soldered together at the piece of prototype circuit panel (green colored about having metalized holes).

prototype printed circuit panel (green colored about having metalized holes).).

The power for this microclimate sensor served by the camper's onboard 12V line. For take this power, the 2-pole screw connector was placed on the circuit panel. One latching normally-open button was placed on the circuit panel for switch this sensor on/off.

The 14-3.3V DC-DC converter was connected as this wiring diagram:

the 14-3.3V DC-DC converter pinother devices pins
DC IN +Via power on/off button to pole "+" of the screw connector
DC IN -Pole "-" of the screw connector
DC OUT +Bluetooth Nordic nRF52832 module pin 10 (VCC),
Artekit SI7021 pin VCC
DC OUT -Bluetooth Nordic nRF52832 module pin 24 (GND),
Artekit SI7021 pin GND

The assembled sensor was equipped with the suitable case and was installed in the camper.


This can be viewed like a lifehack, but taking in account the vibrations protection, the case being done on the principle of "toothpaste tube carton box" is one pretty design. This one can makes from plastic sheet 0.5 mm thickness. When case design/select need provide the maximum distance between a DC-DC converter, that can be heating up, and the temperature sensor.

The case of this sensor was with holes for mounting, for the power button and for free air convection.

The sensor was connected to the onboard 12V line.


Once powered this sensor, the data broadcasts the Bluetooth Nordic nRF52832 can be examined with application nRF Connect for Mobile (Android/iOS).
Where is 6E60463601CA, the data of sensors in hexadecimal RAW format displays at this moment:
6E60 - is temperature;
4636 - is humidity;
01CA - is CO2 parameter (not null if this microclimate sensor soldered together with ventilation fan's controller).
This data will change time to time.

In order to convert RAW-data of sensors broadcasts by Bluetooth Nordic nRF52832 in MQTT standard messages, thats can be used for all computers and camper's crew gadgets within the camper's network, the set of MQTT scripts was used.

In this case, all together this set of MQTT scripts, the MQTT broker and the 4.0 Bluetooth USB dongle was deployed on Cubietruck clone with Armbian OS (Ubuntu version) installed and had static IP in the camper's network. This computer was tuned for not sleep, not hibernate. The Node.js with packages were installed on this computer as described in same topic about MQTT broker.


The easy way to install the set of MQTT scripts is to use WinSCP on PC. In some cases will need switch off the PC firewall while settings. In WinSCP, a connection was established to the single-board computer via SCP protocol by host name (IP), port 22, root username and password.


The set of MQTT scripts being unzipped was copied via WinSCP to the /home/USERNAME folder (not to root folder).

Then in the PC was established connection to the single-board computer via PuTTY by host name (IP, port 22, root username and password. Bottom listed commands were entered, where

- /home/USERNAME is folder where the set of MQTT scripts was copied;

- b131abcd7195142be0120808817f198d is UUID of Bluetooth Nordic nRF52832 module that was obtained as described above;

- the IP of the computer where MQTT broker is:

crontab -e

@reboot sleep 10; sudo modprobe -r btusb; sleep 10; sudo modprobe btusb

*/1 * * * * cd /home/USERNAME; sudo timeout 50 node CA_THC_bt2mqtt b131abcd7195142be0120808817f198d CA/THC mqtt:// >> /dev/null

# and at least one empty line should be at the end of the file! 

Ctrl+O, Enter, Ctrl+X

Note: the string "@reboot sleep 10; sudo modprobe -r btusb; sleep 10; sudo modprobe btusb" in the crontab file is optional, is for use if a Bluetooth LE dongle, being extremely low power consumption, has no a stable start.


No later then 1 minute and then each 1 minute, any computer and any camper's crew gadget within the camper's network can receive standard MQTT topics named CA/THC with human-read sub-string.

Then Nginx web server was installed as described next.

The Nginx web server can be installed on any Linux-computer within the camper's network but this computer must have static IP for easy access to him. It is possible to set a static IP in this computer, but it is more reliable to setup a static IP in the camper's router settings. Also possible but not good idea to install this server (with specified web port-number) on same computer where the Camper's NAS was deployed with static IP as the NAS's work is resources expensive and not all single-board computers can serves both the NAS and the web server.

In this case, the Nginx web server was deployed on Cubietruck clone with Armbian OS (Ubuntu version) installed and had static IP in the camper's network. This computer was tuned for not sleep, not hibernate. This is was that one computer where before was deployed all together the MQTT broker and the 4.0 Bluetooth USB dongle, the Node.js with packages.

All settings for Nginx were made via Windows PC. In some cases will need switch off the PC firewall while settings.

When Linux-computer chosen for Nginx was connected to the camper's router, it was available in the PC terminal via PuTTY over IP on port 22 with root user and password. The camper's router had Internet connection at this time.

Were entered via PuTTY terminal on PC:

apt-get install nginx

systemctl enable nginx

This files set was unzipped on the PC. One of unzipped file index.nginx-debian.html was opened in Geany and line with MQTT broker IP was changed as in the camper's network tuned. This was the string MQTTbroker = "";

Then file index.nginx-debian.html was saved in Geany and no other modification need to make within.


The unzipped files set and the just changed file index.nginx-debian.html was transfered in /var/www/html folder of the Linux-computer where Nginx just installed. The easy way to transfer this files to the Linux computer is to use WinSCP.

From this point, the start Nginx web-page can be opened with typing in the Internet browser on any computer or gadget in the camper's network (on a iOS need to be switched on the javascript support, that one typically switched off).


No later 1 minute, the data will charts.
Data of CO2 charts will if was made the ventilation fan' controller as described in this series of articles.

Note: few first usage of this application must be with Internet connection in order for buffering Java libraries being used. In further the Internet connection is not necessarily.


A software you can load from this site is free for a non-commercial use except for components for which their owners declared their own rights. Can be limited by local laws.

No your data will be collected with a software you can load from this site.


Get updates