{"id":21,"date":"2021-01-09T14:33:36","date_gmt":"2021-01-09T14:33:36","guid":{"rendered":"http:\/\/www.larry4u.com\/co2diy.com\/?page_id=21"},"modified":"2021-08-03T19:39:23","modified_gmt":"2021-08-03T19:39:23","slug":"diy-make-big-screen-monitor","status":"publish","type":"page","link":"https:\/\/www.larry4u.com\/co2diy.com\/diy-make-big-screen-monitor\/","title":{"rendered":"DIY SCD30  Monitor"},"content":{"rendered":"\r\n<h3>DIY Make CO2\u00a0Sensor<\/h3>\r\n<p>please review <a href=\"https:\/\/www.larry4u.com\/co2diy.com\/what-you-need-to-do-the-scr30-sensor\/\">what you need to do for setting up the scd30 sensor<\/a><\/p>\r\n<h3>Raspberry pi OS<\/h3>\r\n<p>The following instructions are for both the Raspberry pi zero and 3B<\/p>\r\n<ul>\r\n<li>Download the Latest PI OS from <a href=\"https:\/\/www.raspberrypi.org\/software\/\">https:\/\/www.raspberrypi.org\/software\/<\/a><\/li>\r\n<li>Use your PC or Mac to run the application for putting the OS on your memory card.<\/li>\r\n<li><img decoding=\"async\" loading=\"lazy\" class=\"size-full wp-image-41 aligncenter\" src=\"http:\/\/www.larry4u.com\/co2diy.com\/wp-content\/uploads\/2021\/01\/Screenshot-2021-01-09-084100.jpg\" alt=\"\" width=\"250\" height=\"157\" \/><\/li>\r\n<li>Do not install the lite OS version.<\/li>\r\n<\/ul>\r\n<h3>Loading the OS on the Pi<\/h3>\r\n<ul>\r\n<li>Attach Kneeboard and Mouse to USB ports<\/li>\r\n<li>Attach HDMI cable to Monitor and Pi<\/li>\r\n<li>Attach Ethernet Cable (optional)<\/li>\r\n<li>Attach Power Supply to Pi<\/li>\r\n<li>As it boots, follow the instructions on the Monitor.<\/li>\r\n<li>The last part will ask for Update Software.\r\n<ul>\r\n<li>Just take a break. This will take some time.<\/li>\r\n<\/ul>\r\n<\/li>\r\n<li>When finished, select restart.<\/li>\r\n<\/ul>\r\n<h3>Setting up the environment for the Pi.<\/h3>\r\n<ul>\r\n<li>After reboot\r\n<ul>\r\n<li>Click on the Raspberry pi at the top left.<\/li>\r\n<li>Select Preferences<\/li>\r\n<li>Select Raspberry PI Configuration<\/li>\r\n<li>Select interfaces<\/li>\r\n<li>Enable SSH, VNC, and I2C<\/li>\r\n<li>Select Location<\/li>\r\n<li>Set Time zone US and (your local time zone)<\/li>\r\n<li>Select System<\/li>\r\n<li>Change Password<\/li>\r\n<\/ul>\r\n<\/li>\r\n<\/ul>\r\n<form  target=\"_blank\" action=\"https:\/\/www.paypal.com\/cgi-bin\/webscr\" method=\"post\">\n    \t\t\t<div class=\"pal_donation_button\">\n\t\t\t        <input type=\"hidden\" name=\"cmd\" value=\"_donations\">\n                                <input type=\"hidden\" name=\"item_name\" value=\"Recover development costs\">\n                                <input type=\"hidden\" name=\"amount\" value=\"10\">\n\t\t\t        <input type=\"hidden\" name=\"business\" value=\"larry@eldredge.org\">\n\t\t\t        <input type=\"hidden\" name=\"rm\" value=\"0\">\n\t\t\t        <input type=\"hidden\" name=\"currency_code\" value=\"USD\">\n\t\t\t\t\t<input name=\"bn\" value=\"WPCodelibrary_SP_EC_PRO\" type=\"hidden\">\n\t\t\t        <input type=\"image\" src=\"https:\/\/www.paypal.com\/en_US\/i\/btn\/btn_donateCC_LG.gif\" name=\"submit\" alt=\"PayPal - The safer, easier way to pay online.\">\n\t\t\t        <img alt=\"\" src=\"https:\/\/www.paypal.com\/en_US\/i\/scr\/pixel.gif\" width=\"1\" height=\"1\">\n\t\t\t    <\/div>\n\t\t\t<\/form>\r\n<h3>SSH into the Pi\u00a0<\/h3>\r\n<p>You can now disconnect HDMI, USB from the Pi. No longer needed.<\/p>\r\n<ul>\r\n<li>Note the IP address by left-clicking on the Wi-Fi icon on the top right side. You will need it to SSH.<\/li>\r\n<li>There are several apps for SSH into the Pi.\r\n<ul>\r\n<li>I like to use Bitvise on my computer.\u00a0<\/li>\r\n<li>If you haven&#8217;t download <a href=\"https:\/\/www.bitvise.com\/\">Bitvise: SSH software for Windows, <\/a>do it now.<\/li>\r\n<li>On the Pi, which is a Linux system. You will need to learn how to use an editor for it. The most common is the nano. It is just a line command editor that comes with the Pi OS.<\/li>\r\n<li>Log in as the User Pi and the password.<\/li>\r\n<li>The default password is \u201craspberry if you did not change it.<\/li>\r\n<\/ul>\r\n<\/li>\r\n<\/ul>\r\n<p>There now more tweaks that we need to add to the PI OS.<\/p>\r\n<ul>\r\n<li>Make a static IP address.\u00a0\u00a0\r\n<ul>\r\n<li>There are two kinds of IP address, DHCP and Static.\u00a0 DHCP means the router will assign an IP address. This can be random and change from time to time. We need to have an IP that is always the same.\u00a0 Most IP addresses from 2 to 255. If you have access to the router you can set up a static there if not choose a number that is 200 or higher and follow this URL: (<a href=\"https:\/\/howchoo.com\/pi\/configure-static-ip-address-raspberry-pi\" target=\"_blank\" rel=\"noopener\">link<\/a>)\u00a0<\/li>\r\n<li>One way to see if an IP is being used is to run cmd on your computer and type arp -a. This will give a list of most IP&#8217;s being used on your local network.<\/li>\r\n<li>It is possible that if you choose an IP that is not currently being used and you could get a duplicate IP address error.<\/li>\r\n<\/ul>\r\n<\/li>\r\n<li>\r\n<h2>add software for the creating web Pages<\/h2>\r\n<ul>\r\n<li style=\"list-style-type: none;\">\r\n<ul>\r\n<li>In order to have a web page to display the CO2 data, we will use a web server. The APACHE service will provide this option.<\/li>\r\n<li>Install the following from: <a href=\"https:\/\/pimylifeup.com\/raspberry-pi-apache\/\" target=\"_blank\" rel=\"noopener\">How to Setup a Raspberry Pi Apache Web Server &#8211; Pi My Life Up<\/a>.<\/li>\r\n<\/ul>\r\n<\/li>\r\n<\/ul>\r\n<\/li>\r\n<\/ul>\r\n<p>note in order to have read-write to the HTML directory dot the following;<\/p>\r\n<ul>\r\n<li style=\"list-style-type: none;\">\r\n<ul>\r\n<li>cd \/var\/www<\/li>\r\n<li>sudo chmod 777 html<\/li>\r\n<\/ul>\r\n<\/li>\r\n<li>\r\n<h2>Add Plotting software:<\/h2>\r\n<\/li>\r\n<\/ul>\r\n<div class=\"entry-content clearfix\">\r\n<p style=\"padding-left: 40px;\">Follow the link below:<\/p>\r\n<pre class=\"lang-py s-code-block\"><code class=\"hljs language-python\">sudo apt install python3-matplotlib<\/code><\/pre>\r\n<pre class=\"lang-py s-code-block hljs python\"><code>sudo pip3 install matplotlib\r\ncreat a test file name it testplot.py\r\n\r\nimport matplotlib.pyplot as plt #import the Python Matplotlib sub-module for graph plotting pyplot.\r\nx = [1,2,3,4] # x axis\r\ny = [1,2,3,4] # y axis\r\nplt.plot(x,y)# plotting the graph\r\n#plt.show() #Displaying the figures\r\nplt.savefig('Matplotlib_save_plot.png')<\/code><\/pre>\r\n<p>sudo reboot from the xterm<\/p>\r\n<p>run with \u201cpython3 testplot.py\u201d<\/p>\r\n<p>This will create a png file. Duble click on it from the remoter ssh file manger and you see the following graph.<\/p>\r\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-356\" src=\"https:\/\/www.larry4u.com\/co2diy.com\/wp-content\/uploads\/2021\/01\/Screenshot-2021-01-23-121051-300x228.jpg\" sizes=\"(max-width: 300px) 100vw, 300px\" srcset=\"https:\/\/www.larry4u.com\/co2diy.com\/wp-content\/uploads\/2021\/01\/Screenshot-2021-01-23-121051-300x228.jpg 300w, https:\/\/www.larry4u.com\/co2diy.com\/wp-content\/uploads\/2021\/01\/Screenshot-2021-01-23-121051.jpg 602w\" alt=\"\" width=\"300\" height=\"228\" \/><\/p>\r\n<ul>\r\n<li>Set up the run environment\r\n<ul>\r\n<li>On the PC download the zip file.\r\n<ul>\r\n<li>in your browser type larry4u.com\/data<\/li>\r\n<li>click on data_co2SCD30.7z this will download all files need to run the programs.<\/li>\r\n<li>unzip the file copy the files to the Pi using Bitvise, as follows:\r\n<ul>\r\n<li>to the pi home directory (\/home\/pi) using your mouse move these files:\r\n<ul>\r\n<li>clean_data_folder.py<\/li>\r\n<li>display_co2.py<\/li>\r\n<li>example.py<\/li>\r\n<li>get_co2.py<\/li>\r\n<li>readCSV.py<\/li>\r\n<li>scd30.py<\/li>\r\n<li>testplot.py<\/li>\r\n<li>VCR_OSD_MONO_1.001.ttf<\/li>\r\n<\/ul>\r\n<\/li>\r\n<li>Move these files to \/var\/www\/html and delete the index.html\r\n<ul>\r\n<li>index.php<\/li>\r\n<li>download.php<\/li>\r\n<li>selectFile.php<\/li>\r\n<\/ul>\r\n<\/li>\r\n<li>Need one more file by doing a symbolical link to the data_folder in the pi home directory\r\n<ul>\r\n<li>copy and paste the following in the xterm:\r\n<ul>\r\n<li>cd \/var\/www\/html<\/li>\r\n<li>ln -s \/home\/pi\/data_folder data_folder<\/li>\r\n<li>ls -ltra\u00a0 (this will show all the files plus the linked data_folder<\/li>\r\n<\/ul>\r\n<\/li>\r\n<\/ul>\r\n<\/li>\r\n<\/ul>\r\n<\/li>\r\n<\/ul>\r\n<\/li>\r\n<\/ul>\r\n<\/li>\r\n<li>Load the software for controlling the display module\r\n<ul>\r\n<li>Follow the following link: <a href=\"https:\/\/www.raspberrypi-spy.co.uk\/2018\/04\/i2c-oled-display-module-with-raspberry-pi\/\" target=\"_blank\" rel=\"noopener\">Using an I2C OLED Display Module with the Raspberry Pi &#8211; Raspberry Pi Spy (raspberrypi-spy.co.uk)<\/a><\/li>\r\n<\/ul>\r\n<\/li>\r\n<li>\r\n<p><strong>Connecting the SCD30 Hardware<\/strong><\/p>\r\n<ul>\r\n<li>Break off 4 of the male-to-male pins<\/li>\r\n<li>Put on the first four pinholes of the SCD30 and solder.<\/li>\r\n<li><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-73\" src=\"https:\/\/www.larry4u.com\/co2diy.com\/wp-content\/uploads\/2021\/01\/Screenshot-2021-01-09-165759.jpg\" alt=\"\" width=\"192\" height=\"182\" \/><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-75\" src=\"https:\/\/www.larry4u.com\/co2diy.com\/wp-content\/uploads\/2021\/01\/Screenshot-2021-01-09-165857.jpg\" alt=\"\" width=\"274\" height=\"115\" \/><\/li>\r\n<\/ul>\r\n<p><strong>SCD30 connection<\/strong><\/p>\r\n<ul>\r\n<li>VDD 3v3 Power pin 1<\/li>\r\n<li>GND Ground pin 6<\/li>\r\n<li>TX\/SCL I2CL SDA pin 5<\/li>\r\n<li>RX\/SDA I2C SDA pin 3<\/li>\r\n<li>PINs as per the chart<\/li>\r\n<\/ul>\r\n<p>&nbsp;<\/p>\r\n<p>&nbsp;<\/p>\r\n<p><strong>Steps to read data from SCD30<\/strong><\/p>\r\n<\/li>\r\n<li>\r\n<p>&nbsp;<\/p>\r\n<ul>\r\n<li>fallow instructions from <a href=\"https:\/\/github.com\/paulvha\/scd30_on_raspberry\">GitHub &#8211; paulvha\/scd30_on_raspberry: Program to set and read SCD30 on a raspberry Pi<\/a><\/li>\r\n<li>To test if the pi sees the sensor works, run the example.py file you copy to \/home\/pi directory.<\/li>\r\n<li>In your SSH terminal at the pi home directory, type:<\/li>\r\n<li>python3 -m pip install scd30_i2c<\/li>\r\n<li>Python3 example.py<\/li>\r\n<\/ul>\r\n<ul>\r\n<li>If you see this, the wiring is right.<\/li>\r\n<\/ul>\r\n<p><strong>Write data to the monitor.<\/strong><\/p>\r\n<ul>\r\n<li>Create a folder \u201cdata_folder\u201d with the following command:<\/li>\r\n<\/ul>\r\n<ul>\r\n<li style=\"list-style-type: none;\">\r\n<ul>\r\n<li style=\"list-style-type: none;\">\r\n<ul>\r\n<li>In the SSH terminal, type at the pi home directory:\r\n<ul>\r\n<li>mkdir data_folder<\/li>\r\n<\/ul>\r\n<\/li>\r\n<\/ul>\r\n<\/li>\r\n<\/ul>\r\n<\/li>\r\n<\/ul>\r\n<ul>\r\n<li>Run the script scd30.py that you put in the pi directory.\r\n<ul>\r\n<li>from SSH type &#8220;python3 scd30.py&#8221;<\/li>\r\n<\/ul>\r\n<\/li>\r\n<li>\u00a0<\/li>\r\n<li>This script reads the SCD30 data and updates the current.txt file that the Website sees and also writes the data to a daily file in the data_folder.<\/li>\r\n<\/ul>\r\n<ul>\r\n<li style=\"list-style-type: none;\">\u00a0<\/li>\r\n<li>This will run the scd30.py every minute and update the &#8220;current.txt&#8221; file, which uploaded to the web page.<\/li>\r\n<\/ul>\r\n<\/li>\r\n<li>\r\n<p><strong>Create a crontab job<\/strong><\/p>\r\n<ul>\r\n<li>A cron job is an automated program developed for Unix and Linux systems. It allows the user to execute several commands at a specific time on a precise date.<\/li>\r\n<li>We need to run the python script scd30.py every minute. To do that, we use the command crontab.<\/li>\r\n<li>&#8220;crontab \u2013l&#8221; (that is, lowercase L&#8221; lists what is in the file, and crontab \u2013e lets us edit or add new jobs.<\/li>\r\n<li>Type\u00a0 crontab \u2013e<\/li>\r\n<li>It now asks what editor to use.<\/li>\r\n<li>\/bin\/nano works much like note pad.<\/li>\r\n<li>vim is used mostly by gurus.<\/li>\r\n<li>ed is an ancient editor.<\/li>\r\n<li>If new to Unix, use nano.<\/li>\r\n<li>Add this line to the bottom of the file:\r\n<ul>\r\n<li>* * * * * python3 \/home\/pi\/scd30.py<\/li>\r\n<li>* * * * * python3 \/home\/pi\/readCSV.py &gt; \/home\/pi\/CSV.log<\/li>\r\n<li>* * * * * python \/home\/pi\/get_co2.py &gt; \/home\/pi\/get_co2.log<\/li>\r\n<li>5 0 * * * python \/home\/pi\/clean_data_folder.py\u00a0 &gt;\u00a0 \/home\/pi\/clean.log<\/li>\r\n<\/ul>\r\n<\/li>\r\n<li>This will run these programs at a scheduletime.<\/li>\r\n<li>see <a href=\"https:\/\/crontab.guru\/#*_*_*_*_*\">Crontab.guru &#8211; The cron schedule expression editor<\/a> for corn details.<\/li>\r\n<\/ul>\r\n<p><strong>Notes<\/strong><\/p>\r\n<ul>\r\n<li>The &#8220;current.txt&#8221; file is just an HTML file the is updated by the program scd30.py<\/li>\r\n<li>The data files in the directory &#8220;data_folder&#8221; and are created at the first run after midnight. The files names contain the date it was created. They are CSV files that can be open in excel.<\/li>\r\n<li>i2cdetect -y 1\u00a0 use this command to test that the monitor and the sense are working. This is what you should see. 3c is the monitor and 61 is the scd30 sensro.<img decoding=\"async\" loading=\"lazy\" class=\"size-medium wp-image-551 alignright\" src=\"https:\/\/www.larry4u.com\/co2diy.com\/wp-content\/uploads\/2021\/03\/Screenshot-2021-03-01-091007-300x122.jpg\" alt=\"\" width=\"300\" height=\"122\" srcset=\"https:\/\/www.larry4u.com\/co2diy.com\/wp-content\/uploads\/2021\/03\/Screenshot-2021-03-01-091007-300x122.jpg 300w, https:\/\/www.larry4u.com\/co2diy.com\/wp-content\/uploads\/2021\/03\/Screenshot-2021-03-01-091007.jpg 481w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/li>\r\n<\/ul>\r\n<form  target=\"_blank\" action=\"https:\/\/www.paypal.com\/cgi-bin\/webscr\" method=\"post\">\n    \t\t\t<div class=\"pal_donation_button\">\n\t\t\t        <input type=\"hidden\" name=\"cmd\" value=\"_donations\">\n                                <input type=\"hidden\" name=\"item_name\" value=\"Recover development costs\">\n                                <input type=\"hidden\" name=\"amount\" value=\"10\">\n\t\t\t        <input type=\"hidden\" name=\"business\" value=\"larry@eldredge.org\">\n\t\t\t        <input type=\"hidden\" name=\"rm\" value=\"0\">\n\t\t\t        <input type=\"hidden\" name=\"currency_code\" value=\"USD\">\n\t\t\t\t\t<input name=\"bn\" value=\"WPCodelibrary_SP_EC_PRO\" type=\"hidden\">\n\t\t\t        <input type=\"image\" src=\"https:\/\/www.paypal.com\/en_US\/i\/btn\/btn_donateCC_LG.gif\" name=\"submit\" alt=\"PayPal - The safer, easier way to pay online.\">\n\t\t\t        <img alt=\"\" src=\"https:\/\/www.paypal.com\/en_US\/i\/scr\/pixel.gif\" width=\"1\" height=\"1\">\n\t\t\t    <\/div>\n\t\t\t<\/form>\r\n<p>&nbsp;<\/p>\r\n<\/li>\r\n<\/ul>\r\n<p>&nbsp;<\/p>\r\n<\/div>","protected":false},"excerpt":{"rendered":"<p>DIY Make CO2\u00a0Sensor please review what you need to do for setting up the scd30 sensor Raspberry pi OS The following instructions are for both the Raspberry pi zero and 3B Download the Latest PI OS from https:\/\/www.raspberrypi.org\/software\/ Use your <span class=\"excerpt-dots\">&hellip;<\/span> <a class=\"more-link\" href=\"https:\/\/www.larry4u.com\/co2diy.com\/diy-make-big-screen-monitor\/\"><span class=\"more-msg\">Continue reading &rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"_coblocks_attr":"","_coblocks_dimensions":"","_coblocks_responsive_height":"","_coblocks_accordion_ie_support":""},"_links":{"self":[{"href":"https:\/\/www.larry4u.com\/co2diy.com\/wp-json\/wp\/v2\/pages\/21"}],"collection":[{"href":"https:\/\/www.larry4u.com\/co2diy.com\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.larry4u.com\/co2diy.com\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.larry4u.com\/co2diy.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.larry4u.com\/co2diy.com\/wp-json\/wp\/v2\/comments?post=21"}],"version-history":[{"count":67,"href":"https:\/\/www.larry4u.com\/co2diy.com\/wp-json\/wp\/v2\/pages\/21\/revisions"}],"predecessor-version":[{"id":568,"href":"https:\/\/www.larry4u.com\/co2diy.com\/wp-json\/wp\/v2\/pages\/21\/revisions\/568"}],"wp:attachment":[{"href":"https:\/\/www.larry4u.com\/co2diy.com\/wp-json\/wp\/v2\/media?parent=21"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}