tag:blogger.com,1999:blog-36489272378014942482024-03-05T22:14:46.704+08:00Blog of Wei-Hsiung HuangThis blog is for keeping my study notes, sharing knowledge and showing the products of my study.. I welcome your feedback...Wei-Hsiung Huanghttp://www.blogger.com/profile/09437875322676421890noreply@blogger.comBlogger270125tag:blogger.com,1999:blog-3648927237801494248.post-13563798034959707802025-01-01T10:00:00.000+08:002018-09-24T16:13:31.003+08:00How to use / navigate this blogThis is a quick summary of how to use / navigate this blog.<br />
<b><br /></b>
<b><span style="color: red;">Announcements:</span></b><br />
<br />
<span style="color: red;">Sep. 24, 2018: The broken HTML Sitemap has been fixed. Hope it will help you find what you need faster...</span><br />
<br />
<b>Auto Translation by Google Translate</b><br />
<br />
Use the Select Language widget to translate this blog into the language of you choosing (the translation quality may not be good, but I think it's enough to give you some general idea about the post).<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjRTgSpcPX7-xm5WwRQr8OXo-2FuRdLw0CdJoyZBZmtwe79xDnSgAHxMRAx3aqIK65Bwf_hYmVpJ2Vn9cgZaWcjroFsH3mI-Aa2zwFuBPWLOEeoojzZd31MMClbInx-PEw6zfrBbcax6fqn/s1600/1.JPG" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjRTgSpcPX7-xm5WwRQr8OXo-2FuRdLw0CdJoyZBZmtwe79xDnSgAHxMRAx3aqIK65Bwf_hYmVpJ2Vn9cgZaWcjroFsH3mI-Aa2zwFuBPWLOEeoojzZd31MMClbInx-PEw6zfrBbcax6fqn/s200/1.JPG" width="195" /></a></div>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<a name='more'></a><b>How to follow / search</b><br />
<br />
<u>How to follow my blog</u><br />
<br />
To follow my blog, enter your e-mail address in the field under "Followed by Email" and left click on "Submit" to submit your e-mail address.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhXkcIZENUuPF0yIMrBfU9JlsDkWMA00DNOjBL3WR8UFIoSO9PtB484HpiRjt0zgmLnOtTxpIElFRid1NNUzj6X4utJSwXRax6E-4f6seTHGefYiTX8U7Ur-clynf7oREG9gXnBsw8K8WKp/s1600/3.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="123" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhXkcIZENUuPF0yIMrBfU9JlsDkWMA00DNOjBL3WR8UFIoSO9PtB484HpiRjt0zgmLnOtTxpIElFRid1NNUzj6X4utJSwXRax6E-4f6seTHGefYiTX8U7Ur-clynf7oREG9gXnBsw8K8WKp/s640/3.JPG" width="640" /></a></div>
<br />
<br />
<a href="https://www.blogger.com/null" name="more"></a><br />
<u>How to search for content</u><br />
<br />
- Use the "Search This Blog" to search for content in this blog.<br />
<br />
- Or, use "Site Map" to find posts with the tag that you are looking for.<br />
<br />
<b>How to Navigate</b><br />
<br />
<u>How to find posts with videos</u><br />
<br />
To find posts that contain video, left click on "Site Map" and scroll down to find and left click on the "Video" tag to display a list of the posts that contain the video in them.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgqwfttlHbpoa3d19kKqXcCrRJhYx7fRUl531ctdnVE4hcBz8RMo9z8FSQdJ0JBQteDQ2Q4BDec71Ajn-CzbARQEUmYcQlOUL7ZG-menvYMuikQOrGXWcUe-tIuw34Sy2ubfJ1aC-ByqM5R/s1600/1.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="656" data-original-width="992" height="422" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgqwfttlHbpoa3d19kKqXcCrRJhYx7fRUl531ctdnVE4hcBz8RMo9z8FSQdJ0JBQteDQ2Q4BDec71Ajn-CzbARQEUmYcQlOUL7ZG-menvYMuikQOrGXWcUe-tIuw34Sy2ubfJ1aC-ByqM5R/s640/1.JPG" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<u>How to find product / service offered</u><br />
<br />
To find product / service offered, left click on "Site Map" and scroll down to find the "Buy" tag and left click on it to display a list of the posts that contain product / service offered.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjNkFUm80DJFlj11bmZEje3l32ov6zYRt46xF6MK3n-z5ATOxXw3ailx7dJGQFxSdYC9VtuRD3Z6nPknyoM1TTOyRZHniexi5OVEBsC3iS_Cw_X332ZNlRqQKWCvj_FxNwPZAS6V1-6aPLf/s1600/1.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="495" data-original-width="992" height="318" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjNkFUm80DJFlj11bmZEje3l32ov6zYRt46xF6MK3n-z5ATOxXw3ailx7dJGQFxSdYC9VtuRD3Z6nPknyoM1TTOyRZHniexi5OVEBsC3iS_Cw_X332ZNlRqQKWCvj_FxNwPZAS6V1-6aPLf/s640/1.JPG" width="640" /></a></div>
<br />
Alternatively, you could left click on "Products" to enter the web store. However, I would suggest you to use the "Buy" tag as I intend to use it as the primary way for posting my offers.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg4EFdDQel3oyWfAijgp5G6_pHEPkKpwK-u7tB61_Stppzha_LxSXrWPkvhpGU2g_7_qMlA3We5hJZ4Ats5P1JF2lcRWZolX6Zrtj1XQsx3dIqlqY4uf-eLtQCw_Vvn6KwYbqyNWqAMjK-i/s1600/2.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="52" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg4EFdDQel3oyWfAijgp5G6_pHEPkKpwK-u7tB61_Stppzha_LxSXrWPkvhpGU2g_7_qMlA3We5hJZ4Ats5P1JF2lcRWZolX6Zrtj1XQsx3dIqlqY4uf-eLtQCw_Vvn6KwYbqyNWqAMjK-i/s640/2.JPG" width="640" /></a></div>
<b><br /></b><b>Other</b><br />
<br />
<u>My favorite sites / videos / books</u><br />
<br />
They can be found on the right hand side of the screen under "My Links".<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjdRg_hJoiILRpKd050S_8wE_irqBFwQEglC-GoA7sq8Wn9KesxI7Vgbg2OKIogRGDwTQY6ZBT5bbJXHwaSha0cEfvxP4E6kT_R8smkIRc0QavgIaXZmn4pj_eYoZm190EGQA-4jWe5jJcG/s1600/4.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjdRg_hJoiILRpKd050S_8wE_irqBFwQEglC-GoA7sq8Wn9KesxI7Vgbg2OKIogRGDwTQY6ZBT5bbJXHwaSha0cEfvxP4E6kT_R8smkIRc0QavgIaXZmn4pj_eYoZm190EGQA-4jWe5jJcG/s640/4.JPG" width="328" /></a></div>
<br />
Under "Popular Posts" are the 5 most popular posts of my blog selected by Blogger according to how frequent they are viewed by visitors to my blog.<br />
<br />
-------------------------------------------------------------------------------------------------------------------------<br />
<br />
<b>Maintenance Log</b><br />
<b><br /></b>
2016/10/4 - Create link redirection for the posts that are referenced internally or externally.<br />
<br />
2016/10/9 - Fix the problem of unable to load the Sitemap<br />
<br />
2016/10/27 - Add the tab "Store" to my new blog (http://whhuangstore.blogspot.tw/) dedicated to sell my products and remove the "Products" tab linked to my store on ecwid site.<br />
<br />
2016/12/26 - Add Printfriendly button to the template. The button will appear at the end of each published post.<br />
<br />
2017/3/16 - Installed Disqus to replace the built-in comment feature.<br />
<br />
2018/9/24 - Fixed broken HTML sitemap feature using the info. at the link below.<br />
<a href="https://helplogger.blogspot.com/2013/12/add-sitemap-table-of-contents-to-blogger.html" target="_blank">https://helplogger.blogspot.com/2013/12/add-sitemap-table-of-contents-to-blogger.html</a>Wei-Hsiung Huanghttp://www.blogger.com/profile/09437875322676421890noreply@blogger.com0tag:blogger.com,1999:blog-3648927237801494248.post-23273681273400517842020-07-11T10:18:00.003+08:002020-07-11T10:31:27.200+08:00How to create and prepare design for CNC machines (laser cutter, milling machine, router, etc)This is a quick write up about how to create and prepare designs for CNC machines (laser cutter, milling machine, etc).<br />
<br />
The software tools used are SketchUp and Inkscape.<br />
<br />
**IMPORTANT**<br />
<br />
1. The use of Sketchup is not a must. However, if you have a 3D design and you want to produce it using materials cut with laser cutter / CNC milling machine, it would be easier to first do the 3D design in Sketchup, convert it to 2D, then export the 2D design in SVG format for further process in Inkscape.<br />
<br />
2. There are at least 2 file formats supported by Inkscape that could be used by CNC machines. One is PDF (it could be imported and used by CorelDraw), the other is DXF. If you plan to use DXF format, <span style="color: red;"><u>be sure to install the latest Inkscape (v1.0)</u></span> because the scaling of the objects saved in DXF format is incorrect (too small) in the previous versions. More about this could be found in the link below.<br />
<br />
3. Some shops will ask you for design file in DWG format. You could either use PDF to DWG converter (not all of them are free and some of the converted results are not so good or have a watermark on them) or ask whether they could take file in DXF format instead.<br />
<br />
Scaling issue saving DXF from Inkscape<br />
<a href="https://graphicdesign.stackexchange.com/questions/96509/scaling-issue-saving-dxf-from-inkscape" target="_blank">https://graphicdesign.stackexchange.com/questions/96509/scaling-issue-saving-dxf-from-inkscape</a><br />
<br />
<b><span style="font-size: large;"><u>The Sketchup Part</u></span></b><br />
<br />
Step-1: Launch Sketchup. Before starting the design, be sure to set the Camera to "Standard Views - Top" and enable "Parallel Projection".<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEin7nSKtdEzwUgxOpvBBVDCPBKcv8rOnyR7ZDjndnYkfeNoYkj10mkGNxcRKqQ7wSkDbfOeBAySmEMDHn9W779KB-1bsQLonTSdUFFF3xJ7-Rb46IYzOf43jQGF9vxw_4tUmK7ObGxd5JKG/s1600/7.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="519" data-original-width="560" height="370" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEin7nSKtdEzwUgxOpvBBVDCPBKcv8rOnyR7ZDjndnYkfeNoYkj10mkGNxcRKqQ7wSkDbfOeBAySmEMDHn9W779KB-1bsQLonTSdUFFF3xJ7-Rb46IYzOf43jQGF9vxw_4tUmK7ObGxd5JKG/s400/7.png" width="400" /></a></div>
<br />
<a name='more'></a>Step-2: Create the design.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiIVKsoj63F_Ou3NsDW-R_jFqzpAy2ZJ0Cbxv8vatYnrvn104-PbnFwxJjqMhyphenhyphen9dB5EoXsFkL3c1yFGO6MHer7ExAb57g3vFnqELGRaFZwPLd14WOOHERUW4bwxNhF8__0E76USVTduW2-u/s1600/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="687" data-original-width="1366" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiIVKsoj63F_Ou3NsDW-R_jFqzpAy2ZJ0Cbxv8vatYnrvn104-PbnFwxJjqMhyphenhyphen9dB5EoXsFkL3c1yFGO6MHer7ExAb57g3vFnqELGRaFZwPLd14WOOHERUW4bwxNhF8__0E76USVTduW2-u/s640/1.png" width="640" /></a></div>
<br />
Step-3: After the design is completed. Holding down the left mouse button then drag the mouse to select the design to be exported as SVG. Once done, click on the SVG plugin icon.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhSpO0kBzJUavL-y6tMT8BVErmP5im8xfXxX1YNzwNxd66OIbZ9g7dsQS9Ovrs6fNUkt1qgyKkCK9xiyJ_Bd-Lji_uuquUlsmVE5ZsD6FPVexxCsapPkVpVeA3drtSDYrzw_ayLU4yqdDw1/s1600/7.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="688" data-original-width="1366" height="322" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhSpO0kBzJUavL-y6tMT8BVErmP5im8xfXxX1YNzwNxd66OIbZ9g7dsQS9Ovrs6fNUkt1qgyKkCK9xiyJ_Bd-Lji_uuquUlsmVE5ZsD6FPVexxCsapPkVpVeA3drtSDYrzw_ayLU4yqdDw1/s640/7.png" width="640" /></a></div>
<br />
Step-4: Select the path and filename to which the SVG will be exported to at "Save SVG to the following file" then click the Save button to save it.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjR4bqlbVCMsJLzEZetqEE_COpngyfY_GIyu6pYlFkqt9xVZBladEih3kSM1OO5HZrrPskDvTNX9K1I5ewPd0ROz-d9oENAjSCeNuB_DFcDF5VZVXC3vNmvuOmI0_4ZSdO7uUvd6AcGT_VQ/s1600/5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="596" data-original-width="1019" height="374" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjR4bqlbVCMsJLzEZetqEE_COpngyfY_GIyu6pYlFkqt9xVZBladEih3kSM1OO5HZrrPskDvTNX9K1I5ewPd0ROz-d9oENAjSCeNuB_DFcDF5VZVXC3vNmvuOmI0_4ZSdO7uUvd6AcGT_VQ/s640/5.png" width="640" /></a></div>
<br />
<b><span style="font-size: large;"><u>The Inkscape Part</u></span></b><br />
<br />
Step-1: Double click on the saved .svg file to open it.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjRNTRFpqeZwWpSl08SRmUdZbGW-2t3srGzEt76JgASzsh5BncOClmS482WkYipZRKiRyjJj8uxEcAoEblfokpNCQ-3hZf7Xg_C4LoOWOrfFis3yqw_70AweEPhR8Hp_1IwIsHIbuLh3pyt/s1600/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="209" data-original-width="253" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjRNTRFpqeZwWpSl08SRmUdZbGW-2t3srGzEt76JgASzsh5BncOClmS482WkYipZRKiRyjJj8uxEcAoEblfokpNCQ-3hZf7Xg_C4LoOWOrfFis3yqw_70AweEPhR8Hp_1IwIsHIbuLh3pyt/s1600/1.png" /></a></div>
<br />
Below is a front panel design that I designed for one of my projects and I want to create 4 PCs using laser-cut acrylic.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh2KMnziIm1rh7-nLBm-BRU6rLk5syWYTJJ-AZiSMFt9x1jdqk799-1zOGtrf1caCbgztFZs5QPOo4qg6SCIcycviktkLlSD5_TLQ1sRfItc36mW10ZnEo0k-oxrRMZvLBJjUiJLe7C1s2S/s1600/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="736" data-original-width="932" height="504" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh2KMnziIm1rh7-nLBm-BRU6rLk5syWYTJJ-AZiSMFt9x1jdqk799-1zOGtrf1caCbgztFZs5QPOo4qg6SCIcycviktkLlSD5_TLQ1sRfItc36mW10ZnEo0k-oxrRMZvLBJjUiJLe7C1s2S/s640/1.png" width="640" /></a></div>
<br />
Step-2: The size of the current template isn't enough to hold 4 PCs of the design. To change it, go to "File" -> "Document Properties..." to bring up the document properties window.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgvHz8DxxZmXgyJXayu_TWDHpUORPGkKyXRloE000rQK6dibi0hYET9kE8uZKEjXgDsvTjqhn3ve4OHJQ3tee6GTzeNL9lJ_D3kGDr-_L9PUYixGx_mgsUsn_tLeMTlQogMRZipee7GpKeV/s1600/2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="593" data-original-width="608" height="390" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgvHz8DxxZmXgyJXayu_TWDHpUORPGkKyXRloE000rQK6dibi0hYET9kE8uZKEjXgDsvTjqhn3ve4OHJQ3tee6GTzeNL9lJ_D3kGDr-_L9PUYixGx_mgsUsn_tLeMTlQogMRZipee7GpKeV/s400/2.png" width="400" /></a></div>
<br />
Step-3: The size of the template can be changed by changing the Width and the Height under the "Page" tag. Be sure to close the Document Properties window when done.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgoIu-WlWExlrLDoaLSmPF2E25fH9Apf3RwAo7NXcNDOSCGcaiHaMhxsDHwBr0VWA4wsltNP479jYB_BgLHVwG-n4GmXuMKeof4MNpqqDtOFHFILppYcJD4MpSWq_wCnGrE_8PhvdX3BwUk/s1600/4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="738" data-original-width="1366" height="344" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgoIu-WlWExlrLDoaLSmPF2E25fH9Apf3RwAo7NXcNDOSCGcaiHaMhxsDHwBr0VWA4wsltNP479jYB_BgLHVwG-n4GmXuMKeof4MNpqqDtOFHFILppYcJD4MpSWq_wCnGrE_8PhvdX3BwUk/s640/4.png" width="640" /></a></div>
<br />
Step-4: Select the design to be duplicated then use copy and paste to make 3 additional copies.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi6kSpoDXLJdXD7__NXm79c0Ip14Ev-Ls_fjuBQnTetS5kFPeP_bj4oo-ZfNwu2vvFjeWx48iM7E0RyuR8L33TWIzB6soGK50nV1Zq5IKV1w4HuA9V7JAWOBEaiFp6njcuse1gzEA9XwEX-/s1600/4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="501" data-original-width="575" height="346" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi6kSpoDXLJdXD7__NXm79c0Ip14Ev-Ls_fjuBQnTetS5kFPeP_bj4oo-ZfNwu2vvFjeWx48iM7E0RyuR8L33TWIzB6soGK50nV1Zq5IKV1w4HuA9V7JAWOBEaiFp6njcuse1gzEA9XwEX-/s400/4.png" width="400" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhEZasfb_ha2YxIXV-72qasWaUdYNQAbSJ0bi-q7e90KrIneDs2XdpavHU_8LfmXpJyt-FpQXEEt_QkRntfO5qxnsHI1F4tHzrJlvJ2F1VTmPUOhes9i7Ehnqs9zcrGzkaXidcNuw99dvuc/s1600/7.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="503" data-original-width="674" height="297" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhEZasfb_ha2YxIXV-72qasWaUdYNQAbSJ0bi-q7e90KrIneDs2XdpavHU_8LfmXpJyt-FpQXEEt_QkRntfO5qxnsHI1F4tHzrJlvJ2F1VTmPUOhes9i7Ehnqs9zcrGzkaXidcNuw99dvuc/s400/7.png" width="400" /></a></div>
<br />
Step-5: Select the 4 objects. Double click on stroke to bring up the Fill and Stroke window.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqkOx7toxjMGZksBpUureb69i6HV-7kbFG8KUZCk1qbw2U7a_Rgu2Yw0hqicCEJ4f_xFw211Tuma4DwFNIhAPtFbbCqvJbekMygi15yImy9k6B9zmjZEhiYIBbvzUJy03NZKz-K37V3x4z/s1600/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="737" data-original-width="1366" height="344" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqkOx7toxjMGZksBpUureb69i6HV-7kbFG8KUZCk1qbw2U7a_Rgu2Yw0hqicCEJ4f_xFw211Tuma4DwFNIhAPtFbbCqvJbekMygi15yImy9k6B9zmjZEhiYIBbvzUJy03NZKz-K37V3x4z/s640/1.png" width="640" /></a></div>
<br />
Step-6: Go to "Stroke style" then set the width to 0.1 px.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhLRaCJWHkpd00YYK-oSqM5v1hXLN1Hb4VP_YnZu2A5w-IydMv5cchudmTj32hsR2AgQXD8hKZWGWUPHXGTjq3C6vGQ7YXqzcokpj6QPYGDRR-TTLgIlmWYLiUOVUiVZo1dr2B7-KfxFWX-/s1600/7.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="412" data-original-width="305" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhLRaCJWHkpd00YYK-oSqM5v1hXLN1Hb4VP_YnZu2A5w-IydMv5cchudmTj32hsR2AgQXD8hKZWGWUPHXGTjq3C6vGQ7YXqzcokpj6QPYGDRR-TTLgIlmWYLiUOVUiVZo1dr2B7-KfxFWX-/s400/7.png" width="295" /></a></div>
<br />
After hitting the Enter key, the lines become much narrower.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgsFwhFbw4du9LIvJlu-GLgY8h8EDFWw4-vs3zKTcEkN6gxAt924FZDTr0q18Q52jPPu7ajLC_-EeOXqh9xpSt73DMa2UT15EbpuXlSAnBusrzQ-SHGx1BR5ReCSEPyDoCRAOvftAd7qQAI/s1600/6.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="736" data-original-width="1366" height="344" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgsFwhFbw4du9LIvJlu-GLgY8h8EDFWw4-vs3zKTcEkN6gxAt924FZDTr0q18Q52jPPu7ajLC_-EeOXqh9xpSt73DMa2UT15EbpuXlSAnBusrzQ-SHGx1BR5ReCSEPyDoCRAOvftAd7qQAI/s640/6.png" width="640" /></a></div>
<br />
<span style="font-size: large;"><b>Saving the Inkscape design in PDF format</b></span><br />
<br />
Step-1: Select all the parts then go to "File" -> "Save As".<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhKnDrSv_EbvPrvpFwYcFkvNC9nwV1V71IqsFRXyfumAFfFfR28QsorQZNyWJWjwp25YUtByoyc8lNp9yAzkmjycP4dl9ZahmD-ZMYSc-uCkxXubFmwRFVxrAusnjDtsM5VP3iG0rHK9mNk/s1600/4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="643" data-original-width="1010" height="406" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhKnDrSv_EbvPrvpFwYcFkvNC9nwV1V71IqsFRXyfumAFfFfR28QsorQZNyWJWjwp25YUtByoyc8lNp9yAzkmjycP4dl9ZahmD-ZMYSc-uCkxXubFmwRFVxrAusnjDtsM5VP3iG0rHK9mNk/s640/4.png" width="640" /></a></div>
<br />
Step-2: Select "Portable Document Format (*.pdf)" then click on the "Save" button.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgLWp-5y4NodRBaSDBgGL1MLrLw_5t9mjCp4rl77XtH41NrUgxl07xzrm_O5G00HZNzc-G4Uy4qkEnY9J3xrHqHkZ_x-TlKhhLcR0lmRQtEKuBC5-ngw68BAy4knu4uf9ATSOHpwkvsfhFn/s1600/2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="455" data-original-width="817" height="352" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgLWp-5y4NodRBaSDBgGL1MLrLw_5t9mjCp4rl77XtH41NrUgxl07xzrm_O5G00HZNzc-G4Uy4qkEnY9J3xrHqHkZ_x-TlKhhLcR0lmRQtEKuBC5-ngw68BAy4knu4uf9ATSOHpwkvsfhFn/s640/2.png" width="640" /></a></div>
<br />
When prompted, use the below settings.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjfM0FGKn3Pr0H6Qhh2nvZ_fhT2e_HLovgadiKaqZiuvVnz86_q2tWKzbi1l2BQQFBwHpGnU50kOSnYTTega8g11wYC5kipbJqJfWhw63hz1SYOokEW-2hFptnoTPtBFOBnEQzuynPPdxSs/s1600/4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="317" data-original-width="377" height="336" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjfM0FGKn3Pr0H6Qhh2nvZ_fhT2e_HLovgadiKaqZiuvVnz86_q2tWKzbi1l2BQQFBwHpGnU50kOSnYTTega8g11wYC5kipbJqJfWhw63hz1SYOokEW-2hFptnoTPtBFOBnEQzuynPPdxSs/s400/4.png" width="400" /></a></div>
<br />
Step-3: Open the saved pdf file to check its content. If all is good, then the file is ready to be sent to the shop to be used by the CNC machines.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiWjBh6zCgLIkEYEvwn_cnDj_skZhyphenhyphenUkrOi0EH-kt2x0df1jf15oI_lQwwMNfAYW8XxzbYmQx88lNgPrfIh5BS4mg512NmNAzqLCJese8i552-6dm770NTGmHhkISTRwCR3O_BYev_KucQL/s1600/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="736" data-original-width="1107" height="424" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiWjBh6zCgLIkEYEvwn_cnDj_skZhyphenhyphenUkrOi0EH-kt2x0df1jf15oI_lQwwMNfAYW8XxzbYmQx88lNgPrfIh5BS4mg512NmNAzqLCJese8i552-6dm770NTGmHhkISTRwCR3O_BYev_KucQL/s640/1.png" width="640" /></a></div>
<br />
<b style="font-size: x-large;">Saving the Inkscape design in DXF format</b><br />
<br />
Step-1: Select all the parts then go to "File" -> "Save As".<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhKnDrSv_EbvPrvpFwYcFkvNC9nwV1V71IqsFRXyfumAFfFfR28QsorQZNyWJWjwp25YUtByoyc8lNp9yAzkmjycP4dl9ZahmD-ZMYSc-uCkxXubFmwRFVxrAusnjDtsM5VP3iG0rHK9mNk/s1600/4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="643" data-original-width="1010" height="406" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhKnDrSv_EbvPrvpFwYcFkvNC9nwV1V71IqsFRXyfumAFfFfR28QsorQZNyWJWjwp25YUtByoyc8lNp9yAzkmjycP4dl9ZahmD-ZMYSc-uCkxXubFmwRFVxrAusnjDtsM5VP3iG0rHK9mNk/s640/4.png" width="640" /></a></div>
<br />
Step-2: Select "Desktop Cutting Plotter (AutoCAD DXF R14) (*.dxf)" then click on the "Save" button.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2QZ-nBFUDHbO1ILNJDWyCtatB8WsmT6Od2Tl_-axxhX-4GGRB1Ltw39nc5zAm5OWWnGvoc90G1DiW6w_XN6RMjmWbwHv6OXgrRWIhPReJlQIYzORITCEq7CnGtiNnAz_yZrampK-Jbyld/s1600/7.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="647" data-original-width="1008" height="410" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2QZ-nBFUDHbO1ILNJDWyCtatB8WsmT6Od2Tl_-axxhX-4GGRB1Ltw39nc5zAm5OWWnGvoc90G1DiW6w_XN6RMjmWbwHv6OXgrRWIhPReJlQIYzORITCEq7CnGtiNnAz_yZrampK-Jbyld/s640/7.png" width="640" /></a></div>
<br />
Use the setting below. Then click OK to proceed.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiU0Yt9LBvJboGooolmiFwxvOxKQa22p_Fh2e47yoEohRsc_9kbjIxKSrLX1M72Hvh-90ew8_tKWVq8q2p64RBtVeaycnEMBbD5FJq6U5814u51AveJS1ElbavrtUMOr6BbuQkSBByHIawP/s1600/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="348" data-original-width="480" height="290" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiU0Yt9LBvJboGooolmiFwxvOxKQa22p_Fh2e47yoEohRsc_9kbjIxKSrLX1M72Hvh-90ew8_tKWVq8q2p64RBtVeaycnEMBbD5FJq6U5814u51AveJS1ElbavrtUMOr6BbuQkSBByHIawP/s400/1.png" width="400" /></a></div>
<br />
<b style="font-size: x-large;">Verify the saved DXF file using AUTODESK VIEWER</b><br />
<br />
1. Lunch the service at <a href="https://viewer.autodesk.com/designviews" target="_blank">https://viewer.autodesk.com/designviews</a><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjVbMdNJ0zqSFPyWTx2fXMDVKGc-C5xtpaO80_7euvPy5kg2k2eEUu6RK_M_agYhKXSri8u_hdvUFUP8yt-0sSHzBXtOjq10OFHx2i-nhFRiFPa10Q5hcOiMXZHnlruBeKIxdeejhce0oMA/s1600/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="664" data-original-width="1366" height="310" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjVbMdNJ0zqSFPyWTx2fXMDVKGc-C5xtpaO80_7euvPy5kg2k2eEUu6RK_M_agYhKXSri8u_hdvUFUP8yt-0sSHzBXtOjq10OFHx2i-nhFRiFPa10Q5hcOiMXZHnlruBeKIxdeejhce0oMA/s640/1.png" width="640" /></a></div>
<br />
2. Load the dxf format design file.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgUTEy7O0r8djaHxPA10WPLE2sk-DnnEpwgc7rRTzSQoH679d5_qSBdlcsFoBVZBav56wi2dw4O_HTS3CNzy7sjMW0HdRDvfdg59VKT5n900clhwqyXx57MgEDWfl4KVQ7MoUi03Ajyge_r/s1600/7.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="631" data-original-width="1366" height="294" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgUTEy7O0r8djaHxPA10WPLE2sk-DnnEpwgc7rRTzSQoH679d5_qSBdlcsFoBVZBav56wi2dw4O_HTS3CNzy7sjMW0HdRDvfdg59VKT5n900clhwqyXx57MgEDWfl4KVQ7MoUi03Ajyge_r/s640/7.png" width="640" /></a></div>
<br />
3. Check the dimension of the object using the Measure tool.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjkzRmd_RvVIyLgUS__vLrDR4w9zHt2yhrxYBJMWplDJisQ2pXYbbjro9OqI9a9EScM-B3ULxqjuGB9X3FOJI8MjLVVu8usT-3_ROvoOkEusIGkfDG92e3GkXBPEBnVhEQMEZKterYTrj3Q/s1600/2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="505" data-original-width="727" height="444" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjkzRmd_RvVIyLgUS__vLrDR4w9zHt2yhrxYBJMWplDJisQ2pXYbbjro9OqI9a9EScM-B3ULxqjuGB9X3FOJI8MjLVVu8usT-3_ROvoOkEusIGkfDG92e3GkXBPEBnVhEQMEZKterYTrj3Q/s640/2.png" width="640" /></a></div>
<br />
4. Click on Distance to measure the dimension of the object.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhU89h7OpWKG_VnFunAy89h3DuyR65RWlOMBMFGbZkvSNkSr34qL5jDrOAgh_65SR4QU1BAPULAWCFBs7MM4QizVJDjstPby6-1WjjwaUnYeItH4wW9IIIY79eNm8-Jp3sSYVQlqvfzW2DR/s1600/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="530" data-original-width="651" height="520" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhU89h7OpWKG_VnFunAy89h3DuyR65RWlOMBMFGbZkvSNkSr34qL5jDrOAgh_65SR4QU1BAPULAWCFBs7MM4QizVJDjstPby6-1WjjwaUnYeItH4wW9IIIY79eNm8-Jp3sSYVQlqvfzW2DR/s640/1.png" width="640" /></a></div>
<br />
<b><span style="color: red;"><u>Note that if you use Inkscape version prior to V1.0, the dimension of the measured object will be around 3.5 times smaller.</u></span></b><br />
<br />
<b>Reference:</b><br />
<br />
<a href="https://www.youtube.com/watch?v=x629C55iMZk" target="_blank">https://www.youtube.com/watch?v=x629C55iMZk</a><br />
<br />
<a href="https://inkscape.org/release/inkscape-1.0/" target="_blank">https://inkscape.org/release/inkscape-1.0/</a><br />
<br />
PDF to DWG (DXF) using free open source Inkscape<br />
<a href="https://nirklars.wordpress.com/2015/04/22/pdf-to-dwg-using-free-open-source-inkscape/" target="_blank">https://nirklars.wordpress.com/2015/04/22/pdf-to-dwg-using-free-open-source-inkscape/</a><br />
<br />
========================================================================<br />
<br />
Below are some of the results of PDF to DWG conversions.<br />
<br />
PDF to AutoCAD -Free Online<br />
<a href="https://dwg.autodwg.com/" target="_blank">https://dwg.autodwg.com/</a><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEihzzqRxRSni2v0GxM6btLrYh4iSv1PeQ4P9BV1_aXoG_pqqYl5wdrJi7IKAs3TJE6t_krXW4rQGPPkNzZtdKpALWO6W3jtlk37c-JlxtngIclxgOCtZwvLyR1q0gR74nShjw-suCPkTxMb/s1600/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="332" data-original-width="541" height="245" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEihzzqRxRSni2v0GxM6btLrYh4iSv1PeQ4P9BV1_aXoG_pqqYl5wdrJi7IKAs3TJE6t_krXW4rQGPPkNzZtdKpALWO6W3jtlk37c-JlxtngIclxgOCtZwvLyR1q0gR74nShjw-suCPkTxMb/s400/1.png" width="400" /></a></div>
<br />Wei-Hsiung Huanghttp://www.blogger.com/profile/09437875322676421890noreply@blogger.com0tag:blogger.com,1999:blog-3648927237801494248.post-1639732803884013642020-05-23T09:19:00.004+08:002020-06-14T07:27:50.257+08:00Arduino IDE - How to update the arduino core of the installed boardThis is a quick write up on how to update the Arduino core of ESP32 and ESP8266 in Arduino IDE.<br />
<br />
1. Navigate through Tools -> Board -> Boards Manager.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjTAA34MwwwOtw9D0kcp9CmEbuVvCiuQ3MsWVqmw7QV56eXjO8-hDMxerZR6LJXE-mfV4-4LBrbFsA1wOl-PHph7bbBoxkMhBCB8N7KIwWSKmJ_s28PkX0LDT_-FVObs9V2GetkNoape8YC/s1600/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="403" data-original-width="713" height="360" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjTAA34MwwwOtw9D0kcp9CmEbuVvCiuQ3MsWVqmw7QV56eXjO8-hDMxerZR6LJXE-mfV4-4LBrbFsA1wOl-PHph7bbBoxkMhBCB8N7KIwWSKmJ_s28PkX0LDT_-FVObs9V2GetkNoape8YC/s640/1.png" width="640" /></a></div>
<br />
<a name='more'></a><br /><br />
2. In Board Manager, select Updatable.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgzlR_mLiN_SYSTLD4wKeJJ6ROO2id7rjj6eWbwJlRMzVuxQLhsgoC1wagh8ETOhYqmix8LHoLHWKEhVAr8eh96jI9oveAVH5sYXvlLlXwaAvmgY2P-OECIWKPNgFBl8tPt7mhkKXrm5-rR/s1600/2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="442" data-original-width="794" height="355" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgzlR_mLiN_SYSTLD4wKeJJ6ROO2id7rjj6eWbwJlRMzVuxQLhsgoC1wagh8ETOhYqmix8LHoLHWKEhVAr8eh96jI9oveAVH5sYXvlLlXwaAvmgY2P-OECIWKPNgFBl8tPt7mhkKXrm5-rR/s640/2.png" width="640" /></a></div>
<br />
3. A list of the updatable boards will appear.<br />
<br />
You can now select the board to update it to the desired version. The versions of the installed boards show that they haven't been updated for a long time :-).<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgrALB8b3zG3h0Ncl41wOk7HE2MdmTY_O5YhhISoRzd_zw9TJ7wGO80Zqf1Kx6e3wNi6PM3yk9aU8YqJaELUkQQAqn4RRDGYtn36mhh8QiY2fmaTsLnQDlJr_RTSx4kCL_8sWGldnuTTES_/s1600/3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="548" data-original-width="791" height="442" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgrALB8b3zG3h0Ncl41wOk7HE2MdmTY_O5YhhISoRzd_zw9TJ7wGO80Zqf1Kx6e3wNi6PM3yk9aU8YqJaELUkQQAqn4RRDGYtn36mhh8QiY2fmaTsLnQDlJr_RTSx4kCL_8sWGldnuTTES_/s640/3.png" width="640" /></a></div>
<br />
4. After the update, be sure to select the board that you plan to work with under the Tools menu of the Arduino IDE.<br />
<br />
========================================================================<br />
<br />
Prior to the update, I received increasingly more warnings such as the one shown below when compiling the code. They don't affect the working of the code, but I was concerned that one day they might break the code or simply won't successfully compile.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9bWs04D-IMN9uxfc0D8S7SL8VGBFSAs92TeE3OdNFIhADtjlEBjl-F9O9m8VyM2PLXA-1iuNqg54Mior5LSHtb_1LLlWLIxYc3KaThEVeaHLpP_wDjyvR83B8Y4BNh5nRoVdbnKLrZBtW/s1600/7.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="271" data-original-width="894" height="194" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9bWs04D-IMN9uxfc0D8S7SL8VGBFSAs92TeE3OdNFIhADtjlEBjl-F9O9m8VyM2PLXA-1iuNqg54Mior5LSHtb_1LLlWLIxYc3KaThEVeaHLpP_wDjyvR83B8Y4BNh5nRoVdbnKLrZBtW/s640/7.png" width="640" /></a></div>
<br />
After the update, the warnings are gone when compiling the same code.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgRiy9bcJfRYX-O6IvsucyitUZd9GuSTgVdPgf6QbmxTsPk-u9MHR9NQonI5aHve7kAXo5Me9ZBkK035iIRjuRI7c9XPGgm6_EErvN9FPaJkusg32hbpqA2xFQxi3_HHHDHM2uOhgVZMAgO/s1600/6.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="305" data-original-width="888" height="218" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgRiy9bcJfRYX-O6IvsucyitUZd9GuSTgVdPgf6QbmxTsPk-u9MHR9NQonI5aHve7kAXo5Me9ZBkK035iIRjuRI7c9XPGgm6_EErvN9FPaJkusg32hbpqA2xFQxi3_HHHDHM2uOhgVZMAgO/s640/6.png" width="640" /></a></div>
<br />
<b>Reference:</b><br />
<br />
How to update ESP32 Arduino Core<br />
<a href="https://esp32.com/viewtopic.php?t=8284" target="_blank">https://esp32.com/viewtopic.php?t=8284</a>Wei-Hsiung Huanghttp://www.blogger.com/profile/09437875322676421890noreply@blogger.com0tag:blogger.com,1999:blog-3648927237801494248.post-84273719972084369992020-05-02T10:00:00.000+08:002020-05-16T15:27:22.052+08:00How to measure power supply noiseI recently built a power supply board using LM2596S-3.3 and I wanted to find out about its output noise. Below is a quick write up on how I did it with my RIGOL DS1102E scope.<br />
<br />
<b><span style="font-size: large;">Wiring Diagram</span></b><br />
<br />
First, wire up the DUT (LM2596 Board) and the rest of the equipment according to the below diagram.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhR21Zwx0okxD44_WlYOIbAFOkP3FSAKBMHosX6Ph_w2cmXJKRq8ume_TYUX0zZvIihvbOcjyoDz1Uz5GihW9WWEArNYFyR2MmQlJgleXUijutkmeAc5U8FN8jP3kWaV2oVsbpm2WSU5eH4/s1600/5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="246" data-original-width="519" height="302" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhR21Zwx0okxD44_WlYOIbAFOkP3FSAKBMHosX6Ph_w2cmXJKRq8ume_TYUX0zZvIihvbOcjyoDz1Uz5GihW9WWEArNYFyR2MmQlJgleXUijutkmeAc5U8FN8jP3kWaV2oVsbpm2WSU5eH4/s640/5.png" width="640" /></a></div>
<br />
<a name='more'></a><b><span style="font-size: large;">Block out DC component of the input signal</span></b><br />
<br />
1. Power up the scope.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhyj3uKr1U07BWp-z6-rbAP9QSPhMT9XR3tof1FhJHbCS9iyed9RWyDNrAaf2jG9uvV-C70tBpMAigJUXR7Qarco7g7_8eeR9vPkqT9jGLYvwkw4JJyKxOmYTsPin2eloy49HRUVVv-4jDk/s1600/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="462" data-original-width="687" height="427" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhyj3uKr1U07BWp-z6-rbAP9QSPhMT9XR3tof1FhJHbCS9iyed9RWyDNrAaf2jG9uvV-C70tBpMAigJUXR7Qarco7g7_8eeR9vPkqT9jGLYvwkw4JJyKxOmYTsPin2eloy49HRUVVv-4jDk/s640/1.png" width="640" /></a></div>
<br />
2. Press the CH1 button (assuming CH1 will be used for the measurement).<br />
<br />
The menu shows that DC Coupling is enabled.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj36X8BZfeeCjD5jpvvY5n1koODXlTb9eH2W4Udi5tB0iqDEp4vzeGKI-OCJbek9GS4TKckwR-t5emLecM_0m2_JMFokx4n-QR3KDa6B6msso1iLEbHq7BgzOrd9HeBIFgClqo0akM-hOqk/s1600/2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="491" data-original-width="691" height="451" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj36X8BZfeeCjD5jpvvY5n1koODXlTb9eH2W4Udi5tB0iqDEp4vzeGKI-OCJbek9GS4TKckwR-t5emLecM_0m2_JMFokx4n-QR3KDa6B6msso1iLEbHq7BgzOrd9HeBIFgClqo0akM-hOqk/s640/2.png" width="640" /></a></div>
<br />
3. Press the button next to Coupling DC to bring up the next level menu.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg0xqIbumsrKh5nKC7td4GDJ80UyEhIqnCP_QHMHM6gBEBHXhyphenhyphennMlpt2TQZ9uC-u0QninYAdIAHhWqcJAVeyxTnbfr23ECDW-3duR799_zXYbhfAjSFRKdl1pdSYUN90BApvu8t-Eb7N3ci/s1600/3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="490" data-original-width="690" height="452" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg0xqIbumsrKh5nKC7td4GDJ80UyEhIqnCP_QHMHM6gBEBHXhyphenhyphennMlpt2TQZ9uC-u0QninYAdIAHhWqcJAVeyxTnbfr23ECDW-3duR799_zXYbhfAjSFRKdl1pdSYUN90BApvu8t-Eb7N3ci/s640/3.png" width="640" /></a></div>
<br />
4. Rotate the knob counter-clockwise to select "AC".<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJZGx9qHBXNtIEAGUmiO4AWGpte_LB0reE9JX600tbYqrWaeDCwxP0f7UtBwB6I0EfLR2t2oEnJ3XcHnozwlzEqQcrpdBfFsx4mJQNFo-D0osKEHuHKZWo7x3ADOzVYx346hN0DYNNp-6N/s1600/4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="462" data-original-width="669" height="440" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJZGx9qHBXNtIEAGUmiO4AWGpte_LB0reE9JX600tbYqrWaeDCwxP0f7UtBwB6I0EfLR2t2oEnJ3XcHnozwlzEqQcrpdBfFsx4mJQNFo-D0osKEHuHKZWo7x3ADOzVYx346hN0DYNNp-6N/s640/4.png" width="640" /></a></div>
<br />
Press the knob to confirm the selection.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEijuwWweyjVO639CpQ6e65HI3AOfQG_sEqRThaLrLkFI18q2gfAEqdGHTvOvHwS6wP2R2FBuQ8UsXqoV7W690GdA6_2L0X0BXB46w9CBzUKBjy_NGEm1mf2mpOV_1gG3RBYiryKsm8qtL4P/s1600/5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="460" data-original-width="681" height="432" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEijuwWweyjVO639CpQ6e65HI3AOfQG_sEqRThaLrLkFI18q2gfAEqdGHTvOvHwS6wP2R2FBuQ8UsXqoV7W690GdA6_2L0X0BXB46w9CBzUKBjy_NGEm1mf2mpOV_1gG3RBYiryKsm8qtL4P/s640/5.png" width="640" /></a></div>
<br />
5. AC Coupling is now enabled for CH1.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5Z527TRc_BmFuHfSnctAtwc2q2Xjz66Hd6ESBy-yyXgyaOP3ioEwAgfhLZBvBVgo6vliI0WUFa0io11SzN4n8ESnyng3Gx_WkV-Uzhc0aKNB2-nk9-qvEhoB1IYB-906-iiDg9JY9VL4V/s1600/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="451" data-original-width="676" height="425" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5Z527TRc_BmFuHfSnctAtwc2q2Xjz66Hd6ESBy-yyXgyaOP3ioEwAgfhLZBvBVgo6vliI0WUFa0io11SzN4n8ESnyng3Gx_WkV-Uzhc0aKNB2-nk9-qvEhoB1IYB-906-iiDg9JY9VL4V/s640/1.png" width="640" /></a></div>
<br />
<b><span style="font-size: large;">Set Bandwidth Limit (BW Limit)</span></b><br />
<br />
Press the button next to BW Limit OFF.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYH3B1SmfXs39d80w6YDfQLJJi6e-i2JW4xVpYDP-xjTLmRVjvlPXAhgCFwFImgf2t5r2kywCD65EYx7el7L1XngLiFo8vmdlE9AxWGMaQDiQ79ZNr7ZfT-b3QsxXpJvfc7c88eruijavG/s1600/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="448" data-original-width="668" height="427" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYH3B1SmfXs39d80w6YDfQLJJi6e-i2JW4xVpYDP-xjTLmRVjvlPXAhgCFwFImgf2t5r2kywCD65EYx7el7L1XngLiFo8vmdlE9AxWGMaQDiQ79ZNr7ZfT-b3QsxXpJvfc7c88eruijavG/s640/1.png" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<br />
BW Limit is now ON.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjqdPRfmvFcNlkkE0JpQw2Af2eUp9E_s0fUCtBmLyTwp23cuml2JibLmu7S2AA3uqS3oM3zSNgfBTw_rCZXWd8nJ-X4jIEGDRlafvXebOQNHv7hKSJiVEqHi8LfelohtK-4DBcUUyE71be3/s1600/2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="509" data-original-width="691" height="468" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjqdPRfmvFcNlkkE0JpQw2Af2eUp9E_s0fUCtBmLyTwp23cuml2JibLmu7S2AA3uqS3oM3zSNgfBTw_rCZXWd8nJ-X4jIEGDRlafvXebOQNHv7hKSJiVEqHi8LfelohtK-4DBcUUyE71be3/s640/2.png" width="640" /></a></div>
<br />
According to page 2-2 of the RIGOL User's Guide that can be found <a href="https://cdn-shop.adafruit.com/datasheets/Users+Guide+DS1000E.pdf" target="_blank">here</a>, setting BW Limit to "ON" limits the channel bandwidth to 20MHz which could reduce the display noise.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_b84iqh6_OddySIqIIalrs_reIh6dw_D0hIGSYRV18srMF_-JJeHHySOo2QHi74yAOzxxhnSOJhWtCw7oOICEf35IoOlZJPzi6-ZylOXYjIpodf1_XpAbK_J5BhHkJcavjXtk7y7oHFvv/s1600/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="587" data-original-width="535" height="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_b84iqh6_OddySIqIIalrs_reIh6dw_D0hIGSYRV18srMF_-JJeHHySOo2QHi74yAOzxxhnSOJhWtCw7oOICEf35IoOlZJPzi6-ZylOXYjIpodf1_XpAbK_J5BhHkJcavjXtk7y7oHFvv/s640/1.png" width="580" /></a></div>
<br />
<b><span style="font-size: large;">Measuring the ripple</span></b><br />
<br />
1. Be sure the DUT and the equipment have all been connected properly and supplied with power.<br />
<br />
2. At first glance, there is nothing on the scope (because the DC component has been filtered out).<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiU85DFcXADIIKbYoILJ0IOzSSZ06NQ2eXJbzyIMfuibamHp2_kH3raXXXtxtCyLZQ19PcSbnoPHP_Ct2EqH-99UNPh47_9hfmCmUpcqd9cdXBlHhhBykKx7v8CSk1ulRbCOYuWEwSQfPgn/s1600/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="516" data-original-width="691" height="476" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiU85DFcXADIIKbYoILJ0IOzSSZ06NQ2eXJbzyIMfuibamHp2_kH3raXXXtxtCyLZQ19PcSbnoPHP_Ct2EqH-99UNPh47_9hfmCmUpcqd9cdXBlHhhBykKx7v8CSk1ulRbCOYuWEwSQfPgn/s640/1.png" width="640" /></a></div>
<br />
3. Rotate the Vertical knob to set the vertical scale to 50.0mv.<br />
<br />
Below is the ripple (around 30mV) measured before adding any load to the output of the DUT.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjFBMEAQK9efwVOhIWvP1pnAAKKnMe2l-cWBy3VYPUea0sfpOes5rO3-d4-mtpv7l7aQ0DrKtw91n4lQOXfzfaqzpXpE1kf6JYEwXNvSPU6KKmWe2d3bP6pc8_fnrICtDnP0zRZfzSj8-kD/s1600/2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="520" data-original-width="694" height="478" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjFBMEAQK9efwVOhIWvP1pnAAKKnMe2l-cWBy3VYPUea0sfpOes5rO3-d4-mtpv7l7aQ0DrKtw91n4lQOXfzfaqzpXpE1kf6JYEwXNvSPU6KKmWe2d3bP6pc8_fnrICtDnP0zRZfzSj8-kD/s640/2.png" width="640" /></a></div>
<br />
4. Below is the ripple (around 70mV) measured after a 0.2A load is added to the DUT's output.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgBL1rSu0Qs9Uks9UhoyxzlV_GHmmpApmo7edf6xAlHM-XuO6p_MWBvvn5wJ_c9fRTsL5Nk8mtDnkAkA2zTublIZCndPLmDfa8P6YUQQP48QY40MC1Cp6CGQOU4suciIkbe986ckmIM5SdS/s1600/3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="517" data-original-width="692" height="478" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgBL1rSu0Qs9Uks9UhoyxzlV_GHmmpApmo7edf6xAlHM-XuO6p_MWBvvn5wJ_c9fRTsL5Nk8mtDnkAkA2zTublIZCndPLmDfa8P6YUQQP48QY40MC1Cp6CGQOU4suciIkbe986ckmIM5SdS/s640/3.png" width="640" /></a></div>
<br />
5. Below is the ripple (around 184mV) measured after a 2A load is added to the DUT's output.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjdh0DVObpqyUbEpaDzuhr9z8drmlWo3S741z4VGJ-dmZvVioeVT-lPE-qO8Qw1WKr0Bk6CFdAKJV7aF653jgR6un3WQUYtQ1MTCuIJfBYwmsgf3zA48tb9uk4aKOx2Q0kSYvdzOPc2pzN-/s1600/5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="509" data-original-width="691" height="470" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjdh0DVObpqyUbEpaDzuhr9z8drmlWo3S741z4VGJ-dmZvVioeVT-lPE-qO8Qw1WKr0Bk6CFdAKJV7aF653jgR6un3WQUYtQ1MTCuIJfBYwmsgf3zA48tb9uk4aKOx2Q0kSYvdzOPc2pzN-/s640/5.png" width="640" /></a></div>
<br />
<b><span style="font-size: large;">Conclusion</span></b><br />
<br />
According to the LM2596 datasheet, the maximum output ripple is around 100mV.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiD1qLS47g9Bk48ZSkn_Dia43CxjCoJ3E_kk3dRbUd7QEnOvS7IXzzYAtX4nJij-BS-NJIyJM59hcK2wpl4Kz_MNedtGRcl-DdYVtIwmwR9qUY-z22eonlLhDeb6NoC9m3Q90FavtZuYaqs/s1600/4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="579" data-original-width="649" height="570" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiD1qLS47g9Bk48ZSkn_Dia43CxjCoJ3E_kk3dRbUd7QEnOvS7IXzzYAtX4nJij-BS-NJIyJM59hcK2wpl4Kz_MNedtGRcl-DdYVtIwmwR9qUY-z22eonlLhDeb6NoC9m3Q90FavtZuYaqs/s640/4.png" width="640" /></a></div>
<br />
It seems my first attempt at doing switching power supply is not so successful because the output noise is much higher than 100mV. I need to find a different regulator that has lower output noise and follow the datasheet's component selection recommendation and layout techniques such as the one below closely.<br />
<br />
Basic Switching-Regulator-Layout Techniques<br />
<a href="https://pdfserv.maximintegrated.com/en/an/AN2997.pdf" target="_blank">https://pdfserv.maximintegrated.com/en/an/AN2997.pdf</a><br />
<br />
<b>Reference:</b><br />
<br />
EEVblog #594 - How To Measure Power Supply Ripple & Noise<br />
<a href="https://www.youtube.com/watch?v=Edel3eduRj4" target="_blank">https://www.youtube.com/watch?v=Edel3eduRj4</a><br />
<br />
Switching Regulators and Switching Noise<br />
<a href="https://chrisgammell.com/switching-regulators-and-switching-noise/" target="_blank">https://chrisgammell.com/switching-regulators-and-switching-noise/</a><br />
<br />
========================================================================<br />
<br />
<span style="font-size: large;"><b>Testing the ripple of OKI-78SR</b></span><br />
<br />
For comparison, I obtained one OKI-78SR-3.3/1.5-W36-C and one OKI-78SR-5/1.5-W36-C for testing. The datasheet of the 2 modules can be found at the link below:<br />
<br />
<a href="https://www.murata.com/products/productdata/8807037992990/oki-78sr.pdf?1583754815000" target="_blank">https://www.murata.com/products/productdata/8807037992990/oki-78sr.pdf?1583754815000</a><br />
<br />
The test setup and the test results are shown below.<br />
<br />
<b>Test Setup</b><br />
<br />
The DUT on the left is OKI-78SR-5/1.5-W36-C. The meter in the center shows the voltage and the current of the output from the DUT and the electronic load on the right serves as the load that draws power from the DUT.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjpkfmnm48fa3kUB-RVhQ4vNhVb87kzuW5M95Fx4dBsoV2XuNwyu6Gm0w9AAm35Zajn3mD0xf5p_hRNvTS8bT1VdyUREMWAWiYBc7yBLq06byDCJqL7ijiyNH36sC4aIJ5P7bpEMsQoSgTU/s1600/5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="462" data-original-width="1034" height="177" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjpkfmnm48fa3kUB-RVhQ4vNhVb87kzuW5M95Fx4dBsoV2XuNwyu6Gm0w9AAm35Zajn3mD0xf5p_hRNvTS8bT1VdyUREMWAWiYBc7yBLq06byDCJqL7ijiyNH36sC4aIJ5P7bpEMsQoSgTU/s400/5.png" width="400" /></a></div>
<br />
<b>The Results</b><br />
<br />
The range of the ripple measured is between 14mV and 31mV.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiOdgpBE8qpISy9aTjvXfe3KGWueE8jWoomYZ8CWrZGkdYyiGWETEMXhKkL5KkHY2WmcjMlli_cVY2zjPMrr7aE4UOotHJ90-mnIRUJvlpm4cJLvhOl0-VuBNA4KDmZWNZM9uHJXoqIRT2W/s1600/6.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="458" data-original-width="569" height="321" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiOdgpBE8qpISy9aTjvXfe3KGWueE8jWoomYZ8CWrZGkdYyiGWETEMXhKkL5KkHY2WmcjMlli_cVY2zjPMrr7aE4UOotHJ90-mnIRUJvlpm4cJLvhOl0-VuBNA4KDmZWNZM9uHJXoqIRT2W/s400/6.png" width="400" /></a></div>
<br />
According to the OKI-78SR datasheet, the typical/normal ripple is around 30mV and the maximum is around 40mV. The test results are in line with these 2 figures.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhjLUq5odb8m988RARX3OVZSLaeahLpmX-NXb1dv7Nr4OCVNrHVbpuaLC_OusLKySMpgah3cVtpujImbkjUSbIddfWNIK-FbfUNQdQZjhWod133aiVpQ4CrBWAa-mfc1HTLmHiQlDIWiK46/s1600/7.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="437" data-original-width="914" height="304" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhjLUq5odb8m988RARX3OVZSLaeahLpmX-NXb1dv7Nr4OCVNrHVbpuaLC_OusLKySMpgah3cVtpujImbkjUSbIddfWNIK-FbfUNQdQZjhWod133aiVpQ4CrBWAa-mfc1HTLmHiQlDIWiK46/s640/7.png" width="640" /></a></div>
<br />Wei-Hsiung Huanghttp://www.blogger.com/profile/09437875322676421890noreply@blogger.com0tag:blogger.com,1999:blog-3648927237801494248.post-48602017159876617992020-04-07T08:47:00.001+08:002020-04-07T08:56:31.751+08:00ESP32 - OTA firmware update using Arduino IDEThis post is a quick write up of me following the instructions provided by G6EJD on how to do OTA firmware from inside Arduino IDE.<br />
<br />
His instruction video can be found at the link below:<br />
<br />
<a href="https://www.youtube.com/watch?time_continue=1&v=lQavz_U8nd4&feature=emb_logo" target="_blank">https://www.youtube.com/watch?time_continue=1&v=lQavz_U8nd4&feature=emb_logo</a><br />
<br />
Here is the link to his GitHub page for this project: <a href="https://github.com/G6EJD/ESP32-OTA-Example" target="_blank">https://github.com/G6EJD/ESP32-OTA-Example</a><br />
<br />
<a name='more'></a><b><span style="font-size: large;">The Arduino Sketch</span></b><br />
<b><br /></b>
Two files are needed for this: "ESP32_Basic_OTA.ino", and "credentials.h".<br />
<b><br /></b>
<u style="background-color: #eeeeee;">ESP32_Basic_OTA.ino</u><br />
<br />
<div style="background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="line-height: 125%; margin: 0;">#include <WiFi.h>
#include <ESPmDNS.h>
#include <WiFiUdp.h>
#include <ArduinoOTA.h>
#include "credentials.h"
void setup(){
// Setup needed for OTA
Serial.begin(115200);
Serial.println("Booting");
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
while (WiFi.waitForConnectResult() != WL_CONNECTED) {
Serial.println("Connection Failed! Rebooting...");
delay(5000);
ESP.restart();
}
// Port defaults to 3232 // ArduinoOTA.setPort(3232);
// Hostname defaults to esp3232-[MAC] // ArduinoOTA.setHostname("myesp32");
// No authentication by default // ArduinoOTA.setPassword("admin");
// Password can be set with it's md5 value as well // MD5(admin) = 21232f297a57a5a743894a0e4a801fc3
// ArduinoOTA.setPasswordHash("21232f297a57a5a743894a0e4a801fc3");
ArduinoOTA.onStart([]() {
String type;
if (ArduinoOTA.getCommand() == U_FLASH)
type = "sketch";
else // U_SPIFFS
type = "filesystem";
// NOTE: if updating SPIFFS this would be the place to unmount SPIFFS using SPIFFS.end()
Serial.println("Start updating " + type);
});
ArduinoOTA.onEnd([]() { Serial.println("\nEnd"); });
ArduinoOTA.onProgress([](unsigned int progress, unsigned int total) {
Serial.printf("Progress: %u%%\r", (progress / (total / 100)));
});
ArduinoOTA.onError([](ota_error_t error) {
Serial.printf("Error[%u]: ", error);
if (error == OTA_AUTH_ERROR) Serial.println("Auth Failed");
else if (error == OTA_BEGIN_ERROR) Serial.println("Begin Failed");
else if (error == OTA_CONNECT_ERROR) Serial.println("Connect Failed");
else if (error == OTA_RECEIVE_ERROR) Serial.println("Receive Failed");
else if (error == OTA_END_ERROR) Serial.println("End Failed");
});
ArduinoOTA.begin();
Serial.println("Ready");
Serial.print("IP address: ");
Serial.println(WiFi.localIP());
// My setup onwards
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
ArduinoOTA.handle();
yield();
// Your programme loop from here
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(100); // wait for a second
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(100); // wait for a second
// End of your programme loop
}
</pre>
</div>
<br />
<u style="background-color: #eeeeee;">credentials.h</u><br />
<br />
<span style="color: red;">Note, be sure to change the said and password to that of your wifi network.</span><br />
<br />
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="line-height: 125%; margin: 0px;"><span style="background-color: white;">// Change to your WiFi credentials
const char* ssid = "</span><span style="background-color: yellow;"><span style="color: red;">SSID</span></span><span style="background-color: white;">";
const char* password = "</span><span style="background-color: yellow;"><span style="color: red;">Password</span></span><span style="background-color: white;">";
</span></pre>
</div>
<br />
Compile and upload the sketch to your ESP32 via the USB to serial link like you usually do with your other ESP32 projects. There is no need to burn special OTA bootloader to the ESP32 module before the upload.<br />
<br />
Below is the output from the message window of the Arduino IDE.<br />
<br />
<div style="background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="line-height: 125%; margin: 0;">Sketch uses 740194 bytes (56%) of program storage space. Maximum is 1310720 bytes.
Global variables use 42440 bytes (12%) of dynamic memory, leaving 285240 bytes for local variables. Maximum is 327680 bytes.
esptool.py v2.6
Serial port COM4
Connecting........_____....._____.
Chip is ESP32D0WDQ6 (revision 1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
MAC: 80:7d:3a:d5:3a:68
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Auto-detected Flash size: 4MB
Compressed 8192 bytes to 47...
Writing at 0x0000e000... (100 %)
Wrote 8192 bytes (47 compressed) at 0x0000e000 in 0.0 seconds (effective 3640.9 kbit/s)...
Hash of data verified.
Compressed 15328 bytes to 9994...
Writing at 0x00001000... (100 %)
Wrote 15328 bytes (9994 compressed) at 0x00001000 in 0.9 seconds (effective 136.9 kbit/s)...
Hash of data verified.
Compressed 740304 bytes to 414966...
Writing at 0x00010000... (3 %)
Writing at 0x00014000... (7 %)
Writing at 0x00018000... (11 %)
Writing at 0x0001c000... (15 %)
Writing at 0x00020000... (19 %)
Writing at 0x00024000... (23 %)
Writing at 0x00028000... (26 %)
Writing at 0x0002c000... (30 %)
Writing at 0x00030000... (34 %)
Writing at 0x00034000... (38 %)
Writing at 0x00038000... (42 %)
Writing at 0x0003c000... (46 %)
Writing at 0x00040000... (50 %)
Writing at 0x00044000... (53 %)
Writing at 0x00048000... (57 %)
Writing at 0x0004c000... (61 %)
Writing at 0x00050000... (65 %)
Writing at 0x00054000... (69 %)
Writing at 0x00058000... (73 %)
Writing at 0x0005c000... (76 %)
Writing at 0x00060000... (80 %)
Writing at 0x00064000... (84 %)
Writing at 0x00068000... (88 %)
Writing at 0x0006c000... (92 %)
Writing at 0x00070000... (96 %)
Writing at 0x00074000... (100 %)
Wrote 740304 bytes (414966 compressed) at 0x00010000 in 36.9 seconds (effective 160.4 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 144...
Writing at 0x00008000... (100 %)
Wrote 3072 bytes (144 compressed) at 0x00008000 in 0.0 seconds (effective 983.0 kbit/s)...
Hash of data verified.
Leaving...
Hard resetting via RTS pin...
</pre>
</div>
<br />
After the upload is completed, the built-in LED of the ESP32 module starts flashing almost immediately.<br />
<br />
Below is the output of the Serial Monitor.<br />
<br />
At the end of the output message, you could see the IP address assigned to the ESP32 module by your WiFi Router.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEinxBu-938gdHLf9ELPHyV325AtXF8uDvYmgjD-gS65T44Sk2cogjKRWsvyB0LWf2cGuzYca65sdRAGCORsQRrn4bp8t2ynEFp1ZHuIY2FjZHm33-uBPthlWq2Rt9vFeTX_SYUYD3e56pHr/s1600/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="652" data-original-width="624" height="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEinxBu-938gdHLf9ELPHyV325AtXF8uDvYmgjD-gS65T44Sk2cogjKRWsvyB0LWf2cGuzYca65sdRAGCORsQRrn4bp8t2ynEFp1ZHuIY2FjZHm33-uBPthlWq2Rt9vFeTX_SYUYD3e56pHr/s640/1.png" width="611" /></a></div>
<br />
Restart your Arduino IDE, then go to "Tools" -> "Port". A new option is now available for you to upload firmware from the Arduino IDE to the ESP32 module via the wireless network.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgeKOoWANzABUwQB7lut9EhB_aV_F6QkRoLivZzDOlksz-RGK_kPbDM6FzeoeSxO3t040P6vMTS2TBqkpQeM5zS-nSlEh1OA5UpBFKRTK_LW1k5kJrRx6GQwWPXmDPklw24Y0LZrKOpdxD3/s1600/3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="488" data-original-width="819" height="379" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgeKOoWANzABUwQB7lut9EhB_aV_F6QkRoLivZzDOlksz-RGK_kPbDM6FzeoeSxO3t040P6vMTS2TBqkpQeM5zS-nSlEh1OA5UpBFKRTK_LW1k5kJrRx6GQwWPXmDPklw24Y0LZrKOpdxD3/s640/3.png" width="640" /></a></div>
<br />
<b><span style="font-size: large;">Testing the OTA capability</span></b><br />
<br />
1. Unplug ESP32 from your computer and plug it to a phone charger to provide power to the ESP32.<br />
<br />
2. In the Arduino sketch, change the delay time from 100 to 1000 as highlighted below.<br />
<br />
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="line-height: 125%; margin: 0px;"><span style="background-color: white;">#include <WiFi.h>
#include <ESPmDNS.h>
#include <WiFiUdp.h>
#include <ArduinoOTA.h>
#include "credentials.h"
void setup(){
// Setup needed for OTA
Serial.begin(115200);
Serial.println("Booting");
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
while (WiFi.waitForConnectResult() != WL_CONNECTED) {
Serial.println("Connection Failed! Rebooting...");
delay(5000);
ESP.restart();
}
// Port defaults to 3232 // ArduinoOTA.setPort(3232);
// Hostname defaults to esp3232-[MAC] // ArduinoOTA.setHostname("myesp32");
// No authentication by default // ArduinoOTA.setPassword("admin");
// Password can be set with it's md5 value as well // MD5(admin) = 21232f297a57a5a743894a0e4a801fc3
// ArduinoOTA.setPasswordHash("21232f297a57a5a743894a0e4a801fc3");
ArduinoOTA.onStart([]() {
String type;
if (ArduinoOTA.getCommand() == U_FLASH)
type = "sketch";
else // U_SPIFFS
type = "filesystem";
// NOTE: if updating SPIFFS this would be the place to unmount SPIFFS using SPIFFS.end()
Serial.println("Start updating " + type);
});
ArduinoOTA.onEnd([]() { Serial.println("\nEnd"); });
ArduinoOTA.onProgress([](unsigned int progress, unsigned int total) {
Serial.printf("Progress: %u%%\r", (progress / (total / 100)));
});
ArduinoOTA.onError([](ota_error_t error) {
Serial.printf("Error[%u]: ", error);
if (error == OTA_AUTH_ERROR) Serial.println("Auth Failed");
else if (error == OTA_BEGIN_ERROR) Serial.println("Begin Failed");
else if (error == OTA_CONNECT_ERROR) Serial.println("Connect Failed");
else if (error == OTA_RECEIVE_ERROR) Serial.println("Receive Failed");
else if (error == OTA_END_ERROR) Serial.println("End Failed");
});
ArduinoOTA.begin();
Serial.println("Ready");
Serial.print("IP address: ");
Serial.println(WiFi.localIP());
// My setup onwards
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
ArduinoOTA.handle();
yield();
// Your programme loop from here
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
</span><span style="background-color: yellow;"> //delay(100); // wait for a second
delay(1000);</span><span style="background-color: white;">
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
</span><span style="background-color: yellow;"> //delay(100); // wait for a second
delay(1000);</span><span style="background-color: white;">
// End of your programme loop
}
</span></pre>
</div>
<br />
3. Select the network port as the communication interface between the Arduino IDE and the ESP32 module.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjCue9Y5S6QVeIBIz-X6sewmCXbAxg9-u21xWGmKmrUXvBmQbXNzOF9ZkJtXx_gKjJmSC6IBOLkzZQEM6ln8Rr4gAelFhlSHRG0JWTLeQlci_9l6PuL3K65YU0Bi7sc3fA2NXIPeG6aYPRz/s1600/4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="551" data-original-width="822" height="427" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjCue9Y5S6QVeIBIz-X6sewmCXbAxg9-u21xWGmKmrUXvBmQbXNzOF9ZkJtXx_gKjJmSC6IBOLkzZQEM6ln8Rr4gAelFhlSHRG0JWTLeQlci_9l6PuL3K65YU0Bi7sc3fA2NXIPeG6aYPRz/s640/4.png" width="640" /></a></div>
<br />
4. Compile and upload the firmware to the ESP32 module.<br />
<br />
Be sure to allow "espota.exe" to access the network if it's blocked by Windows firewall.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiY4ts1S6e2M4mdjchQTpgtBesMvMADq_LMmY6LyvcI-UjmdHc8aSxrQvlTImMgh8mChyqzefzmjcqtsQbHtchg2S-c2ZSL9DM4oVDZOMLG3iB2oHOoIQKWshlcuR4GooLlXI7F4MQza9sQ/s1600/5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="432" data-original-width="622" height="443" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiY4ts1S6e2M4mdjchQTpgtBesMvMADq_LMmY6LyvcI-UjmdHc8aSxrQvlTImMgh8mChyqzefzmjcqtsQbHtchg2S-c2ZSL9DM4oVDZOMLG3iB2oHOoIQKWshlcuR4GooLlXI7F4MQza9sQ/s640/5.png" width="640" /></a></div>
<br />
If all goes well, the new firmware will be uploaded to the ESP32 module wirelessly and the flashing of the LED will slow down after the upload is completed.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgYKvthsj69pwklv9vBWs_26oi6BJiPYIsllY00GbGJl2zKjtO7s7pFGt0DVAFd6bC-orMDFEnGtEejkpP2geLyEEJs_X1VEHhl72uBTd_YtGENlecKKn3492aDPIIiwrsw9Y7buPnSykB4/s1600/4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="689" data-original-width="832" height="528" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgYKvthsj69pwklv9vBWs_26oi6BJiPYIsllY00GbGJl2zKjtO7s7pFGt0DVAFd6bC-orMDFEnGtEejkpP2geLyEEJs_X1VEHhl72uBTd_YtGENlecKKn3492aDPIIiwrsw9Y7buPnSykB4/s640/4.png" width="640" /></a></div>
<br />
<b>Reference:</b><br />
<br />
Tech Note 082 - ESP32 Over-the-Air (OTA) Updating<br />
<a href="https://www.youtube.com/watch?time_continue=1&v=lQavz_U8nd4&feature=emb_logo" target="_blank">https://www.youtube.com/watch?time_continue=1&v=lQavz_U8nd4&feature=emb_logo</a><br />
<br />
An example of using the OTA function of the ESP32<br />
<a href="https://github.com/G6EJD/ESP32-OTA-Example" target="_blank">https://github.com/G6EJD/ESP32-OTA-Example</a>Wei-Hsiung Huanghttp://www.blogger.com/profile/09437875322676421890noreply@blogger.com0tag:blogger.com,1999:blog-3648927237801494248.post-18827785215968592402020-03-24T12:28:00.000+08:002020-03-25T14:38:34.012+08:00支援32GB SD Card, 可調整觸發距離, 可連網之危害告知器 - v2<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<span style="color: red;"><b>***此說明中所用的危害告知器為v2版本***</b></span><br />
<br />
<span style="color: red;">Revision History: </span><br />
<span style="color: red;">- v1 @ 2020/3/24: 第一版<b><br /></b></span><br />
<br />
<span style="font-size: large;"><b>功能說明:</b></span><br />
<br />
本裝置透過超音波偵測環境中之物體, 當物體與本裝置間之距離小於預設值時將觸發本裝置之告警功能. 本裝置之觸發距離可以30公分為單位進行調整, 最遠可達300公分.<br />
<br />
本裝置被觸發時可透過下列方式發出警報:<br />
<br />
1. 透過內建 / 外接喇叭播放預先存放在SD Card (<span style="color: red;">註1</span>) 中之音聲訊息; <br />
2. 透過外接之警示燈 (透過乾接點) 提供視覺訊息.<br />
3. 透過網際網路對個人或群組發出E-Mail / Telegram等圖文訊息 (<span style="color: red;">註2</span>).<br />
<br />
與使用紅外線感應之裝置相比, 由於超音波具有防強光 (太陽), 指向性, 波束窄, 及可測量與物體間距離之特性, 因此, 本裝置將可比使用紅外線感應之裝置更有效的防止誤動作之發生.<br />
<br />
<span style="color: red;"><span style="color: red;">註1: 本裝置支持最大容量為32GB之Micro SD Card, 您需事先錄製欲播放之語音並將其存放在SD Card上後插入本裝置中. 若您需要能夠於現場立即錄音, 立即播放的版本, 請點擊下方網址.</span></span><br />
<span style="color: red;"></span><a href="https://wei48221.blogspot.com/2019/07/40.html" target="_blank">https://wei48221.blogspot.com/2019/07/40.html</a><br />
<span style="color: red;"></span><br />
<span style="color: red;">註2: 需有網際網路連線並向本公司換購相對應之軟體.</span><br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhRe54J9QCPetrGuKK-jzogjmPo7HyQI6De9JDzhlXGN1JagFgQZ_AFoRgdNi1R_xboZ1OoXZB5fGuQda-hsljsN_HyT1c55pKYVMe5Hr2_luvN4saMynWr4bJUQm0zg-RTALdDj_eSXGmW/s1600/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="263" data-original-width="944" height="178" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhRe54J9QCPetrGuKK-jzogjmPo7HyQI6De9JDzhlXGN1JagFgQZ_AFoRgdNi1R_xboZ1OoXZB5fGuQda-hsljsN_HyT1c55pKYVMe5Hr2_luvN4saMynWr4bJUQm0zg-RTALdDj_eSXGmW/s640/1.png" width="640" /></a></div>
<br />
<a name='more'></a><span style="font-size: large;"><b>使用範例</b></span><br />
<b style="font-size: x-large;"><br /></b>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi55jGngenk2UNJ82NjMIx5xU14BVcfiAYupcX4TVUdiZKJFwvyzTEZ37PfEQD6bU9IGYsR2UmkUbxwdNOsxp86gl_e_ngWEiIkAi1Yh4QwqmKZXvwyrRz-ocnFpYuUmgtqL4EHwSWLqDhl/s1600/1.JPG" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="389" data-original-width="545" height="285" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi55jGngenk2UNJ82NjMIx5xU14BVcfiAYupcX4TVUdiZKJFwvyzTEZ37PfEQD6bU9IGYsR2UmkUbxwdNOsxp86gl_e_ngWEiIkAi1Yh4QwqmKZXvwyrRz-ocnFpYuUmgtqL4EHwSWLqDhl/s400/1.JPG" width="400" /></a></div>
<b style="font-size: x-large;"><br /></b>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiNc3JhktOFz4Wfqrl59NEdiA9ynZoaiDtzxyJHpSRX17vpJTtHA1kf5ZxOH2mvzsq7FWxjuqotULM2SxsCaw8Qff5vsC5XVWW8jVqYPegIDDN3HNCk8lbx_g6noxNPV_W1EhyphenhyphenQ4VKTrGSt/s1600/2.JPG" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="380" data-original-width="524" height="290" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiNc3JhktOFz4Wfqrl59NEdiA9ynZoaiDtzxyJHpSRX17vpJTtHA1kf5ZxOH2mvzsq7FWxjuqotULM2SxsCaw8Qff5vsC5XVWW8jVqYPegIDDN3HNCk8lbx_g6noxNPV_W1EhyphenhyphenQ4VKTrGSt/s400/2.JPG" width="400" /></a></div>
<b style="font-size: x-large;"><br /></b>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjwXFJeV6xWFdlL02Rg_uqxWlxCc5QNxXAUw070zOpLK6x32aHArycLUB14RWHyOXOrKK2ISMMk_AMafLaCGkAQ5pEm20bjGZ_pKAj-U4L7KR0706g-aeanWnbSLWk_FSAtFEsnDJB8IOwH/s1600/3.JPG" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="401" data-original-width="531" height="301" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjwXFJeV6xWFdlL02Rg_uqxWlxCc5QNxXAUw070zOpLK6x32aHArycLUB14RWHyOXOrKK2ISMMk_AMafLaCGkAQ5pEm20bjGZ_pKAj-U4L7KR0706g-aeanWnbSLWk_FSAtFEsnDJB8IOwH/s400/3.JPG" width="400" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<b style="font-size: x-large;">規格</b><br />
<br />
<u>觸發距離:</u><br />
<br />
- 30cm ~ 300cm (以30cm為一調整單位).<br />
<br />
<u>波束角度:</u><br />
<br />
見下圖 (由發射點為準, 左右各約30度).<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1UbQE8_ly5TSkoNtO1iedABUNiocpsuTMtmDoa_giH2CzQViIFQJmwcARZW8aAiss-Zf7LPWnQ5zolaDoVFMmzEddwFrgmnQkjb4Rumq1DfWmU49dMhaWFHST_joOjrfCv7FvuM0haXtj/s1600/1.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="348" data-original-width="456" height="304" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1UbQE8_ly5TSkoNtO1iedABUNiocpsuTMtmDoa_giH2CzQViIFQJmwcARZW8aAiss-Zf7LPWnQ5zolaDoVFMmzEddwFrgmnQkjb4Rumq1DfWmU49dMhaWFHST_joOjrfCv7FvuM0haXtj/s400/1.png" width="400" /></a></div>
<br />
<u>語音存儲容量及規格:</u><br />
<br />
- SD Card最大容量: 32GB;<br />
- 語音格式: MP3, WAV;<br />
- Sample Rate: 8K ~ 48K;<br />
- Bit Rate: 8K ~ 320Kbps.<br />
<br />
<u>告警方式 (本地端):</u><br />
<br />
- 播放預先錄製的語音 (透過內建或外接喇叭);<br />
- 透過長乾接點啟動週邊告警設備 (警示燈, 蜂鳴器, 等.).<br />
<br />
<u>輸入電力規格:</u><br />
<br />
- DC 5V / 1A.<br />
<br />
<u>尺寸:</u><br />
<br />
- 125mm x 80mm x 32mm.<br />
<br />
<b><span style="font-size: large;">輸出入介面</span></b><br />
<br />
<u><b><span style="font-size: small;">上視圖</span></b></u><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj7aIMXLbFD-5av9O6Vrd4_ABddGyjv1OvMoyPr_XYyOkrysXeVW9KYcDJIiMEY3lROdi31vudd4LWmDQtk76csjZxrcyarKYthHtK6xS36KvLJ7k5Q8v-_coLamMCPtvwIjsRNh6YGqtTK/s1600/5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="456" data-original-width="714" height="408" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj7aIMXLbFD-5av9O6Vrd4_ABddGyjv1OvMoyPr_XYyOkrysXeVW9KYcDJIiMEY3lROdi31vudd4LWmDQtk76csjZxrcyarKYthHtK6xS36KvLJ7k5Q8v-_coLamMCPtvwIjsRNh6YGqtTK/s640/5.png" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<u><b>前視圖</b></u></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVjwlASZQg0u0HD81R1QDehmlPWwKd8BpSQJNElKC4QUJX81fwy8rTtEIGBou2z5uFR397HtKmcRM5cOjJhklf5d9vzHnOLq4zVRP9l76iT5i-jqoDAGnhPiuF2QS4mtnxyne4QQvZMD_P/s1600/4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="199" data-original-width="713" height="177" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVjwlASZQg0u0HD81R1QDehmlPWwKd8BpSQJNElKC4QUJX81fwy8rTtEIGBou2z5uFR397HtKmcRM5cOjJhklf5d9vzHnOLq4zVRP9l76iT5i-jqoDAGnhPiuF2QS4mtnxyne4QQvZMD_P/s640/4.png" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<u><b>後視圖</b></u></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhdDZ3WM9Bi9zKU3HLElaaAL9SLAEvkB-07I1B7MZ61LATvNrB10IKAQATxhe1lS1eUNeH2q1WAahrRON2U8Fz-g0ZwWLOXqIasLqtZ6YBwChQpTJ_UE4TR6N1Q2YMZE61Nml79-ZhA66Xm/s1600/3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="195" data-original-width="719" height="171" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhdDZ3WM9Bi9zKU3HLElaaAL9SLAEvkB-07I1B7MZ61LATvNrB10IKAQATxhe1lS1eUNeH2q1WAahrRON2U8Fz-g0ZwWLOXqIasLqtZ6YBwChQpTJ_UE4TR6N1Q2YMZE61Nml79-ZhA66Xm/s640/3.png" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<b style="font-size: x-large;">前方輸出入介面介紹</b><br />
<div>
<br /></div>
<div>
<u><b>電源輸入及音量控制</b></u></div>
<div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEifgKf1ij8Vz33g7bXP-WOctdMlSx0jA60Xd3bF3KphUVSGJCB_vSXDKnRq3mzsjXdxn_iW3IAnQGVIK8RZwOPCpjaksNMLfuwL8KF7xpLp_Qc9gFLIJsSjBk7bIKl4PWwNNAEUj4yeVmpp/s1600/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="268" data-original-width="979" height="174" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEifgKf1ij8Vz33g7bXP-WOctdMlSx0jA60Xd3bF3KphUVSGJCB_vSXDKnRq3mzsjXdxn_iW3IAnQGVIK8RZwOPCpjaksNMLfuwL8KF7xpLp_Qc9gFLIJsSjBk7bIKl4PWwNNAEUj4yeVmpp/s640/1.png" width="640" /></a></div>
<br />
輸入電源規格:<br />
<br />
- DC 5V / 1A; <br />
- 請確認所使用之電源供應器或行動電源能提供1A之電流;<br />
<span style="color: red;"><span style="color: black;">- 請確認所使用之Micro USB電源線之內阻不至於過高以免造成過大之壓降;</span></span><br />
<span style="color: red;">- 輸入超過DC 5V之電壓將燒毀本裝置!!</span><br />
<br /></div>
<b><u>外部喇叭插孔及音軌選擇鍵</u></b><br />
<b><u><br /></u></b>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgMNgpgJOi2ISYlY7VylkEwLFL5VfLHGtVq-ZRXK8bhbsur9RItxNruxBkcWF8svQbKscGZa16oXaV_1GZVn6mN_lpqJ3Xtjua2bJc-vyx2yJGGaYhdzh8eJDpD03OteMGSiGZj5bC7Kroc/s1600/5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="350" data-original-width="717" height="312" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgMNgpgJOi2ISYlY7VylkEwLFL5VfLHGtVq-ZRXK8bhbsur9RItxNruxBkcWF8svQbKscGZa16oXaV_1GZVn6mN_lpqJ3Xtjua2bJc-vyx2yJGGaYhdzh8eJDpD03OteMGSiGZj5bC7Kroc/s640/5.png" width="640" /></a></div>
<span style="background-color: #eeeeee;">外部喇叭插孔:</span><br />
<br />
<b><u></u></b>
- 可透過外接喇叭或外部擴大器播放訊息;<br />
- 內建喇叭可與外接喇叭 / 外部擴大機同時播音. 若欲關閉此功能, 請將內建喇叭音量控制桿撥到中間靜音位置.<br />
<br />
<span style="background-color: #eeeeee;">音軌選擇鍵:</span><br />
<br />
<b>上一首:</b><br />
- 按一下此鍵可選擇播放上一首訊息. <br />
<br />
<b>下一首:</b><br />
- 按一下此鍵可選擇播放下一首訊息.
<br />
<b><u></u></b>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<b><u><br /></u></b>
註: 語音之播放選擇不因斷電而消失, 在復電後本裝置被觸發時仍將播放斷電前所選定之語音.<br />
<br />
<b><u>乾接點輸出, 超音波觸發距離調整</u></b><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZ_fFxxC2eJUvUx9q9D10fCesHDioYQHROX_pDbJyCI6Oow1yhRttM99ApFTBt6snv1ZIYFtElhLdhsKe9xTeCeWWcDIFbJsipDbRzsb2DwSuE8llaHfcojz_nm6582mQzswHx-X-Vstgk/s1600/4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="202" data-original-width="716" height="180" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZ_fFxxC2eJUvUx9q9D10fCesHDioYQHROX_pDbJyCI6Oow1yhRttM99ApFTBt6snv1ZIYFtElhLdhsKe9xTeCeWWcDIFbJsipDbRzsb2DwSuE8llaHfcojz_nm6582mQzswHx-X-Vstgk/s640/4.png" width="640" /></a></div>
<br />
<span style="background-color: #eeeeee;">乾接點輸出:</span><br />
<br />
- 最大允許流經電流: DC 0.5A;<br />
- 最大允許流經電壓: DC 24V.<br />
<b><span style="color: red;">註: 乾接點輸出接點僅可供直流24V, 0.5A以下之電流通過. 讓超過此限制之電流或交流電通過將可能造成乾接點甚至是本告知器之損毀並失去保固!!</span></b><br />
<br />
<span style="background-color: #eeeeee;">超音波觸發距離調整:</span><br />
<br />
- 觸發距離: 30cm ~ 300cm;<br />
- 調整單位: 以30cm為一調整單位 (觸發距離顯示器1格亮: 30cm, 5格亮: 150cm, 10格全亮: 300cm);<br />
- 調整方式: 以一字起子輕插入孔內後向左右旋轉進行調整;<br />
- 若欲關閉超音波之觸發功能, 請將此旋鈕調整到觸發距離顯示器為全滅狀態.<br />
<br />
<span style="background-color: #eeeeee;">乾接點接線示意圖</span><br />
<br />
乾接點為常開 (Normally Open) 型, 其將於本裝置被觸發時成為閉合狀態. 此閉合狀態將持續到語音播放完畢為止.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEieN2KnYlgre_OEwe0TdGKYBMyfUkKOgOzKtyUioK3D7u3ArwwghOP_z7XkiA3IrB2LnTfd6rc6DqJiOjwpnEqOgzwkvbWqHawr908BaTIR5jcBFx6MF4gRPyWojLR9FuqcEm3_hQ1fQuZR/s1600/5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="280" data-original-width="443" height="252" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEieN2KnYlgre_OEwe0TdGKYBMyfUkKOgOzKtyUioK3D7u3ArwwghOP_z7XkiA3IrB2LnTfd6rc6DqJiOjwpnEqOgzwkvbWqHawr908BaTIR5jcBFx6MF4gRPyWojLR9FuqcEm3_hQ1fQuZR/s400/5.png" width="400" /></a></div>
<br />
<b style="font-size: x-large;">後方輸出入介面介紹 </b><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEguKc55TQTFMJe2jgJaKJsxC9n2abw7E7jTN6Kr_ePepUv9Q3wgEEdbgbyHKsoHAIcOG3Qv7mGfrfGJfiQNT2Vtum_z1jrQhuPva_djKk6Cswob3KKJdnl2_1Coc0b2F9zaE-dxT1S5lkl1/s1600/3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="243" data-original-width="894" height="172" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEguKc55TQTFMJe2jgJaKJsxC9n2abw7E7jTN6Kr_ePepUv9Q3wgEEdbgbyHKsoHAIcOG3Qv7mGfrfGJfiQNT2Vtum_z1jrQhuPva_djKk6Cswob3KKJdnl2_1Coc0b2F9zaE-dxT1S5lkl1/s640/3.png" width="640" /></a></div>
<br />
<span style="background-color: #eeeeee;">Micro SD卡插槽:</span><br />
<br />
- 將預先錄製好訊息之Micro SD卡插入此槽中 (見下圖).<br />
<b><span style="color: red;">- 欲取出Micro SD卡時請先以指甲或小起子向內推Micro SD卡以讓其自動彈出. 請勿強行拔出Micro SD卡以免造成插槽之損毀.</span></b><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg7afczcReqwP5Usjy2mu5e7E2r4FJyG8wQT9AtnosD4x3gABFG9uONYSLh5kDsnDMiEazSlPrBPrJiaju2gDFbpb2fP-XPc4mKSRCDzhsHgOIeAgpVOpe5pp01f-SoYj0NX1hE2cDr_GPl/s1600/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="339" data-original-width="291" height="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg7afczcReqwP5Usjy2mu5e7E2r4FJyG8wQT9AtnosD4x3gABFG9uONYSLh5kDsnDMiEazSlPrBPrJiaju2gDFbpb2fP-XPc4mKSRCDzhsHgOIeAgpVOpe5pp01f-SoYj0NX1hE2cDr_GPl/s200/1.png" width="171" /></a></div>
<br />
<span style="background-color: #eeeeee;">RESET鍵:</span><br />
<br />
- 按下此鍵將重置 (Reset) 本機.<br />
<br />
<span style="background-color: #eeeeee;">AP鍵:</span><br />
<br />
- 按下此鍵喚起Config Portal以供進行連網相關設定.<br />
<span style="color: red;"><b>- 本機硬體具備連網功能但本機出廠時之軟體已針對無網際網路之使用環境進行優化. 倘您有將本機連網 (觸發時發出E-Mail / 即時訊息, 等) 之需求, 請與本文作者連絡.</b></span><br />
<br />
<b><span style="font-size: large;">加值功能 - 客製化中央管理系統</span></b><br />
<br />
本裝置之連網功能使得集中監控裝置狀態成為可能 (下方為系統架構示意圖). 倘您有這方面之需求, 請與本文作者連絡.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjapRCM0HibGDqrOqzk_FpSGGmKsxf-O-qZNdQfkIBsnZSSyFQ5mToVBhGXiACE5qXhi13NP7-w8gAz5nbbijQ9YdgYz0WuJxo6x2h5iF2zf5LfZpAyAyAPB3jnp81Q2-9eWR7RDXbyHSpV/s1600/11.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="436" data-original-width="597" height="291" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjapRCM0HibGDqrOqzk_FpSGGmKsxf-O-qZNdQfkIBsnZSSyFQ5mToVBhGXiACE5qXhi13NP7-w8gAz5nbbijQ9YdgYz0WuJxo6x2h5iF2zf5LfZpAyAyAPB3jnp81Q2-9eWR7RDXbyHSpV/s400/11.png" width="400" /></a></div>
<br />
========================================================================<br />
<b><span style="font-size: large;">使用說明</span></b><br />
<br />
<span style="font-size: medium;"><b><u>指示燈號</u></b></span><br />
<ul>
<li>插入電源, 開啟電源開關後10秒內下方之綠色指示燈將開始閃爍以表示本裝置可正常運作. 此時本裝置將開始偵測前方是否有物體接近到預設之告警觸發範圍內.</li>
</ul>
<ul>
<li>當本裝置偵測到前方有物體接近到預設之告警觸發範圍內時下方之紅色指示燈將亮起. 此時本裝置將播放預先選定之告警訊息.</li>
</ul>
<ul>
<li>本裝置之警報觸發距離顯示於右上方之長條型指示燈處 (指示燈每格的單位為30公分, 當10格全亮時表示觸發距離為300公分,
當10格全滅時表示本裝置的觸發功能已關閉, 下圖中一格指示燈亮起代表觸發距離設定為30公分).
本裝置將於偵測到前方物體與本裝置間之距離小於或等於觸發距離時觸發告警.</li>
</ul>
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBj7qaNRadPDH60SHO5iS3Ar0cIOSG1MIjlktKvsvkaZ-yQNs4zBlXMcs-j6XPRpaSwOe1h3uFumROIzfLuT39YTaVuLIWYWDux0LsE7P6qr28RmM9nLfMLjJIlkJZ6fs4DFqMGhR8mjHx/s1600/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="471" data-original-width="645" height="291" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBj7qaNRadPDH60SHO5iS3Ar0cIOSG1MIjlktKvsvkaZ-yQNs4zBlXMcs-j6XPRpaSwOe1h3uFumROIzfLuT39YTaVuLIWYWDux0LsE7P6qr28RmM9nLfMLjJIlkJZ6fs4DFqMGhR8mjHx/s400/1.png" width="400" /></a></div>
<br />
<b><u>觸發距離及告警語音選擇</u></b><br />
<ul>
<li>本裝置之警報觸發距離可由下圖左方之 "超音波偵測距離調整旋鈕" 處向左或向右旋轉調整.</li>
</ul>
<ul>
<li>本裝置觸發告警時所播放之語音可由下圖之 "上一首" 及 "下一首" 兩個按鈕調整.</li>
</ul>
<ul>
<li>本裝置觸發告警時所播放之語音音量可由 "內建喇叭音量控制" (左邊: 大聲, 中央: 靜音, 右邊: 小聲) 開關設定.</li>
</ul>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiBWsX4gR5hv9v8LIrjldm2Iy3vyBQedETSjEsqnXp6MOwJvVS0LyQzmBSlgJEvp7-wxzDnfK6BelKBMiZTAfSJsO1uPCYjfgnklgcedJjEfp2RLSQRUSVTnt-CUa9GKBtquSuLiDm1qtTi/s1600/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="268" data-original-width="979" height="174" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiBWsX4gR5hv9v8LIrjldm2Iy3vyBQedETSjEsqnXp6MOwJvVS0LyQzmBSlgJEvp7-wxzDnfK6BelKBMiZTAfSJsO1uPCYjfgnklgcedJjEfp2RLSQRUSVTnt-CUa9GKBtquSuLiDm1qtTi/s640/1.png" width="640" /></a></div>
<br />
<span style="font-size: large;"><b>耗電量:</b></span><br />
<br />
以下為本裝置在正常運作時所測得之最高耗電量.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhjfxMqznc8sZQssqFunPSUrpBZuU9xkPVXAORxPhB3IbdLFPsZyrlNsC4eN42fR6NOzmZODb-wniYZ5nQsT5c5ExV-1G_lM5qx8WIzV0vVR3cnvUI1N0b7apt0TpygotXR7ShrYHl3GcnV/s1600/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="162" data-original-width="893" height="115" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhjfxMqznc8sZQssqFunPSUrpBZuU9xkPVXAORxPhB3IbdLFPsZyrlNsC4eN42fR6NOzmZODb-wniYZ5nQsT5c5ExV-1G_lM5qx8WIzV0vVR3cnvUI1N0b7apt0TpygotXR7ShrYHl3GcnV/s640/1.png" width="640" /></a></div>
<br />
下方為當使用10,000mAh行動電源作為本裝置之電力來源時, 在假設之運作條件下試算所得之運作時間供參考.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiVmpCSsp7Lq0H9BQL4rKYueDaI5iqv3RXjoUfqJ6KckYesGEgj8tLl9vppE5GgzHxD5WKZ-bvgrw0jvCK8_RAubshjOt1vy6G3NjggxjXVQRQM7CEgrqislrwY8Bm_vOGOeBlS0XUByizr/s1600/2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="464" data-original-width="678" height="436" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiVmpCSsp7Lq0H9BQL4rKYueDaI5iqv3RXjoUfqJ6KckYesGEgj8tLl9vppE5GgzHxD5WKZ-bvgrw0jvCK8_RAubshjOt1vy6G3NjggxjXVQRQM7CEgrqislrwY8Bm_vOGOeBlS0XUByizr/s640/2.png" width="640" /></a></div>
<br />
<br />Wei-Hsiung Huanghttp://www.blogger.com/profile/09437875322676421890noreply@blogger.com0tag:blogger.com,1999:blog-3648927237801494248.post-1724304817618994922020-03-14T16:21:00.001+08:002020-06-18T20:38:10.358+08:00ESP8266 - How to embed bootstrap in the SPIFFS disk of ESP8266This is a quick write up of me following the instruction at the link below to try out embedding bootstrap in the SPIFFS disk of ESP8266.<br />
<br />
Embed bootstrap into an ESP8266 Web server with SPIFFS <br />
<a href="https://www.techtinker.co.za/2018/08/28/fully-embed-bootstrap-into-an-esp8266-web-server/" target="_blank">https://www.techtinker.co.za/2018/08/28/fully-embed-bootstrap-into-an-esp8266-web-server/</a><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhlbpL3rHxHIyIcrdcfvul4_vyKFyPlzqMo-fxxCPXmdo8CuYBafzoHNJTWtD9mHxH1BaoY7Bf7XgWfDQn_2JVh73V5k2Z12IdDtLm369WlCuQUsTjL6o3090sUXGsg6qntRGPGdbRXzcYi/s1600/5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="241" data-original-width="325" height="237" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhlbpL3rHxHIyIcrdcfvul4_vyKFyPlzqMo-fxxCPXmdo8CuYBafzoHNJTWtD9mHxH1BaoY7Bf7XgWfDQn_2JVh73V5k2Z12IdDtLm369WlCuQUsTjL6o3090sUXGsg6qntRGPGdbRXzcYi/s320/5.png" width="320" /></a></div>
<br />
<a name='more'></a>Note that my Arduino IDE already has "ESP8266 Sketch Data Upload" installed from other projects, if you don't have it installed in your Arduino IDE, follow the instruction in the link below to install it.<br />
<br />
<a href="https://www.instructables.com/id/Using-ESP8266-SPIFFS/" target="_blank">https://www.instructables.com/id/Using-ESP8266-SPIFFS/</a><br />
<br />
<b>Uploading bootstrap to SPIFFS for off-line use</b><br />
<br />
1. Create a "data" directory in the directory where the Arduino sketch is kept.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxy96GRfHbFPTGbfRkK9CDe5JUGsJzt4RPerVTMPuOjqJmEu3QMEINK5_yglm16gHY94bibe0HNIZGs-7cW4uXBJubdaRfuE3KT_C9loyUSFumCbXr-SMrYdtRTVLsge5E5gyTsKR0bp_-/s1600/1.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="113" data-original-width="602" height="75" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxy96GRfHbFPTGbfRkK9CDe5JUGsJzt4RPerVTMPuOjqJmEu3QMEINK5_yglm16gHY94bibe0HNIZGs-7cW4uXBJubdaRfuE3KT_C9loyUSFumCbXr-SMrYdtRTVLsge5E5gyTsKR0bp_-/s400/1.png" width="400" /></a></div>
<br />
2. Download the bootstrap framework from this link <a href="https://getbootstrap.com/" target="_blank">https://getbootstrap.com/</a>.<br />
<br />
In
the css and the js folder, find the highlighted files as shown below
and create a compressed version of them using program such as 7zip and
save them in the .gz format.<br />
<br />
<b>In the css folder</b><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgRmomxvcxuG-DNNko1D7wixg7ouRF9ecU7vEBMiyEILBbY-JQJbS2qepsi-UJPVR12-VoAPoLtXcObOYCVqvziTQ-za8LRrB-FJcvSY-ecYtE2w6wkMu0UYRQMTXwfg7b-agMWF7CaeUnx/s1600/3.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="320" data-original-width="592" height="215" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgRmomxvcxuG-DNNko1D7wixg7ouRF9ecU7vEBMiyEILBbY-JQJbS2qepsi-UJPVR12-VoAPoLtXcObOYCVqvziTQ-za8LRrB-FJcvSY-ecYtE2w6wkMu0UYRQMTXwfg7b-agMWF7CaeUnx/s400/3.png" width="400" /></a></div>
<b>In the js folder</b><br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhHB6KrLUpnR4QAHrkfHsJsOU9XF34udAIbVsI_mWuWPtfAFB2kO6gMDtW9eWXXkabwuSznohpTEI5xJPM5_jJidBcqBfv4QBdDUD2ws3GrSOuA37TUlJ5qckrJjxuGs0Bl6gExdGUlmXRJ/s1600/4.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="234" data-original-width="595" height="156" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhHB6KrLUpnR4QAHrkfHsJsOU9XF34udAIbVsI_mWuWPtfAFB2kO6gMDtW9eWXXkabwuSznohpTEI5xJPM5_jJidBcqBfv4QBdDUD2ws3GrSOuA37TUlJ5qckrJjxuGs0Bl6gExdGUlmXRJ/s400/4.png" width="400" /></a></div>
<br />
3. Copy the 4 .gz files to the "data" folder created in step 1 above. <br />
<br />
Note,
alternatively, you could just download the project which contains the
main Arduino sketch and the 5 files shown below from the link below.<br />
<br />
<a href="https://drive.google.com/drive/folders/1pxuUSQCHoMsyVPuX8-EfgiWuip-1YvfE" target="_blank">https://drive.google.com/drive/folders/1pxuUSQCHoMsyVPuX8-EfgiWuip-1YvfE</a>.<br />
<br />
- bootstrap.css.map.gz<br />
- bootstrap.min.css.gz<br />
- bootstrap.min.js.gz<br />
- bootstrap.min.js.map.gz<br />
- index.html.gz <br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjdXTRuaSzK73mghH-O88GzgBrduWLEGFC373bAJCJb5VMn6HyddE6k_YCLpALET8lMwtOHeWkZ4axvXmybrj4bMvrgQ1dE21CGLR5yI7EPZaW6Mx4MYD8YfVlCqWgKaGJsEi5ABUQBL8Hk/s1600/2.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="178" data-original-width="580" height="122" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjdXTRuaSzK73mghH-O88GzgBrduWLEGFC373bAJCJb5VMn6HyddE6k_YCLpALET8lMwtOHeWkZ4axvXmybrj4bMvrgQ1dE21CGLR5yI7EPZaW6Mx4MYD8YfVlCqWgKaGJsEi5ABUQBL8Hk/s400/2.png" width="400" /></a></div>
<br />
The
index.html.gz contains the web page that will be served by the
webserver running on ESP8266. The content of this file is shown below.<br />
<br />
<div style="background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<table><tbody>
<tr><td><pre style="line-height: 125%; margin: 0;"> 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58</pre>
</td><td><pre style="line-height: 125%; margin: 0;"><!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="/favicon.ico">
<title>Fixed top navbar example for Bootstrap</title>
<!-- Bootstrap core CSS -->
<link href="/bootstrap.min.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="navbar-top-fixed.css" rel="stylesheet">
</head>
<body>
<nav class="navbar navbar-expand-md navbar-dark fixed-top bg-dark">
<a class="navbar-brand" href="#">Fixed navbar</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarCollapse" aria-controls="navbarCollapse" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarCollapse">
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Link</a>
</li>
<li class="nav-item">
<a class="nav-link disabled" href="#">Disabled</a>
</li>
</ul>
<form class="form-inline mt-2 mt-md-0">
<input class="form-control mr-sm-2" type="text" placeholder="Search" aria-label="Search">
<button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>
</form>
</div>
</nav>
<br><br><br>
<main role="main" class="container">
<div class="jumbotron">
<h1>Navbar example</h1>
<p class="lead">This example is a quick exercise to illustrate how fixed to top navbar works. As you scroll, it will remain fixed to the top of your browser's viewport.</p>
<a class="btn btn-lg btn-primary" href="../../components/navbar/" role="button">View navbar docs &raquo;</a>
</div>
</main>
<!-- Bootstrap core JavaScript
================================================== -->
<script src="/bootstrap.min.js"></script>
</body>
</html>
</pre>
</td></tr>
</tbody></table>
</div>
<br />
4. Connect ESP8266 to the
computer, launch Arduino IDE. In Arduino IDE, click on "Tools", then
click on "ESP8266 Sketch Data Upload" to upload the files in the "data"
directory to the SPIFFS disk of ESP8266.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEif33rnsfjXiStEs80rFQ7xQSrOKFAWBIMdMb9jcJceBHdmUNjaNj_LPlZyZPloO3ai_gKdAgtZidh18GEGPvc9nuIJ7FYyd6FILs_zyNzFZX3InxEMNzYXSXKzfhfzbr7VPiU9PCXJycR6/s1600/1.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="607" data-original-width="754" height="321" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEif33rnsfjXiStEs80rFQ7xQSrOKFAWBIMdMb9jcJceBHdmUNjaNj_LPlZyZPloO3ai_gKdAgtZidh18GEGPvc9nuIJ7FYyd6FILs_zyNzFZX3InxEMNzYXSXKzfhfzbr7VPiU9PCXJycR6/s400/1.png" width="400" /></a></div>
<br />
The upload progress will be displayed through the message window of the Arduino IDE.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZlpLPrYeLH-OkxLUH2LFbEUn190YQoNuvnKcftH57HPVvOwmH81riNMsqIDbTRHFn9LBFNNr2quSsKEv3uMczUDj9z4YV5CWyYfRe14ikJ7Q3mzOExhpcI7X5m3gNoiywN-5zCd5Qwa5N/s1600/5.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1027" data-original-width="1364" height="480" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZlpLPrYeLH-OkxLUH2LFbEUn190YQoNuvnKcftH57HPVvOwmH81riNMsqIDbTRHFn9LBFNNr2quSsKEv3uMczUDj9z4YV5CWyYfRe14ikJ7Q3mzOExhpcI7X5m3gNoiywN-5zCd5Qwa5N/s640/5.png" width="640" /></a></div>
<br />
5.
Compile and upload the sketch below to ESP8266. Be sure to put the
credential of your wifi network in the "ssid" and "password" fields.<br />
<br />
<div style="background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<table><tbody>
<tr><td><pre style="line-height: 125%; margin: 0;"> 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63</pre>
</td><td><pre style="line-height: 125%; margin: 0;">// Source: https://www.techtinker.co.za/2018/08/28/fully-embed-bootstrap-into-an-esp8266-web-server/
#include <FS.h>
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
const char* ssid = "<span style="color: red;"><span style="background-color: yellow;">Your_Existing_AP</span></span>";
const char* password = "<span style="color: red;"><span style="background-color: yellow;">password_of your_existing_wifi_network</span></span>";
ESP8266WebServer server(80);
void setup() {
Serial.begin(115200);
WiFi.mode(WIFI_STA);
WiFi.begin(ssid,password);
// Wait for connection
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println(WiFi.localIP());
server.begin();
server.on("/", fileindex);
server.on("/index.html", fileindex);
server.on("/bootstrap.min.css", bootstrap);
server.on("bootstrap.min.css", bootstrap);
server.on("/popper.min.js", popper);
server.on("/bootstrap.min.js", bootstrapmin);
server.on("bootstrap.min.js", bootstrapmin);
//NEW
SPIFFS.begin();
}
void loop() {
server.handleClient();
}
void fileindex(){
File file = SPIFFS.open("/index.html.gz", "r");
size_t sent = server.streamFile(file, "text/html");
}
void bootstrap(){
File file = SPIFFS.open("/bootstrap.min.css.gz", "r");
size_t sent = server.streamFile(file, "text/css");
}
void popper(){
File file = SPIFFS.open("/popper.min.js.gz", "r");
size_t sent = server.streamFile(file, "application/javascript");
}
void bootstrapmin(){
File file = SPIFFS.open("/bootstrap.min.js.gz", "r");
size_t sent = server.streamFile(file, "application/javascript");
}
</pre>
</td></tr>
</tbody></table>
</div>
<br />
6. Launch the Serial Monitor of the Arduino IDE to find the IP assigned to the ESP8266. Here, the IP assigned is 192.168.31.9.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj83quwqBw048T5V8yXmjLEn3mo_2g8E_JamC0LvIaL3cS7wbFVbafJGW4Xja6WTsoKJtiRZDHR1olZJSwCc8cyMjxYdLnQxM7W3eGnEEGCD1DrSOr9bs2V7B0Y2DpCXKfyNzO0yEFF9KhM/s1600/5.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="341" data-original-width="609" height="223" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj83quwqBw048T5V8yXmjLEn3mo_2g8E_JamC0LvIaL3cS7wbFVbafJGW4Xja6WTsoKJtiRZDHR1olZJSwCc8cyMjxYdLnQxM7W3eGnEEGCD1DrSOr9bs2V7B0Y2DpCXKfyNzO0yEFF9KhM/s400/5.png" width="400" /></a></div>
<br />
7. Launch a web browser then enter the IP address obtained from above in the URL field to connect to the ESP8266.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEit80ZupVqm-wWiiYKqWgCJJGo_yQ-c618NyDkp2j9kP_MSrpKkIK3xlp4O_Wh0Kn_IaE0x53J2BGmH9FP-owmBftAdkdJlaqq7onJocvC5gCnXVPxz4lRCTHI9v47sMY6ib7Brg4qoBUM-/s1600/1.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="446" data-original-width="1352" height="210" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEit80ZupVqm-wWiiYKqWgCJJGo_yQ-c618NyDkp2j9kP_MSrpKkIK3xlp4O_Wh0Kn_IaE0x53J2BGmH9FP-owmBftAdkdJlaqq7onJocvC5gCnXVPxz4lRCTHI9v47sMY6ib7Brg4qoBUM-/s640/1.png" width="640" /></a></div>
A neat thing about using bootstrap is that it's responsive..<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiFlHy5rG4OuLAs3txgjcQjn8LWDopaz0hL9oTCmiZ8ASQKy_pQnhBsHyfLpqkL8qEeeVU_bQ13Vlx2Xci2bMbPTdJ9idwVaOolC6NLVDC4Usj0rS5BM1Eq0N1gTSI4rb-PmWLjeiE4DYYy/s1600/5.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="478" data-original-width="455" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiFlHy5rG4OuLAs3txgjcQjn8LWDopaz0hL9oTCmiZ8ASQKy_pQnhBsHyfLpqkL8qEeeVU_bQ13Vlx2Xci2bMbPTdJ9idwVaOolC6NLVDC4Usj0rS5BM1Eq0N1gTSI4rb-PmWLjeiE4DYYy/s320/5.png" width="304" /></a></div>
<br />
<b>Reference - UI Design:</b><br />
<br />
Bootstrap: create a beautiful Web Interface for your projects ESP8266<br />
<a href="https://diyprojects.io/bootstrap-create-beautiful-web-interface-projects-esp8266/" target="_blank">https://diyprojects.io/bootstrap-create-beautiful-web-interface-projects-esp8266/</a><br />
<br />
Using ESP8266 SPIFFS <br />
<a href="https://www.instructables.com/id/Using-ESP8266-SPIFFS/" target="_blank">https://www.instructables.com/id/Using-ESP8266-SPIFFS/</a><br />
<br />
Embed bootstrap into ESP8266<br />
<a href="https://mybroadband.co.za/forum/threads/embed-bootstrap-into-esp8266.972617/" target="_blank">https://mybroadband.co.za/forum/threads/embed-bootstrap-into-esp8266.972617/</a><br />
<br />
Bootstrap Tutorial for Beginners<br />
<a href="https://www.youtube.com/watch?v=FMFm9GxB_Eo" target="_blank">https://www.youtube.com/watch?v=FMFm9GxB_Eo</a><br />
<br />
Bootstrap Glyphicon Components<br />
<a href="https://www.w3schools.com/bootstrap/bootstrap_ref_comp_glyphs.asp" target="_blank">https://www.w3schools.com/bootstrap/bootstrap_ref_comp_glyphs.asp</a><br />
<br />
======================================================================<br />
<br />
<b>Icons and symbols that could be used for artworks</b><br />
<br />
GLYPHICONS®<br />
<a href="https://www.glyphicons.com/" target="_blank">https://www.glyphicons.com/</a><br />
<br />
A library of precisely prepared monochromatic icons and symbols,
created with an emphasis to simplicity and easy orientation.Wei-Hsiung Huanghttp://www.blogger.com/profile/09437875322676421890noreply@blogger.com0tag:blogger.com,1999:blog-3648927237801494248.post-62477717835806196742020-03-04T15:51:00.000+08:002020-03-04T15:51:26.022+08:00ESP32 - Compact breakout board for low power applicationsThis is a compact ESP32 breakout board for low power applications. To ensure minimum power consumption, aside from the ESP32-S module itself, all the other components that consume power have been removed.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg4mOCBs7YaDunSYaL__sAR-iHX4Hd5NYeMncUhJaXJCC_UZjlqrNq1aeqiPVgYh65SmhFIlad-mAsjKIn_eRTBRukQS3AcW0W4Smg8nOotilwHqPznmBnsqhF-spDbhetbE2h8sYBKCaEg/s1600/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="420" data-original-width="867" height="193" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg4mOCBs7YaDunSYaL__sAR-iHX4Hd5NYeMncUhJaXJCC_UZjlqrNq1aeqiPVgYh65SmhFIlad-mAsjKIn_eRTBRukQS3AcW0W4Smg8nOotilwHqPznmBnsqhF-spDbhetbE2h8sYBKCaEg/s400/1.png" width="400" /></a></div>
<br />
This breakout board was developed for prototyping on PCB or a perf board. Instead of soldering the ESP32-S module to the PCB / perf board directly, this breakout board allows for the reuse of the ESP32-S module without the need to de-solder it.<br />
<br />
<a name='more'></a><b>The Schematic</b><br />
<br />
Below is the schematic of the breakout board. Except for SD0, SD1, SD2, SD3, CMD, and CLK, all the other pads of the ESP32-S module are exposed and connected to the corresponding pin headers.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-8mQIQpn60ND1r8HWEcSgWK1ZHivrWUhkVsQBuNc6pmz1_dkzhIfDtKPU6Zo7OsuaEsBYGB3aKHaOSNlSQcWKYBYXUwOj6irMpI_kWdQ3iyznESb6IRI4Gm3hTBW1IBMmpeepyDIItvg5/s1600/2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="455" data-original-width="917" height="196" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-8mQIQpn60ND1r8HWEcSgWK1ZHivrWUhkVsQBuNc6pmz1_dkzhIfDtKPU6Zo7OsuaEsBYGB3aKHaOSNlSQcWKYBYXUwOj6irMpI_kWdQ3iyznESb6IRI4Gm3hTBW1IBMmpeepyDIItvg5/s400/2.png" width="400" /></a></div>
<br />
<b>The Offer</b><br />
<br />
Please find below my offer for the breakout board and the parts used.<br />
<br />
- ESP32-S Breakout Board: US$ 2/ea<br />
- Pin Head (40 x 1): US$0.5/ea<br />
- ESP32-S Module: US$5.42/ea<br />
<br />
Item Location: Taipei, TAIWAN<br />
Payment Method: Paypal<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjALTywD3vA0btjY5-0OiNBj2zzKPCCGmq2lJ5D6g_RYP6v0iD0bf2JivXsQtX-qxBP_XhnJnsKAN6A7r7sv4uW-FPmgZtGvTLRqFimo22IhgPf0X65i-Df1MmalAtFFn2zW-yulgpNLx4q/s1600/3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="325" data-original-width="363" height="357" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjALTywD3vA0btjY5-0OiNBj2zzKPCCGmq2lJ5D6g_RYP6v0iD0bf2JivXsQtX-qxBP_XhnJnsKAN6A7r7sv4uW-FPmgZtGvTLRqFimo22IhgPf0X65i-Df1MmalAtFFn2zW-yulgpNLx4q/s400/3.png" width="400" /></a></div>
<br />Wei-Hsiung Huanghttp://www.blogger.com/profile/09437875322676421890noreply@blogger.com0tag:blogger.com,1999:blog-3648927237801494248.post-60528691189506987252020-03-04T14:27:00.003+08:002020-03-04T15:14:26.606+08:00ESP32 - Breadboard friendly breakout board for low power applicationsThis is an ESP32-S breakout board for low power applications. To minimize power consumption, all the components (LDO, LED, USB - Serial Chip, etc.) that consume power have been removed. The difference between this breakout board and the common NodeMCU-32S can be seen in the photo below (Left: Low Power Breakout Board, Right: NodeMCU-32S).<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgPUYX3YoLxwgZLM1csE9pO_NCfmlxxcPACzTZr0P3JvukCga0TIdZD49WJGsw5cKySXuZ5cqykpkNAqkLz_NLAe7_gp7LORV28X8q8CfxYfb4eocnzCufCJ4ckvhAd02OnuXZCaaiI1Ytx/s1600/4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="783" data-original-width="863" height="362" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgPUYX3YoLxwgZLM1csE9pO_NCfmlxxcPACzTZr0P3JvukCga0TIdZD49WJGsw5cKySXuZ5cqykpkNAqkLz_NLAe7_gp7LORV28X8q8CfxYfb4eocnzCufCJ4ckvhAd02OnuXZCaaiI1Ytx/s400/4.png" width="400" /></a></div>
<br />
<a name='more'></a>The breakout board is breadboard friendly and the pins may be soldered as shown on the right in the photo below so that the labels could be easily seen.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhLmYgaH0FfLdcfKo5GvqhykmwWcnjm-Z80RRhLJCpq1zdg7Mgr5dlXhMIoMO5FpA_lCJuOZUDAmP36xN9B4GTpDIaAMaxvtAHKG5pzc1x7IfuwK3nV-58yOlziQCdnBOnnx14k3sLHPWMM/s1600/5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="416" data-original-width="698" height="237" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhLmYgaH0FfLdcfKo5GvqhykmwWcnjm-Z80RRhLJCpq1zdg7Mgr5dlXhMIoMO5FpA_lCJuOZUDAmP36xN9B4GTpDIaAMaxvtAHKG5pzc1x7IfuwK3nV-58yOlziQCdnBOnnx14k3sLHPWMM/s400/5.png" width="400" /></a></div>
<br />
<b>The Schematic</b><br />
<br />
Below is the schematic of the breakout board. Except for SD0, SD1, SD2, SD3, CMD, and CLK, all the other pads of the ESP32-S module are exposed and connected to the corresponding pin headers.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEib30V79vnXC4gHPy4WHjeoclE8yvAnPAj7d3kHm1EfYDgOEleiVonySF7aJq2MbEWVEmRl6lgVq1H60HGekoLUvSDS6lyaKnDHUwR1iJYgH4yDPAb2ilHgvf2a7YBnm1pQVbUmiCv3twy_/s1600/2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="456" data-original-width="800" height="225" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEib30V79vnXC4gHPy4WHjeoclE8yvAnPAj7d3kHm1EfYDgOEleiVonySF7aJq2MbEWVEmRl6lgVq1H60HGekoLUvSDS6lyaKnDHUwR1iJYgH4yDPAb2ilHgvf2a7YBnm1pQVbUmiCv3twy_/s400/2.png" width="400" /></a></div>
<b><br /></b>
<b>The Offer:</b><br />
<br />
Please find below my offer for the breakout board and the parts used.<br />
<br />
- ESP32-S Breakout Board: US$ 2/ea<br />
- Pin Head (40 x 1): US$0.5/ea<br />
- ESP32-S Module: US$5.42/ea<br />
<br />
Item Location: Taipei, TAIWAN<br />
Payment Method: Paypal<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi1U0dp7f_V1JznUGatwNdcZtC5b49ENSobBtrbz0S8IXWDF5WD466CIREk8qroTiTDl7pz_bOUnyOEI3wq75vOobzYWB6VNY6s6to-FkFTQf1SfSqpl8uVvy2cJNH6PwOvVwEce-IwTL9Y/s1600/3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="973" data-original-width="855" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi1U0dp7f_V1JznUGatwNdcZtC5b49ENSobBtrbz0S8IXWDF5WD466CIREk8qroTiTDl7pz_bOUnyOEI3wq75vOobzYWB6VNY6s6to-FkFTQf1SfSqpl8uVvy2cJNH6PwOvVwEce-IwTL9Y/s400/3.png" width="350" /></a></div>
<br />
<br />Wei-Hsiung Huanghttp://www.blogger.com/profile/09437875322676421890noreply@blogger.com0tag:blogger.com,1999:blog-3648927237801494248.post-18494695353459383182020-03-04T09:01:00.002+08:002020-03-04T09:04:40.149+08:00Eagle PCB Tip - Enable tented viaThis is a quick tip about how to enable tented via.<br />
<br />
Version: EaglePCB 6.6.0<br />
<br />
1. Check the size of the via.<br />
<br />
In the pic below, the via size (0.014) is 14mil.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQQTCvt8CMLOvVebNa71MrjFmySlXsZjpntVBCkTgpDA5Aglbk4vCSmdKohLoUv7-FCH1Ysw7ZhBnn7Gk2eIGNQvCa40-oPbe12DlxJrQAvijs1eFrV921ln1tyDjbfKrjFWkPLphFKJ66/s1600/2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="444" data-original-width="531" height="333" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQQTCvt8CMLOvVebNa71MrjFmySlXsZjpntVBCkTgpDA5Aglbk4vCSmdKohLoUv7-FCH1Ysw7ZhBnn7Gk2eIGNQvCa40-oPbe12DlxJrQAvijs1eFrV921ln1tyDjbfKrjFWkPLphFKJ66/s400/2.png" width="400" /></a></div>
<br />
<a name='more'></a>2. In DRC/Masks, set the "Limit" parameter to a large number. Vias only get solder mask if they are larger than the "limit" value.<br />
<br />
<u><b>Before</b></u><br />
<br />
The limit was 0mil before the change.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhSslYg96MGiOZOvvzbjAM3HJnRUhuG31A3Tmb-ZxV3fNcRmjMzr3koVoncX0YMEI8O2VR0ufh7k_ITFh9uzDXU9SFzV2p7pjbaxt_vyxPNvd4FPGuryNY_gbNpOroNUTuLbpJgMct2eOdw/s1600/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="575" data-original-width="974" height="235" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhSslYg96MGiOZOvvzbjAM3HJnRUhuG31A3Tmb-ZxV3fNcRmjMzr3koVoncX0YMEI8O2VR0ufh7k_ITFh9uzDXU9SFzV2p7pjbaxt_vyxPNvd4FPGuryNY_gbNpOroNUTuLbpJgMct2eOdw/s400/1.png" width="400" /></a></div>
<br />
<b><u>After</u></b><br />
<br />
Change the limit to 15mil.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgLw1TT1XD9_ZQ_CszqBdssyveoavKfOjmaYXxWZlgciV2gfDgRDymZ6Hc_cvPI5kPAqTkP9DZq1oPKG4RThwihNBEFDVtFEkU2KrPpMOh4K4WyL7OqK6vjGJU38Xf9bo-XzLED866NsVzR/s1600/3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="480" data-original-width="826" height="231" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgLw1TT1XD9_ZQ_CszqBdssyveoavKfOjmaYXxWZlgciV2gfDgRDymZ6Hc_cvPI5kPAqTkP9DZq1oPKG4RThwihNBEFDVtFEkU2KrPpMOh4K4WyL7OqK6vjGJU38Xf9bo-XzLED866NsVzR/s400/3.png" width="400" /></a></div>
<br />
All via with diameter smaller than 15mil will be covered.<br />
<br />
<b>Reference:</b><br />
<br />
<a href="https://www.avrfreaks.net/forum/eagle-layout-solder-mask-over-setting" target="_blank">https://www.avrfreaks.net/forum/eagle-layout-solder-mask-over-setting</a><br />
<br />
Tented Via's in Eagle<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/l-GiphuZLEg/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/l-GiphuZLEg?feature=player_embedded" width="320"></iframe></div>
<br />
PCB Via Calculator<br />
<a href="http://circuitcalculator.com/wordpress/2006/03/12/pcb-via-calculator/" target="_blank">http://circuitcalculator.com/wordpress/2006/03/12/pcb-via-calculator/</a>Wei-Hsiung Huanghttp://www.blogger.com/profile/09437875322676421890noreply@blogger.com0tag:blogger.com,1999:blog-3648927237801494248.post-36037246620339415632020-02-18T11:32:00.003+08:002020-02-18T11:34:41.937+08:00Raspberry Pi - Add support for power on / off buttonThis post is a quick write up of me following the instruction <a href="https://howchoo.com/g/mwnlytk3zmm/how-to-add-a-power-button-to-your-raspberry-pi" target="_blank">here</a> to create an on/off button for switching on/off the PI. When the PI is running, connecting GPIO3 to GND will cause the system to send out the <span style="background-color: #eeeeee;">sudo shutdown -h now</span> command to switch off the PI. When the PI is not running, connecting GPIO3 to GND will cause the PI to wake up and start running.<br />
<br />
<span style="color: red;">***IMPORTANT!! This is extremely important to shut down the PI using the <span style="background-color: #eeeeee;">sudo shutdown -h now</span> command to avoid corrupting the file system of the SD Card. If you experience trouble booting the PI after a sudden power outage, chances are the SD file system is corrupted and you will have to write a new Raspbian image to the SD Card and re-configure the Raspbian if a backup image is not available ***</span><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEijx-hgV__ZWCJNFLmbDNq5dVq7NmhFQeMupARP3a0KD6eFco6ZcYIozad8-_dG1ogxONdArX-zsjH97MU6elTbQNZ3gy_ehaheh5PIqKrfYjnYxumtQ7UwCjhvptgeMyTVRwKdfViYjJeo/s1600/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="445" data-original-width="576" height="308" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEijx-hgV__ZWCJNFLmbDNq5dVq7NmhFQeMupARP3a0KD6eFco6ZcYIozad8-_dG1ogxONdArX-zsjH97MU6elTbQNZ3gy_ehaheh5PIqKrfYjnYxumtQ7UwCjhvptgeMyTVRwKdfViYjJeo/s400/1.png" width="400" /></a></div>
<br />
<a name='more'></a><br />
<br />
1. Change the working directory to /home/pi using the <span style="background-color: #eeeeee;">cd /home/pi</span> command.<br />
<br />
2. Issue <span style="background-color: #eeeeee;">nano listen-for-shutdown.py</span> to edit a program.<br />
<br />
<div style="background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="line-height: 125%; margin: 0;">#!/usr/bin/env python</pre>
<pre style="line-height: 125%; margin: 0;"></pre>
<pre style="line-height: 125%; margin: 0;">import RPi.GPIO as GPIO
import subprocess
GPIO.setmode(GPIO.BCM)
GPIO.setup(3, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.wait_for_edge(3, GPIO.FALLING)
subprocess.call(['shutdown', '-h', 'now'], shell=False)
</pre>
</div>
<br />
Press "ctrl + x" followed by "y" then enter to save the program.<br />
<br />
3. Place the script in /usr/local/bin and make it executable:<br />
<br />
<span style="background-color: #eeeeee;">sudo mv listen-for-shutdown.py /usr/local/bin/</span><br />
<span style="background-color: #eeeeee;">sudo chmod +x /usr/local/bin/listen-for-shutdown.py</span><br />
<br />
4. Add another script called listen-for-shutdown.sh that will start/stop our service. To create the script:<br />
<br />
<span style="background-color: #eeeeee;">nano listen-for-shutdown.sh</span><br />
<br />
Enter the following code in that file and save it:<br />
<br />
<div style="background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="line-height: 125%; margin: 0;">#! /bin/sh
### BEGIN INIT INFO
# Provides: listen-for-shutdown.py
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
### END INIT INFO
# If you want a command to always run, put it here
# Carry out specific functions when asked to by the system
case "$1" in
start)
echo "Starting listen-for-shutdown.py"
/usr/local/bin/listen-for-shutdown.py &
;;
stop)
echo "Stopping listen-for-shutdown.py"
pkill -f /usr/local/bin/listen-for-shutdown.py
;;
*)
echo "Usage: /etc/init.d/listen-for-shutdown.sh {start|stop}"
exit 1
;;
esac
exit 0
</pre>
</div>
<br />
5. Place this file in /etc/init.d and make it executable.<br />
<br />
<span style="background-color: #eeeeee;">sudo mv listen-for-shutdown.sh /etc/init.d/</span><br />
<span style="background-color: #eeeeee;">sudo chmod +x /etc/init.d/listen-for-shutdown.sh</span><br />
<br />
6. Now we'll register the script to run on boot.<br />
<br />
<span style="background-color: #eeeeee;">sudo update-rc.d listen-for-shutdown.sh defaults</span><br />
<br />
7. Since the script won't be running, we'll go ahead and start it with:<br />
<br />
<span style="background-color: #eeeeee;">sudo /etc/init.d/listen-for-shutdown.sh start</span><br />
<br />
A message similar to the below one will appear. Ignore it.<br />
<br />
<div style="background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="line-height: 125%; margin: 0;">pi@raspberrypi:~ $ /usr/local/bin/listen-for-shutdown.py:7: RuntimeWarning: A physical pull up resistor is fitted on this channel!
GPIO.setup(3, GPIO.IN, pull_up_down=GPIO.PUD_UP)
</pre>
</div>
<br />
There's nothing to build here, but we need to understand how to wake up the Pi from a halt state before we build the shutdown functionality. Simply put, shorting pins 5 and 6 (GPIO3 and GND) together will wake the Pi up from a halt state.<br />
<br />
An easy way to test this is to shut down the Pi with <span style="background-color: #eeeeee;">sudo shutdown -h now</span>, and connect pins 5 and 6 with a female to female cable. You only need to short them momentarily. Then you should find that the Pi is "awake".<br />
<br />
<b>Reference:</b><br />
<br />
How to Add a Power Button to Your Raspberry Pi<br />
<a href="https://howchoo.com/g/mwnlytk3zmm/how-to-add-a-power-button-to-your-raspberry-pi" target="_blank">https://howchoo.com/g/mwnlytk3zmm/how-to-add-a-power-button-to-your-raspberry-pi</a>Wei-Hsiung Huanghttp://www.blogger.com/profile/09437875322676421890noreply@blogger.com0tag:blogger.com,1999:blog-3648927237801494248.post-50855121478672423102020-02-17T15:56:00.000+08:002020-02-18T11:33:24.292+08:00Raspberry Pi - Headless installation of Raspbian OS on Raspberry Pi Zero WThis post is about how to install Raspbian OS onto Raspberry Pi Zero W headlessly (without physically attaching monitor, keyboard, and mouse to the Pi Zero W).<br />
<br />
<b><span style="font-size: large;">Download OS Image</span></b><br />
<br />
Download the OS image from the link below.<br />
<br />
<a href="https://www.raspberrypi.org/downloads/raspbian/" target="_blank">https://www.raspberrypi.org/downloads/raspbian/</a><br />
<br />
For my application, I use the lite version.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjV4X5YTAw4LGbFPL3OQQDYOaBYogIDDC2x1J-94S3NuR_CfMutOfac248j826qZQXhxuH5bjaGOEc6X-9yNtYVrPv8k0GjmqZ7q5Qq32beguRsIHIDUE0LQsMV7JVOHByD3RJ_LKzz4Nco/s1600/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="545" data-original-width="932" height="374" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjV4X5YTAw4LGbFPL3OQQDYOaBYogIDDC2x1J-94S3NuR_CfMutOfac248j826qZQXhxuH5bjaGOEc6X-9yNtYVrPv8k0GjmqZ7q5Qq32beguRsIHIDUE0LQsMV7JVOHByD3RJ_LKzz4Nco/s640/1.png" width="640" /></a></div>
<br />
<a name='more'></a><b><span style="font-size: large;">Write the OS image to SD Card</span></b><br />
<br />
Use tools such as <a href="https://sourceforge.net/projects/win32diskimager/" target="_blank">win32imagewriter</a> or <a href="https://www.balena.io/etcher/" target="_blank">balenaEtcher</a> to write the image to an SD Card.<br />
<br />
<b><span style="font-size: large;">Enable SSH</span></b><br />
<br />
For security reasons, ssh is no longer enabled by default. To enable it you need to place a blank text file called "ssh" in the root of the boot SD by doing the following:<br />
<br />
1. Run Notepad;<br />
2. In a new file put in one space and nothing more;<br />
3. Click File / Save As ...;<br />
4. Be sure to set Save as type to All Files (so the file is NOT saved with a .txt extension);<br />
5. Call the file "ssh" and save it;<br />
6. Close the file.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVcCfLN3816AdnoUnsFeJ6HprQrF8tdUULrny_EJ9i8e6ZO4N0EadfmN883CuJGeamc0dVlNdKXMmhkHCiEZMttpuBen4pmddATvolglDlxurLl4iHtRBW_AEsEgktYgZ7zX8rr_qNk8FI/s1600/5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="335" data-original-width="447" height="238" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVcCfLN3816AdnoUnsFeJ6HprQrF8tdUULrny_EJ9i8e6ZO4N0EadfmN883CuJGeamc0dVlNdKXMmhkHCiEZMttpuBen4pmddATvolglDlxurLl4iHtRBW_AEsEgktYgZ7zX8rr_qNk8FI/s320/5.png" width="320" /></a></div>
<br />
<b><span style="font-size: large;">Add Network Info</span></b><br />
<br />
To add network info you need to create a second text file called <span style="background-color: #eeeeee;">wpa_supplicant.conf</span> and place that in the root of the boot SD too.<br />
<br />
1. Run Notepad;<br />
2. Paste in the contents below (adjusting for the name of your country code, network name and network password):<br />
<br />
<span style="background-color: #eeeeee;">country=US</span><br />
<span style="background-color: #eeeeee;">ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev</span><br />
<span style="background-color: #eeeeee;">update_config=1</span><br />
<span style="background-color: #eeeeee;"><br /></span>
<span style="background-color: #eeeeee;">network={</span><br />
<span style="background-color: #eeeeee;"> ssid="NETWORK-NAME"</span><br />
<span style="background-color: #eeeeee;"> psk="NETWORK-PASSWORD"</span><br />
<span style="background-color: #eeeeee;">}</span><br />
<br />
3. Click File / Save As ...<br />
4. Be sure to set Save as type to All Files (so the file is NOT saved with a .txt extension)<br />
5. Call the file <span style="background-color: #eeeeee;">wpa_supplicant.conf </span>and save it<br />
6. Close the file<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgVR9ZZS-B6NTFmFxVzfI76IFk0w8Eg7TwZmjxQdI5wS215uKZ7WpT8Ds1wqQh7YIG7ITAYUCZuc-lyLd6w4nVhlUyPkNRwbqJJzoplkphunBIv1aSwB83AQXO8H-iToVkX2hL6rxIXBP-j/s1600/4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="331" data-original-width="496" height="212" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgVR9ZZS-B6NTFmFxVzfI76IFk0w8Eg7TwZmjxQdI5wS215uKZ7WpT8Ds1wqQh7YIG7ITAYUCZuc-lyLd6w4nVhlUyPkNRwbqJJzoplkphunBIv1aSwB83AQXO8H-iToVkX2hL6rxIXBP-j/s320/4.png" width="320" /></a></div>
<br />
<span style="font-size: large;"><b>Connect to your board</b></span><br />
<br />
Insert the SD card into the Pi Zero W and connect it to a power source; a Micro-USB power cable into the power port will do the trick. Once it powers up it takes some time to boot and connect to the WiFi, usually from 45 to 90 seconds.<br />
<br />
Using nmap or a network scanner like "Advanced IP Scanner" you have to obtain the new device connected to your network. The Pi also exposes raspberrypi as a hostname. Using the IP address you can SSH your board as:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjysVtrBGQ-PqA2wI_5D41YfIvD0drNmVW8hZ5gR41EhJIu3xmotdKkOhWwSzeCZljyq4x4dOEVBZggUSvLzjuXABUJQwiT7LE9yZ1AHLS9s-QKdTGQkqz0SXjzbhn7GnaqDiGTWR9OpHZU/s1600/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="589" data-original-width="958" height="245" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjysVtrBGQ-PqA2wI_5D41YfIvD0drNmVW8hZ5gR41EhJIu3xmotdKkOhWwSzeCZljyq4x4dOEVBZggUSvLzjuXABUJQwiT7LE9yZ1AHLS9s-QKdTGQkqz0SXjzbhn7GnaqDiGTWR9OpHZU/s400/1.png" width="400" /></a></div>
<br />
Launch PuTTY, enter the IP address found above and set the port number to 22 (default SSH port), then click the Open button to connect.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjqtSsXamIAHAlm6b4A7LaIC9eJdD47uWsYh_ykOwYiIXkfvnh3OHk7iHNz-rC_Id1va047bNqaQ1vFEyUgEgAPSbgGflztSzJp-7-7etcfqYfsAedBMVc9EoFnR1GIGgmGKcdK3GScnb4_/s1600/5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="443" data-original-width="461" height="306" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjqtSsXamIAHAlm6b4A7LaIC9eJdD47uWsYh_ykOwYiIXkfvnh3OHk7iHNz-rC_Id1va047bNqaQ1vFEyUgEgAPSbgGflztSzJp-7-7etcfqYfsAedBMVc9EoFnR1GIGgmGKcdK3GScnb4_/s320/5.png" width="320" /></a></div>
<br />
Click "Yes" when you see a warning message similar to the one below.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_5fpVmesX44p-YiXgIUAAViInpEGck96d-49rMf9HLpw_lu09lK9aAO-SDNQaG7A4il1vtGXxN88hkETpoR95VlJLeRfiod3epAs6Hrhl8M4OoXCdElL6KnQ3vwZg_uflWbSab3BqxNDR/s1600/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="375" data-original-width="455" height="263" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_5fpVmesX44p-YiXgIUAAViInpEGck96d-49rMf9HLpw_lu09lK9aAO-SDNQaG7A4il1vtGXxN88hkETpoR95VlJLeRfiod3epAs6Hrhl8M4OoXCdElL6KnQ3vwZg_uflWbSab3BqxNDR/s320/1.png" width="320" /></a></div>
<br />
Enter the default username (pi) and password (raspberry) when prompted. After which you are ready to go.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjKxqFqy1PSM7F4-PkVuZJGMYDxsQkutKoQ8hJeOspaAr0hfZuZZ_qDlrIJW7QkAbsrR7FdS4b2SRkzxhARRXuN98Dg11P2xnIDg3YB5_5czyVYsgwocNTCgRUpz1XYoHDjki0_tSp8EWTC/s1600/3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="452" data-original-width="700" height="257" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjKxqFqy1PSM7F4-PkVuZJGMYDxsQkutKoQ8hJeOspaAr0hfZuZZ_qDlrIJW7QkAbsrR7FdS4b2SRkzxhARRXuN98Dg11P2xnIDg3YB5_5czyVYsgwocNTCgRUpz1XYoHDjki0_tSp8EWTC/s400/3.png" width="400" /></a></div>
<br />
<b><span style="font-size: large;">Upgrade the installed packages</span></b><br />
<br />
<span style="background-color: #eeeeee;">sudo apt-get update</span><br />
<span style="background-color: #eeeeee;">sudo apt-get upgrade</span> or <span style="background-color: #eeeeee;">sudo apt-get dist-upgrade</span><br />
<br />
or, you could combine the two commands into a one liner.<br />
<br />
<span style="background-color: #eeeeee;">sudo apt-get update && sudo apt-get dist-upgrade</span><br />
<br />
<span style="font-size: large;"><b>Check disk usage</b></span><br />
<br />
Use the df command to show the amount of disk space used and available on Linux file systems.<br />
<br />
<!-- HTML generated using hilite.me -->On an 8GB SD Card, there is around 5.6GB available space left after a fresh installation of Raspban Buster Lite.<br />
<br />
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="line-height: 125%; margin: 0px;"><span style="background-color: white;">pi@raspberrypi:~ $ </span><span style="background-color: #eeeeee;">df</span><span style="background-color: white;">
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/root 7366160 1448168 5583152 21% /
devtmpfs 217212 0 217212 0% /dev
tmpfs 221540 0 221540 0% /dev/shm
tmpfs 221540 5908 215632 3% /run
tmpfs 5120 4 5116 1% /run/lock
tmpfs 221540 0 221540 0% /sys/fs/cgroup
/dev/mmcblk0p1 258095 53463 204632 21% /boot
tmpfs 44308 0 44308 0% /run/user/1000
pi@raspberrypi:~ $
</span></pre>
</div>
<br />
<b>Reference:</b><br />
<br />
HEADLESS PI ZERO W WIFI SETUP (WINDOWS)<br />
<a href="https://desertbot.io/blog/headless-pi-zero-w-wifi-setup-windows" target="_blank">https://desertbot.io/blog/headless-pi-zero-w-wifi-setup-windows</a><br />
<br />
Getting Started with the Raspberry Pi Zero Wireless<br />
<a href="https://learn.sparkfun.com/tutorials/getting-started-with-the-raspberry-pi-zero-wireless/all" target="_blank">https://learn.sparkfun.com/tutorials/getting-started-with-the-raspberry-pi-zero-wireless/all</a><br />
<br />
Headless Raspberry Pi Zero W Setup<br />
<a href="https://dev.to/vorillaz/headless-raspberry-pi-zero-w-setup-3llj" target="_blank">https://dev.to/vorillaz/headless-raspberry-pi-zero-w-setup-3llj</a><br />
<br />
Raspberry Pi Zero Time-Lapse Camera<br />
<a href="https://projects.raspberrypi.org/en/projects/raspberry-pi-zero-time-lapse-cam/3" target="_blank">https://projects.raspberrypi.org/en/projects/raspberry-pi-zero-time-lapse-cam/3</a><br />
<br />
What does “sudo apt-get update” do?<br />
<a href="https://askubuntu.com/questions/222348/what-does-sudo-apt-get-update-do" target="_blank">https://askubuntu.com/questions/222348/what-does-sudo-apt-get-update-do</a><br />
<br />Wei-Hsiung Huanghttp://www.blogger.com/profile/09437875322676421890noreply@blogger.com0tag:blogger.com,1999:blog-3648927237801494248.post-83432866453004528412020-02-17T15:55:00.001+08:002020-02-18T11:21:12.087+08:00Raspberry Pi - How to run a program on startupThis is a quick write up of me following the instruction <a href="https://learn.sparkfun.com/tutorials/how-to-run-a-raspberry-pi-program-on-startup/all" target="_blank">here</a> to test out how to use the GPIO of Raspberry Pi and make a program to auto-execute on startup.<br />
<br />
<b>Wiring Diagram</b><br />
<br />
Wire up the Pi with an LED and a resistor as shown below.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEib3qVzJA9p1F8kYTo5KTsn_RHbKX52fkqPM7JB2NFtCZeP_6FvZbRuH0Lp0NuOjVapiG6whIYFKzNnT6Ve73VOp5PyJe_ctcG1V1kRNEDmAB3p0PzqMx_hCeUcxYk3pLX60ZS03UkWC1hH/s1600/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="430" data-original-width="599" height="286" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEib3qVzJA9p1F8kYTo5KTsn_RHbKX52fkqPM7JB2NFtCZeP_6FvZbRuH0Lp0NuOjVapiG6whIYFKzNnT6Ve73VOp5PyJe_ctcG1V1kRNEDmAB3p0PzqMx_hCeUcxYk3pLX60ZS03UkWC1hH/s400/1.png" width="400" /></a></div>
<br />
<a name='more'></a>On your Raspberry Pi, open a terminal, and make sure you are in your home directory:<br />
<br />
<span style="background-color: #eeeeee;">cd /home/pi</span><br />
<br />
Open a new document named blink.py<br />
<br />
<span style="background-color: #eeeeee;">nano blink.py</span><br />
<br />
<b>The Code (blink.py)</b><br />
<br />
<div style="background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="line-height: 125%; margin: 0;">import time
import RPi.GPIO as GPIO
# Pin definitions
led_pin = 12
# Use "GPIO" pin numbering
GPIO.setmode(GPIO.BCM)
# Set LED pin as output
GPIO.setup(led_pin, GPIO.OUT)
# Blink forever
try:
while True:
GPIO.output(led_pin, GPIO.HIGH) # Turn LED on
time.sleep(1) # Delay for 1 second
GPIO.output(led_pin, GPIO.LOW) # Turn LED off
time.sleep(1) # Delay for 1 second
# When you press ctrl+c, nicely release GPIO resources
finally:
GPIO.cleanup()
</pre>
</div>
<br />
Save it with ctrl + x, then press y when asked to save, and press enter. Run the program with the following:<br />
<br />
<span style="background-color: #eeeeee;">python blink.py</span><br />
<br />
You should see the LED begin to blink on and off. Press ctrl + c to stop the program.<br />
<br />
<b>Make the program to auto start on bootup using the rc.local method.</b><br />
<br />
Running your program from rc.local is likely the easiest method, but because rc.local is executed before X starts, you will not have access to GUI elements. As a result, it's recommended that you only use rc.local for starting programs that do not have graphical elements.<br />
<br />
The rc.local script is executed after all of the normal system services have been started (including networking, if enabled) and just before the system switches to a multiuser run level (where you would traditionally get a login prompt). While most Linux distributions do not need an rc.local, it's usually the easiest way to get a program to run on boot with Raspbian.<br />
<br />
Modify rc.local<br />
<br />
You will need root-level access to modify rc.local, so do so with sudo:<br />
<br />
<span style="background-color: #eeeeee;">sudo nano /etc/rc.local</span><br />
<br />
Scroll down, and just before the exit 0 line, enter the following:<br />
<br />
<span style="background-color: #eeeeee;">python /home/pi/blink.py &</span><br />
<br />
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="line-height: 125%; margin: 0px;"><span style="background-color: white;">pi@raspberrypi:~ $ cat /etc/rc.local
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
printf "My IP address is %s\n" "$_IP"
fi
</span><span style="background-color: yellow;">python /home/pi/blink.py &</span><span style="background-color: white;">
exit 0
</span></pre>
</div>
<br />
<span style="color: red;">Note: the ampersand (&) at the end of the line is needed so that your Python script runs in a different process and does not block execution of the boot process. Without it, the rc.local script would wait for your script to end before continuing, and if you have an infinite loop (like in our blink.py program), you would never get a login prompt.</span><br />
<br />
Notice that we are calling our script with the absolute file location (/home/pi/blink.py), as calling python blink.py from within rc.local will cause python to look for a local file (i.e. blink.py file located in the same directory as rc.local). We use the absolute file location to make it explicit to Python where our program can be found.<br />
<br />
Save and exit with ctrl + x, followed by y when prompted to save, and then enter.<br />
<br />
Test it by restarting your Pi with <span style="background-color: #eeeeee;">sudo reboot</span>. You should see the LED begin to blink on and off after the system reboot.<br />
<br />
<b>How to stop your program</b><br />
<br />
You might notice that your program runs great, but there's no easy way to stop it! The simplest method would be to remove (or comment out) the line you added in rc.local followed by a reboot, but that takes a lot of time.<br />
<br />
The quickest way to stop your program is to kill its Linux process. In a terminal, enter the following command:<br />
<br />
<span style="background-color: #eeeeee;">sudo ps -ax | grep python</span><br />
<br />
ps -ax tells Linux to list out all the current processes. We pipe that list to grep, which allows us to search for keywords. We're looking for python in this example, but feel free to change it to the name of your program or whatever you are using to run your program.<br />
<br />
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="line-height: 125%; margin: 0px;"><span style="background-color: white;">pi@raspberrypi:~ $ </span><span style="background-color: #eeeeee;">sudo ps -ax | grep python</span><span style="background-color: white;">
</span><span style="background-color: yellow;">420</span><span style="background-color: white;"> ? S 0:00 python /home/pi/blink.py
675 pts/0 S+ 0:00 grep --color=auto python
pi@raspberrypi:~ $
</span></pre>
</div>
<br />
Find the process ID (PID) number to the left of the listed process, and use the kill command to terminate that process:<br />
<br />
<span style="background-color: #eeeeee;">sudo kill <PID></span><br />
<br />
In the example above, the PID is 420. Issuing "<span style="background-color: #eeeeee;">sudo kill 420</span>" will immediately kill the program and stop the blinking of the LED.<br />
<br />
<span style="color: red;">IMPORTANT! Make sure you type the PID correctly! If you kill the wrong process, you could halt Linux, and you would need to reboot again.</span><br />
<br />
<b>How to Stop Your Program from Running on Boot</b><br />
<br />
If you no longer want your program to run on boot, simply open rc.local with:<br />
<br />
<span style="background-color: #eeeeee;">sudo nano /etc/rc.local</span><br />
<br />
Delete the line that you added to run your program, and save and exit with ctrl + x and y. Reboot your computer, and your program should no longer run after boot.<br />
<br />
<b>Reference:</b><br />
<br />
How to Run a Raspberry Pi Program on Startup<br />
<a href="https://learn.sparkfun.com/tutorials/how-to-run-a-raspberry-pi-program-on-startup/all" target="_blank">https://learn.sparkfun.com/tutorials/how-to-run-a-raspberry-pi-program-on-startup/all</a>Wei-Hsiung Huanghttp://www.blogger.com/profile/09437875322676421890noreply@blogger.com0tag:blogger.com,1999:blog-3648927237801494248.post-5899143330169368192020-02-17T09:15:00.000+08:002020-02-17T09:15:12.440+08:00Raspberry Pi - How to mount an USB Flash DriveThis is a quick write up of me following the instruction below on how to mount an USB Flash Drive to my Raspberry Pi.<br />
<br />
How To Mount A USB Flash Disk On The Raspberry Pi<br />
<a href="https://www.raspberrypi-spy.co.uk/2014/05/how-to-mount-a-usb-flash-disk-on-the-raspberry-pi/" target="_blank">https://www.raspberrypi-spy.co.uk/2014/05/how-to-mount-a-usb-flash-disk-on-the-raspberry-pi/</a><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhWtSvaryJqCRKgS9jgLkgQtZDA4aZv0MyVbd-PqVLtRmT2PkBJAVkvknnIzEwF4wPCg3hlzVjlXvUmQTTMXvsrdTwv1EkGto3aFThor15MtW7cgRkare2ZAGBw1IKPvLx7LgN1JhCZ5sko/s1600/4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="364" data-original-width="406" height="286" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhWtSvaryJqCRKgS9jgLkgQtZDA4aZv0MyVbd-PqVLtRmT2PkBJAVkvknnIzEwF4wPCg3hlzVjlXvUmQTTMXvsrdTwv1EkGto3aFThor15MtW7cgRkare2ZAGBw1IKPvLx7LgN1JhCZ5sko/s320/4.png" width="320" /></a></div>
<br />
<a name='more'></a><b>1. Be sure the RPI is power off</b><br />
<br />
Plugging in the USB Flash Drive when RPI is on will cause the RPI to re-boot and it could crash the system.<br />
<br />
<b>2. Plug in the USB Flash Drive</b><br />
<br />
<b>3. Switch on the power to RPI</b><br />
<br />
<b>4. List all block devices</b><br />
<br />
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="line-height: 125%; margin: 0px;"><span style="background-color: white;">pi@raspberrypi:~ $ </span><span style="background-color: #eeeeee;">lsblk</span><span style="background-color: white;">
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
</span><span style="background-color: yellow;">sda 8:0 1 14.7G 0 disk
└─sda1 8:1 1 14.7G 0 part</span><span style="background-color: white;">
mmcblk0 179:0 0 14.9G 0 disk
</span><span style="background-color: cyan;">├─mmcblk0p1 179:1 0 256M 0 part /boot
└─mmcblk0p2 179:2 0 14.6G 0 part /</span><span style="background-color: white;">
pi@raspberrypi:~ $
</span></pre>
</div>
<br />
In the output above, sda represents the external USB Flash Drive, mmcblk0 represents the internal SD Card.<br />
<br />
<b>5. Identify the devices unique ID (UUID).</b><br />
<br />
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="line-height: 125%; margin: 0px;"><span style="background-color: white;">pi@raspberrypi:~ $ </span><span style="background-color: #eeeeee;">ls -l /dev/disk/by-uuid/</span><span style="background-color: white;">
total 0
lrwxrwxrwx 1 root root 10 Feb 16 08:18 </span><span style="background-color: yellow;">2420-5E40</span><span style="background-color: white;"> -> ../../sda1
lrwxrwxrwx 1 root root 15 Feb 16 08:18 2ab3f8e1-7dc6-43f5-b0db-dd5759d51d4e -> ../../mmcblk0p2
lrwxrwxrwx 1 root root 15 Feb 16 08:18 5203-DB74 -> ../../mmcblk0p1
pi@raspberrypi:~ $
</span></pre>
</div>
<br />
Note down the UUID for /sda1, in my case, it's "2420-5E40". This UUID will be used later.<br />
<br />
<b>6. Create a mount point</b><br />
<br />
A mount point is a directory that points to the contents of the USB Flash Drive. Use the command below to create a directory (/media/usb).<br />
<br />
<span style="background-color: #eeeeee;">sudo mkdir /media/usb</span><br />
<br />
Now that we need to make sure the Pi user owns this folder :<br />
<br />
<span style="background-color: #eeeeee;">sudo chown -R pi:pi /media/usb</span><br />
<div>
<br /></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="line-height: 125%; margin: 0px;"><span style="background-color: white;">pi@raspberrypi:/media $ ls -l
total 4
drwxr-xr-x 2 </span><span style="background-color: yellow;">root root</span><span style="background-color: white;"> 4096 Feb 16 09:15 usb
pi@raspberrypi:/media $ sudo chown -R pi:pi /media/usb
pi@raspberrypi:/media $ ls -l
total 4
drwxr-xr-x 2 </span><span style="background-color: yellow;">pi pi</span><span style="background-color: white;"> 4096 Feb 16 09:15 usb
pi@raspberrypi:/media $
</span></pre>
</div>
<br />
Below is the meaning of each field.<br />
<br />
1 | Permissions | drwxr-xr-x<br />
2 | # of Hard Links | 2<br />
3 | User That Owns File or Directory | root<br />
4 | Group for File or Directory | root<br />
5 | File Size | 4096<br />
6 | Timestamp | Feb 16 09:15<br />
7 | Filename | usb<br />
<br />
Ref.: <a href="https://www.liquidweb.com/kb/7-extremely-useful-linux-commands-for-beginners/" target="_blank">https://www.liquidweb.com/kb/7-extremely-useful-linux-commands-for-beginners/</a><br />
<br />
Note that in the output above, before executing the command <span style="background-color: #eeeeee;">sudo chown -R pi:pi /media/usb</span>, the owner of the folder is root, the owner changed to pi after the command is executed.<br />
<br />
<b>7. Manually mounting the drive</b><br />
<br />
To manually mount the drive use the following command :<br />
<br />
<span style="background-color: #eeeeee;">sudo mount /dev/sda1 /media/usb -o uid=pi,gid=pi</span><br />
<br />
This will mount the drive so that the ordinary Pi user can write to it. Omitting the “-o uid=pi,gid=pi” would mean you could only write to it using “sudo”.<br />
<br />
Now you can read, write and delete files using “/media/usb” as a destination or source without needing to use sudo.<br />
<br />
<b>8. Un-mounting the drive</b><br />
<br />
You don’t need to manually un-mount if you shutdown your Pi but if you need to remove the drive at any other time you should un-mount it first. Only the user that mounted the drive can un-mount it.<br />
<br />
<span style="background-color: #eeeeee;">umount /media/usb</span><br />
<br />
If you used the fstab file to auto-mount it you will need to use :<br />
<br />
<span style="background-color: #eeeeee;">sudo umount /media/usb</span><br />
<br />
<b>9. Auto mount</b><br />
<br />
When you restart your Pi your mounts will be lost and you will need to repeat Step 7 (Manually mounting the drive). If you want your USB drive to be mounted when the system starts you can edit the fstab file :<br />
<br />
<span style="background-color: #eeeeee;">sudo nano /etc/fstab</span><br />
<br />
Then add the following line at the end :<br />
<br />
<span style="background-color: #eeeeee;">UUID=<span style="color: red;">2420-5E40</span> /media/usb vfat auto,nofail,noatime,users,rw,uid=pi,gid=pi 0 0</span><br />
<br />
<span style="color: red;"><b>***IMPORTANT - </b></span><b style="color: red;">Be sure to set the correct UUID ***</b><br />
<br />
The “nofail” option allows the boot process to proceed if the drive is not plugged in. The “noatime” option stops the file access time being updated every time a file is read from the USB stick. This helps improve performance.<br />
<br />
Below is how my fstab file looks like after adding the line to auto mount the USB Drive.<br />
<br />
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="line-height: 125%; margin: 0px;"><span style="background-color: white;">pi@raspberrypi:/media $ </span><span style="background-color: #eeeeee;">sudo nano /etc/fstab</span><span style="background-color: white;">
pi@raspberrypi:/media $ </span><span style="background-color: #eeeeee;">cat nano /etc/fstab</span><span style="background-color: white;">
cat: nano: No such file or directory
proc /proc proc defaults 0 0
PARTUUID=6c586e13-01 /boot vfat defaults 0 2
PARTUUID=6c586e13-02 / ext4 defaults,noatime 0 1
# a swapfile is not a swap partition, no line here
# use dphys-swapfile swap[on|off] for that
</span><span style="background-color: yellow;">UUID=2420-5E40 /media/usb vfat auto,nofail,noatime,users,rw,uid=pi,gid=pi 0 0</span><span style="background-color: white;">
pi@raspberrypi:/media $
</span></pre>
</div>
<br />
<b>Additional note about file systems</b><br />
<br />
In the examples above I specified “vfat” as the file system of the device as it was formatted as FAT32. If you need to change the file system replace references of “vfat” with “ntfs-3g”, “ext3” or “ext4”.<br />
<br />
If you are using NTFS you will also need to install the following package :<br />
<br />
<span style="background-color: #eeeeee;">sudo apt-get install ntfs-3g</span><br />
<br />Wei-Hsiung Huanghttp://www.blogger.com/profile/09437875322676421890noreply@blogger.com0tag:blogger.com,1999:blog-3648927237801494248.post-66455508314313768182020-02-03T13:53:00.003+08:002020-02-03T13:59:47.175+08:00Seeing LoRa transmission in action using a RTL-SDR dongle and SDR# softwareIn this post, I use a RTL-SDR dongle and SDR# software to watch the transmission of LoRa signal at 433MHz. For info. on how to set up the RTL-SDR, please refer to the post below.<br />
<br />
<a href="https://wei48221.blogspot.com/2020/02/how-to-setup-rtl-sdr-dongle-to-work.html" target="_blank">https://wei48221.blogspot.com/2020/02/how-to-setup-rtl-sdr-dongle-to-work.html</a><br />
<br />
<a name='more'></a><b>Sender Code (running on ESP8266)</b><br />
<br />
<div style="background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<table><tbody>
<tr><td><pre style="line-height: 125%; margin: 0;"> 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65</pre>
</td><td><pre style="line-height: 125%; margin: 0;">/*********
Modified from the examples of the Arduino LoRa library
More resources: https://randomnerdtutorials.com
*********/
#include <SPI.h>
#include <LoRa.h>
//define the pins used by the transceiver module
//#define ss 5
//#define rst 14
//#define dio0 2 // GO of the Adafruit RFM9x breakout module
#define ss 15
#define rst 0
#define dio0 16 // GO of the Adafruit RFM9x breakout module
int counter = 0;
void setup() {
//initialize Serial Monitor
Serial.begin(115200);
while (!Serial);
Serial.println("LoRa Sender");
//setup LoRa transceiver module
LoRa.setPins(ss, rst, dio0);
//replace the LoRa.begin(---E-) argument with your location's frequency
//433E6 for Asia
//866E6 for Europe
//915E6 for North America
/*
while (!LoRa.begin(866E6)) {
Serial.println(".");
delay(500);
}
*/
while (!LoRa.begin(433E6)) {
Serial.println(".");
delay(500);
}
// Change sync word (0xF3) to match the receiver
// The sync word assures you don't get LoRa messages from other LoRa transceivers
// ranges from 0-0xFF
LoRa.setSyncWord(0xF3);
Serial.println("LoRa Initializing OK!");
}
void loop() {
Serial.print("Sending packet: ");
Serial.println(counter);
//Send LoRa packet to receiver
LoRa.beginPacket();
LoRa.print("hello ");
LoRa.print(counter);
LoRa.endPacket();
counter++;
delay(10000);
}
</pre>
</td></tr>
</tbody></table>
</div>
<br />
<b>Receiver Code (running on ESP32)</b><br />
<br />
<div style="background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<table><tbody>
<tr><td><pre style="line-height: 125%; margin: 0;"> 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67</pre>
</td><td><pre style="line-height: 125%; margin: 0;">/*********
Modified from the examples of the Arduino LoRa library
More resources: https://randomnerdtutorials.com
*********/
#include <SPI.h>
#include <LoRa.h>
//define the pins used by the transceiver module
//#define ss 5
//#define rst 14
//#define dio0 2
#define ss 21 // GPIO21 of ESP32
#define rst 17 // GPIO17 of ESP32
#define dio0 16 // Connect to G0 of the Adafruit RFM9x breakout module
void setup() {
//initialize Serial Monitor
Serial.begin(115200);
while (!Serial);
Serial.println("LoRa Receiver");
//setup LoRa transceiver module
LoRa.setPins(ss, rst, dio0);
//replace the LoRa.begin(---E-) argument with your location's frequency
//433E6 for Asia
//866E6 for Europe
//915E6 for North America
/*
while (!LoRa.begin(866E6)) {
Serial.println(".");
delay(500);
}
*/
while (!LoRa.begin(433E6)) {
Serial.println(".");
delay(500);
}
// Change sync word (0xF3) to match the receiver
// The sync word assures you don't get LoRa messages from other LoRa transceivers
// ranges from 0-0xFF
LoRa.setSyncWord(0xF3);
Serial.println("LoRa Initializing OK!");
}
void loop() {
// try to parse packet
int packetSize = LoRa.parsePacket();
if (packetSize) {
// received a packet
Serial.print("Received packet '");
// read packet
while (LoRa.available()) {
String LoRaData = LoRa.readString();
Serial.print(LoRaData);
}
// print RSSI of packet
Serial.print("' with RSSI ");
Serial.println(LoRa.packetRssi());
}
}
</pre>
</td></tr>
</tbody></table>
</div>
<br />
<b>Serial Output</b><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj6gkqleZ_IKoyJ-zmswtOtLvCvg7uxcnuj4OzqdgYEMP7KwpaZQGMWAWQASVLapysgohyphenhyphenYzgpLite3bO0CNnF0IhWyz1ykqFPDtv3gcwg0yoIIWFxmAzG4j1or2-EKridmz0AgCojCsFyL/s1600/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="691" data-original-width="1211" height="364" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj6gkqleZ_IKoyJ-zmswtOtLvCvg7uxcnuj4OzqdgYEMP7KwpaZQGMWAWQASVLapysgohyphenhyphenYzgpLite3bO0CNnF0IhWyz1ykqFPDtv3gcwg0yoIIWFxmAzG4j1or2-EKridmz0AgCojCsFyL/s640/1.png" width="640" /></a></div>
<br />
<b>SDR# Display (Youtube Video)</b><br />
<br />
The pulse at 433MHz is the signal sent by the sender.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/3TWT8fXjcug/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/3TWT8fXjcug?feature=player_embedded" width="320"></iframe></div>
<br />
<b>Reference:</b><br />
<br />
QUICK START GUIDE<br />
<a href="https://www.rtl-sdr.com/rtl-sdr-quick-start-guide/" target="_blank">https://www.rtl-sdr.com/rtl-sdr-quick-start-guide/</a><br />
<br />
Airspy<br />
<a href="https://airspy.com/" target="_blank">https://airspy.com/</a>Wei-Hsiung Huanghttp://www.blogger.com/profile/09437875322676421890noreply@blogger.com0tag:blogger.com,1999:blog-3648927237801494248.post-51578550568181603672020-02-02T18:38:00.001+08:002020-02-02T18:43:19.602+08:00How to setup an RTL2832U DVB dongle as RTL-SDR to work with SDR# (SDR Sharp)This post is a quick record of how I set up an RTL2832U DVB dongle similar to the one shown below as RTL-SDR to work with SDR# by following the instruction at <a href="https://www.rtl-sdr.com/rtl-sdr-quick-start-guide/" target="_blank">https://www.rtl-sdr.com/rtl-sdr-quick-start-guide/</a>.<br />
<br />
OS: Windows 8.1.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhxGee-Hs9_7UfvEqdoQwpUXJ-Pgpn_qCYm8tHUph9UaohdcLGsH8qhOjzYF5Fe7O_LdkniLu_lXMAG0O6FQ6UZQR2fv3S76il4DEWINvv4FRQdEVfteyoEEBHiIPIh5-MM2UTPRWTQ_rRu/s1600/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="413" data-original-width="388" height="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhxGee-Hs9_7UfvEqdoQwpUXJ-Pgpn_qCYm8tHUph9UaohdcLGsH8qhOjzYF5Fe7O_LdkniLu_lXMAG0O6FQ6UZQR2fv3S76il4DEWINvv4FRQdEVfteyoEEBHiIPIh5-MM2UTPRWTQ_rRu/s200/1.png" width="187" /></a></div>
<br />
<a name='more'></a><b>Install SDR# (SDRSharp)</b><br />
<br />
<span style="color: red;">***IMPORTANT***</span><br />
<span style="color: red;"><br /></span>
<span style="color: red;">Do not install any of the software that it came with (if any). If you've already installed the DVB-T drivers that came on the CD bundled with some dongles, uninstall them first. </span><span style="color: red;">Don't plug in the USB DVB dongle before completing the below software installation procedure.</span><br />
<br />
1. Install Microsoft .NET 4.6 or newer redistributable installed to use SDRSharp.<br />
<br />
Note, for my laptop running Windows 8.1, Microsoft .NET 4.6 is already installed.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgC8g56BlWk3t1GT7bBJ7kuDPRiZBrXGCLSGY1lvrgBK0-D1Bozkw6ukfJOOqxA5tO5S9kU1_lH569iPF68jB5dub8_SrmxBI8ttLAmC5Uucp5Nia5d207hpDLYbM408k24Y-cZi8EUBU2x/s1600/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="479" data-original-width="542" height="352" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgC8g56BlWk3t1GT7bBJ7kuDPRiZBrXGCLSGY1lvrgBK0-D1Bozkw6ukfJOOqxA5tO5S9kU1_lH569iPF68jB5dub8_SrmxBI8ttLAmC5Uucp5Nia5d207hpDLYbM408k24Y-cZi8EUBU2x/s400/1.png" width="400" /></a></div>
<br />
2. Go to <a href="https://airspy.com/" target="_blank">https://airspy.com/</a> and find the downloads button on the top menu. Next to the "SDR Software Package" heading click on the download button to download sdrsharp-x86.zip.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDQNWdJEmMvyaDnmPn1r6_Tg05SQwzNB2jOrkmCW0PHF33CnJKEtO4rS-DDH-nCLWq2iidoPm8ZZOHl-5ODFmUargewPw5u9xhVGLaDcr8XcEZY2MiMFY_FbNNHC1SK1XDyCstEH6RtR7a/s1600/2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="525" data-original-width="1152" height="290" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDQNWdJEmMvyaDnmPn1r6_Tg05SQwzNB2jOrkmCW0PHF33CnJKEtO4rS-DDH-nCLWq2iidoPm8ZZOHl-5ODFmUargewPw5u9xhVGLaDcr8XcEZY2MiMFY_FbNNHC1SK1XDyCstEH6RtR7a/s640/2.png" width="640" /></a></div>
<br />
3. Extract (unzip) sdrsharp-x86.zip to a folder on your PC.<br />
<br />
<span style="color: red;">Note, Many people who have issues forget this step! Do not run the files from within the zip file or the following steps will fail. Also, do not extract into a folder within the Program Files directory, or installation may fail as these folders are often automatically made read-only by Windows.</span><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgutsiKoCOoyEJns6-SngFSXAPJ0cMoZH3rPTfhaSpg4Y3uens_DmXuc4ksOjK96VD6YnS1hDHzNmnfFzi2AR9VyYzmxmpAxhejKPxVImewME6sAzr87rZoH34gc1rIP3xnfrAn5PU9JsOf/s1600/3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="528" data-original-width="702" height="300" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgutsiKoCOoyEJns6-SngFSXAPJ0cMoZH3rPTfhaSpg4Y3uens_DmXuc4ksOjK96VD6YnS1hDHzNmnfFzi2AR9VyYzmxmpAxhejKPxVImewME6sAzr87rZoH34gc1rIP3xnfrAn5PU9JsOf/s400/3.png" width="400" /></a></div>
<br />
4. Double click on<b> install-rtlsdr.bat</b> from within the extracted folder. This will start a command prompt that will download all the drivers required to make SDRSharp work with RTL-SDR. The command prompt will automatically close after a few seconds when it is done. It the bat file ran successfully the files rtlsdr.dll and zadig.exe will be downloaded into the SDR# directory. If they were not downloaded then your PC or anti virus solution may be misconfigured and may have trouble running batch files (Check that the folder is not read only, and not located in the Program Files directory).<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDd99vM78mD5IhxoVV6D_KpsoP8ky53JMUg0A3utdmvA-4kJyhXeeYMA6oTxk9J-AxSEQobWt7vZ7a6AofcHMesTW1mpgLHOA1RPAA3jfWHSDjNb9RKCiG9z2KUGX0L6dZX1ZdLyaMaNGS/s1600/4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="780" data-original-width="658" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDd99vM78mD5IhxoVV6D_KpsoP8ky53JMUg0A3utdmvA-4kJyhXeeYMA6oTxk9J-AxSEQobWt7vZ7a6AofcHMesTW1mpgLHOA1RPAA3jfWHSDjNb9RKCiG9z2KUGX0L6dZX1ZdLyaMaNGS/s400/4.png" width="336" /></a></div>
<br />
Press any key to close the command prompt window.<br />
<br />
5. Plug in the USB DVB dongle and wait a few seconds for plug and play to finish attempting to install the dongle (it will either fail or install Windows DVB-T TV drivers).<br />
<br />
6. In the folder where you extracted the sdrsharp files find the file called <b>zadig.exe</b>. Right click this file and select "Run as administrator".<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjUViFMLlDEA6ffNdKSp9bGrGUxseC-sZ9sdAn7ZMKJFjui09B8LkU1x_seMPj273zGFf637d1HnJuXXE-wyvaADlPudPQyBH0rEpHKAK2FxgR9Siz-Jio14aJ1Q7kcnOKAgLqOdiCdB7Xd/s1600/5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="428" data-original-width="960" height="177" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjUViFMLlDEA6ffNdKSp9bGrGUxseC-sZ9sdAn7ZMKJFjui09B8LkU1x_seMPj273zGFf637d1HnJuXXE-wyvaADlPudPQyBH0rEpHKAK2FxgR9Siz-Jio14aJ1Q7kcnOKAgLqOdiCdB7Xd/s400/5.png" width="400" /></a></div>
<br />
7. In Zadig, go to "<b>Options->List All Devices</b>" and make sure this option is checked. If you are using Windows 10, in some cases you may need to also uncheck "Ignore Hubs or Composite Parents".<br />
<br />
<span style="background-color: #eeeeee;">Before performing "Options->List All Devices"</span><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgA40UFi9bGqPQW_VZS6O2WGSHEdlHEotVUxi5TbKmQjye2I1kGrQgqlTRIbPDZIMLjDcf2Sh0XO10bWKcegaR_88WBtfKkFcXtrESEIbHKwnbwjwxYj0dGXGX22-9RuGf7jV6yrls8GTVN/s1600/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="256" data-original-width="585" height="140" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgA40UFi9bGqPQW_VZS6O2WGSHEdlHEotVUxi5TbKmQjye2I1kGrQgqlTRIbPDZIMLjDcf2Sh0XO10bWKcegaR_88WBtfKkFcXtrESEIbHKwnbwjwxYj0dGXGX22-9RuGf7jV6yrls8GTVN/s320/1.png" width="320" /></a></div>
<br />
<span style="background-color: #eeeeee;">After performing "Options->List All Devices"</span><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEijXpfkAlmjikN1EI-Uiy8zGrGUaF4CVUIKj267CK3lI_ExRDeYf5VcUR4CW7ZIR4j-9YUIP0y_ffENLM-xP7QVUuDkGcA9pSADgkEim9Ybbg1fgtX4Xnxj0grBiuPZKzHmboHTG-5PDL3Z/s1600/2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="256" data-original-width="586" height="138" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEijXpfkAlmjikN1EI-Uiy8zGrGUaF4CVUIKj267CK3lI_ExRDeYf5VcUR4CW7ZIR4j-9YUIP0y_ffENLM-xP7QVUuDkGcA9pSADgkEim9Ybbg1fgtX4Xnxj0grBiuPZKzHmboHTG-5PDL3Z/s320/2.png" width="320" /></a></div>
<br />
8. Select "<b>Bulk-In, Interface (Interface 0)</b>" from the drop down list. Note on some PCs you may see something like RTL2832UHIDIR or RTL2832U instead of the bulk in interface. This is also a valid selection. Do not select "USB Receiver (Interface 0) or Interface 1" or anything else or you will overwrite that driver! Double check that USB ID shows "0BDA 2838 00" as this indicates that the dongle is selected.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhrpjP_QQ3LsodhFomQO4QZNyJ1Xy43IM1KzbAPfNKZuzHHX8IRurEaVP7avXql1-tVsYJjv10-SUH6PuzcA7Jfu5gz_TRV98sGWEDbFQqIlFoMXhf38S2n6sBDTnK8w-Hw4loaJS_Ua8sT/s1600/5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="259" data-original-width="586" height="140" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhrpjP_QQ3LsodhFomQO4QZNyJ1Xy43IM1KzbAPfNKZuzHHX8IRurEaVP7avXql1-tVsYJjv10-SUH6PuzcA7Jfu5gz_TRV98sGWEDbFQqIlFoMXhf38S2n6sBDTnK8w-Hw4loaJS_Ua8sT/s320/5.png" width="320" /></a></div>
<br />
9. We need to install the WinUSB driver, so also ensure that WinUSB is selected in the box after the arrow next to where it says Driver (this is the default selection).<br />
<br />
Note that there has been some confusion for a few people over this step. The goal is to install the WinUSB driver. So to be clear, the box to the left of the arrow shows the currently installed driver, whereas the box to the right of the arrow shows the driver that will be installed in the next step. The first time you open zadig the box on the left will show either 'None', or the default DVB-T drivers installed by Windows (RTL2832UUSB), depending on your Windows configuration and version.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgotmWEhoxBWupp2wEjHw8WCDY-hp6oPHt7q1gCHIAVSB55VSedAlyB70uh2x82Toj1XKHnXinMTFcjuG74KTFt1lEiXc3Ajlag92Lwtbj6YsGJOdcW4pj3TysU0l9Dw90tSvh-sYSBOQlO/s1600/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="256" data-original-width="585" height="140" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgotmWEhoxBWupp2wEjHw8WCDY-hp6oPHt7q1gCHIAVSB55VSedAlyB70uh2x82Toj1XKHnXinMTFcjuG74KTFt1lEiXc3Ajlag92Lwtbj6YsGJOdcW4pj3TysU0l9Dw90tSvh-sYSBOQlO/s320/1.png" width="320" /></a></div>
<br />
10. Click the <b>Replace Driver </b>button. On some PC's you might get a warning that the publisher cannot be verified, but just accept it by clicking on "Install this driver software anyway". This will install the drivers necessary to run the dongle as a software defined radio. Note that you may need to run zadig.exe again if you move the dongle to another USB port, or want to use two or more dongles together.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgw33VOha4jSNFWYCLUkUxzyivvCqYAbxZ2iAzYG8NmNcObAx1g9Ui8ZkOCGS1UdY21NLdKV6RCaKGEd0b4iWJvRby2pUdyTU-4OORJ4Vh4o6yjr2vt4cWzjGipvTzUCQFdDzIIiTf1O3hx/s1600/2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="257" data-original-width="583" height="140" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgw33VOha4jSNFWYCLUkUxzyivvCqYAbxZ2iAzYG8NmNcObAx1g9Ui8ZkOCGS1UdY21NLdKV6RCaKGEd0b4iWJvRby2pUdyTU-4OORJ4Vh4o6yjr2vt4cWzjGipvTzUCQFdDzIIiTf1O3hx/s320/2.png" width="320" /></a></div>
<br />
Click the close button to close the notification window.<br />
<br />
11. Open <b>SDRSharp.exe.</b><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjAF7iLpYUq2ckCDfTgoheTzqmEBR16T0uGgXtDAuoD7krB10QP4yEc0vzorgi2zgw3xrakLgUW2JxtFmA9AOfsbpIQ-JHj-ZPC9hgMislPFSvWzt9k5duqWGGuGmII5uJ5MWjtETA4aqlL/s1600/3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="422" data-original-width="955" height="176" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjAF7iLpYUq2ckCDfTgoheTzqmEBR16T0uGgXtDAuoD7krB10QP4yEc0vzorgi2zgw3xrakLgUW2JxtFmA9AOfsbpIQ-JHj-ZPC9hgMislPFSvWzt9k5duqWGGuGmII5uJ5MWjtETA4aqlL/s400/3.png" width="400" /></a></div>
<br />
Set the "Source" drop down box to '<b>RTL-SDR (USB)</b>'. This "Source" tab is on the top left. (Note that the first time you do this you may get a smart screen message indicating that Windows has protected your PC, this is a false alarm. Simply click on "more info" and then "run anyway").<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhFTcnsl991Dt515gf3-aMQ_67_cjPLH8h7xgIR5Mr8VCpDiBetYkidEdeDjpBu5mk1czhhULkMRuermaKqwnPiLRIhT3usFpWz-amqi0AiAbqghFipF5rkOUDHfvny2d__aWS5ri7XSH1W/s1600/5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="704" data-original-width="992" height="283" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhFTcnsl991Dt515gf3-aMQ_67_cjPLH8h7xgIR5Mr8VCpDiBetYkidEdeDjpBu5mk1czhhULkMRuermaKqwnPiLRIhT3usFpWz-amqi0AiAbqghFipF5rkOUDHfvny2d__aWS5ri7XSH1W/s400/5.png" width="400" /></a></div>
<br />
12. Press the <b>Play</b> button (the right facing triangle). Your RTL-SDR software radio should now be set up and ready to use! If everything has worked you should be able to start tuning to frequencies.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjiDAsDFFX5AArbUzdAC6COHpVTd7xmXCBIU6LjzOQaap619v9bG89dJrykV4HfHlic_v2POorz0I2fCjLLTMrs1LyIaMFonwnD29taF2ZTetdiPUxpwpWYiykB8wwx9R2OVamVO-NbFIFC/s1600/5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="207" data-original-width="607" height="108" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjiDAsDFFX5AArbUzdAC6COHpVTd7xmXCBIU6LjzOQaap619v9bG89dJrykV4HfHlic_v2POorz0I2fCjLLTMrs1LyIaMFonwnD29taF2ZTetdiPUxpwpWYiykB8wwx9R2OVamVO-NbFIFC/s320/5.png" width="320" /></a></div>
<br />
13. Important! Don't forget to also adjust the RF gain settings by pressing the Configure button (looks like a cog) up the top next to the Play button. By default the RF gain is set at zero. A gain of zero will probably receive nothing but very strong broadcast FM - increase the gain until you start seeing other signals.<br />
<br />
To receive HF signals with a RTL-SDR.com V3, please see the <a href="https://www.rtl-sdr.com/rtl-sdr-blog-v-3-dongles-user-guide/" target="_blank">V3 users guide</a>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgCEavSf-pDv7s9DjXabS0PMnjkxmv13hfLm1i3CrH73cn1ELA1trjJ0tCBO-d2WLDM05lLohxYYlUMpBEfBPB5hLDE5w0mU4JIB2CGARQdHL77m820e0PBwxsrBW4FuBYIMGoyOaQUBjhs/s1600/3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="447" data-original-width="289" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgCEavSf-pDv7s9DjXabS0PMnjkxmv13hfLm1i3CrH73cn1ELA1trjJ0tCBO-d2WLDM05lLohxYYlUMpBEfBPB5hLDE5w0mU4JIB2CGARQdHL77m820e0PBwxsrBW4FuBYIMGoyOaQUBjhs/s320/3.png" width="205" /></a></div>
<br />
The RTL-SDR is now ready for work.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhCI-dKqi1758E1OwQXbZLx5-dKYP7GRrVxezztOCd8blViVQKtMsMwD0vzu_Pq-MKpjKZ5jXesLWYvkLBvXj6WVVGxAX4JoVXGFqNb2wmr0eMffd_1-aFDr4_fJXM7VuSYaW2HPskpIXNg/s1600/5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="703" data-original-width="992" height="282" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhCI-dKqi1758E1OwQXbZLx5-dKYP7GRrVxezztOCd8blViVQKtMsMwD0vzu_Pq-MKpjKZ5jXesLWYvkLBvXj6WVVGxAX4JoVXGFqNb2wmr0eMffd_1-aFDr4_fJXM7VuSYaW2HPskpIXNg/s400/5.png" width="400" /></a></div>
<br />
<b>Additional references:</b><br />
<br />
SDRSHARP USERS GUIDE<br />
<a href="https://www.rtl-sdr.com/sdrsharp-users-guide/" target="_blank">https://www.rtl-sdr.com/sdrsharp-users-guide/</a><br />
<br />
Featured articles<br />
<a href="https://www.rtl-sdr.com/category/article/" target="_blank">https://www.rtl-sdr.com/category/article/</a><br />
<br />
Planar Disk Antennas<br />
<a href="http://www.wa5vjb.com/references/PlanarDiskAntennas.pdf" target="_blank">http://www.wa5vjb.com/references/PlanarDiskAntennas.pdf</a>Wei-Hsiung Huanghttp://www.blogger.com/profile/09437875322676421890noreply@blogger.com0tag:blogger.com,1999:blog-3648927237801494248.post-87752929990511574592019-12-27T18:37:00.004+08:002020-01-05T10:07:14.710+08:00Testing out WeMos D1 Mini with OLED Display driven by SSD1306Below is the specs. of the OLED display used:<br />
<br />
- Driver IC: SSD1306<br />
- Resolution: 128 x 64<br />
- Interface: I2C<br />
<br />
Wire up the OLED display to WeMos D1 Mini according to the below diagram.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEivvzg5f2-rtGavjel-IOfZUiMcHA9ahsMIkw8xbssTtQNGWUaUxoY-1hXohpbH1NA4ycagthhQ2IOlsXYptL9ish1R6TLAcTW-WthiXjbMK6ypwrJo1dQHtLmTA_8OkSi6RtB1AP1YtfnK/s1600/2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="317" data-original-width="533" height="379" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEivvzg5f2-rtGavjel-IOfZUiMcHA9ahsMIkw8xbssTtQNGWUaUxoY-1hXohpbH1NA4ycagthhQ2IOlsXYptL9ish1R6TLAcTW-WthiXjbMK6ypwrJo1dQHtLmTA_8OkSi6RtB1AP1YtfnK/s640/2.png" width="640" /></a></div>
<br />
<a name='more'></a><b style="font-size: x-large;">Installing the required OLED libraries in Arduino IDE</b><br />
<br />
First, install the Adafruit_SSD1306 library.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgxt7Np756Zkvs1NVStSqgU0nemTxWLAtlPvEbKq097lddq6A1YyETpdflyX4aAE9c3FXFyPhtwi9YwRU1f7630wWjT-pMuJ8_HG_K0NzYFyXoHkl66eoV1WgvpvGCqACcOjtmYZFk8ZVcQ/s1600/3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="525" data-original-width="799" height="420" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgxt7Np756Zkvs1NVStSqgU0nemTxWLAtlPvEbKq097lddq6A1YyETpdflyX4aAE9c3FXFyPhtwi9YwRU1f7630wWjT-pMuJ8_HG_K0NzYFyXoHkl66eoV1WgvpvGCqACcOjtmYZFk8ZVcQ/s640/3.png" width="640" /></a></div>
<br />
Second, install the Adafruit_GFX library.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi8PY2EPEWMePisWtvOg-QWcGT4ezJ-efFBAGrjDYjfXODWwYqp74B3OMoyzjwQZJT9oi_7xsBUlfz7IoJtRArrnKd39-73NSvkT4e43TrNovP0wkQvF0-i9M12qN8ZYJH7tpAwRfHItc5c/s1600/3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="525" data-original-width="798" height="420" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi8PY2EPEWMePisWtvOg-QWcGT4ezJ-efFBAGrjDYjfXODWwYqp74B3OMoyzjwQZJT9oi_7xsBUlfz7IoJtRArrnKd39-73NSvkT4e43TrNovP0wkQvF0-i9M12qN8ZYJH7tpAwRfHItc5c/s640/3.png" width="640" /></a></div>
<br />
Be sure to restart the Arduino IDE after the 2 libraries have been installed.<br />
<br />
<b><span style="font-size: large;">Finding the I2C address of the OLED Display</span></b><br />
<br />
Use the sketch below to find the I2C address of the OLED display and to make sure the wiring is O.K.<br />
<br />
<b>Source:</b><br />
<a href="https://github.com/jainrk/i2c_port_address_scanner/blob/master/i2c_port_address_scanner/i2c_port_address_scanner.ino" target="_blank">https://github.com/jainrk/i2c_port_address_scanner/blob/master/i2c_port_address_scanner/i2c_port_address_scanner.ino</a><br />
<br />
<b>Instructable:</b><br />
<a href="https://www.instructables.com/id/ESP8266-I2C-PORT-and-Address-Scanner/" target="_blank">https://www.instructables.com/id/ESP8266-I2C-PORT-and-Address-Scanner/</a><br />
<br />
<span style="background-color: #eeeeee;"><b>The Arduino Sketch</b></span><br />
<br />
<div style="background: rgb(255, 255, 255); border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<table><tbody>
<tr><td><pre style="line-height: 16.25px;"> 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68</pre>
</td><td><pre style="line-height: 16.25px;">/*
* i2c_port_address_scanner
* Scans ports D0 to D7 on an ESP8266 and searches for I2C device. based on the original code
* available on Arduino.cc and later improved by user Krodal and Nick Gammon (www.gammon.com.au/forum/?id=10896)
* D8 throws exceptions thus it has been left out
*
*/
#include <Wire.h>
void setup() {
Serial.begin(115200);
while (!Serial); // Leonardo: wait for serial monitor
Serial.println("\n\nI2C Scanner to scan for devices on each port pair D0 to D7");
scanPorts();
}
uint8_t portArray[] = {16, 5, 4, 0, 2, 14, 12, 13};
<span style="background-color: yellow;">String portMap[] = {"D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7"}; //for Wemos</span>
//String portMap[] = {"GPIO16", "GPIO5", "GPIO4", "GPIO0", "GPIO2", "GPIO14", "GPIO12", "GPIO13"};
void scanPorts() {
for (uint8_t i = 0; i < sizeof(portArray); i++) {
for (uint8_t j = 0; j < sizeof(portArray); j++) {
if (i != j){
Serial.print("Scanning (SDA : SCL) - " + portMap[i] + " : " + portMap[j] + " - ");
Wire.begin(portArray[i], portArray[j]);
check_if_exist_I2C();
}
}
}
}
void check_if_exist_I2C() {
byte error, address;
int nDevices;
nDevices = 0;
for (address = 1; address < 127; address++ ) {
// The i2c_scanner uses the return value of
// the Write.endTransmisstion to see if
// a device did acknowledge to the address.
Wire.beginTransmission(address);
error = Wire.endTransmission();
if (error == 0){
Serial.print("I2C device found at address 0x");
if (address < 16)
Serial.print("0");
Serial.print(address, HEX);
Serial.println(" !");
nDevices++;
} else if (error == 4) {
Serial.print("Unknow error at address 0x");
if (address < 16)
Serial.print("0");
Serial.println(address, HEX);
}
} //for loop
if (nDevices == 0)
Serial.println("No I2C devices found");
else
Serial.println("**********************************\n");
//delay(1000); // wait 1 seconds for next scan, did not find it necessary
}
void loop() {
}
</pre>
</td></tr>
</tbody></table>
</div>
<br />
<b style="background-color: #eeeeee;">The Result</b><br />
<br />
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="line-height: 16.25px;"><span style="background-color: white;">I2C Scanner to scan for devices on each port pair D0 to D7
Scanning (SDA : SCL) - D0 : D1 - No I2C devices found
Scanning (SDA : SCL) - D0 : D2 - No I2C devices found
Scanning (SDA : SCL) - D0 : D3 - No I2C devices found
Scanning (SDA : SCL) - D0 : D4 - No I2C devices found
Scanning (SDA : SCL) - D0 : D5 - No I2C devices found
Scanning (SDA : SCL) - D0 : D6 - No I2C devices found
Scanning (SDA : SCL) - D0 : D7 - No I2C devices found
Scanning (SDA : SCL) - D1 : D0 - No I2C devices found
Scanning (SDA : SCL) - D1 : D2 - No I2C devices found
Scanning (SDA : SCL) - D1 : D3 - No I2C devices found
Scanning (SDA : SCL) - D1 : D4 - No I2C devices found
Scanning (SDA : SCL) - D1 : D5 - No I2C devices found
Scanning (SDA : SCL) - D1 : D6 - No I2C devices found
Scanning (SDA : SCL) - D1 : D7 - No I2C devices found
Scanning (SDA : SCL) - D2 : D0 - No I2C devices found
</span><span style="background-color: yellow;">Scanning (SDA : SCL) - D2 : D1 - I2C device found at address 0x3C !</span><span style="background-color: white;">
**********************************
Scanning (SDA : SCL) - D2 : D3 - No I2C devices found
Scanning (SDA : SCL) - D2 : D4 - No I2C devices found
Scanning (SDA : SCL) - D2 : D5 - No I2C devices found
Scanning (SDA : SCL) - D2 : D6 - No I2C devices found
Scanning (SDA : SCL) - D2 : D7 - No I2C devices found
Scanning (SDA : SCL) - D3 : D0 - No I2C devices found
Scanning (SDA : SCL) - D3 : D1 - No I2C devices found
Scanning (SDA : SCL) - D3 : D2 - No I2C devices found
Scanning (SDA : SCL) - D3 : D4 - No I2C devices found
Scanning (SDA : SCL) - D3 : D5 - No I2C devices found
Scanning (SDA : SCL) - D3 : D6 - No I2C devices found
Scanning (SDA : SCL) - D3 : D7 - No I2C devices found
Scanning (SDA : SCL) - D4 : D0 - No I2C devices found
Scanning (SDA : SCL) - D4 : D1 - No I2C devices found
Scanning (SDA : SCL) - D4 : D2 - No I2C devices found
Scanning (SDA : SCL) - D4 : D3 - No I2C devices found
Scanning (SDA : SCL) - D4 : D5 - No I2C devices found
Scanning (SDA : SCL) - D4 : D6 - No I2C devices found
Scanning (SDA : SCL) - D4 : D7 - No I2C devices found
Scanning (SDA : SCL) - D5 : D0 - No I2C devices found
Scanning (SDA : SCL) - D5 : D1 - No I2C devices found
Scanning (SDA : SCL) - D5 : D2 - No I2C devices found
Scanning (SDA : SCL) - D5 : D3 - No I2C devices found
Scanning (SDA : SCL) - D5 : D4 - No I2C devices found
Scanning (SDA : SCL) - D5 : D6 - No I2C devices found
Scanning (SDA : SCL) - D5 : D7 - No I2C devices found
Scanning (SDA : SCL) - D6 : D0 - No I2C devices found
Scanning (SDA : SCL) - D6 : D1 - No I2C devices found
Scanning (SDA : SCL) - D6 : D2 - No I2C devices found
Scanning (SDA : SCL) - D6 : D3 - No I2C devices found
Scanning (SDA : SCL) - D6 : D4 - No I2C devices found
Scanning (SDA : SCL) - D6 : D5 - No I2C devices found
Scanning (SDA : SCL) - D6 : D7 - No I2C devices found
Scanning (SDA : SCL) - D7 : D0 - No I2C devices found
Scanning (SDA : SCL) - D7 : D1 - No I2C devices found
Scanning (SDA : SCL) - D7 : D2 - No I2C devices found
Scanning (SDA : SCL) - D7 : D3 - No I2C devices found
Scanning (SDA : SCL) - D7 : D4 - No I2C devices found
Scanning (SDA : SCL) - D7 : D5 - No I2C devices found
Scanning (SDA : SCL) - D7 : D6 - No I2C devices found
</span></pre>
</div>
<br />
O.K. So the I2C address of the OLED display is at 0x3C.<br />
<br />
<b><span style="font-size: large;">Running the OLED Example Sketch</span></b><br />
<br />
Load the 128x64 I2C example sketch from the OLED examples provided by Adafruit1306 library.<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi2en0atLa3WBEqlXxGFr1P88OpZZP4KjlIPPypkBrq46lfF-yXRkcuewyKdE4vBZHlYrkefSjcmooYP_ohM7_9Hz7fGC7IkG8ilffGSu_0u-kgmjItDdy9svpNvqll57JqfUWf-jr_F3Vc/s1600/3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="446" data-original-width="600" height="296" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi2en0atLa3WBEqlXxGFr1P88OpZZP4KjlIPPypkBrq46lfF-yXRkcuewyKdE4vBZHlYrkefSjcmooYP_ohM7_9Hz7fGC7IkG8ilffGSu_0u-kgmjItDdy9svpNvqll57JqfUWf-jr_F3Vc/s400/3.png" width="400" /></a></div>
<br />
<b style="background-color: #eeeeee;">The sample sketch</b><br />
<br />
<div style="background: rgb(255, 255, 255); border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<table><tbody>
<tr><td><pre style="line-height: 16.25px;"> 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413</pre>
</td><td><pre style="line-height: 16.25px;">/**************************************************************************
This is an example for our Monochrome OLEDs based on SSD1306 drivers
Pick one up today in the adafruit shop!
------> http://www.adafruit.com/category/63_98
This example is for a 128x32 pixel display using I2C to communicate
3 pins are required to interface (two I2C and one reset).
Adafruit invests time and resources providing this open
source code, please support Adafruit and open-source
hardware by purchasing products from Adafruit!
Written by Limor Fried/Ladyada for Adafruit Industries,
with contributions from the open source community.
BSD license, check license.txt for more information
All text above, and the splash screen below must be
included in any redistribution.
**************************************************************************/
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
//#define OLED_RESET 4 // Reset pin # (or -1 if sharing Arduino reset pin)
<span style="background-color: yellow;">#define OLED_RESET -1 // Reset pin # (or -1 if sharing Arduino reset pin)</span>
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
#define NUMFLAKES 10 // Number of snowflakes in the animation example
#define LOGO_HEIGHT 16
#define LOGO_WIDTH 16
static const unsigned char PROGMEM logo_bmp[] =
{ B00000000, B11000000,
B00000001, B11000000,
B00000001, B11000000,
B00000011, B11100000,
B11110011, B11100000,
B11111110, B11111000,
B01111110, B11111111,
B00110011, B10011111,
B00011111, B11111100,
B00001101, B01110000,
B00011011, B10100000,
B00111111, B11100000,
B00111111, B11110000,
B01111100, B11110000,
B01110000, B01110000,
B00000000, B00110000 };
void setup() {
//Serial.begin(9600);
<span style="background-color: yellow;"> Serial.begin(115200);</span>
// SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally
//if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3D)) { // Address 0x3D for 128x64
<span style="background-color: yellow;"> if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { // Address 0x3D for 128x64</span>
Serial.println(F("SSD1306 allocation failed"));
for(;;); // Don't proceed, loop forever
}
// Show initial display buffer contents on the screen --
// the library initializes this with an Adafruit splash screen.
display.display();
delay(2000); // Pause for 2 seconds
// Clear the buffer
display.clearDisplay();
// Draw a single pixel in white
display.drawPixel(10, 10, SSD1306_WHITE);
// Show the display buffer on the screen. You MUST call display() after
// drawing commands to make them visible on screen!
display.display();
delay(2000);
// display.display() is NOT necessary after every single drawing command,
// unless that's what you want...rather, you can batch up a bunch of
// drawing operations and then update the screen all at once by calling
// display.display(). These examples demonstrate both approaches...
testdrawline(); // Draw many lines
testdrawrect(); // Draw rectangles (outlines)
testfillrect(); // Draw rectangles (filled)
testdrawcircle(); // Draw circles (outlines)
testfillcircle(); // Draw circles (filled)
testdrawroundrect(); // Draw rounded rectangles (outlines)
testfillroundrect(); // Draw rounded rectangles (filled)
testdrawtriangle(); // Draw triangles (outlines)
testfilltriangle(); // Draw triangles (filled)
testdrawchar(); // Draw characters of the default font
testdrawstyles(); // Draw 'stylized' characters
testscrolltext(); // Draw scrolling text
testdrawbitmap(); // Draw a small bitmap image
// Invert and restore display, pausing in-between
display.invertDisplay(true);
delay(1000);
display.invertDisplay(false);
delay(1000);
testanimate(logo_bmp, LOGO_WIDTH, LOGO_HEIGHT); // Animate bitmaps
}
void loop() {
}
void testdrawline() {
int16_t i;
display.clearDisplay(); // Clear display buffer
for(i=0; i<display.width(); i+=4) {
display.drawLine(0, 0, i, display.height()-1, SSD1306_WHITE);
display.display(); // Update screen with each newly-drawn line
delay(1);
}
for(i=0; i<display.height(); i+=4) {
display.drawLine(0, 0, display.width()-1, i, SSD1306_WHITE);
display.display();
delay(1);
}
delay(250);
display.clearDisplay();
for(i=0; i<display.width(); i+=4) {
display.drawLine(0, display.height()-1, i, 0, SSD1306_WHITE);
display.display();
delay(1);
}
for(i=display.height()-1; i>=0; i-=4) {
display.drawLine(0, display.height()-1, display.width()-1, i, SSD1306_WHITE);
display.display();
delay(1);
}
delay(250);
display.clearDisplay();
for(i=display.width()-1; i>=0; i-=4) {
display.drawLine(display.width()-1, display.height()-1, i, 0, SSD1306_WHITE);
display.display();
delay(1);
}
for(i=display.height()-1; i>=0; i-=4) {
display.drawLine(display.width()-1, display.height()-1, 0, i, SSD1306_WHITE);
display.display();
delay(1);
}
delay(250);
display.clearDisplay();
for(i=0; i<display.height(); i+=4) {
display.drawLine(display.width()-1, 0, 0, i, SSD1306_WHITE);
display.display();
delay(1);
}
for(i=0; i<display.width(); i+=4) {
display.drawLine(display.width()-1, 0, i, display.height()-1, SSD1306_WHITE);
display.display();
delay(1);
}
delay(2000); // Pause for 2 seconds
}
void testdrawrect(void) {
display.clearDisplay();
for(int16_t i=0; i<display.height()/2; i+=2) {
display.drawRect(i, i, display.width()-2*i, display.height()-2*i, SSD1306_WHITE);
display.display(); // Update screen with each newly-drawn rectangle
delay(1);
}
delay(2000);
}
void testfillrect(void) {
display.clearDisplay();
for(int16_t i=0; i<display.height()/2; i+=3) {
// The INVERSE color is used so rectangles alternate white/black
display.fillRect(i, i, display.width()-i*2, display.height()-i*2, SSD1306_INVERSE);
display.display(); // Update screen with each newly-drawn rectangle
delay(1);
}
delay(2000);
}
void testdrawcircle(void) {
display.clearDisplay();
for(int16_t i=0; i<max(display.width(),display.height())/2; i+=2) {
display.drawCircle(display.width()/2, display.height()/2, i, SSD1306_WHITE);
display.display();
delay(1);
}
delay(2000);
}
void testfillcircle(void) {
display.clearDisplay();
for(int16_t i=max(display.width(),display.height())/2; i>0; i-=3) {
// The INVERSE color is used so circles alternate white/black
display.fillCircle(display.width() / 2, display.height() / 2, i, SSD1306_INVERSE);
display.display(); // Update screen with each newly-drawn circle
delay(1);
}
delay(2000);
}
void testdrawroundrect(void) {
display.clearDisplay();
for(int16_t i=0; i<display.height()/2-2; i+=2) {
display.drawRoundRect(i, i, display.width()-2*i, display.height()-2*i,
display.height()/4, SSD1306_WHITE);
display.display();
delay(1);
}
delay(2000);
}
void testfillroundrect(void) {
display.clearDisplay();
for(int16_t i=0; i<display.height()/2-2; i+=2) {
// The INVERSE color is used so round-rects alternate white/black
display.fillRoundRect(i, i, display.width()-2*i, display.height()-2*i,
display.height()/4, SSD1306_INVERSE);
display.display();
delay(1);
}
delay(2000);
}
void testdrawtriangle(void) {
display.clearDisplay();
for(int16_t i=0; i<max(display.width(),display.height())/2; i+=5) {
display.drawTriangle(
display.width()/2 , display.height()/2-i,
display.width()/2-i, display.height()/2+i,
display.width()/2+i, display.height()/2+i, SSD1306_WHITE);
display.display();
delay(1);
}
delay(2000);
}
void testfilltriangle(void) {
display.clearDisplay();
for(int16_t i=max(display.width(),display.height())/2; i>0; i-=5) {
// The INVERSE color is used so triangles alternate white/black
display.fillTriangle(
display.width()/2 , display.height()/2-i,
display.width()/2-i, display.height()/2+i,
display.width()/2+i, display.height()/2+i, SSD1306_INVERSE);
display.display();
delay(1);
}
delay(2000);
}
void testdrawchar(void) {
display.clearDisplay();
display.setTextSize(1); // Normal 1:1 pixel scale
display.setTextColor(SSD1306_WHITE); // Draw white text
display.setCursor(0, 0); // Start at top-left corner
display.cp437(true); // Use full 256 char 'Code Page 437' font
// Not all the characters will fit on the display. This is normal.
// Library will draw what it can and the rest will be clipped.
for(int16_t i=0; i<256; i++) {
if(i == '\n') display.write(' ');
else display.write(i);
}
display.display();
delay(2000);
}
void testdrawstyles(void) {
display.clearDisplay();
display.setTextSize(1); // Normal 1:1 pixel scale
display.setTextColor(SSD1306_WHITE); // Draw white text
display.setCursor(0,0); // Start at top-left corner
display.println(F("Hello, world!"));
display.setTextColor(SSD1306_BLACK, SSD1306_WHITE); // Draw 'inverse' text
display.println(3.141592);
display.setTextSize(2); // Draw 2X-scale text
display.setTextColor(SSD1306_WHITE);
display.print(F("0x")); display.println(0xDEADBEEF, HEX);
display.display();
delay(2000);
}
void testscrolltext(void) {
display.clearDisplay();
display.setTextSize(2); // Draw 2X-scale text
display.setTextColor(SSD1306_WHITE);
display.setCursor(10, 0);
display.println(F("scroll"));
display.display(); // Show initial text
delay(100);
// Scroll in various directions, pausing in-between:
display.startscrollright(0x00, 0x0F);
delay(2000);
display.stopscroll();
delay(1000);
display.startscrollleft(0x00, 0x0F);
delay(2000);
display.stopscroll();
delay(1000);
display.startscrolldiagright(0x00, 0x07);
delay(2000);
display.startscrolldiagleft(0x00, 0x07);
delay(2000);
display.stopscroll();
delay(1000);
}
void testdrawbitmap(void) {
display.clearDisplay();
display.drawBitmap(
(display.width() - LOGO_WIDTH ) / 2,
(display.height() - LOGO_HEIGHT) / 2,
logo_bmp, LOGO_WIDTH, LOGO_HEIGHT, 1);
display.display();
delay(1000);
}
#define XPOS 0 // Indexes into the 'icons' array in function below
#define YPOS 1
#define DELTAY 2
void testanimate(const uint8_t *bitmap, uint8_t w, uint8_t h) {
int8_t f, icons[NUMFLAKES][3];
// Initialize 'snowflake' positions
for(f=0; f< NUMFLAKES; f++) {
icons[f][XPOS] = random(1 - LOGO_WIDTH, display.width());
icons[f][YPOS] = -LOGO_HEIGHT;
icons[f][DELTAY] = random(1, 6);
Serial.print(F("x: "));
Serial.print(icons[f][XPOS], DEC);
Serial.print(F(" y: "));
Serial.print(icons[f][YPOS], DEC);
Serial.print(F(" dy: "));
Serial.println(icons[f][DELTAY], DEC);
}
for(;;) { // Loop forever...
display.clearDisplay(); // Clear the display buffer
// Draw each snowflake:
for(f=0; f< NUMFLAKES; f++) {
display.drawBitmap(icons[f][XPOS], icons[f][YPOS], bitmap, w, h, SSD1306_WHITE);
}
display.display(); // Show the display buffer on the screen
delay(200); // Pause for 1/10 second
// Then update coordinates of each flake...
for(f=0; f< NUMFLAKES; f++) {
icons[f][YPOS] += icons[f][DELTAY];
// If snowflake is off the bottom of the screen...
if (icons[f][YPOS] >= display.height()) {
// Reinitialize to a random position, just off the top
icons[f][XPOS] = random(1 - LOGO_WIDTH, display.width());
icons[f][YPOS] = -LOGO_HEIGHT;
icons[f][DELTAY] = random(1, 6);
}
}
}
}
</pre>
</td></tr>
</tbody></table>
</div>
<br />
Upload the code to your ESP8266 board. Don’t forget to select the right board and COM port in the Tools menu.<br />
<br />
You should get a series of different animations in the OLED.<br />
<br />
<b>**IMPORTANT**</b><br />
<br />
1. If the OLED used doesn’t have a RESET pin, be sure to set the OLED_RESET variable (line 30 above) to -1 as shown below:<br />
<br />
<span style="background-color: #eeeeee;">#define OLED_RESET <span style="color: red;"><b>-1</b></span> // Reset pin # (or -1 if sharing Arduino reset pin)</span><br />
<br />
2. Be sure to run the I2C scanner sketch to find the I2C address of the OLED display. Don't trust the I2C address marking on the back of the display module. On the back of the OLED display module, it shows the address to be either 0x78 or 0x7A. However, the actual address is 0x3C.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgnQ3HAZbKZBMQCd9XpwaCeqrDBRnEcL8cblkOGgF7QNWhphAgQNl0cMO6K95wZlcaggGhnKsAOcYfD4qmTtBfodIrm7mB689a6a1R_2DeC5miLNphhJxUVpNd0HHtt5MIQzPu_LFKG4_9m/s1600/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="321" data-original-width="372" height="345" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgnQ3HAZbKZBMQCd9XpwaCeqrDBRnEcL8cblkOGgF7QNWhphAgQNl0cMO6K95wZlcaggGhnKsAOcYfD4qmTtBfodIrm7mB689a6a1R_2DeC5miLNphhJxUVpNd0HHtt5MIQzPu_LFKG4_9m/s400/1.png" width="400" /></a></div>
<br />
<b>Reference:</b><br />
<br />
ESP8266 0.96 inch OLED Display with Arduino IDE<br />
<a href="https://randomnerdtutorials.com/esp8266-0-96-inch-oled-display-with-arduino-ide/" target="_blank">https://randomnerdtutorials.com/esp8266-0-96-inch-oled-display-with-arduino-ide/</a><br />
<br />
Arduino Tutorial: OLED 0.96" I2C/SPI Display<br />
<a href="https://www.youtube.com/watch?v=PrIAnDZ9dp8" target="_blank">https://www.youtube.com/watch?v=PrIAnDZ9dp8</a><br />
<br />
#21 Two Equal Displays on One Arduino I2C Bus (Tutorial)<br />
<a href="https://www.youtube.com/watch?v=j6B47reye80" target="_blank">https://www.youtube.com/watch?v=j6B47reye80</a>Wei-Hsiung Huanghttp://www.blogger.com/profile/09437875322676421890noreply@blogger.com0tag:blogger.com,1999:blog-3648927237801494248.post-17753436831895628082019-12-03T18:30:00.004+08:002019-12-03T18:30:35.371+08:00Linux Programming In C - A Simple Hello WorldThis is a quick summary of how to write and run a C program in Linux.<br />
<br />
<span style="font-size: large;"><b>A Simple Hello World</b></span><br />
<br />
1. Issue the command "<span style="background-color: #eeeeee;">sudo nano hello-world.c</span>" to launch the nano editor;<br />
<br />
2. Enter the code below in nano. Press Ctrl-X then press Y to save.<br />
<br />
<span style="background-color: #eeeeee;">#include <stdio.h></span><br />
<span style="background-color: #eeeeee;"><br /></span>
<span style="background-color: #eeeeee;">int main()</span><br />
<span style="background-color: #eeeeee;">{</span><br />
<span style="background-color: #eeeeee;"> printf("Hello, World! \n");</span><br />
<span style="background-color: #eeeeee;"> return 0;</span><br />
<span style="background-color: #eeeeee;">}</span><br />
<br />
3. Issue the command "<span style="background-color: #eeeeee;">gcc hello-world.c -o myfirstcprogram</span>" to compile;<br />
<br />
4. Issue the command "<span style="background-color: #eeeeee;">./myfirstcprogram</span>" to execute it.<br />
<br />
<b>Reference:</b><br />
<br />
HOW TO WRITE AND RUN A C PROGRAM ON THE RASPBERRY PI<br />
<a href="http://www.circuitbasics.com/how-to-write-and-run-a-c-program-on-the-raspberry-pi/" target="_blank">http://www.circuitbasics.com/how-to-write-and-run-a-c-program-on-the-raspberry-pi/</a>Wei-Hsiung Huanghttp://www.blogger.com/profile/09437875322676421890noreply@blogger.com0tag:blogger.com,1999:blog-3648927237801494248.post-58489708464249139252019-11-19T17:56:00.003+08:002019-12-27T19:19:47.116+08:00EaglePCB - How to configure the design rules used by DRC according to the capabilities of the board manufacturerThis is a quick summary of how to change the design rules used by EaglePCB to perform design rules check (DRC).<br />
<br />
First of all, let's see the DRC results using design rules from adafruit and sparkfun respectively.<br />
<br />
<span style="font-size: large;"><b>DRC Results</b></span><br />
<br />
<span style="background-color: #eeeeee;">Using "adafruit.dru"</span><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgASAIS9fqArUj76_7mRxhLK0YLbT2SchP-9w8e74slac9vXC9W3BknGinSIKFDd4Zet2cN8fOJ5aVvMZzayhrtQgTbOlxW23O8bdbs8jiB6Xu8Qx6dtQKQ4a9gJfxC6V8qMhDIZHhuK4Ya/s1600/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="502" data-original-width="763" height="420" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgASAIS9fqArUj76_7mRxhLK0YLbT2SchP-9w8e74slac9vXC9W3BknGinSIKFDd4Zet2cN8fOJ5aVvMZzayhrtQgTbOlxW23O8bdbs8jiB6Xu8Qx6dtQKQ4a9gJfxC6V8qMhDIZHhuK4Ya/s640/1.png" width="640" /></a></div>
<br />
<br />
<a name='more'></a><br />
<br />
<span style="background-color: #eeeeee;">Using "sparkfun.dru"</span><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiqWKiIwZbyjNNgfIhsUSEnoUB-hbn6aaWO5kM7SRmv98dDLDJuQUj69eclBUmdw6snOF3bzguLoHMtW8vbdMjHCJDeaXtVIu1l9hdxizSXroz9KFcRMVvMDD_mHk0cscP24w-fTWzW-TMC/s1600/2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="714" data-original-width="805" height="566" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiqWKiIwZbyjNNgfIhsUSEnoUB-hbn6aaWO5kM7SRmv98dDLDJuQUj69eclBUmdw6snOF3bzguLoHMtW8vbdMjHCJDeaXtVIu1l9hdxizSXroz9KFcRMVvMDD_mHk0cscP24w-fTWzW-TMC/s640/2.png" width="640" /></a></div>
<br />
<b><span style="font-size: large;">The settings of "adafruit.dru" and "sparkfun.dru"</span></b><br />
<br />
<span style="background-color: #eeeeee;">Layers</span><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDmBz5AxIUgyuTOgM_9mrm2aBtxZt0aHnP3vBDqAvvjCSGtUD4duNaJ0jBteJxx4H-fZoixk5oWICSg_DFTQHtrieWdvjmV7gHNT7gOI7CZJp8xDkvG2Id-1OHV19VGAyQSOYp9zBZB3HV/s1600/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="762" data-original-width="653" height="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDmBz5AxIUgyuTOgM_9mrm2aBtxZt0aHnP3vBDqAvvjCSGtUD4duNaJ0jBteJxx4H-fZoixk5oWICSg_DFTQHtrieWdvjmV7gHNT7gOI7CZJp8xDkvG2Id-1OHV19VGAyQSOYp9zBZB3HV/s640/1.png" width="548" /></a></div>
<br />
<span style="background-color: #eeeeee;">Clearance</span><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjIdlqZ-SSCiX39VdDInpN_zbz5_pfvjblnU735tyYRujs4PYk-8G8Z4MzbHS7Cw2Z22HgulPoiX8jHSyyLavRMgBWFwOYZ8HvElN8aGDX759u6sQU_GccGCTzZFD8HeQT_d_ElKqCIbkMB/s1600/2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="762" data-original-width="653" height="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjIdlqZ-SSCiX39VdDInpN_zbz5_pfvjblnU735tyYRujs4PYk-8G8Z4MzbHS7Cw2Z22HgulPoiX8jHSyyLavRMgBWFwOYZ8HvElN8aGDX759u6sQU_GccGCTzZFD8HeQT_d_ElKqCIbkMB/s640/2.png" width="547" /></a></div>
<br />
<span style="background-color: #eeeeee;">Distance</span><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiKxpWU-ASwTTqX9kotj3C6hjfe2ZSUs-5IaWOwWCeMmeIITLrBmxDr9JMcaEy21orJ_2J6FzIduiAuH2JNmYNf1HSRS88nmp7pwb1mhGYLdVhGyQCgAlUu3neZE4m0BBAFOzXgaz4IY0vL/s1600/3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="764" data-original-width="653" height="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiKxpWU-ASwTTqX9kotj3C6hjfe2ZSUs-5IaWOwWCeMmeIITLrBmxDr9JMcaEy21orJ_2J6FzIduiAuH2JNmYNf1HSRS88nmp7pwb1mhGYLdVhGyQCgAlUu3neZE4m0BBAFOzXgaz4IY0vL/s640/3.png" width="546" /></a></div>
<br />
<span style="background-color: #eeeeee;">Sizes</span><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhK6vLmQ3HoVQl3BMi6meI0NRKKBX_ddiamHcvj9hGJqSe0wB3GgHdI0KjjcEjtCBAiDsdTTyO8HCosk0b2gWBksXsrRATFK32zF6rXYBVBkmlgUUUMhgyd-DtycOw-MRlW6o0ZV2V-1iV9/s1600/4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="761" data-original-width="653" height="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhK6vLmQ3HoVQl3BMi6meI0NRKKBX_ddiamHcvj9hGJqSe0wB3GgHdI0KjjcEjtCBAiDsdTTyO8HCosk0b2gWBksXsrRATFK32zF6rXYBVBkmlgUUUMhgyd-DtycOw-MRlW6o0ZV2V-1iV9/s640/4.png" width="548" /></a></div>
<br />
<span style="background-color: #eeeeee;">Resting</span><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhyhIDKQiloov8yw6X4eqhISJ0R2cpkOKDpv9scdsihLi2twReErLyN8fpkzLQ3F1ej-A6OM96QZIXIG9zOSaR6vfZf4qFxJxiAKmuvJqC_1dhSDptjx0WpbEqEtHCrt4mkOvAnmXiB8tY7/s1600/5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="766" data-original-width="654" height="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhyhIDKQiloov8yw6X4eqhISJ0R2cpkOKDpv9scdsihLi2twReErLyN8fpkzLQ3F1ej-A6OM96QZIXIG9zOSaR6vfZf4qFxJxiAKmuvJqC_1dhSDptjx0WpbEqEtHCrt4mkOvAnmXiB8tY7/s640/5.png" width="546" /></a></div>
<br />
<span style="background-color: #eeeeee;">Shapes</span><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEipf85xJIJdw9ZgfecZWahq_oxjlUhyphenhyphenWljT4n7fp78mMdXlQF9npTtDmk_54UorNDrTKtKYHoPnlFEcP-NDfdy1T1E67ONPsX6w8sjQchvbKofLCbhopZk0dyx4CMFV78sRUAvixrlFhmI0/s1600/6.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="762" data-original-width="666" height="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEipf85xJIJdw9ZgfecZWahq_oxjlUhyphenhyphenWljT4n7fp78mMdXlQF9npTtDmk_54UorNDrTKtKYHoPnlFEcP-NDfdy1T1E67ONPsX6w8sjQchvbKofLCbhopZk0dyx4CMFV78sRUAvixrlFhmI0/s640/6.png" width="558" /></a></div>
<br />
<span style="background-color: #eeeeee;">Supply</span><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhM7CmIA3JIepAFnxiE5WYD88SZBcPh7So2dAbZoybyZgMl12Ee71sKFvu4VAk4Pu7p_agxX58VNClJmleJY4VYFFijYqoReRZMIG2QbrRDeWZrvB8AD_2wA8u-3W57D9ucNwzO7EI6lgjx/s1600/7.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="763" data-original-width="647" height="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhM7CmIA3JIepAFnxiE5WYD88SZBcPh7So2dAbZoybyZgMl12Ee71sKFvu4VAk4Pu7p_agxX58VNClJmleJY4VYFFijYqoReRZMIG2QbrRDeWZrvB8AD_2wA8u-3W57D9ucNwzO7EI6lgjx/s640/7.png" width="542" /></a></div>
<br />
<span style="background-color: #eeeeee;">Masks</span><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgge9hlD858y4vlbVYmRu5Fz8VyaFvN_d5jRi5JpP0bmbLipeb8myhWg4Y9HUdplLuz6xD8St1E1Y3YZiRSvrrNTK8xjz_PPTq4DMjTXY2R6PDX3sjA6ll0yh-_LtAeukDzM9iJjLYCviAx/s1600/8.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="758" data-original-width="652" height="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgge9hlD858y4vlbVYmRu5Fz8VyaFvN_d5jRi5JpP0bmbLipeb8myhWg4Y9HUdplLuz6xD8St1E1Y3YZiRSvrrNTK8xjz_PPTq4DMjTXY2R6PDX3sjA6ll0yh-_LtAeukDzM9iJjLYCviAx/s640/8.png" width="550" /></a></div>
<br />
<span style="background-color: #eeeeee;">Misc</span><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjuHg3ldAOHaoq1t8ZXp2H8DMJo_tRtF7ti-uhuHJsGnmNCYJtOlz119kpDo4qHKj_sHR7W0bK4lrGv5FdaNYA9OUjwVJo82qywlWGumZh69oJYbigbG4ZSOQRf31LZ5gJhb8eM2T-ec73P/s1600/9.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="766" data-original-width="654" height="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjuHg3ldAOHaoq1t8ZXp2H8DMJo_tRtF7ti-uhuHJsGnmNCYJtOlz119kpDo4qHKj_sHR7W0bK4lrGv5FdaNYA9OUjwVJo82qywlWGumZh69oJYbigbG4ZSOQRf31LZ5gJhb8eM2T-ec73P/s640/9.png" width="546" /></a></div>
<br />
For board manufacturing, I mainly use PCBWay. The PCB manufacturing capabilities of PCBWay are listed at <a href="https://www.pcbway.com/capabilities.html" target="_blank">https://www.pcbway.com/capabilities.html</a>.<br />
<br />
The table below was taken from the "PCB Capabilities - Quick-turn PCB" section from the link above and added with the design rules of adafruit and sparkfun and my personal notes.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhcy6I7gCOMYJMByICj0Fe53lcrCq9oo85mhgE6AtoA-6SZnz16Z3AADjBiVCa8FNiPmsEQcEaoF0b_QX5aCkGCPrt6CNvKufaXj8OOeYXGc0hgu1WN8FP7o2dMyFqZq8gE1dQizG2f9NbR/s1600/10.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1535" data-original-width="911" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhcy6I7gCOMYJMByICj0Fe53lcrCq9oo85mhgE6AtoA-6SZnz16Z3AADjBiVCa8FNiPmsEQcEaoF0b_QX5aCkGCPrt6CNvKufaXj8OOeYXGc0hgu1WN8FP7o2dMyFqZq8gE1dQizG2f9NbR/s1600/10.png" /></a></div>
<br />
<span style="font-size: large;"><b>Changing and testing the design rules</b></span><br />
<br />
From the table above, it's clear that the Drill Sizes setting (see the part in red box below ) in "sparkfun.dru" could be loosened to the same as that in adafruit.dru.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjCdRj1jWD1CNBHPyoQEjK_dHG5CaNZ5Q2u-cz3pPXiMP3bO53k119jISOv_QJhsiEyBVfhJh2LbYpHwV-Qw6q-PZuoKyiJjRFJjI_8md3n-2bKFNeVx8eJUBBA_vsAbjs7Ttxuck-DOMT_/s1600/11.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1535" data-original-width="911" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjCdRj1jWD1CNBHPyoQEjK_dHG5CaNZ5Q2u-cz3pPXiMP3bO53k119jISOv_QJhsiEyBVfhJh2LbYpHwV-Qw6q-PZuoKyiJjRFJjI_8md3n-2bKFNeVx8eJUBBA_vsAbjs7Ttxuck-DOMT_/s1600/11.png" /></a></div>
<br />
Follow the steps below to change the minimum drill setting from 20mil to 16mil.<br />
<br />
1. Load the schematic and gerber of the board design;<br />
<br />
2. Launch DRC;<br />
<br />
3. Load "sparkfun.dru";<br />
<br />
4. Click "Sizes". Change the Minimum Drill setting from 20mil to 16mil as shown below;<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgteXOla9Ebbf_qaq91_3CLapLSHVGpsZbeo3fFvwWmHmMWEQZPFDLSrrRYHoQhs0pMWGD0ymfz1SLzl1E-0Zn-FXMslzo7hj-kyg0ufYS4WhsDcWlFXcUYkSyvyYM7-EPYezP7nJGkVaVD/s1600/12.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="471" data-original-width="825" height="364" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgteXOla9Ebbf_qaq91_3CLapLSHVGpsZbeo3fFvwWmHmMWEQZPFDLSrrRYHoQhs0pMWGD0ymfz1SLzl1E-0Zn-FXMslzo7hj-kyg0ufYS4WhsDcWlFXcUYkSyvyYM7-EPYezP7nJGkVaVD/s640/12.png" width="640" /></a></div>
<br />
5. Click "Apply", then click "Check" to perform DRC;<br />
<br />
6. From the result generated, it's clear that there is no longer any drill size error;<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiyShtBmd42hSaRe76hL9WVfezh8_Gc9WApAPJMFm7Rp4CniC2mJ1987ANa9ooVFd14zA6dhOEIfUmyWFuwFb1cFUieCpWMnvNuNOa-MlL3XGw0gqGtTwz4o30995Ltjuo9glOWN1pJebIU/s1600/13.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="490" data-original-width="808" height="388" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiyShtBmd42hSaRe76hL9WVfezh8_Gc9WApAPJMFm7Rp4CniC2mJ1987ANa9ooVFd14zA6dhOEIfUmyWFuwFb1cFUieCpWMnvNuNOa-MlL3XGw0gqGtTwz4o30995Ltjuo9glOWN1pJebIU/s640/13.png" width="640" /></a></div>
<br />
7. However, there are still more errors (clearance error x 3) than the DRC result generated by using adafruit.dru (see below pic).<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiLWQurGsvUK-4n3WhTscDoUq1svqQZc-853z-OpDJeljRv5RXEhDir_XUxLGuIlWSHBXuB3eVPOMJkYn4y7K-u7krzsyBZbkZcmYA5Jyyuj13ojtFgG2_oYhh4Rgu_BWPGHhHH8oye6ht2/s1600/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="502" data-original-width="763" height="419" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiLWQurGsvUK-4n3WhTscDoUq1svqQZc-853z-OpDJeljRv5RXEhDir_XUxLGuIlWSHBXuB3eVPOMJkYn4y7K-u7krzsyBZbkZcmYA5Jyyuj13ojtFgG2_oYhh4Rgu_BWPGHhHH8oye6ht2/s640/1.png" width="640" /></a></div>
<br />
To solve this problem, follow the steps below:<br />
<br />
1. Click on any one of the Clearance error in the DRC Errors window to find the location of the error. From the pic below, it's clear that the cause has something to do with via.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhw8TPFwWzf-VadF8WxjXEh871kaAMaOC3I4Tqddnr5gGern_ivNNlgnuL2b0_PGTQZY-3cuWU8wCeNgkHLRKm9vEjVHpM1O21Ca2mnitT5opOImdQ3H33iWIrRQ9mJJ1cBcGN7Xo92uHO0/s1600/14.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="424" data-original-width="743" height="364" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhw8TPFwWzf-VadF8WxjXEh871kaAMaOC3I4Tqddnr5gGern_ivNNlgnuL2b0_PGTQZY-3cuWU8wCeNgkHLRKm9vEjVHpM1O21Ca2mnitT5opOImdQ3H33iWIrRQ9mJJ1cBcGN7Xo92uHO0/s640/14.png" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
2. Launch DRC, click on "Resting" then change the Outer and Inner settings for Vias from 10mil to 8mil as shown below.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZn4w-KK4_kIE88ehhBfHwaKDNtW_UcSPe3NvWVxQg5Nowd6Mofu6g7HcYwrR8-7CTivrCtw40n7a_3tw7-pTIKTmDlnsuf_bJj4BzPOswbq7th8r_Yul3l3hW8sgPXdFjzFhNzMcTAJDK/s1600/16.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="481" data-original-width="826" height="372" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZn4w-KK4_kIE88ehhBfHwaKDNtW_UcSPe3NvWVxQg5Nowd6Mofu6g7HcYwrR8-7CTivrCtw40n7a_3tw7-pTIKTmDlnsuf_bJj4BzPOswbq7th8r_Yul3l3hW8sgPXdFjzFhNzMcTAJDK/s640/16.png" width="640" /></a></div>
<br />
3. Click "Apply", then click "Check" to perform DRC again;<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiFlXXfFFyvWT2RFK45dsIHKKcNIb7HC145eI7UM192doHr27rFxDiAebN_pZcYc1P2Ccxq4ZZV87YLsnep0swCri-WWAIUajWb0Yq_5UhTm7p0tcs97jJxlAUDrZkDROJHG4Io4LjS0EvQ/s1600/17.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="418" data-original-width="739" height="362" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiFlXXfFFyvWT2RFK45dsIHKKcNIb7HC145eI7UM192doHr27rFxDiAebN_pZcYc1P2Ccxq4ZZV87YLsnep0swCri-WWAIUajWb0Yq_5UhTm7p0tcs97jJxlAUDrZkDROJHG4Io4LjS0EvQ/s640/17.png" width="640" /></a></div>
<br />
The numbers and types of error are the same as those checked by using "adafruit.dru" now. From the data highlighted in the red square in the table below, it's clear that the change is within the allowable range of PCBWay.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgtUViPFyFEw9Mu650B5k4XLro2EbF-KGb2V_e_bWlGoUsuBFMs6wqqROERcEXME16G6LMm4EoUCDyXIFVr2YoYcD4Hpaeotd-YScV9pXbQWZQAdjfd_F8INoJoENfiI_TmS-OSS9ROC1pG/s1600/18.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1536" data-original-width="911" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgtUViPFyFEw9Mu650B5k4XLro2EbF-KGb2V_e_bWlGoUsuBFMs6wqqROERcEXME16G6LMm4EoUCDyXIFVr2YoYcD4Hpaeotd-YScV9pXbQWZQAdjfd_F8INoJoENfiI_TmS-OSS9ROC1pG/s1600/18.png" /></a></div>
<br />Wei-Hsiung Huanghttp://www.blogger.com/profile/09437875322676421890noreply@blogger.com0tag:blogger.com,1999:blog-3648927237801494248.post-22368703917727492782019-11-18T17:17:00.001+08:002019-11-18T17:33:28.611+08:00EaglePCB - How to export parts used in a schematic to a libraryThis is a quick summary of how to export parts used in a schematic to a library using EaglePCB Version 6.6.0.<br />
<br />
Step-1, Launch EaglePCB and load the schematic that you want to extract the components from;<br />
<br />
Step-2, Click on the "Run ULP" icon (as shown below);<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjOKjF2ExiBy_gN2lSSZaQE2Fwpu1tVBSnj8SxDAZAVujjtqpMTcex_et9QB7HGh2SHdWCnzYFEmI3Awfxl3UrWqStV_UC-pMJL_NonJx-l4X4B9d7-G-GPRPEoAjnAudeqTw7q3i9IIzOx/s1600/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="592" data-original-width="798" height="296" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjOKjF2ExiBy_gN2lSSZaQE2Fwpu1tVBSnj8SxDAZAVujjtqpMTcex_et9QB7HGh2SHdWCnzYFEmI3Awfxl3UrWqStV_UC-pMJL_NonJx-l4X4B9d7-G-GPRPEoAjnAudeqTw7q3i9IIzOx/s400/1.png" width="400" /></a></div>
<br />
<a name='more'></a>Step-3, Locate "exp-lbrs.ulp";<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFFpohslqvVPNeERimk81aHEnU4B9AeB5mUjlsr31Imw5sHtmRh0kZiFv_sZohvOxojBQAdlZ6cAVk-3Gs8MC1hTRxPoyFFgO3WyQ7eDAI27shh4M-nff4z-7IY5SvFlP4unyJ4oUXPvd6/s1600/2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="506" data-original-width="594" height="340" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFFpohslqvVPNeERimk81aHEnU4B9AeB5mUjlsr31Imw5sHtmRh0kZiFv_sZohvOxojBQAdlZ6cAVk-3Gs8MC1hTRxPoyFFgO3WyQ7eDAI27shh4M-nff4z-7IY5SvFlP4unyJ4oUXPvd6/s400/2.png" width="400" /></a></div>
<br />
Step-4, Select the location to store the library that contains the exported components. Then click the OK button to proceed;<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhb_qezFkMhOIU12EkyoOa_le5-_MRYPP5HEff1IAOzN1OM8r8QWR9zxFif8sHXueUKZvoZgA00eb-GZR0hEfVxCIDXJOlnNU4UuueNys8g4UnOgEcD3-aWt6b7C9Uwq08JT715EiiUpus8/s1600/3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="225" data-original-width="505" height="177" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhb_qezFkMhOIU12EkyoOa_le5-_MRYPP5HEff1IAOzN1OM8r8QWR9zxFif8sHXueUKZvoZgA00eb-GZR0hEfVxCIDXJOlnNU4UuueNys8g4UnOgEcD3-aWt6b7C9Uwq08JT715EiiUpus8/s400/3.png" width="400" /></a></div>
<br />
After a short while, a new window will be opened automatically which contains the components exported.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTrUITBFqoKHcM9uwS0yHxNi5WgUgrMvIBSq9GsrHhCqaRL2x6GLHdZeLgfaZuo32bGfGeTqZSl7jnQupDR9yznBHePNtk8FonNXKLP6rW0wNR95HXigTPHJV0LAXVhrJWKCt1Ybjpcbzs/s1600/4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="660" data-original-width="1069" height="246" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTrUITBFqoKHcM9uwS0yHxNi5WgUgrMvIBSq9GsrHhCqaRL2x6GLHdZeLgfaZuo32bGfGeTqZSl7jnQupDR9yznBHePNtk8FonNXKLP6rW0wNR95HXigTPHJV0LAXVhrJWKCt1Ybjpcbzs/s400/4.png" width="400" /></a></div>
<br />
You are now ready to import the component(s) to your own library. Or, you could move the newly created library to where you keep all other EaglePCB libraries and use it from there. In my case, instead of adding the parts to my own library, I decided to put the newly created library with the rest of the libraries.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjtrE7OdX7T6p1YN8eOkI_nxNr_sGL0SGKOsQl41mSUF2sc4KYXofgEHGVs03PMeMI9deMD9M75FIjkOoJf0gbiSRJ8sAAC3aVi6sTTUJWhByQtihQ6L6zdrnIbMaVZBAaMvYbZLLraaffQ/s1600/5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="456" data-original-width="595" height="306" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjtrE7OdX7T6p1YN8eOkI_nxNr_sGL0SGKOsQl41mSUF2sc4KYXofgEHGVs03PMeMI9deMD9M75FIjkOoJf0gbiSRJ8sAAC3aVi6sTTUJWhByQtihQ6L6zdrnIbMaVZBAaMvYbZLLraaffQ/s400/5.png" width="400" /></a></div>
<br />
<b>Reference:</b><br />
<br />
How do you copy a component from Schematic to Library<br />
<a href="https://www.element14.com/community/thread/17211/l/how-do-you-copy-a-component-from-schematic-to-library?displayFullThread=true" target="_blank">https://www.element14.com/community/thread/17211/l/how-do-you-copy-a-component-from-schematic-to-library?displayFullThread=true</a>Wei-Hsiung Huanghttp://www.blogger.com/profile/09437875322676421890noreply@blogger.com0tag:blogger.com,1999:blog-3648927237801494248.post-14202681186576375452019-10-08T16:35:00.001+08:002019-10-09T09:14:05.948+08:00Cloud-based messaging system with Telegram as the client-side App.The purpose of this system is to provide an easy to use interface for viewing sensor status and configuring messaging settings for individual sensor deployed in the field. With this system in place, the deployed sensors only need to transmit essential data to the backend system and they could leave tasks such as who to receive what info. via which channel to the backend system; thus, making it possible to achieve longer battery life (by reducing the transmitting time).<br />
<br />
<b>Messaging Test</b><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhF6m8GoOU04DY5AABlKoHMkl2iIHFmMkDs068HXutvIGTqLZN4B5fx2eMFGudU6nBSEANpmfW3gD36_fNlEYjfK5ryFlll6ur11-PhejTblk1-heIpSE0KlgNFA-OUmnjcXGjaLCaNWlXz/s1600/telegram.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="706" data-original-width="1360" height="332" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhF6m8GoOU04DY5AABlKoHMkl2iIHFmMkDs068HXutvIGTqLZN4B5fx2eMFGudU6nBSEANpmfW3gD36_fNlEYjfK5ryFlll6ur11-PhejTblk1-heIpSE0KlgNFA-OUmnjcXGjaLCaNWlXz/s640/telegram.gif" width="640" /></a></div>
<br />
<a name='more'></a><b>Sensor Status Overview & Messaging Settings</b><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiV_TVgwEj0mEsacboLlKvlBaflP3helGK197nc5x0Fi9P3FFyyWXq0-qAbYsoU7cozSFgHmeVlNsNX2_XumYkVEnTxu7tlX0LutiQ_gBjRl8YzN4JZjpZ9WsuRj2sagVNPZiQyqqrCIgk2/s1600/test.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="631" data-original-width="1360" height="296" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiV_TVgwEj0mEsacboLlKvlBaflP3helGK197nc5x0Fi9P3FFyyWXq0-qAbYsoU7cozSFgHmeVlNsNX2_XumYkVEnTxu7tlX0LutiQ_gBjRl8YzN4JZjpZ9WsuRj2sagVNPZiQyqqrCIgk2/s640/test.gif" width="640" /></a></div>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />Wei-Hsiung Huanghttp://www.blogger.com/profile/09437875322676421890noreply@blogger.com0tag:blogger.com,1999:blog-3648927237801494248.post-80170188238163933032019-10-06T12:14:00.005+08:002019-10-06T12:16:34.428+08:00A bare minimum, working HTML + jQuery framework that will be executed automatically upon the completion of page load.This is a bare minimum, working HTML + jQuery framework that will be executed automatically upon the completion of page load.<br />
<br />
<b>index.html</b><br />
<br />
<div style="background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="line-height: 125%; margin: 0;"><!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
<!-- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" /> -->
<!-- script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> -->
</head>
<body>
</body>
</html>
<script>
$(document).ready(function(){
console.log('Hello World');
alert('Hello Kitty');
});
</script>
</pre>
</div>
<br />
<b>The Result</b><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIDsfIUmNGYP2HbDWqvsqiQpTBmWpQXZYVoiiKDmaYN7b5mvaw7Ia4hdnmeYkweJYPDV1-fSHmZr6m_4HwYU6UZZ1tQB-2b5nc29reaX1pqXykcz9QNF6nys-TyB1W9Zhyphenhyphen7Aqv7KhfkMDJ/s1600/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="335" data-original-width="743" height="180" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIDsfIUmNGYP2HbDWqvsqiQpTBmWpQXZYVoiiKDmaYN7b5mvaw7Ia4hdnmeYkweJYPDV1-fSHmZr6m_4HwYU6UZZ1tQB-2b5nc29reaX1pqXykcz9QNF6nys-TyB1W9Zhyphenhyphen7Aqv7KhfkMDJ/s400/1.png" width="400" /></a></div>
Wei-Hsiung Huanghttp://www.blogger.com/profile/09437875322676421890noreply@blogger.com0tag:blogger.com,1999:blog-3648927237801494248.post-38166612699584651512019-09-30T10:17:00.002+08:002019-09-30T10:17:45.837+08:00How to retrieve data from MySQL database using PHP and display it using jQuery and AjaxThis is a quick summary of how to retrieve data from MySQL database using PHP and display it using jQuery and Ajax.<br />
<br />
<b>Step 1 - Prepare MySQL database and data table.</b><br />
<br />
The SQL query below creates a database and data table and fills the table with sample data.<br />
<br />
<a name='more'></a><div style="background: rgb(255, 255, 255); border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="line-height: 16.25px;">
CREATE DATABASE IF NOT EXISTS question;
CREATE TABLE IF NOT EXISTS q_TABLE (
id int NOT NULL AUTO_INCREMENT,
name varchar(20) NOT NULL,
position varchar(20) NOT NULL,
salary varchar(20) NOT NULL,
start_date varchar(20) NOT NULL,
office varchar(20) NOT NULL,
extn varchar(20) NOT NULL,
PRIMARY KEY (id)
);
-- Insert data into the newly created "q_TABLE"
INSERT INTO q_TABLE (name, position, salary, start_date, office, extn)
VALUES
('Tiger Nixon','System Architect','$320,800','2011/04/25','Edinburgh','5421'),
('Garrett Winters','Accountant','$170,750','2011/07/25','Tokyo','8422'),
('Ashton Cox','Junior Technical Author','$86,000','2009/01/12','San Francisco','1562'),
('Cedric Kelly','Senior Javascript Developer','$433,060','2012/03/29','Edinburgh','6224'),
('Airi Satou','Accountant','$162,700','2008/11/28','Tokyo','5407'),
('Brielle Williamson','Integration Specialist','$372,000','2012/12/02','New York','4804'),
('Herrod Chandler','Sales Assistant','$137,500','2012/08/06','San Francisco','9608'),
('Rhona Davidson','Integration Specialist','$327,900','2010/10/14','Tokyo','6200'),
('Colleen Hurst','Javascript Developer','$205,500','2009/09/15','San Francisco','2360'),
('Sonya Frost','Software Engineer','$103,600','2008/12/13','Edinburgh','1667'),
('Jena Gaines','Office Manager','$90,560','2008/12/19','London','3814'),
('Quinn Flynn','Support Lead','$342,000','2013/03/03','Edinburgh','9497'),
('Charde Marshall','Regional Director','$470,600','2008/10/16','San Francisco','6741'),
('Haley Kennedy','Senior Marketing Designer','$313,500','2012/12/18','London','3597'),
('Tatyana Fitzpatrick','Regional Director','$385,750','2010/03/17','London','1965'),
('Michael Silva','Marketing Designer','$198,500','2012/11/27','London','1581'),
('Paul Byrd','Chief Financial Officer (CFO)','$725,000','2010/06/09','New York','3059'),
('Gloria Little','Systems Administrator','$237,500','2009/04/10','New York','1721'),
('Bradley Greer','Software Engineer','$132,000','2012/10/13','London','2558'),
('Dai Rios','Personnel Lead','$217,500','2012/09/26','Edinburgh','2290'),
('Jenette Caldwell','Development Lead','$345,000','2011/09/03','New York','1937'),
('Yuri Berry','Chief Marketing Officer (CMO)','$675,000','2009/06/25','New York','6154'),
('Caesar Vance','Pre-Sales Support','$106,450','2011/12/12','New York','8330'),
('Doris Wilder','Sales Assistant','$85,600','2010/09/20','Sidney','3023'),
('Angelica Ramos','Chief Executive Officer (CEO)','$1,200,000','2009/10/09','London','5797'),
('Gavin Joyce','Developer','$92,575','2010/12/22','Edinburgh','8822'),
('Jennifer Chang','Regional Director','$357,650','2010/11/14','Singapore','9239'),
('Brenden Wagner','Software Engineer','$206,850','2011/06/07','San Francisco','1314'),
('Fiona Green','Chief Operating Officer (COO)','$850,000','2010/03/11','San Francisco','2947'),
('Shou Itou','Regional Marketing','$163,000','2011/08/14','Tokyo','8899'),
('Michelle House','Integration Specialist','$95,400','2011/06/02','Sidney','2769'),
('Suki Burks','Developer','$114,500','2009/10/22','London','6832'),
('Prescott Bartlett','Technical Author','$145,000','2011/05/07','London','3606'),
('Gavin Cortez','Team Leader','$235,500','2008/10/26','San Francisco','2860'),
('Martena Mccray','Post-Sales support','$324,050','2011/03/09','Edinburgh','8240'),
('Unity Butler','Marketing Designer','$85,675','2009/12/09','San Francisco','5384'),
('Howard Hatfield','Office Manager','$164,500','2008/12/16','San Francisco','7031'),
('Hope Fuentes','Secretary','$109,850','2010/02/12','San Francisco','6318'),
('Vivian Harrell','Financial Controller','$452,500','2009/02/14','San Francisco','9422'),
('Timothy Mooney','Office Manager','$136,200','2008/12/11','London','7580'),
('Jackson Bradshaw','Director','$645,750','2008/09/26','New York','1042'),
('Olivia Liang','Support Engineer','$234,500','2011/02/03','Singapore','2120'),
('Bruno Nash','Software Engineer','$163,500','2011/05/03','London','6222'),
('Sakura Yamamoto','Support Engineer','$139,575','2009/08/19','Tokyo','9383'),
('Thor Walton','Developer','$98,540','2013/08/11','New York','8327'),
('Finn Camacho','Support Engineer','$87,500','2009/07/07','San Francisco','2927'),
('Serge Baldwin','Data Coordinator','$138,575','2012/04/09','Singapore','8352'),
('Zenaida Frank','Software Engineer','$125,250','2010/01/04','New York','7439'),
('Zorita Serrano','Software Engineer','$115,000','2012/06/01','San Francisco','4389'),
('Jennifer Acosta','Junior Javascript Developer','$75,650','2013/02/01','Edinburgh','3431'),
('Cara Stevens','Sales Assistant','$145,600','2011/12/06','New York','3990'),
('Hermione Butler','Regional Director','$356,250','2011/03/21','London','1016'),
('Lael Greer','Systems Administrator','$103,500','2009/02/27','London','6733'),
('Jonas Alexander','Developer','$86,500','2010/07/14','San Francisco','8196'),
('Shad Decker','Regional Director','$183,000','2008/11/13','Edinburgh','6373'),
('Michael Bruce','Javascript Developer','$183,000','2011/06/27','Singapore','5384'),
('Donna Snider','Customer Support','$112,000','2011/01/25','New York','4226');
</pre>
</div>
<br />
<b>Step 2 - Prepare the PHP code that fetches data from the database.</b><br />
<br />
<span style="background-color: #eeeeee;">data_fetch.php</span><br />
<br />
<div style="background: rgb(255, 255, 255); border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="line-height: 16.25px;"><span style="font-style: italic;"><?php</span>
<span style="font-weight: bold;">require</span> <span style="font-style: italic;">"includes/dbh.inc.php"</span>;
$query = <span style="font-style: italic;">"SELECT * FROM q_TABLE"</span>;
$result = mysqli_query($conn, $query);
<span style="font-weight: bold;">while</span> ($row = mysqli_fetch_array($result)){
$data[] = $row;
}
<span style="font-weight: bold;">echo</span> json_encode($data);
<span style="font-style: italic;">?></span>
</pre>
</div>
<br />
Below is the output result.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJx2JcRALiZzZQX90v5HEFeDngnJoLWNR5qRj7eemxxgv5jSAoezwW7AMefh8ZdY3RzZ0_PM0SqmharUsuLV1HDyEEP7jU3m-fGorXweZtHui5Ro1Epm6PmujhbQWQYUyquMs67ZxqbQ3W/s1600/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="632" data-original-width="437" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJx2JcRALiZzZQX90v5HEFeDngnJoLWNR5qRj7eemxxgv5jSAoezwW7AMefh8ZdY3RzZ0_PM0SqmharUsuLV1HDyEEP7jU3m-fGorXweZtHui5Ro1Epm6PmujhbQWQYUyquMs67ZxqbQ3W/s400/1.png" width="276" /></a></div>
<br />
<b>Step 3 - Prepare the HTML and the jQuery and the Ajax code that displays the fetched data in console.log.</b><br />
<br />
Ref.:<br />
Save php json object into jquery variables<br />
<a href="https://stackoverflow.com/questions/36251127/save-php-json-object-into-jquery-variables" target="_blank">https://stackoverflow.com/questions/36251127/save-php-json-object-into-jquery-variables</a><br />
<br />
<div style="background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="line-height: 125%; margin: 0;"><!DOCTYPE html>
<html>
<head>
<meta name="description" content="Add Select and input to html table">
<script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
<link href="https://nightly.datatables.net/css/jquery.dataTables.css" rel="stylesheet" type="text/css" />
<script src="https://nightly.datatables.net/js/jquery.dataTables.js"></script>
<link href="https://cdn.datatables.net/select/1.2.1/css/select.dataTables.min.css" rel="stylesheet" type="text/css" />
<script src="https://cdn.datatables.net/select/1.2.1/js/dataTables.select.min.js" type="text/javascript" ></script>
<link href="https://cdn.datatables.net/buttons/1.2.4/css/buttons.dataTables.min.css" rel="stylesheet" type="text/css"/>
<script src="https://cdn.datatables.net/buttons/1.2.4/js/dataTables.buttons.min.js" type="text/javascript"></script>
<script type="text/javascript" language="javascript" src="//cdn.datatables.net/buttons/1.3.1/js/buttons.print.min.js"></script>
<script type="text/javascript" src="//cdn.datatables.net/plug-ins/1.10.15/sorting/custom-data-source/dom-text.js"></script>
<meta charset=utf-8 />
<title>A Simple Test</title>
</head>
</html>
<script type="text/javascript" language="javascript">
// ref.:
// https://stackoverflow.com/questions/35402370/send-php-array-to-jquery-ajax-and-make-a-each-loop-from-that-array
// https://stackoverflow.com/questions/21488145/why-isnt-this-very-simple-jquery-working
$(document).ready(function() {
//console.log('I am in!');
//alert('Hi.');
$.ajax({
url: "data_fetch.php",
dataType: 'json',
cache: false,
success: function(response)
{
for (var i = 0; i < response.length; i++)
{
//console.log(i, response[i].name);
console.log(response[i].name);
}
}
});
});
</script>
</pre>
</div>
<br />
<b>The Result</b><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgKNoG2icYmqoiXJB7ISlBZaZ1EDI8r4F1zzruLpa6G1R95PaDwwgE2psgINnE_drFIPP2tnV5mH5A1QBMRvzqgSnQoJPH9hdc5jxCrHJQCSLn3iggNoL9__DI72BrLO8WhU6VBWD2JOapL/s1600/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="642" data-original-width="504" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgKNoG2icYmqoiXJB7ISlBZaZ1EDI8r4F1zzruLpa6G1R95PaDwwgE2psgINnE_drFIPP2tnV5mH5A1QBMRvzqgSnQoJPH9hdc5jxCrHJQCSLn3iggNoL9__DI72BrLO8WhU6VBWD2JOapL/s400/1.png" width="311" /></a></div>
<br />
<br />Wei-Hsiung Huanghttp://www.blogger.com/profile/09437875322676421890noreply@blogger.com0tag:blogger.com,1999:blog-3648927237801494248.post-5701803760470183582019-09-27T16:12:00.002+08:002019-09-27T16:58:41.745+08:00PHP and MySQL - Trying out "mysqli_fetch_assoc()".This is a quick experiment on using "mysqli_fetch_assoc()" to retrieve data from MySQL database and display the retrieved data.<br />
<br />
<b><u>The Code</u></b><br />
<br />
<div style="background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<table><tbody>
<tr><td><pre style="line-height: 125%; margin: 0;"> 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36</pre>
</td><td><pre style="line-height: 125%; margin: 0;"><span style="font-style: italic;"><?php</span>
$conn = mysqli_connect(<span style="font-style: italic;">"localhost"</span>, <span style="font-style: italic;">"root"</span>, <span style="font-style: italic;">""</span>, <span style="font-style: italic;">"sensors"</span>);
$query = <span style="font-style: italic;">"SELECT * FROM t_viewname"</span>;
<span style="font-style: italic;">// Get the number of row in the result</span>
$number_filter_row = mysqli_num_rows(mysqli_query($conn, $query));
<span style="font-weight: bold;">echo</span> <span style="font-style: italic;">"No. of Row: "</span>.$number_filter_row;
<span style="font-style: italic;">//echo $number_filter_row;</span>
<span style="font-weight: bold;">echo</span> <span style="font-style: italic;">"<br>"</span>;
<span style="font-style: italic;">// mysqli_query() -> Perform queries against the database.</span>
<span style="font-style: italic;">// For example:</span>
<span style="font-style: italic;">// mysqli_query($con,"SELECT * FROM Persons");</span>
<span style="font-style: italic;">// mysqli_query($con,"INSERT INTO Persons (FirstName,LastName,Age) VALUES ('Glenn','Quagmire',33)");</span>
$result = mysqli_query($conn, $query);
<span style="font-style: italic;">// Reference:</span>
<span style="font-style: italic;">// https://stackoverflow.com/questions/14456529/mysqli-fetch-array-while-loop-columns</span>
$post = <span style="font-weight: bold;">array</span>();
<span style="font-weight: bold;">while</span> ($row = <span style="background-color: yellow;">mysqli_fetch_assoc</span>($result)) {
$post[] = $row;
}
<span style="font-weight: bold;">foreach</span> ($post <span style="font-weight: bold;">as</span> $row) {
<span style="font-weight: bold;">foreach</span> ($row <span style="font-weight: bold;">as</span> $element) {
<span style="font-weight: bold;">echo</span> $element.<span style="font-style: italic;">", "</span>;
}
<span style="font-weight: bold;">echo</span> <span style="font-style: italic;">"<br>"</span>;
}
<span style="font-style: italic;">?></span>
</pre>
</td></tr>
</tbody></table>
</div>
<br />
Note, see below for the explanation on why there is no index inside the while loop.<br />
<br />
Ref.: <a href="https://stackoverflow.com/questions/9105419/generate-array-from-php-while-loop" target="_blank">https://stackoverflow.com/questions/9105419/generate-array-from-php-while-loop</a><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjifdqhNeTkycB2VQhavggOWKMzBbTMM_aT2Qn1xPOod5oG-EFZqv1wOcGEjBe7QOtHTzdjMUXwpv9AEcur0fIi21x0ZDWuG8k3cSP-y-jE1CbOskYf5F_JJEMA9l_pDGYHhUN_7s1F66ZW/s1600/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="166" data-original-width="696" height="150" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjifdqhNeTkycB2VQhavggOWKMzBbTMM_aT2Qn1xPOod5oG-EFZqv1wOcGEjBe7QOtHTzdjMUXwpv9AEcur0fIi21x0ZDWuG8k3cSP-y-jE1CbOskYf5F_JJEMA9l_pDGYHhUN_7s1F66ZW/s640/1.png" width="640" /></a></div>
<br />
<b><u>The Result</u></b><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjcBPHHM7qgzF0SRhNTNsrqUldZUhvzlfMpjA4FEk4ss7AoYn2EAR6AXLJgUBzf-_HbN-3Af-5OGU9uDQoTdCd8pYbL3M1FevIU2pfr4GFC5D6T77lVm4725wV2O-RsjysiBQ3J3jt0H1tN/s1600/5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="279" data-original-width="809" height="220" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjcBPHHM7qgzF0SRhNTNsrqUldZUhvzlfMpjA4FEk4ss7AoYn2EAR6AXLJgUBzf-_HbN-3Af-5OGU9uDQoTdCd8pYbL3M1FevIU2pfr4GFC5D6T77lVm4725wV2O-RsjysiBQ3J3jt0H1tN/s640/5.png" width="640" /></a></div>
<br />
<b>Reference:</b><br />
<br />
mysqli_fetch_array while loop columns<br />
<a href="https://stackoverflow.com/questions/14456529/mysqli-fetch-array-while-loop-columns" target="_blank">https://stackoverflow.com/questions/14456529/mysqli-fetch-array-while-loop-columns</a>Wei-Hsiung Huanghttp://www.blogger.com/profile/09437875322676421890noreply@blogger.com0tag:blogger.com,1999:blog-3648927237801494248.post-47514507698623234562019-09-27T15:42:00.001+08:002019-09-27T16:05:40.280+08:00PHP and MySQL - A quick experiment on "mysqli_fetch_assoc()", "mysqli_fetch_row()", and "mysqli_fetch_array()".This is a quick experiment on "mysqli_fetch_assoc()", "mysqli_fetch_row()", and "mysqli_fetch_array()".<br />
<br />
As for which one to use, I think below comment from <a href="https://stackoverflow.com/questions/20261041/when-and-why-to-use-mysqli-fetch-row-mysqli-fetch-object-mysqli-fetch-assoc-m" target="_blank">stackoverflow</a>.<br />
<br />
"<span style="color: red;"><u>I'd typically use _fetch_assoc, because I want to be accessing my data by name because it makes the code more comprehensible and less prone to errors.</u></span> _fetch_array returns numerically and string indexed arrays, which is superfluous and potentially maybe possibly more wasteful. Not that it really matters in the grand scheme of things, but still. Do what you need; if you want named keys, use the function that gives you named keys and nothing more."<br />
<br />
<a name='more'></a><b style="background-color: white; font-size: x-large;">mysqli_fetch_assoc</b><br />
<br />
This function will return a row as an associative array where the column names will be the keys storing corresponding value.<br />
<br />
<u>The Code</u><br />
<br />
<div style="background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<table><tbody>
<tr><td><pre style="line-height: 125%; margin: 0;"> 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30</pre>
</td><td><pre style="line-height: 125%; margin: 0;"><span style="font-style: italic;"><?php</span>
$conn = mysqli_connect(<span style="font-style: italic;">"localhost"</span>, <span style="font-style: italic;">"root"</span>, <span style="font-style: italic;">""</span>, <span style="font-style: italic;">"sensors"</span>);
$query = <span style="font-style: italic;">"SELECT * FROM t_viewname"</span>;
<span style="font-style: italic;">// Get the number of row in the result</span>
$number_filter_row = mysqli_num_rows(mysqli_query($conn, $query));
<span style="font-weight: bold;">echo</span> <span style="font-style: italic;">"No. of Row: "</span>;
<span style="font-weight: bold;">echo</span> $number_filter_row;
<span style="font-weight: bold;">echo</span> <span style="font-style: italic;">", "</span>;
<span style="font-style: italic;">// mysqli_query() -> Perform queries against the database.</span>
<span style="font-style: italic;">// For example:</span>
<span style="font-style: italic;">// mysqli_query($con,"SELECT * FROM Persons");</span>
<span style="font-style: italic;">// mysqli_query($con,"INSERT INTO Persons (FirstName,LastName,Age) VALUES ('Glenn','Quagmire',33)");</span>
$result = mysqli_query($conn, $query);
$row = <span style="background-color: yellow;">mysqli_fetch_assoc</span>($result);
<span style="font-weight: bold;">echo</span> $row[<span style="font-style: italic;">'dev_id'</span>];
<span style="font-weight: bold;">echo</span> <span style="font-style: italic;">', '</span>;
<span style="font-weight: bold;">echo</span> $row[<span style="font-style: italic;">'b_level'</span>];
<span style="font-weight: bold;">echo</span> <span style="font-style: italic;">', '</span>;
<span style="font-weight: bold;">echo</span> $row[<span style="font-style: italic;">'dev_location'</span>];
<span style="font-weight: bold;">echo</span> <span style="font-style: italic;">'.'</span>;
<span style="font-style: italic;">?></span>
</pre>
</td></tr>
</tbody></table>
</div>
<br />
<u>The Result</u><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJnVfD4pbdjSinCSx8B401tBXjzx5mlgby4SykeyJWgh8H0vl3a455McR3zBMKTAWIAvRi0O-QPIdjPTWXTpeuo9sneQVEu6znY34GkDSuAtAFNO8ODf-j_Vm5L4jgWhKMWNkmJ2vV6SHp/s1600/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="69" data-original-width="391" height="70" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJnVfD4pbdjSinCSx8B401tBXjzx5mlgby4SykeyJWgh8H0vl3a455McR3zBMKTAWIAvRi0O-QPIdjPTWXTpeuo9sneQVEu6znY34GkDSuAtAFNO8ODf-j_Vm5L4jgWhKMWNkmJ2vV6SHp/s400/1.png" width="400" /></a></div>
<br />
--------------------------------------------------------------------------------------------------------------------------<br />
<br />
<b><span style="font-size: large;">mysqli_fetch_row</span></b><br />
<br />
This function will return a row where the values will come in the order as they are defined in the SQL query, and the keys will span from 0 to one less than the number of columns selected.<br />
<br />
<u>The Code</u><br />
<br />
<div style="background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<table><tbody>
<tr><td><pre style="line-height: 125%; margin: 0;"> 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30</pre>
</td><td><pre style="line-height: 125%; margin: 0;"><span style="font-style: italic;"><?php</span>
$conn = mysqli_connect(<span style="font-style: italic;">"localhost"</span>, <span style="font-style: italic;">"root"</span>, <span style="font-style: italic;">""</span>, <span style="font-style: italic;">"sensors"</span>);
$query = <span style="font-style: italic;">"SELECT * FROM t_viewname"</span>;
<span style="font-style: italic;">// Get the number of row in the result</span>
$number_filter_row = mysqli_num_rows(mysqli_query($conn, $query));
<span style="font-weight: bold;">echo</span> <span style="font-style: italic;">"No. of Row: "</span>;
<span style="font-weight: bold;">echo</span> $number_filter_row;
<span style="font-weight: bold;">echo</span> <span style="font-style: italic;">", "</span>;
<span style="font-style: italic;">// mysqli_query() -> Perform queries against the database.</span>
<span style="font-style: italic;">// For example:</span>
<span style="font-style: italic;">// mysqli_query($con,"SELECT * FROM Persons");</span>
<span style="font-style: italic;">// mysqli_query($con,"INSERT INTO Persons (FirstName,LastName,Age) VALUES ('Glenn','Quagmire',33)");</span>
$result = mysqli_query($conn, $query);
$row = <span style="background-color: yellow;">mysqli_fetch_row</span>($result);
<span style="font-weight: bold;">echo</span> $row[0];
<span style="font-weight: bold;">echo</span> <span style="font-style: italic;">', '</span>;
<span style="font-weight: bold;">echo</span> $row[1];
<span style="font-weight: bold;">echo</span> <span style="font-style: italic;">', '</span>;
<span style="font-weight: bold;">echo</span> $row[2];
<span style="font-weight: bold;">echo</span> <span style="font-style: italic;">'.'</span>;
<span style="font-style: italic;">?></span>
</pre>
</td></tr>
</tbody></table>
</div>
<br />
<u>The Result</u><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8newOaHx125tyEWIz6kq89Aiysai105Zq3g-DI-kl5l8oR9jH-LmKX8EmWKGaZc3NQACKPq-kDdW9WndzW6-yrbZcmFGN6EG7wVKE6Sdk0NlcRp9SG_NtgSx_Wt2-cyyNTLPtgnRHjpuH/s1600/2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="63" data-original-width="387" height="65" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8newOaHx125tyEWIz6kq89Aiysai105Zq3g-DI-kl5l8oR9jH-LmKX8EmWKGaZc3NQACKPq-kDdW9WndzW6-yrbZcmFGN6EG7wVKE6Sdk0NlcRp9SG_NtgSx_Wt2-cyyNTLPtgnRHjpuH/s400/2.png" width="400" /></a></div>
<br />
--------------------------------------------------------------------------------------------------------------------------<br />
<br />
<b><span style="font-size: large;">mysqli_fetch_array</span></b><br />
<br />
This function will actually return an array <u><span style="color: red;">with both the contents of <b>mysql_fetch_row</b> and <b>mysql_fetch_assoc</b> merged into one</span></u>. It will both have numeric and string keys which will let you access your data in whatever way you'd find easiest.<br />
<br />
<u>The Code</u><br />
<br />
<div style="background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<table><tbody>
<tr><td><pre style="line-height: 125%; margin: 0;"> 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37</pre>
</td><td><pre style="line-height: 125%; margin: 0;"><span style="font-style: italic;"><?php</span>
$conn = mysqli_connect(<span style="font-style: italic;">"localhost"</span>, <span style="font-style: italic;">"root"</span>, <span style="font-style: italic;">""</span>, <span style="font-style: italic;">"sensors"</span>);
$query = <span style="font-style: italic;">"SELECT * FROM t_viewname"</span>;
<span style="font-style: italic;">// Get the number of row in the result</span>
$number_filter_row = mysqli_num_rows(mysqli_query($conn, $query));
<span style="font-weight: bold;">echo</span> <span style="font-style: italic;">"No. of Row: "</span>;
<span style="font-weight: bold;">echo</span> $number_filter_row;
<span style="font-weight: bold;">echo</span> <span style="font-style: italic;">", "</span>;
<span style="font-style: italic;">// mysqli_query() -> Perform queries against the database.</span>
<span style="font-style: italic;">// For example:</span>
<span style="font-style: italic;">// mysqli_query($con,"SELECT * FROM Persons");</span>
<span style="font-style: italic;">// mysqli_query($con,"INSERT INTO Persons (FirstName,LastName,Age) VALUES ('Glenn','Quagmire',33)");</span>
$result = mysqli_query($conn, $query);
$row = mysqli_fetch_array($result);
<span style="font-weight: bold;">echo</span> $row[<span style="font-style: italic;">'dev_id'</span>];
<span style="font-weight: bold;">echo</span> <span style="font-style: italic;">', '</span>;
<span style="font-weight: bold;">echo</span> $row[<span style="font-style: italic;">'b_level'</span>];
<span style="font-weight: bold;">echo</span> <span style="font-style: italic;">', '</span>;
<span style="font-weight: bold;">echo</span> $row[<span style="font-style: italic;">'dev_location'</span>];
<span style="font-weight: bold;">echo</span> <span style="font-style: italic;">'. <br>'</span>;
<span style="font-weight: bold;">echo</span> $row[0];
<span style="font-weight: bold;">echo</span> <span style="font-style: italic;">', '</span>;
<span style="font-weight: bold;">echo</span> $row[1];
<span style="font-weight: bold;">echo</span> <span style="font-style: italic;">', '</span>;
<span style="font-weight: bold;">echo</span> $row[2];
<span style="font-weight: bold;">echo</span> <span style="font-style: italic;">'.'</span>;
<span style="font-style: italic;">?></span>
</pre>
</td></tr>
</tbody></table>
</div>
<br />
<u>The Result</u><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhTfLRjDZXxe4zT9lH3dUXEFEMnVIgEbZ3NTMAdkr_oC03uGzavIFyUPCzFrXHIep5eH9F33YwYKyNA4mF8J1XeRgFay6DRDguUfa2SKhhqoHAzO73ndMjOzQVBiU3vaGYjsE_jAFaxH1Y6/s1600/3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="115" data-original-width="391" height="117" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhTfLRjDZXxe4zT9lH3dUXEFEMnVIgEbZ3NTMAdkr_oC03uGzavIFyUPCzFrXHIep5eH9F33YwYKyNA4mF8J1XeRgFay6DRDguUfa2SKhhqoHAzO73ndMjOzQVBiU3vaGYjsE_jAFaxH1Y6/s400/3.png" width="400" /></a></div>
<br />
<b>Reference:</b><br />
<br />
What's the difference between mysqli_fetch_array and mysqli_fetch_assoc in PHP?<br />
<a href="https://www.quora.com/Whats-the-difference-between-mysqli_fetch_array-and-mysqli_fetch_assoc-in-PHP" target="_blank">https://www.quora.com/Whats-the-difference-between-mysqli_fetch_array-and-mysqli_fetch_assoc-in-PHP</a>Wei-Hsiung Huanghttp://www.blogger.com/profile/09437875322676421890noreply@blogger.com0