Elektor_Mag_-_January-February_2021

([email protected]) #1

16 January & February 2021 http://www.elektormagazine.com


A good basis for further projects
There is plenty of scope for expanding the firmware. For example, the
ESP32 could be configured as an access point so that it can deliver data
directly over WiFi rather than requiring an external wireless network.
Provision could be made for entering the access details for other WiFi
networks more conveniently. The colours used for the display and
magnifying glass could be made configurable, and filters could be
designed to reduce noise and flicker. An Android app could handle
multiple MTheCam devices simultaneously, displaying all their images
in a live view. Alarm conditions could be specified, with automatic notifi-
cations sent out. This could be done relatively simply using Node-RED
and MQTT. It will be worth taking a look at the project web page from
time to time [9] as the foundation for some clever and useful appli-
cations is already there!

The author would like to extend a special thanks to Daniel Zelosko for
developing the prototype.
180337-

{“device”: “MTheCam”,”ver”: “1.0”,”rowsize”:
8,”batvolt”: 3.39,
“tavg”: 2317,”tmin”: 2050,”tmax”: 2750,”tminrange”:
1817,”tmaxrange”: 2817,
“frame”: [2075, 2050, 2100, 2275, 2600, 2475, 2100,
2050, , ...... ]} // 64 values °C 100 // + 2
arrays with ‘HSL’ colours of 8
8 and 32*32 tiles.


Listing 4 shows the most relevant part of the HTML code. The body
of the document, including all the CSS and HTML tags, is defined as
a fixed string and is sent to the client, whereas the thermal image is
implemented as an HTML canvas comprising tiles in an 8-by-8 or
32-by-32 grid in value mode and image mode respectively.


A script in the HTML code periodically requests the sensor data from
/frame under control of a timer, obtaining a JSON object as above.
JavaScript and JSON work well together and it is easy to extract the
payload data from the object. jsonData.frame and jsonData.
framecol yield arrays that represent the readings and colour values
directly. From these we can extract the original temperature values
and the interpolated colours, then set the colours of the tiles and the
overlaid numbers appropriately. The display update interval can be
adjusted from 200 ms to 3 s.


Questions or Comments?
Questions or comments regarding this article? Send an e-mail
to the author ([email protected]) or to the editor
([email protected]).

Contributors
Circuit, software and text:
Olaf Mertens (Micom)
Translation: Mark Owen

Editing: Stuart Cording
Layout: Giel Dols

related products


> M5StickC
http://www.elektor.com/m5stack-m5stickc-esp32-pico-mini-iot-development-board

[1] Pyrometer: https://en.wikipedia.org/wiki/Pyrometer
[2] Interpolation in images: https://en.wikipedia.org/wiki/Image_scaling
[3] AMG88xx: https://bit.ly/2VPiCGc
[4] ESP32 documentation: https://bit.ly/37FlcEk
[5] M5StickC: https://bit.ly/2In5aq
[6] Visual Studio: https://code.visualstudio.com/
[7] ArduinoJSON : https://arduinojson.org/
[8] M5StickC library: https://github.com/m5stack/M5StickC
[9] Author’s project page: https://www.micom.de/lab/mthecam
[10] HSL colour model: https://en.wikipedia.org/wiki/HSL_and_HSV

WEB LINKS
Free download pdf