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. 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 works like here described too.
Any DC-DC converter can steps 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:
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 on the PC was opened Device Manager:
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 his COM-port number was noted.
|Black Magic Probe programmer pin||nRF52832 BT module pin|
|VCC 3.3V||10 (VCC)|
Next steps was on the PC in order to flash Bluetooth Nordic nRF52832 module:
Then in the PC command-line terminal was entered one by one:
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
(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) load C:/Users/%username%/temp/out.hex
From this point, the Bluetooth Nordic nRF52832 module was been flashed 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 pin||Artekit SI7021 pin|
All components was 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 pin||other 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 192.168.1.71 in the camper's network. This computer was tuned for not sleep, not hibernate. The Node.js with packages was 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 192.168.1.71), 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;
- 192.168.1.71 the IP of the computer where MQTT broker is:
*/1 * * * * cd /home/USERNAME; sudo timeout 50 node CA_THC_bt2mqtt b131abcd7195142be0120808817f198d CA/THC mqtt://192.168.1.71 >> /dev/null
# and at least one empty line should be at the end of the file!
Ctrl+O, Enter, Ctrl+X
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 192.168.1.71 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.
Was 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 = "192.168.1.71";
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.
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.