{"id":2490,"date":"2023-11-30T22:26:23","date_gmt":"2023-11-30T21:26:23","guid":{"rendered":"https:\/\/theroamingworkshop.cloud\/b\/?p=2490"},"modified":"2023-11-30T22:27:56","modified_gmt":"2023-11-30T21:27:56","slug":"%f0%9f%8c%a1unihiker-real-time-temperature-sensor-set-up-in-2-minutes","status":"publish","type":"post","link":"https:\/\/theroamingworkshop.cloud\/b\/en\/2490\/%f0%9f%8c%a1unihiker-real-time-temperature-sensor-set-up-in-2-minutes\/","title":{"rendered":"\ud83c\udf21UNIHIKER real-time temperature sensor set up in 2 minutes"},"content":{"rendered":"\n<p>I keep experimenting with the <strong>UNIHIKER <\/strong>board by DFRobot and it&#8217;s incredibly fast to make things work in it. Today I&#8217;ll show you how to set up on-screen real-time temperature display in two minutes using a BMP-280 module and <strong>zero programming<\/strong>.<\/p>\n\n\n\n<div id=\"menu\" style=\"padding:20px 20px 20px 20px; border-left:2px solid darkgrey;\">\n<p style=\"font-weight:bold;\">Content<\/p>\n<\/div>\n<script>\nvar text;\nvar element;\n\nfunction fillmenu(){\n\nfor (let i=0; i<window.document.getElementsByTagName(\"h2\").length; i++){\nelement = window.document.getElementsByTagName(\"h2\")[i];\ntext = \"\u25b9 \"+element.innerHTML;\nvar newelement = document.createElement(\"a\");\nnewelement.innerHTML=text;\nvar postid=window.document.getElementsByTagName(\"article\")[0].id;\nvar url = \"https:\/\/theroamingworkshop.cloud\/b\/?p=\"+postid.substr(5,postid.length)+\"#\"+element.id;\nnewelement.setAttribute(\"href\", url);\nnewelement.appendChild(document.createElement(\"br\"));\nwindow.document.getElementById(\"menu\").appendChild(newelement);\nconsole.log(text);\n}\n}\nif(window.location.href.includes(\"tag\")){\n\n}else{\nwindow.setTimeout(fillmenu,2000);\n}\n\n<\/script>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"prerrequisites\">Prerrequisites<\/h2>\n\n\n\n<p>Here's the trick. I was expecting you already had a few things working before starting the countdown:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Download and install <strong>Mind+<\/strong>, DFRobot's IDE for UNIHIKER.<br>On Linux, it is a .deb file which does take a while to install:<br><a href=\"https:\/\/mindplus.cc\/download-en.html\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/mindplus.cc\/download-en.html<\/a><\/li>\n\n\n\n<li>Solder a <strong>BMP-280<\/strong> temperature and pressure module and connect it to the I2C cable. You might need to bend your pins slightly as the connector seems to be 1mm nano JST.<\/li>\n<\/ul>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><a href=\"https:\/\/theroamingworkshop.cloud\/b\/wp-content\/uploads\/2023\/11\/bmp1.jpg\" target=\"_blank\" rel=\"noreferrer noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"4080\" height=\"3060\" src=\"https:\/\/theroamingworkshop.cloud\/b\/wp-content\/uploads\/2023\/11\/bmp1.jpg\" alt=\"\" class=\"wp-image-2491\" style=\"aspect-ratio:1.3333333333333333;object-fit:cover;width:407px;height:auto\"\/><\/a><\/figure>\n<\/div>\n\n\n<ul class=\"wp-block-list\">\n<li>Plug the UNIHIKER to your PC using the provided USB-C cable and connect to it via Mind+ just like recommended in the official wiki:<br><a href=\"https:\/\/www.unihiker.com\/wiki\/get-started#4.4.%20Programming%20on%20Mind+\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/www.unihiker.com\/wiki\/get-started#4.4.%20Programming%20on%20Mind+<\/a><\/li>\n<\/ul>\n\n\n\n<p>You're ready to go!<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"set-up\">Set-up<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>In <strong>Mind+<\/strong>, go to the <strong>Blocks<\/strong> editor and open the <strong>Extensions<\/strong> menu.<\/li>\n\n\n\n<li>Go to the <strong>pinpong<\/strong> tab and select the pinpong module (which enables interaction with the UNIHIKER pinout) and the BMP-280 module extension, for interaction with the temperature module.<\/li>\n<\/ol>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><a href=\"https:\/\/theroamingworkshop.cloud\/b\/wp-content\/uploads\/2023\/11\/DFR_bmp4.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"472\" height=\"439\" src=\"https:\/\/theroamingworkshop.cloud\/b\/wp-content\/uploads\/2023\/11\/DFR_bmp4.png\" alt=\"\" class=\"wp-image-2525\" style=\"width:356px;height:auto\"\/><\/a><\/figure>\n<\/div>\n\n\n<ol class=\"wp-block-list\" start=\"3\">\n<li>Go back to the Blocks editor and start building your code block. Just navigate through the different sections on the left hand side and drag all you need below the <kbd>Python program start<\/kbd> block:\n<ul class=\"wp-block-list\">\n<li><strong>pinpong<\/strong> - initialize board.<\/li>\n\n\n\n<li><strong>bmp280<\/strong> - initialize module at standard address 0x76.<\/li>\n\n\n\n<li><strong>control<\/strong> - forever block (to introduce a while True loop).<\/li>\n\n\n\n<li><strong>unihiker<\/strong> - add objects to the display. I firstly add a filled rectangle object to clear previous text, then add a text object. Specify X,Y coordinates where every object will be displayed on the screen and its color.<\/li>\n\n\n\n<li><strong>bmp280<\/strong> - read temperature property. Drag this inside the text field of the text object.<\/li>\n\n\n\n<li><strong>python<\/strong> - (optional) add a print to show the data on the terminal. I included all other sensor values.<\/li>\n\n\n\n<li><strong>control<\/strong> - add a wait object and wait for 1 second before next loop.<br>All of it should look something like this (click to enlarge)<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/theroamingworkshop.cloud\/b\/wp-content\/uploads\/2023\/11\/DFR_bmp1.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"5474\" height=\"976\" src=\"https:\/\/theroamingworkshop.cloud\/b\/wp-content\/uploads\/2023\/11\/DFR_bmp1.png\" alt=\"\" class=\"wp-image-2526\"\/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"launch\">Launch<\/h2>\n\n\n\n<p>And that's all your program done, without any programming! Press <kbd>RUN<\/kbd> above and see how it loads and displays in your UNIHIKER screen. Touch the sensor with your finger to see how values change with the increase in temperature.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"450\" height=\"252\" src=\"https:\/\/theroamingworkshop.cloud\/b\/wp-content\/uploads\/2023\/11\/Unihiker-BMP280-1.gif\" alt=\"\" class=\"wp-image-2528\"\/><\/figure>\n<\/div>\n\n\n<p>Wasn't that only 2 minutes? Let me know via Twitter ; )<\/p>\n\n\n\n<p>\ud83d\udc26 <code><a rel=\"noreferrer noopener\" href=\"https:\/\/twitter.com\/roamingworkshop\" target=\"_blank\">@RoamingWorkshop<\/a><\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I keep experimenting with the UNIHIKER board by DFRobot and it&#8217;s incredibly fast to make things work in it. Today I&#8217;ll show you how to set up on-screen real-time temperature display in two minutes using a BMP-280 module and zero programming. Prerrequisites Here&#8217;s the trick. I was expecting you already had a few things working [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":2525,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[68],"tags":[621,611,613,623,403,401,397,629,617,615,619,399,631,633,627,625],"class_list":["post-2490","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-electronics","tag-bmp280","tag-dev-board","tag-development-board","tag-dfrobot","tag-electronica","tag-electronics","tag-iot","tag-pantalla-tactil","tag-placas","tag-placas-de-desarrollo","tag-sensor","tag-smat-home","tag-temperatura","tag-temperature","tag-touchscreen","tag-unihiker","post-preview"],"_links":{"self":[{"href":"https:\/\/theroamingworkshop.cloud\/b\/wp-json\/wp\/v2\/posts\/2490","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/theroamingworkshop.cloud\/b\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/theroamingworkshop.cloud\/b\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/theroamingworkshop.cloud\/b\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/theroamingworkshop.cloud\/b\/wp-json\/wp\/v2\/comments?post=2490"}],"version-history":[{"count":5,"href":"https:\/\/theroamingworkshop.cloud\/b\/wp-json\/wp\/v2\/posts\/2490\/revisions"}],"predecessor-version":[{"id":2538,"href":"https:\/\/theroamingworkshop.cloud\/b\/wp-json\/wp\/v2\/posts\/2490\/revisions\/2538"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/theroamingworkshop.cloud\/b\/wp-json\/wp\/v2\/media\/2525"}],"wp:attachment":[{"href":"https:\/\/theroamingworkshop.cloud\/b\/wp-json\/wp\/v2\/media?parent=2490"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/theroamingworkshop.cloud\/b\/wp-json\/wp\/v2\/categories?post=2490"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/theroamingworkshop.cloud\/b\/wp-json\/wp\/v2\/tags?post=2490"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}