{"id":43720,"date":"2017-10-10T13:08:01","date_gmt":"2017-10-10T13:08:01","guid":{"rendered":"http:\/\/randomnerdtutorials.com\/?p=43720"},"modified":"2019-04-02T10:23:27","modified_gmt":"2019-04-02T10:23:27","slug":"node-red-with-raspberry-pi-camera-take-photos","status":"publish","type":"post","link":"https:\/\/randomnerdtutorials.com\/node-red-with-raspberry-pi-camera-take-photos\/","title":{"rendered":"Node-RED with Raspberry Pi Camera (Take Photos)"},"content":{"rendered":"<p>In this project we&#8217;re going to show you how to take photos with Node-RED using the Raspberry Pi Camera Module V2.<!--more--><\/p>\n<p><img data-recalc-dims=\"1\" fetchpriority=\"high\" decoding=\"async\" class=\"aligncenter wp-image-43772\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/10\/PiCamera-Node-RED-featured-image.jpg?resize=642%2C361&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"642\" height=\"361\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/10\/PiCamera-Node-RED-featured-image.jpg?w=1280&amp;quality=100&amp;strip=all&amp;ssl=1 1280w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/10\/PiCamera-Node-RED-featured-image.jpg?resize=300%2C169&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/10\/PiCamera-Node-RED-featured-image.jpg?resize=768%2C432&amp;quality=100&amp;strip=all&amp;ssl=1 768w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/10\/PiCamera-Node-RED-featured-image.jpg?resize=1024%2C576&amp;quality=100&amp;strip=all&amp;ssl=1 1024w\" sizes=\"(max-width: 642px) 100vw, 642px\" \/><\/p>\n<h2>Prerequisites:<\/h2>\n<ul>\n<li>You should be familiar with the Raspberry Pi \u2013\u00a0<a href=\"https:\/\/randomnerdtutorials.com\/getting-started-with-raspberry-pi\/\" target=\"_blank\" rel=\"noopener noreferrer\">read Getting Started with Raspberry Pi<\/a>.<\/li>\n<li>You should have the Raspbian or Raspbian Lite operating system installed in your Raspberry Pi \u2013\u00a0<a href=\"https:\/\/randomnerdtutorials.com\/installing-raspbian-lite-enabling-and-connecting-with-ssh\/\">read Installing Raspbian Lite, Enabling and Connecting with SSH<\/a>.<\/li>\n<li>You need\u00a0<a href=\"https:\/\/randomnerdtutorials.com\/getting-started-with-node-red-on-raspberry-pi\/\">Node-RED installed on your Pi<\/a> and <a href=\"https:\/\/randomnerdtutorials.com\/getting-started-with-node-red-dashboard\/\">Node-RED Dashboard<\/a>.<\/li>\n<li>We also recommend reading our:\u00a0<a href=\"https:\/\/randomnerdtutorials.com\/guide-to-raspberry-pi-camera-v2-module\/\" target=\"_blank\" rel=\"noopener noreferrer\">Guide to Raspberry Pi Camera V2 Module<\/a>.<\/li>\n<\/ul>\n<p>If you like home automation and you want to learn more about Node-RED, Raspberry Pi, ESP8266 and Arduino. I recommend that you download my course:\u00a0<a href=\"https:\/\/randomnerdtutorials.com\/build-a-home-automation-system-for-100\/\" target=\"_blank\" rel=\"noopener noreferrer\">Build a Home Automation System for $100<\/a>.<\/p>\n<h2>Parts required<\/h2>\n<p>For this project you need the following parts (click the links below to find the best price at <a href=\"https:\/\/makeradvisor.com\/tools\/\" target=\"_blank\" rel=\"noopener noreferrer\">Maker Advisor<\/a>):<\/p>\n<ul>\n<li><a href=\"https:\/\/makeradvisor.com\/tools\/raspberry-pi-board\/\" target=\"_blank\" rel=\"noopener noreferrer\">Raspberry Pi Board<\/a>\u00a0\u00a0\u2013 read\u00a0<a href=\"https:\/\/makeradvisor.com\/best-raspberry-pi-3-starter-kits\/\" target=\"_blank\" rel=\"noopener noreferrer\">Best Raspberry Pi Starter Kits<\/a><\/li>\n<li><a href=\"https:\/\/makeradvisor.com\/tools\/raspberry-pi-camera-v2-module\/\" target=\"_blank\" rel=\"noopener noreferrer\">Raspberry Pi Camera V2 Module<\/a><\/li>\n<li><a href=\"https:\/\/makeradvisor.com\/tools\/microsd-card-raspberry-pi-16gb-class-10\/\" target=\"_blank\" rel=\"noopener noreferrer\">MicroSD Card &#8211; 16GB Class10<\/a><\/li>\n<li><a href=\"https:\/\/makeradvisor.com\/tools\/raspberry-pi-power-supply\/\" target=\"_blank\" rel=\"noopener noreferrer\">Raspberry Pi Power Supply (5V 2.5A)<\/a><\/li>\n<\/ul>\n<p>You can use the preceding links or go directly to <a href=\"https:\/\/makeradvisor.com\/tools\/?utm_source=rnt&utm_medium=post&utm_campaign=post\" target=\"_blank\">MakerAdvisor.com\/tools<\/a> to find all the parts for your projects at the best price!<\/p><p style=\"text-align:center;\"><a href=\"https:\/\/makeradvisor.com\/tools\/?utm_source=rnt&utm_medium=post&utm_campaign=post\" target=\"_blank\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/10\/header-200.png?w=1200&#038;quality=100&#038;strip=all&#038;ssl=1\"><\/a><\/p>\n<h2>Connect the Raspberry Pi Camera Module<\/h2>\n<p>With the Pi shutdown, connect the camera to the Pi CSI port as shown in the following figure. Make sure the camera is connected in the right orientation with the ribbon blue letters facing up.<\/p>\n<p><img data-recalc-dims=\"1\" decoding=\"async\" class=\"aligncenter size-full wp-image-41868\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/08\/connectcamera-1.jpg?resize=516%2C406&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"516\" height=\"406\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/08\/connectcamera-1.jpg?w=516&amp;quality=100&amp;strip=all&amp;ssl=1 516w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/08\/connectcamera-1.jpg?resize=300%2C236&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 516px) 100vw, 516px\" \/><\/p>\n<h2>Enable the camera<\/h2>\n<p>To use the Raspberry Pi Camera module, you need to enable the camera software in your Raspberry Pi. In the Desktop environment, go to the\u00a0<strong>Raspberry Pi Configuration<\/strong>\u00a0window under the\u00a0<strong>Preferences<\/strong>\u00a0menu, open the\u00a0<strong>Interfaces\u00a0<\/strong>tab and enable the\u00a0<strong>Camera<\/strong>\u00a0as shown in figure below.<\/p>\n<p><img data-recalc-dims=\"1\" decoding=\"async\" class=\"aligncenter size-full wp-image-41866\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/08\/Figure-13-3.png?resize=508%2C429&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"508\" height=\"429\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/08\/Figure-13-3.png?w=508&amp;quality=100&amp;strip=all&amp;ssl=1 508w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/08\/Figure-13-3.png?resize=300%2C253&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 508px) 100vw, 508px\" \/><\/p>\n<p>Or, in the\u00a0<strong>Terminal<\/strong>\u00a0window, type the following command:<\/p>\n<pre>pi@raspberry:~ $ <strong>sudo raspi-config<\/strong><\/pre>\n<p>You should see the Raspberry Pi software configuration tool. Select the\u00a0<strong>Interfacing Options<\/strong>:<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-41873\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/08\/Interfacing-options.png?resize=959%2C270&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"959\" height=\"270\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/08\/Interfacing-options.png?w=959&amp;quality=100&amp;strip=all&amp;ssl=1 959w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/08\/Interfacing-options.png?resize=300%2C84&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/08\/Interfacing-options.png?resize=768%2C216&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 959px) 100vw, 959px\" \/><\/p>\n<p>Enable the camera and reboot your Pi:<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-41874\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/08\/enable-camera-raspi-config.png?resize=960%2C270&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"960\" height=\"270\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/08\/enable-camera-raspi-config.png?w=960&amp;quality=100&amp;strip=all&amp;ssl=1 960w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/08\/enable-camera-raspi-config.png?resize=300%2C84&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/08\/enable-camera-raspi-config.png?resize=768%2C216&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 960px) 100vw, 960px\" \/><\/p>\n<h2>Installing the Raspberry Pi Camera node<\/h2>\n<p>To install the Raspberry Pi Camera node on Node-RED, enter the following command:<\/p>\n<pre>pi@raspberry:~ $ <strong>sudo npm install -g node-red-contrib-camerapi<\/strong><\/pre>\n<h2>Choosing the photos directory<\/h2>\n<p>You need to chose a directory where the photos will be temporarily saved. For that you need to edit the <strong>settings.js<\/strong> file. Try one of the following commands because your Node-RED directory installation may be different.<\/p>\n<pre>pi@raspberry:~ $ <strong>sudo nano \/root\/.node-red\/settings.js<\/strong><\/pre>\n<p>or<\/p>\n<pre>pi@raspberry:~ $ <strong>sudo nano ~\/.node-red\/settings.js\r\n<\/strong><\/pre>\n<p>Then, scroll down the file, find the <strong>httpStatic<\/strong> setting, uncomment and type your desired directory to store the Raspberry Pi Camera photo. Take a look at the figure below.<\/p>\n<pre>httpStatic: '<strong>\/home\/pi\/Pictures\/<\/strong>',<\/pre>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-43744\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/10\/httpstatic-enable.png?resize=797%2C419&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"797\" height=\"419\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/10\/httpstatic-enable.png?w=797&amp;quality=100&amp;strip=all&amp;ssl=1 797w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/10\/httpstatic-enable.png?resize=300%2C158&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/10\/httpstatic-enable.png?resize=768%2C404&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 797px) 100vw, 797px\" \/><\/p>\n<p>When you&#8217;re done, exit and save the changes.<\/p>\n<h2>Start Node-RED<\/h2>\n<p>To start Node-RED, enter the following in the <strong>Terminal<\/strong>\u00a0window:<\/p>\n<pre>pi@raspberry:~ $ <strong>sudo node-red start<\/strong><\/pre>\n<p>To access Node-RED, open a tab in any browser on the local network and type the following:<\/p>\n<pre>http:\/\/<strong><span style=\"color: #ff0000;\">Your_RPi_IP_address<\/span><\/strong>:1880<\/pre>\n<p>You should replace\u00a0<strong>Your_RPi_IP_address\u00a0<\/strong>with your Raspberry Pi IP address. If you don&#8217;t know your Raspberry Pi IP address, in the Terminal enter:<\/p>\n<pre>pi@raspberry:~ $ <strong>hostname -I<\/strong><\/pre>\n<h2>Node-RED Dashboard<\/h2>\n<p>You need to create a tab and a group on Node-RED to add your dashboard widgets. Follow the next instruction to create a tab and a group (see figure below):<\/p>\n<ul>\n<li>On top right corner of the Node-RED window you have a tab called\u00a0<strong>dashboard<\/strong>.<\/li>\n<li>Select that tab\u00a0<strong>(1)<\/strong>. To add a tab to the user interface click on the\u00a0<strong>+tab<\/strong>\u00a0button\u00a0<strong>(2)<\/strong>.<\/li>\n<li>Once created, you can edit the tab by clicking on the\u00a0<strong>edit<\/strong>\u00a0button\u00a0<strong>(3)<\/strong>.<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-41742\" src=\"https:\/\/i1.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/08\/tabsandgroups.png?resize=407%2C223&amp;ssl=1\" sizes=\"(max-width: 407px) 100vw, 407px\" srcset=\"https:\/\/i1.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/08\/tabsandgroups.png?w=407&amp;ssl=1 407w, https:\/\/i1.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/08\/tabsandgroups.png?resize=300%2C164&amp;ssl=1 300w\" alt=\"\" width=\"407\" height=\"223\" \/><\/p>\n<p>You can edit the tab\u2019s name and change its icon:<\/p>\n<ul>\n<li><strong>Name<\/strong>: you can call it whatever you want<\/li>\n<li><strong>Icon<\/strong>:\u00a0\u00a0you should use a name accordingly to the icon\u2019s names in this link:\u00a0<a href=\"https:\/\/klarsys.github.io\/angular-material-icons\/\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/klarsys.github.io\/angular-material-icons<\/a><\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-41744\" src=\"https:\/\/i2.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/08\/edit-tab.png?resize=506%2C201&amp;ssl=1\" sizes=\"(max-width: 506px) 100vw, 506px\" srcset=\"https:\/\/i2.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/08\/edit-tab.png?w=506&amp;ssl=1 506w, https:\/\/i2.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/08\/edit-tab.png?resize=300%2C119&amp;ssl=1 300w, https:\/\/i2.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/08\/edit-tab.png?resize=250%2C100&amp;ssl=1 250w\" alt=\"\" width=\"506\" height=\"201\" \/><\/p>\n<h2>Creating the Node-RED Flow<\/h2>\n<p>Before creating the flow, make sure you have the <strong>camerapi takephoto<\/strong> node, as show in the figure below. If you don&#8217;t have the node, check that you&#8217;ve followed the instructions above in the <strong>Installing the Raspberry Pi Camera node<\/strong> section.<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-43751\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/10\/pi-camera-node-installed.png?resize=139%2C387&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"139\" height=\"387\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/10\/pi-camera-node-installed.png?w=139&amp;quality=100&amp;strip=all&amp;ssl=1 139w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/10\/pi-camera-node-installed.png?resize=108%2C300&amp;quality=100&amp;strip=all&amp;ssl=1 108w\" sizes=\"(max-width: 139px) 100vw, 139px\" \/><\/p>\n<p>First, drag 3 nodes into the flow: <strong>template<\/strong>, <strong>camerapi takephoto<\/strong> and <strong>debug<\/strong>.<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-43748\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/10\/drag-nodes.png?resize=524%2C48&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"524\" height=\"48\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/10\/drag-nodes.png?w=524&amp;quality=100&amp;strip=all&amp;ssl=1 524w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/10\/drag-nodes.png?resize=300%2C27&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/10\/drag-nodes.png?resize=510%2C48&amp;quality=100&amp;strip=all&amp;ssl=1 510w\" sizes=\"(max-width: 524px) 100vw, 524px\" \/><\/p>\n<h3>Template node<\/h3>\n<p>Then, edit the template node, as shown in the figure below &#8211; copy and paste the template code below the figure.<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-43753\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/10\/template-node.png?resize=681%2C740&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"681\" height=\"740\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/10\/template-node.png?w=681&amp;quality=100&amp;strip=all&amp;ssl=1 681w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/10\/template-node.png?resize=276%2C300&amp;quality=100&amp;strip=all&amp;ssl=1 276w\" sizes=\"(max-width: 681px) 100vw, 681px\" \/><\/p>\n<pre>&lt;script&gt;\r\nvar value = \"1\";\r\n\/\/ or overwrite value in your callback function ...\r\nthis.scope.action = function() { return value; }\r\n\r\nfunction updateF() {\r\n  var source = '\/photo1.JPEG',\r\n  timestamp = (new Date()).getTime(),\r\n  newUrl = source + '?_=' + timestamp;\r\n  document.getElementById(\"photo\").src = newUrl;\r\n}\r\n&lt;\/script&gt;\r\n\r\n&lt;md-button ng-click=\"send({payload:action()})\" onclick=\"setTimeout(updateF, 2500);\" style=\"padding:40px; margin-bottom: 40px;\" &gt;\r\n &lt;ui-icon icon=\"camera\"&gt;&lt;\/ui-icon&gt;\r\n Take a photo&lt;br&gt;\r\n&lt;\/md-button&gt;\r\n\r\n&lt;div style=\"margin-bottom:40px;\"&gt;\r\n &lt;img src=\"\/photo1.JPEG\" id=\"photo\" width=\"100%\" height=\"100%\"&gt;\r\n&lt;\/div&gt;<\/pre>\n<p>This JavaScript code automatically updates the Node-RED page when a new photo is taken.<\/p>\n<h3>Camerapi Takephoto node<\/h3>\n<p>Finally, edit the <strong>camerapi takephoto<\/strong> node with the following properties:<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-43747\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/10\/camera-pi-take-photo.png?resize=444%2C685&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"444\" height=\"685\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/10\/camera-pi-take-photo.png?w=444&amp;quality=100&amp;strip=all&amp;ssl=1 444w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/10\/camera-pi-take-photo.png?resize=194%2C300&amp;quality=100&amp;strip=all&amp;ssl=1 194w\" sizes=\"(max-width: 444px) 100vw, 444px\" \/><\/p>\n<p><strong>Note 1:<\/strong> don&#8217;t forget to add the right <strong>File Path<\/strong> to your node including the last forward slash &#8211; \/home\/pi\/Pictures<strong>\/<\/strong><\/p>\n<p><strong>Note 2<\/strong>: every time you open the\u00a0<strong>camerapi takephoto<\/strong> node, it will change the file default path to yes. So, make sure you select the right properties, every time you open the node.<\/p>\n<p><strong>Note 3<\/strong>: when you take a new photo, it will be saved on your chosen directory with the name\u00a0<strong>photo1.JPEG<\/strong>. Every time you take a new photo, Node-RED overwrites the existing photo because they have the same name.<\/p>\n<h3>Wiring the nodes<\/h3>\n<p>Connect the nodes as shown in the figure below.<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-43749\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/10\/nodes-connected.png?resize=433%2C43&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"433\" height=\"43\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/10\/nodes-connected.png?w=433&amp;quality=100&amp;strip=all&amp;ssl=1 433w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/10\/nodes-connected.png?resize=300%2C30&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 433px) 100vw, 433px\" \/><\/p>\n<p>Lastly, press the <strong>Deploy<\/strong> button to save all the changes.<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-40013 aligncenter\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/06\/11_deploy_button.png?resize=138%2C40&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"138\" height=\"40\" \/><\/p>\n<h2>Node-RED UI<\/h2>\n<p>Your Node-RED application is ready. To access the UI, you can use any browser in your local network when you type:<\/p>\n<pre>http:\/\/Your_RPi_IP_address:1880<strong>\/ui<\/strong><\/pre>\n<p>The next figure shows how the Node-RED UI looks. We&#8217;re using this application to monitor <a href=\"https:\/\/randomnerdtutorials.com\/creality-3d-cr-10-3d-printer-review\/\">our Creality CR-10 3D printer<\/a>. With this setup we can quickly check the printing status from any room by clicking the <strong>TAKE A PHOTO<\/strong> button.<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-43754\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/10\/picam.jpg?resize=734%2C629&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"734\" height=\"629\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/10\/picam.jpg?w=734&amp;quality=100&amp;strip=all&amp;ssl=1 734w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/10\/picam.jpg?resize=300%2C257&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 734px) 100vw, 734px\" \/><\/p>\n<h3>Troubleshooting<\/h3>\n<p>1) If your image is not being displayed on the Node-RED UI, you can go the following URL and see if your httpStatic path was set properly:<\/p>\n<pre>http:\/\/Your_RPi_IP_address:1880\/<strong>photo1.JPEG<\/strong><\/pre>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-43752\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/10\/picamera-test.png?resize=615%2C459&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"615\" height=\"459\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/10\/picamera-test.png?w=615&amp;quality=100&amp;strip=all&amp;ssl=1 615w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/10\/picamera-test.png?resize=300%2C224&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 615px) 100vw, 615px\" \/><\/p>\n<p>2) If the Pi Camera is not taking photos, double-check that the camera ribbon is well connected to your Pi&#8217;s CSI port. Also confirm that it&#8217;s enabled in your Pi&#8217;s raspi-config menu.<\/p>\n<p>3) Open the\u00a0camerapi takephoto node and ensure that it has the right file path.<\/p>\n<h2>Demonstration<\/h2>\n<p>Here&#8217;s a GIF image showing how the application works. When you click on the button, a new photo is automatically updated on the Node-RED UI.<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-43764\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/10\/PiCamera-GIF.gif?resize=480%2C390&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"480\" height=\"390\" \/><\/p>\n<h2>Wrapping up<\/h2>\n<p>In this project, we&#8217;ve shown you how you can use the Raspberry Pi Camera with Node-RED to take photos. You can edit the flow and the template to use the camera in your own projects whether you want to monitor your lab, door or 3D printer.<\/p>\n<p>We hope you&#8217;ve found this post useful. Thanks for reading!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this project we&#8217;re going to show you how to take photos with Node-RED using the Raspberry Pi Camera Module V2.<\/p>\n","protected":false},"author":1,"featured_media":43772,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[301,273,264,268],"tags":[],"class_list":["post-43720","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-0-raspberrypi","category-node-red","category-project","category-raspberry-pi-project"],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/10\/PiCamera-Node-RED-featured-image.jpg?fit=1280%2C720&quality=100&strip=all&ssl=1","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts\/43720","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/comments?post=43720"}],"version-history":[{"count":0,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts\/43720\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/media\/43772"}],"wp:attachment":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/media?parent=43720"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/categories?post=43720"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/tags?post=43720"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}