tag:blogger.com,1999:blog-32200063454470414042024-03-05T01:20:08.056-08:00Confused Life - ReloadedTisham Dharhttp://www.blogger.com/profile/15154154153085427197noreply@blogger.comBlogger498125tag:blogger.com,1999:blog-3220006345447041404.post-3226686214038645272022-11-05T06:23:00.006-07:002022-11-05T06:27:54.703-07:00Drop shipping products from PCBWay<h1 id="drop-shipping-products-from-pcbway">Drop shipping products from PCBWay</h1>
<p>For a while I have been ordering PCB’s from <a href="https://www.pcbway.com/project/shareproject/ATM90E36_Breakout_a7d8bccf.html">PCBWay</a> and parts from <a href="https://au.mouser.com/">Mouser</a> and <a href="https://www.digikey.com.au/">Digikey</a>, then hand assembling them at home. These have been very small scale cottage industry style runs and ultimately time consuming as I focus more on design and evaluation of new energy monitor ASIC’s such as the <a href="">V9261F</a>. When PCBWay started offering to stock and drop ship my PCB’s directly from the factory using their extensive clout with DHL, I promptly signed up for the service.</p>
<p>Recently I have been getting my <a href="https://github.com/whatnick/ATM90E36_Breakout_KiCAD">ATM90E36 Devkit</a> PCB’s assembled there. The service has been excellent with concierge like parts choice and purchase. Followed by extremely helpful consultation on assembly progress and correctness.</p>
<p>I received the following images after the first stage and confirmed the crystal and LED’s.</p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjNEY2otpCpvnRxLZn1ncbbgyeYG_vYzoyhFkhmeuszriHHgPmKGoPB-Obc7dVBd2UOy1B1amtHn6G4CczpNmh_kjPfuq1pFqEWwzVKTPOyYVIUHZBXNQN5ejFRygz2vcTfqHs62kUXQI5ROSdeLSUbroUzMX20QtUcyNMNq9lTzezSZMRwv1vzWDk2/s756/Q1-orientation%20confirmation.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="588" data-original-width="756" height="249" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjNEY2otpCpvnRxLZn1ncbbgyeYG_vYzoyhFkhmeuszriHHgPmKGoPB-Obc7dVBd2UOy1B1amtHn6G4CczpNmh_kjPfuq1pFqEWwzVKTPOyYVIUHZBXNQN5ejFRygz2vcTfqHs62kUXQI5ROSdeLSUbroUzMX20QtUcyNMNq9lTzezSZMRwv1vzWDk2/s320/Q1-orientation%20confirmation.jpg" width="320" /></a></div><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhr0WFpmPB_hAMPU-LAaF9tI7vj5fXukcuMV1kHA8Wmt0s0paVi8DXw_bnyUablpp-s4CKky0eALKeV8MbGnppu7wCjps2qDAU2HRpxN82womh5jsvIhVhmR_kW2A0HY3xEXFoBTDtItx1Zu2_iMNhg89DUKkpa3jzqEldMlnS3jxh8QB-EjcMs82Iv/s4608/T-U137W51580A-01.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="3456" data-original-width="4608" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhr0WFpmPB_hAMPU-LAaF9tI7vj5fXukcuMV1kHA8Wmt0s0paVi8DXw_bnyUablpp-s4CKky0eALKeV8MbGnppu7wCjps2qDAU2HRpxN82womh5jsvIhVhmR_kW2A0HY3xEXFoBTDtItx1Zu2_iMNhg89DUKkpa3jzqEldMlnS3jxh8QB-EjcMs82Iv/s320/T-U137W51580A-01.jpg" width="320" /></a></div><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjtTLEC_IIN7goJ-8qe-oW19of6SG2wGNKLsTohXeU33LP6G3ONawgaFCc-29YHHU8wUeGCy4t-_bGh2-bZl6b90NzZoSkdCecba2XN3YzbPaPK4BZQMky4Tlmjqwz9g1dRDz-tns8YB9kc_UmTc14-D8tKw_3fUBLwW5eIvpCmROKGBkprmOC57Pc8/s4608/T-U137W51580A-02.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="3456" data-original-width="4608" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjtTLEC_IIN7goJ-8qe-oW19of6SG2wGNKLsTohXeU33LP6G3ONawgaFCc-29YHHU8wUeGCy4t-_bGh2-bZl6b90NzZoSkdCecba2XN3YzbPaPK4BZQMky4Tlmjqwz9g1dRDz-tns8YB9kc_UmTc14-D8tKw_3fUBLwW5eIvpCmROKGBkprmOC57Pc8/s320/T-U137W51580A-02.jpg" width="320" /></a></div><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjXqXVbWMlGTlX_dnRcX8GMw9TusoGBZNk7OAILeNQB7FfPOcGVinDssJPwiQbLeAOSCb8zqy7Bu86s4YBliw_himCMkiUWYqgpRVG8gm5fwXh5mcltnEStU-wvmOJRl6xETiB1ix1WFpnHW19qu0ADWZr9guSksU62KjkBQSk79Z4f0WLN8V2oKiPZ/s876/The%20arrow%20indicates%20cathode%20.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="542" data-original-width="876" height="198" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjXqXVbWMlGTlX_dnRcX8GMw9TusoGBZNk7OAILeNQB7FfPOcGVinDssJPwiQbLeAOSCb8zqy7Bu86s4YBliw_himCMkiUWYqgpRVG8gm5fwXh5mcltnEStU-wvmOJRl6xETiB1ix1WFpnHW19qu0ADWZr9guSksU62KjkBQSk79Z4f0WLN8V2oKiPZ/s320/The%20arrow%20indicates%20cathode%20.jpg" width="320" /></a></div><br /><p><br /></p>
<p>Then I received some more inspection photos to allay any doubts.</p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4Z0nJ7s3SrPC1HJ_5M1LupeAIDz_FQB2ilhKbZcwgjKtgUUVxOL48JjfhaFWpJmdM0rGYxwYqNEQ3N37CU0bJi3XDiJE3ALYd5ycIm2_KsVTn0rEJ94lWGdKJqkoIxkdw2uXAtz2Fkv8sDb38t3I-OwXzIYvxxi25g_8KJu5Brn88-2zzRH29mEcL/s1052/T-U137W51580A-the%20arrow%20indicates%20cathode%20.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="835" data-original-width="1052" height="254" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4Z0nJ7s3SrPC1HJ_5M1LupeAIDz_FQB2ilhKbZcwgjKtgUUVxOL48JjfhaFWpJmdM0rGYxwYqNEQ3N37CU0bJi3XDiJE3ALYd5ycIm2_KsVTn0rEJ94lWGdKJqkoIxkdw2uXAtz2Fkv8sDb38t3I-OwXzIYvxxi25g_8KJu5Brn88-2zzRH29mEcL/s320/T-U137W51580A-the%20arrow%20indicates%20cathode%20.png" width="320" /></a></div><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgfd_H5I90aNo-VAsTkuAzyxHQGZ_18AKuHTG2wKCXN3uyFh6eEti9p4UWawtqZ4UD6mzGnxUHffVVvR5nECOL4jOqFsh27BOlH4eHFWLyIYjLwZE4fNQEUnuPqmrTCx14tJpqtkrg6YkbHFP7jp0vs1Wlh4S35zD5pigFuQCutHRMbQsGFUC9jZXXh/s4624/Updated%20T-U137W51580A-01.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="3472" data-original-width="4624" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgfd_H5I90aNo-VAsTkuAzyxHQGZ_18AKuHTG2wKCXN3uyFh6eEti9p4UWawtqZ4UD6mzGnxUHffVVvR5nECOL4jOqFsh27BOlH4eHFWLyIYjLwZE4fNQEUnuPqmrTCx14tJpqtkrg6YkbHFP7jp0vs1Wlh4S35zD5pigFuQCutHRMbQsGFUC9jZXXh/s320/Updated%20T-U137W51580A-01.jpg" width="320" /></a></div><br /><p><br /></p>
<p>Looking forward to the stock appearing on the <a href="https://www.pcbway.com/project/gifts_detail/ATM90E26_FeatherWing.html">shop front</a>.</p>
<p><strong>NOTE: This is a paid promotion of PCBWay services</strong></p>
Tisham Dharhttp://www.blogger.com/profile/15154154153085427197noreply@blogger.com0tag:blogger.com,1999:blog-3220006345447041404.post-61892769717157712512020-12-27T13:51:00.002-08:002020-12-31T05:28:56.985-08:00Trucks vs Trains as an analogy for Microservices vs Monoliths<p>2018 and 2019 was mostly spent obsessing over containers, trucks, trailers and hand written paper invoices for me. I was helping build out the technology stack and engineering team for <a href="https://www.lorisystems.com/">Lori Systems</a>. Early in 2019 we made our first DevOps hire, getting <a href="https://www.linkedin.com/in/cmakamara/">Clive</a> from Safaricom and getting started on migrating our handrolled Django monolith from EC2 to EKS. We would make jokes around shipping containers using containers. Clive even had a container shaped stressball with the EKS logo on it. This set me thinking on the parallels between shipping code and shipping goods, perhaps also led to the foundations of this post.</p>
<h2 id="intermodal-shipping-in-the-real-world-and-in-software">Intermodal Shipping in the real-world and in software</h2>
<p>Over the almost 2-years of work in Logistics I learnt a lot about how the global logistics system works. Almost like the life-blood of the planet. Large container ships abstract away contents and ship things from Taiwan to Timbukutu. The seminal book on this topic is perhaps, <a href="https://doi.org/10.1515/9781400880751">The BOX</a>. Watching global shipping lanes in <a href="https://www.marinetraffic.com/en/ais/home/centerx:-12.0/centery:25.0/zoom:4">Marine Traffic</a> and scraping <a href="https://www.kpa.co.ke/Pages/14DaysList.aspx">ships arriving in Mombasa</a> from the KPA Sharepoint became a daily ritual. I digress, back to the original point on the importance for containerization in shipping code or machinery.</p>
<p>Docker uses the ubiquitous whale/ship logo, most containers arrive at ports this way from the oceans of developers. I don't quite have an analogy here for the massive ships that land the containers at ports, some <a href="https://en.wikipedia.org/wiki/Twenty-foot_equivalent_unit">500 or 1000 TEU's</a> at a time. The analogy here covers land transport aspects, somewhat related to how code runs in production and is typically served via datacenters / public clouds to users.</p>
<p>Containers themselves make transfer of goods/code from development (ships) to production (trains/trucks) easy. However even containerized applications can demonstrate tight coupling similar to what a train has, in effect being a distributed monolith, instead of a true suite of microservices. In my opinion, any system that requires a release train approach for new features is most likely to be a distributed monolith masquarding as microservices. The real flexibility comes from the low coupling between containers and the freedom to release each clearly delineated service at its own cadence on the roads.</p>
<h2 id="trains-are-awesome">Trains are awesome</h2>
<p>My 5yo is currently obsessed with steam engines, even though they are from an era long gone. There is something magical about a powerful engine pulling everything along smoothly on a set of constraints (rails). It works nicely as long as no quick changes are needed in the carriages and everyone wants to get to the same destination. Trouble arises when something in the closely coupled chain of components goes awry and requires a quick change. I still don't understand the <a href="https://www.denofgeek.com/tv/snowpiercer-episode-6-review-trouble-comes-sideways/">scene in snow piercer</a> where a few wagons were dumped in a siding at speed. If we can do that one neat trick perhaps monoliths would become much more maintainable. In early stages of a product monoliths are a <a href="https://www.infoq.com/news/2019/04/monolith-vs-microservices/">nice simple entry point</a>, especially if the features are narrowly scoped and well coupled. On the reverse the monolith may be a very good idea for a mature product which is not changing rapidly and perhaps needs to be optimised for performance instead by reducing communication overhead between components by introducing tight coupling. In both cases a modular approach and service-oriented designs are still feasible, as long as the implementation and maintenance team is aware of the implications. People are still driving around in classic cars from the 1900's, where as steam locomotives from that era are languishing in museums.</p>
<h2 id="trucks-are-flexible">Trucks are flexible</h2>
<p>One of the killer advantages of trucks in the logistics business is their ability to deliver right to the factory or warehouse loading bay. It is simply not feasible to build train tracks to serve every address. Even in areas with great railway infrastructure, buffers (known as Inland container depots) have to be placed to cover the last few miles of transport from the rail to the industrial areas. This sort of mode can sometimes be seen in Microservices being layered on older monoliths to provide user facing services, especially in banking systems. The other great advantage trucks have is the ability overtake each other gradually along the road, this manifests itself in software systems as rolling deployment of new features. Such an approach requires careful management of the stateful parts of the system such as storage and database schemas. Otherwise it turns into a Fast and Furious game of stealing a container from a moving platform, aka the <a href="https://www.eurogamer.net/articles/2020-12-07-gangs-are-hitting-lorries-on-the-run-to-steal-ps5s">Romanian Rollover</a>.</p>
<h2 id="this-analogy-is-not-new">This analogy is not new</h2>
<p>The logistics analogies are rife in software engineering, we <code>ship</code> code, we <code>package</code> things, we have <code>release trains</code>. The largest real world container orchestration organization <a href="https://www.maersk.com/">Maersk</a> uses a 7-point logo surprisingly similar to the most popular software container orchestration platform <a href="https://kubernetes.io/">Kubernetes</a>. I will continue updating this post as more ideas and links come together.</p>
<p>You can engage with article via comments or the twitter thread.</p>
<blockquote class="twitter-tweet">
<p lang="en" dir="ltr">
Random Roadtrip Rumination : Microservices vs Monotliths is Trucks vs Trains for shipping features.
</p>
— Tisham Dhar (<span class="citation">@whatnick</span>) <a href="https://twitter.com/whatnick/status/1342654642736353281?ref_src=twsrc%5Etfw">December 26, 2020</a>
</blockquote>
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
Tisham Dharhttp://www.blogger.com/profile/15154154153085427197noreply@blogger.com0tag:blogger.com,1999:blog-3220006345447041404.post-25706765823126276322020-10-04T15:19:00.004-07:002020-10-24T04:23:36.775-07:00Desktop Software API's in Python (KiCAD, FreeCAD, Blender, QGIS)<h1 id="python-wraps-around-everything">Python wraps around everything</h1>
<p>For the last couple of years I have mostly written <a href="https://github.com/GeoscienceAustralia/dea-notebooks">Satellite Data Processing code</a> in Python and plenty of <a href="https://github.com/opendatacube/datacube-ows">Flask/Django web services</a>. However Python is also an excellent automation tool for GUI based applications allowing custom plugins to be written and functionality provided out of the box extended by users.</p>
<p>The first desktop application I seriously looked at Python plugins for was QGIS. It was early days of learning how to wrap C++ code using <a href="http://osgeo-org.1560.x6.nabble.com/GDAL-Python-Bindings-td4157607.html#a4157610">SWIG/SIP</a> etc. In the old mailing list you can find a much younger me making inane comments about mixing wrapper metaphors in QGIS with SWIG + SIP. We have come a long way since then and SIP based bindings are the mainstay of QGIS plugins.</p>
<h2 id="qgis">QGIS</h2>
<p>QGIS has so many Python plugins that they need <a href="https://plugins.qgis.org/">a registry</a> of their own. Occasionally QGIS Python gets twisted around itself due to <a href="https://github.com/qgis/QGIS/issues/37783">multiple Pythons in the user enviroment</a>. You can also flip the python API around and instead of building a plugin you can turn QGIS into a custom desktop application. Which is what I have done with my basic <a href="https://github.com/whatnick/demo_qgis_app">Airport Viewer</a> demo.</p>
<p>QGIS being a fairly extensive and complex C++ application which takes <a href="https://whatnicklife.blogspot.com/2020/08/compiling-qgis-in-msvc-in-2020.html">hours to compile</a>, being able to make small quick changes in python is invaluable.</p>
<h2 id="kicad">KiCAD</h2>
<p>At the time of writing KiCAD has an extensive Python API for processing the automating the PCB layout part of the workflow and this has lead to many innovations in automating traditionally laborious hand layout or even performing complex simulations / optimization to set trace lengths. For example <a href="https://twitter.com/_joshajohnson">Josh Johnson</a> has one for <a href="https://github.com/joshajohnson/ecp5-mini/blob/master/breakouts/clock-test/circle-placement.py">laying parts out in a circle</a> and <a href="https://twitter.com/gregdavill">Greg Davill</a> has several for <a href="https://github.com/gregdavill/ButterStick/blob/main/lib/bus_aware_length_matching_verification.py">length matching</a> and <a href="https://github.com/gregdavill/kicadScripts">rendering file generation</a>. My personal favourite among the KiCAD scripts is the one for generation of <a href="https://github.com/openscopeproject/InteractiveHtmlBom">Interactive BOM</a>.</p>
<p>I am really looking forward to Python script support in the <a href="https://forum.kicad.info/t/plans-for-the-python-api-for-eeschema/1776">Schematic Editor</a>. Meanwhile programmatic Schematic generation tools like <a href="https://github.com/xesscorp/skidl">Skidl</a> provide schematic oriented Python fun.</p>
<p>The <a href="https://github.com/pcbarts/stylized-blender-setup">rendering</a> of the PCB's is often done in Blender. Which has its own set of Python nicities.</p>
<h2 id="blender">Blender</h2>
<p>My first foray in creating a <a href="https://docs.blender.org/api/current/index.html#">Blender API</a> based application was during the Kinect USB protocol hacking days. The data stream had just been decoded and I wanted an easy pipeline to a commonly installed / open-source 3D display software. The Python API is mature enough for people these days to quickly put together <a href="https://github.com/moraell/KinectMocap4Blender">motion capture plugins</a> for Blender. This plugin however demonstrates the challenges for creating native plugins for blender, the <a href="https://docs.python.org/3/faq/windows.html#is-a-pyd-file-the-same-as-a-dll">.pyd</a> files for Python have to be recreated for different versions of Blender for ABI compaitibility.</p>
<p>Getting the binaries working has had me thrashing about and posting in <a href="https://blenderartists.org/t/python-as-a-module-msvc2010-win64/552870">forums</a>, then sticking to a working Blender build with Python 2.7 for about 5 years since I did not want to touch it and break it. My integration actually reversed the <a href="https://wiki.blender.org/wiki/Building_Blender/Other/BlenderAsPyModule">embedding process</a>, i.e. instead of using additional modules in the Blender embedded python I embedded Blender in a 3D GIS automation.</p>
<p>Native plugin weirdness aside, Blender Python API is a really powerful tool for creating procedural objects from waves / <a href="https://b3d.interplanety.org/en/fluid-simulation-in-blender-2-80/">fluid simulation</a> to astrophysics with <a href="https://amuse.readthedocs.io/en/latest/tutorial/blender.html">amuse</a>.</p>
<h2 id="freecad">FreeCAD</h2>
<p>FreeCAD is sort of the third part of my physical electrical / mechnical design triumvirate. I occasionally design parts for KiCAD in FreeCAD, or bring multiple boards together to <a href="https://archive.org/details/kicon_2019-MCAD_ECAD_For_DIN_Rail_Energy_Monitors">test enclosure fit</a>. FreeCAD also has an extensive python library which is leveraged by KiCAD part library maintainers to <a href="https://github.com/easyw/kicad-3d-models-in-freecad">parametrically generate parts</a>.</p>
<p>The scripting in FreeCAD can be used much like the PCB layout scripts in KiCAD to create this with circular symmetry, like <a href="https://wiki.freecadweb.org/Scripted_Parts:_Ball_Bearing_-_Part_1">ball bearings</a> which are difficult and repetitive to do by hand.</p>
<h1 id="final-words">Final words</h1>
<p>There are lots of other pieces of desktop software I have used that have started shipping with Python API's to address the never ending demand from users to easily automate repeated tasks. The live process for making this blogpost in somewhat recursive fashion can be found here.</p>
<blockquote class="twitter-tweet">
<p lang="en" dir="ltr">
Started a new blog post around <a href="https://twitter.com/hashtag/python?src=hash&ref_src=twsrc%5Etfw">#python</a> wrapping around a bunch of desktop applications to ease automation / extension. Live updates here as I collate material to flesh it out. <a href="https://t.co/zz8b29kHcO">pic.twitter.com/zz8b29kHcO</a>
</p>
— Tisham Dhar (<span class="citation">@whatnick</span>) <a href="https://twitter.com/whatnick/status/1312880481470349312?ref_src=twsrc%5Etfw">October 4, 2020</a>
</blockquote>
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
<p>I have even made videos withs a proprietary one, I will live that here for anyone interested in my attempts at a voiceover.</p>
<iframe width="560" height="315" src="https://www.youtube.com/embed/YnppaRLpLWc" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen>
</iframe>
Tisham Dharhttp://www.blogger.com/profile/15154154153085427197noreply@blogger.com0tag:blogger.com,1999:blog-3220006345447041404.post-532854163674571522020-08-30T00:12:00.004-07:002020-10-02T02:27:15.389-07:00Compiling QGIS in MSVC in 2020<h1 id="compiling-qgis-on-windows-in-200x">Compiling QGIS on Windows in 200x</h1>
<p>I don't quite remember when I decided to help compile QGIS on Windows. It was somewhere between compiling GDAL with ECW support for Photoshop on Windows and getting carried into Direct3D and C# land with NASA WorldWind. It was sometime in the 2000's while still working at Apogee Imaging in Lobethal.</p>
<p>At that point I was manually building a database of the footprints of satellite imagery that filled up a wall cabinet with CD's and DVD's. The technique was something like open up the image, go around edges and trace a polygon. This was days before mature boolean thresholding and reliable/easy raster-to-vector logic.</p>
<p>I hopped on IRC on #qgis in Freenode and chatted with luminaries like timlinux, frankw and gsherman. Listened to the automated notifications from <strong>sigq</strong>, the commits bot. Things were heating up and instead of a Linux cross-compile to windows using MingW, something native to windows say using MSyS+MingW instead of Cygwin was desired. A lot of GDAL and Qt worked in MingW, so presumably QGIS would too. So I set myself to put together an MSYS environment with all the third-party dependencies that could be used to happily build QGIS. Eventually I built a release in NSIS as well.</p>
<p>My MSYS environment got packed in a zip and shared via FTP/HTTP on a VPS I had back then to the rest of the community. I earned myself a pin in the QGIS core contributor map in Adelaide. Something I am very proud of to this day. Eventually the MingW build got deprecated and native MSVC builds were supported. That's how contributions work, nothing lasts forever. In my IRC days, I helped on-board Nathan Woodrow to QGIS, who in turn I believe helped on-board Nyall Dawson. Nyall has surpassed us all in feature contributions and work on QGIS.</p>
<blockquote class="twitter-tweet">
<p lang="en" dir="ltr">
Getting started on QGIS on MSVC blog article. Trying to add some historical perspective on my involvement. Found this acknowledgement in the docs. Thanks to <a href="https://twitter.com/timlinux?ref_src=twsrc%5Etfw"><span class="citation">@timlinux</span></a> . Back in the days of sharing mingw zip files via FTP. <a href="https://t.co/NTkQgU5ibN">pic.twitter.com/NTkQgU5ibN</a>
</p>
— Tisham Dhar (<span class="citation">@whatnick</span>) <a href="https://twitter.com/whatnick/status/1299858242311315456?ref_src=twsrc%5Etfw">August 29, 2020</a>
</blockquote>
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
<h1 id="fast-forward-to-2020-compiling-qgis-in-msvc">Fast forward to 2020, compiling QGIS in MSVC</h1>
<p>I am getting back into doing lots of Open-source work after long hiatus in private industry with <a href="https://twitter.com/aerometrex">Aerometrex</a> and start-up land with <a href="https://twitter.com/lorisystems">Lorisystems</a>. It is great fun working on mostly in the open at <a href="https://twitter.com/GeoscienceAus">Geoscience Australia</a>. There is actually a recently archived opendatacube + qgis repository <a href="https://github.com/opendatacube/datacube-qgis">here</a>. Seeing that repo and speaking to <a href="https://twitter.com/madmanwoo">Nathan</a> and LinuxConfAu inspired me to have a go and getting back into actively working on the Qgis code base. It has sprawled out, with lots and lots of new features. The build system is still familiar via CMake and actually much easier now with MSVC. I cast around for a recent guide and found <a href="https://www.shaeffer.co/compiling-qgis-on-windows/">this</a>. The guide mostly works, however I made some refinements.</p>
<ul>
<li>Ditched <code>bison</code> and <code>flex</code> via Cygwin to using the one available via Msys2. These can be found <a href="https://packages.msys2.org/package/bison">here</a>. Not needing the while Cygwin system helps in keeping the windows build system light. Simply download the binaries and add them to the Osgeo4W binaries directory.</li>
<li>Captured my <a href="https://gist.github.com/whatnick/6008597bffa427a733b7ccf6ba0f8fca">CMakeCache.txt</a> to make it easier to reproduce and debug the build environment for others.</li>
<li>Used <a href="https://www.incredibuild.com/">Incredibuild</a> in demo mode to use a few NUC's I have lying around to speed up the build. Recording while building failed the first time and worked the next. The whole build from scratch still tooks around 35minutes overall.</li>
</ul>
<iframe width="560" height="315" src="https://www.youtube.com/embed/zTW5DmO06b0" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen>
</iframe>
<p>I am planning to throw some of my day to day DevOps skills towards the QGIS project and start helping again with Raster enhancements and windows release management. Perhaps getting Incredibuild in the hands of the windows maintainers will help tighten up the iteration cycle and make testing easier.</p>
<iframe width="560" height="315" src="https://www.youtube.com/embed/R8wq6D_kEjA" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen>
</iframe>
<p>The twitter thread/ stream of consciousness edition of this is available as well.</p>
<blockquote class="twitter-tweet">
<p lang="en" dir="ltr">
Moving from babun to msys2 to get flex and bison required for compiling QGIS from source. <a href="https://t.co/W866AOM9Kt">https://t.co/W866AOM9Kt</a> <a href="https://t.co/fUmqpa9YHY">pic.twitter.com/fUmqpa9YHY</a>
</p>
— Tisham Dhar (<span class="citation">@whatnick</span>) <a href="https://twitter.com/whatnick/status/1276482732621565952?ref_src=twsrc%5Etfw">June 26, 2020</a>
</blockquote>
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
Tisham Dharhttp://www.blogger.com/profile/15154154153085427197noreply@blogger.com0tag:blogger.com,1999:blog-3220006345447041404.post-85584295058139081332020-07-22T00:12:00.006-07:002020-08-02T04:29:35.741-07:00Microservices the hard way - folders in EC2 Instance<p>For day to day work I wrangle containers in EKS these days. However when doing personal projects EKS is a luxury (baseline cost being $70 or so per month). So I decided to do microservice development for the rain radar project using no Docker, no Kubernetes but using:</p>
<ul>
<li>multiple venvs</li>
<li>multiple service folders</li>
<li>environments in .env files (secrets in plain text)</li>
<li>web service start using <span class="citation">@reboot</span> in Cron</li>
<li>scheduled services using ... ya Cron</li>
</ul>
<p>The whole thing started with noble intentions to use lambda's all the way however I got stuck in using S3-SNS to trigger the lambda and decided to scan the S3 bucket using timestamps to find latest files to process. More on the pitfalls of that later.</p>
<p>The major microservices handle are:</p>
<ul>
<li>Raw radar data preparation using custom hand crafted algorithm, being ported to Rust <a href="https://github.com/whatnick/crop_circle">here</a>.</li>
<li>Inserting prepared data to DynamoDB as a <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/bp-indexes-general-sparse-indexes.html">sparse array</a> and serving this via Flask.</li>
<li><a href="https://github.com/pySTEPS/pysteps">Nowcasting</a> using the timeseries of sparse array of rain observations also serving results via Flask.</li>
<li>Capturing rain events and nowcasts and creating text and gif to send to <a href="https://python-twitter.readthedocs.io/en/latest/">twitter</a>.</li>
</ul>
<p>Each of these applications consumes the other to some extent and is sort of separated in responsibility. I decided to deploy them with basic a folder per application on the <code>/home/ubuntu</code> directory, with a venv per folder.</p>
<p>I had it like this for a while. Then I got tired for sshing into the box and git pulling in each folder. So I decided to write a fabfile per application which would do this for me and created deployment keys which would be used to pull the code to this folder. Then I got tired of running multiple fabfiles and decided to setup a polled process which run the fabfiles and git synced the code from a <a href="https://support.atlassian.com/bitbucket-cloud/docs/schedule-pipelines/">master pipeline</a>.</p>
<p>Eventually I got around to bootstrapping the whole VM using <a href="https://www.packer.io/">Packer</a> + <a href="https://www.packer.io/docs/provisioners/ansible.html">Ansible</a> playbooks. The development work for it was done locally using <a href="https://www.vagrantup.com/">Vagrant</a> with Hyper-V as the VM provide to test the same <a href="https://www.vagrantup.com/docs/provisioning/ansible">Ansible</a> playbooks. I will follow up on this with a few characters on twitter.</p>
<blockquote class="twitter-tweet">
<p lang="en" dir="ltr">
Wrangling VM's with Packer, Vagrant and Ansible all at the same time. Helped me figure out issues in Ansible docs and divergence between bento ubuntu box and AWS AMI. One calls ntp ntpd, the other ntp.service. <a href="https://t.co/tSbaPuKtVB">pic.twitter.com/tSbaPuKtVB</a>
</p>
— Tisham Dhar (<span class="citation">@whatnick</span>) <a href="https://twitter.com/whatnick/status/1284412192255733765?ref_src=twsrc%5Etfw">July 18, 2020</a>
</blockquote>
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
<p>Once the initial Packer AMI is established the choice is to either keep building this image or to move away from the whole VM based old-school stuff to a more modern/fun Kubernetes way.</p>
Tisham Dharhttp://www.blogger.com/profile/15154154153085427197noreply@blogger.com0tag:blogger.com,1999:blog-3220006345447041404.post-90381463434194072322020-06-01T06:59:00.005-07:002020-06-06T02:40:49.675-07:00Replicating Databases in RDS<p>One Sunday in 2018 I sat for a whole day in Art Caffe at the ground floor of Yaya Centre in Nairobi on the phone to Norman at AWS Support in Cape Town discussing DMS for MSSQL servers. After a whole day of screen sharing and being on call we decided what we were trying to do was no achievable, but AWS was working on it. The next day AWS sent me an NDA (since expired).</p>
<p>Data replication from on-prem Database instances or between cloud database instances is an issue that comes up all the time. I have hands on experience doing this a couple of times now. This post summarizes my 3 or so attempts at doing this with different sources and targets and lessons learnt.</p>
<h2 id="mssql-to-mssql-using-aws-dms">MSSQL to MSSQL using AWS DMS</h2>
<p>At the start-up I was working at we adopted a pre-built mini ERP, it covered logistics workflows and finance / billing aspects. It was built in the 2000's in .NET Classic and ran on IIS and MSSQL server. Quickly the MSSQL became the single point of lack of scalability in the system. Since AWS does not natively support read-replicas for MSSQL RDS instances I looked at DMS to create these replicas. DMS did not quite work as expected and led to the conversation alluded to above with Norman. I ended up performing replication using <a href="https://cloudbasic.net/">CloudBasic</a> as the SaaS provider for managing the Change Tracking and handling schema changes in the source tables and propagating them to the target replicas. The replication was fine for single replicas, but quickly bogged the source database down as I added more replicas.</p>
<p>As aside the same database was also being replicated to a Redshift cluster for BI usage using tooling provided by <a href="https://www.sisense.com/product/data-teams/">Periscope Data</a>.</p>
<p>As part of this excercise I came to appreciate the advantage to write-only / append-only schemas in improving no-lock replication performance (at the cost of storage), also the need for timestamp columns such as <code>update_time</code> to perform incremental data transfer. I spent a lot of time reading the <a href="https://eng.uber.com/schemaless-part-one-mysql-datastore/">Schemaless articles</a> by Uber Eng around building Schemaless DB's on top of RDBMS's like MySQL. I don't 100% agree with their design choices but it adds interesting perspective. The bottomline <strong>CRUD at scale is HARD</strong>.</p>
<h2 id="rds-postgresql-to-postgresql-using-dms">RDS PostgreSQL to PostgreSQL using DMS</h2>
<p>Fast forward a year or so, I am now working at Geoscience Australia, with the <a href="http://www.ga.gov.au/dea">Digital Earth Australia</a>. Everything runs on Kubernetes and is highly scalable. Single point of lack of scalability is again the database. A pattern seems to be emerging here. We were performing cluster migration in Kubernetes and I offered to investigate DMS again.</p>
<p>In the MSSQL scenario there is a small prologue, I had previously migrated around 1million cells from a massive Google Sheet to the MSSQL database at the start of my tenure at the startup, by the time we hit scalability issues in the single instance MSSQL we were at 10million rows in the largest append-only table. The PostgreSQL migration of the <a href="https://www.opendatacube.org/">datacube tables</a> featured 8-9 million rows in the largest table. However the database also has lots of indexes and uses PostGIS for some applications, particularly <a href="https://github.com/opendatacube/datacube-explorer">Datacube Explorer</a>. DMS fell down in support for the Geometry columns, however I learnt a lot in setting up DMS using Terraform IAC and fine tuning for JSON Blob columns, which in <a href="https://github.com/opendatacube/datacube-core/releases/tag/datacube-1.8.0">Datacube design in 1.8.x</a> series can be upto 2MB in size. DMS migrates standard columns separately from LOB columns.</p>
<p>Ultimately DMS was not feasible for datacube DB migration to a new RDS instance. However I believe core datacube can be migrated next time I try with applications depending on Materialized views and PostGIS setup afresh on new DB. Also by the time I try again Amazon may have better PostGIS support. For the cluster migration we ended up using a <a href="https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_RestoreFromSnapshot.html">snaphot</a> of the last DB.</p>
<h2 id="on-prem-postgresql-to-rds-postgresql">On-prem PostgreSQL to RDS PostgreSQL</h2>
<p>There is a Datacube PostgreSQL DB instance at the NCI which needs to be regularly replicated to RDS. It powers the <a href="https://explorer.dea.ga.gov.au/ls5_fc_albers">Explorer Datacube</a> application. However DB migration from one server without direct disk access to RDS where we also don't have disk access using <a href="https://www.postgresql.org/docs/11/app-pgrestore.html">pg_dump / pg_restore</a> for a DB with largest tables being around 22 million rows and the compressed dump being around 11GB is a long running task. Ideally we sort something out that is <a href="https://github.com/opendatacube/datacube-core/pull/951">incremental</a> using <code>update_time</code> generated using triggers. The options explored so far are :</p>
<ul>
<li>Using an <a href="https://github.com/GeoscienceAustralia/dea-airflow/blob/develop/dags/k8s_db_sync.py">Airflow DAG</a> with Kubernetes Executors wrapped around pg_dump/restore with some application specific details.</li>
<li>Using <a href="https://aws.amazon.com/about-aws/whats-new/2019/06/amazon-aurora-with-postgresql-compatibility-supports-data-import-from-amazon-s3/">COPY from S3</a> support for Aurora PostgreSQL, CSV's restored using the COPY command are generated incrementally.</li>
<li>Using PostgreSQL publish / subscribe and <a href="https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_PostgreSQL.html#PostgreSQL.Concepts.General.FeatureSupport.LogicalReplication">Logical Replication</a>. Networking over the internet to maintain connectivity securely to the on-prem instance via <a href="https://www.postgresql.org/docs/11/ssh-tunnels.html">SSH Tunnels</a> and to the RDS instance via <a href="https://kubernetes.io/docs/tasks/access-application-cluster/port-forward-access-application-cluster/">EKS port-forwarding</a>.</li>
</ul>
Tisham Dharhttp://www.blogger.com/profile/15154154153085427197noreply@blogger.com0tag:blogger.com,1999:blog-3220006345447041404.post-85808247825115998892020-05-07T15:11:00.002-07:002020-05-09T00:39:47.381-07:00ADE7816 Energy Monitor<p>I have been meaning to try out the <a href="https://www.analog.com/en/products/ade7816.html">ADE7816</a> Single-phase 6 current channels energy monitor for a while. However time has been lacking for the last couple of years. Finally I have a working version with successful board bring-up and a semi-working <a href="https://github.com/whatnick/ADE7816_Micropython">Micropython driver</a>, with an <a href="https://github.com/whatnick/ADE7816_Arduino">Arduino driver</a> in the works.</p>
<h2 id="pcb-design">PCB Design</h2>
<p>The PCB design process for this was not easy mostly due to a footprint choice mistake on my part. I had placed the 5x5mm QFN part instead of the 6x6mm QFN part in KiCAD. This made the DRC fail everywhere in standard settings. However it ended up being a collaboration opportunity with Greg Davill who loves to practice and photograph bodging stuff. So I now have a work of art at hand instead of a non-functional board.</p>
<blockquote class="twitter-tweet">
<p lang="en" dir="ltr">
Practising my bodge skills<br><br>This is a QFN where the footprint on the PCB was incorrect.<br><br>Just a couple more bodge wires to add. <a href="https://t.co/AmZ1CsWqC3">pic.twitter.com/AmZ1CsWqC3</a>
</p>
— Greg (<span class="citation">@GregDavill</span>) <a href="https://twitter.com/GregDavill/status/1252870227584356352?ref_src=twsrc%5Etfw">April 22, 2020</a>
</blockquote>
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
<p>I am even debating whether to place the rest of the parts and possibly take away from the dead-bug awesomeness. Next time need to order parts in advance and make sure I do <a href="https://forum.kicad.info/t/how-to-print-a-pcb-from-pcbnew-in-kicad-5-0/11924/5">1-1 prints</a> to verify footprints before pulling the trigger on PCB's.</p>
<h2 id="energy-montor-details">Energy Montor Details</h2>
<p>Now to more about the energy monitor. This ASIC features 3 single-ended and 3 differential current inputs and a single-phase voltage input, all in very compact 40-pin <strong>6x6mm</strong> QFN package. In fact the PCB is large on purpose to accomodate ease of use with stereo-jack type current clamps. The main usage would be in standard households where there are typically 3-4 lighting circuits, 1-2 socket circuits and dedicated Air Conditioning circuit. A single energy monitor could be built to monitor all channels using a single-ASIC and leave out fancy NILM stuff from worrying about the lights. The socket circuits could have anything plugged into them and can potentially have point-of-load monitoring instead of breaker board based monitoring. All this translates to more data being generated for IoT platforms and some sensible firmware work needs to be done to handle that.</p>
<h2 id="ade7816-driver-development">ADE7816 Driver Development</h2>
<p>This is still work in progress. I have done some initial exploration to find prior art. Nothing exists yet from Arduino however there is some register lists from a <a href="https://github.com/tadakado/smart-meter/tree/master/Soft">Javascript driver</a> written for the now defunct Intel Edison.</p>
<p>Intel never quite had the maker market pinned right to market that board, it makes me sad to think of all the engineering ours sunk into a now defunct platform. Open-source software / hardware helps us salvage some of that. I also sped up the register listing by copy-pasting the ubquitous table from the ADE7816 datasheet and dropping it into a Jupyter notebook to parse all the registers, not as fancy as the Pdf parser I had built before, but much more reliable.</p>
<blockquote class="twitter-tweet">
<p lang="en" dir="ltr">
My <a href="https://twitter.com/adafruit?ref_src=twsrc%5Etfw"><span class="citation">@adafruit</span></a> <a href="https://twitter.com/hashtag/ESP32?src=hash&ref_src=twsrc%5Etfw">#ESP32</a> + Logic Analyzer test rig. Due in the background is just to keep cables tidy. The ESP32 runs micropython so that I can iterate on SPI modes quickly and use the excellent struct functions to pack/unpack bytes. <a href="https://t.co/0pQgAO1Cgl">https://t.co/0pQgAO1Cgl</a> <a href="https://t.co/R2imRukrpT">pic.twitter.com/R2imRukrpT</a>
</p>
— Tisham Dhar (<span class="citation">@whatnick</span>) <a href="https://twitter.com/whatnick/status/1250199028828008448?ref_src=twsrc%5Etfw">April 14, 2020</a>
</blockquote>
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
<p>My driver development follwed the now tried and tested Micropython + Jupyter Notebook + Logic Analyzer path. I used an ESP32 feather as host processor with standard micropython loaded and probed the SPI bus with read-write packets for known registers until the protocol gave in and started responding with some values. The ASIC is super versatile in supported protocols - I2C Slave, SPI Master and SPI Slave modes are all viable. So developing a fully functional driver supporting all the possible modes will take a while. The initial work so far is on the SPI slave mode since all my other work in DIN rail and Featherwing formats is linked to the SPI bus, however the I2C mode can be really interesting for host-processors with fewer pins and flaky SPI support (while having solid I2C support - like the Onion).</p>
<p>If anyone is interested in driver development I am happy to send you a board or you can get one yourself from <a href="https://oshpark.com/shared_projects/oovHySXk">Oshpark</a>, <a href="https://aisler.net/whatnick/playground/ade7816-breakout">Aisler</a> or <a href="https://www.pcbway.com/project/shareproject/Breakout_Board_for_ADE7816_6_Channel_Energy_Monitor_ASIC.html">PCBWay</a>. Once the drivers mature I will list it for a wider audience on Tindie.</p>
Tisham Dharhttp://www.blogger.com/profile/15154154153085427197noreply@blogger.com0tag:blogger.com,1999:blog-3220006345447041404.post-10211915187073585302020-04-04T00:12:00.006-07:002020-04-04T06:02:14.704-07:00Distributed Locking from Python while running on AWS<div dir="ltr" style="text-align: left;" trbidi="on">
In the day and age of eventually consistent web-scale applications the concept of locking may seem very archaic. However in some instances attempting to obtain a lock and failing to do so within a limited window can prevent dogpile effects for expensive server side operations or prevent over-write of already executing long running tasks such as ETL processes.<br />
I have used 3-basic approaches to create distributed locks on AWS with the help of built-in services and accessed them via Python which is what I build most of my sofware in.<br />
<h2 id="file-locks-upgraded-to-efs">
File locks upgraded to EFS</h2>
File based locks in UNIX file-systems are very common. They are typically created using the flock command, avalaible in Python under os-specific <a href="https://docs.python.org/3/library/fcntl.html#fcntl.flock">flock</a> API. Also checkout the platform independent <a href="https://pypi.org/project/filelock/">filelock</a>. This is well and good for a VM or single application instance. For distributed locking, we will need <a href="https://aws.amazon.com/efs/">EFS</a> as the filesystem on which these locks are held, Linux-Kernel and NFS will use <a href="https://github.com/torvalds/linux/commit/55725513b5ef9d462aa3e18527658a0362aaae83">byte-range locks</a> to help simulate locally attached file system type locks. However if the client loses connectivity the NFS lock-state cannot be determined, better run that EFS with enough replicas to ensure connectivity.<br />
File locking this way is very useful if we are using EFS for holding large file and processing data anyway.<br />
<h2 id="redis-locks-upgraded-to-elasticache">
Redis locks upgraded to ElastiCache</h2>
Another popular pattern for holding locks in Python is using Redis. This can be upgraded in the cloud-hosted scenario to <a href="https://aws.amazon.com/elasticache/redis/">Redis-Elasticache</a>, This pairs well with the <a href="https://pypi.org/project/python-redis-lock/">redis-lock</a> library.<br />
Using redis requires a bit of setup and is subject to similar network vagaries and EFS. It makes sense when using Redis already as an in-memory cache for accelration or as a broker/results mechanism for <a href="https://docs.celeryproject.org/en/latest/getting-started/brokers/redis.html">Celery</a>. Having data encrypted at rest and transit may require running an <a href="https://www.stunnel.org/">Stunnel Proxy</a>.<br />
<h2 id="an-aws-only-method---dynamodb">
An AWS only Method - DynamoDB</h2>
A while ago AWS published <a href="https://aws.amazon.com/blogs/database/building-distributed-locks-with-the-dynamodb-lock-client/">an article</a> for creating and holding locks on DynamoDB using a Java lock client. This client creates the lock and holds it live using heart-beats while the relevant code section executes. Since then it has been ported to <a href="https://pypi.org/project/python-dynamodb-lock/">Python</a> and I am maintaining my own <a href="https://github.com/whatnick/python_dynamodb_lock">fork</a>.<br />
It works well and helps scale-out singleton processes run as Lambdas to multiple lambdas in a serverless fashion, with a given lambda quickly skipping over a task another lambda is holding a lock on. I have also used it on EC2 based stuff where I was already using DynamoDB for other purposes. This is possibly the easiest and cheapest method for achieving distributed locking. Locally testing this technique is also quite easy using <a href="https://hub.docker.com/r/amazon/dynamodb-local/">local-dynamodb</a> in a docker container.<br />
Feel free to ping me other distributed locking solutions that work well on AWS and I will try them out.</div>
Tisham Dharhttp://www.blogger.com/profile/15154154153085427197noreply@blogger.com0tag:blogger.com,1999:blog-3220006345447041404.post-59463665892545693082020-01-24T05:48:00.001-08:002020-01-24T06:35:58.289-08:00Testing the OrangeCrab r0.1<div dir="ltr" style="text-align: left;" trbidi="on">
After hassling <a href="https://twitter.com/GregDavill">Greg Davill</a> for a while on twitter and admiring his OrangeCrab hardware I managed to catch up with him in person in Adelaide. I have been away in Nairobi till October last year, then I spent a brief few days in Adelaide before coming over to Canberra to take up a position in Geoscience Australia. The new gig is much less time commitment than the start-up world and hopefully will allow more time for blogging and board bring-ups like this one.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-r59HHJnWSMg/XisAjOeBsNI/AAAAAAAArvg/KacsrT0xB2Igr5aHnJ-Wrxgegd-Jwy6-QCKgBGAsYHg/s1600/PANO_20191015_182101.vr.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="698" data-original-width="1600" height="173" src="https://1.bp.blogspot.com/-r59HHJnWSMg/XisAjOeBsNI/AAAAAAAArvg/KacsrT0xB2Igr5aHnJ-Wrxgegd-Jwy6-QCKgBGAsYHg/s400/PANO_20191015_182101.vr.jpg" width="400" /></a></div>
<br />
I caught up with Greg at a Japanese restaurant in Rundle mall and was treated to his now trademark led cube and led icosahedron. They are insanely detailed pieces of work and deserve staring at. However I am most grateful for the care package he left me, an OrangeCrab v0.1. This is an ECP5 board in feather form factor with an ADC built in to respect the Analog In pins on the feather. My aim for this board is to host some energy monitoring code on the FPGA with a fast 4mbps or so ADC and perform power/energy calculation on some parts of LUT's/DSP and have a <a href="https://github.com/riscv/riscv-cores-list">softcpu</a> push data out.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-GZ5T-zTqdAw/Xir_AZD2CjI/AAAAAAAArvU/6R6-V6960u8AqlXJiHmo1U8WA7P0pTQdwCKgBGAsYHg/s1600/IMG_20191205_203704.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1600" data-original-width="1200" height="320" src="https://1.bp.blogspot.com/-GZ5T-zTqdAw/Xir_AZD2CjI/AAAAAAAArvU/6R6-V6960u8AqlXJiHmo1U8WA7P0pTQdwCKgBGAsYHg/s320/IMG_20191205_203704.jpg" width="240" /></a></div>
Greg also left me a home-made FTDI based board to use a JTAG programmer. The whole setup requires 3 USB cables:<br />
<br />
<ul style="text-align: left;">
<li> To plugin and power the FPGA board (eventually it should be alos programmable via this port) </li>
<li>To attach a USB-Serial converter and watch the console when the gateware comes up </li>
<li>To program the board over JTAG using an FTDI chip</li>
</ul>
<br />
<br />
Getting firmware compiled these days is getting easier, but Greg had done his initial testing with <a href="https://ycnrg.org/lattice-diamond-on-ubuntu-16-04/">Lattice Diamond</a>. I managed to installed it in WSL and promptly ran into a tonne of issues. The weirdest being close coupling to bash, Ubuntu actually uses <a href="https://askubuntu.com/questions/976485/what-is-the-point-of-sh-being-linked-to-dash">dash</a> as its default shell. You can get a Diamond <a href="http://www.latticesemi.com/Support/Licensing/">licence</a> and help support integration of diamond in <a href="https://github.com/timvideos/litex-buildenv">litex-buildenv</a>.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-DwZ86V_ZDGA/Xir-gdqsWII/AAAAAAAArvM/RXLyz158uOIM1SKyDsJ6A_kH0m1bqh_owCLcBGAsYHQ/s1600/RAM_Test_pass.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="834" data-original-width="1600" height="166" src="https://1.bp.blogspot.com/-DwZ86V_ZDGA/Xir-gdqsWII/AAAAAAAArvM/RXLyz158uOIM1SKyDsJ6A_kH0m1bqh_owCLcBGAsYHQ/s320/RAM_Test_pass.jpg" width="320" /></a></div>
I was about to give up then Greg got it working with the opensource toolchain and [NextPNR-ECP5<a href="https://github.com/YosysHQ/nextpnr/tree/master/ecp5"></a>. I had by then setup litex-buildenv to support the orangecrab. So getting some gateware on was relatively easy. Then I got stuck on <a href="https://github.com/enjoy-digital/litedram/issues/103">RAM timing bug</a> in Litex till a few hours ago when I tested out some <a href="https://gist.github.com/gregdavill/e7644319dcc3b8015758171067d37b98">new gateware</a>.<br />
<br />
Also Checkout out Greg's <a href="https://github.com/gregdavill/foboot/tree/OrangeCrab-ECP5">foboot fork</a> and help make programming over the USB possible and reduce 1 USB cable. More work on this including getting <a href="https://github.com/antonblanchard/microwatt">MicroWatt</a> running coming soon.</div>
Tisham Dharhttp://www.blogger.com/profile/15154154153085427197noreply@blogger.com0tag:blogger.com,1999:blog-3220006345447041404.post-64997119797950376962019-10-06T06:43:00.000-07:002019-10-06T06:43:29.367-07:00Around Kenya in 4 days and a year ( part 2)<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: inherit;">The New Year adventure continued past the sad mercury laden mines of Migori to the Tanzania border , Isebania in particular. We met up with professor <a href="https://www.linkedin.com/in/sangaimohochi/">Sangai Mohochi</a> and had a brief gander into Tanzania ( Serere) for a beer. Later we had some <span style="background-color: #f8f9fa; color: #222222;">Orokore Beer made from millet, we sat around a car tyre sipping still fermenting beer from straws.</span></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://4.bp.blogspot.com/-p4sAuzJ_Wns/XEi_4s3VlKI/AAAAAAAAi2s/6bzlYpmewrsmL2OXRTtex06ot3M4FS1gwCKgBGAs/s1600/IMG_20181230_131006.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1600" data-original-width="1200" height="320" src="https://4.bp.blogspot.com/-p4sAuzJ_Wns/XEi_4s3VlKI/AAAAAAAAi2s/6bzlYpmewrsmL2OXRTtex06ot3M4FS1gwCKgBGAs/s320/IMG_20181230_131006.jpg" width="240" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
We took our leave from the professor and had a long drive out to Rusinga island. A beautiful place without much of the tourist trappings lakeside places have. The Suba culture is being revived with <a href="https://en.wikipedia.org/wiki/Rusinga_(Cultural)_Festival">festivals</a>. We woke up early and did a trip around Rusinga Island and visited <a href="https://kisumucitycouncil.wordpress.com/2013/01/02/kisumus-heritagetom-mboya-mausoleum/">Tom Mboya's Mausoleum</a>. One of my high school's illustrious alumni. </div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://4.bp.blogspot.com/-BdgrfXuoJyw/XEi_4oBcpcI/AAAAAAAAi2s/ZuIhiUQzLbYS-vSjQeMfdyDscMRKd6iVwCKgBGAs/s1600/PANO_20181231_064431.vr.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="546" data-original-width="1600" height="109" src="https://4.bp.blogspot.com/-BdgrfXuoJyw/XEi_4oBcpcI/AAAAAAAAi2s/ZuIhiUQzLbYS-vSjQeMfdyDscMRKd6iVwCKgBGAs/s320/PANO_20181231_064431.vr.jpg" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://2.bp.blogspot.com/-dy-rKIwfQWQ/XEi_4kHBJoI/AAAAAAAAi2s/jkPxPPO82W07z9z-VhqDy8NghBQyYdOJACKgBGAs/s1600/IMG_20181231_094230.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1200" data-original-width="1600" height="240" src="https://2.bp.blogspot.com/-dy-rKIwfQWQ/XEi_4kHBJoI/AAAAAAAAi2s/jkPxPPO82W07z9z-VhqDy8NghBQyYdOJACKgBGAs/s320/IMG_20181231_094230.jpg" width="320" /></a></div>
After another long day of driving and some fiddling with charging phones directly from a car battery ( another story on how many engineers does it take to charge a phone), we ended up in <a href="http://www.naiberi.com/">Naiberi River Campsite</a>. It is more like a glamping spot and ideal for a quiet New Year's celebration around a fire in the main hall.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://3.bp.blogspot.com/-HGumzvtmtXc/XEi_4oN_m_I/AAAAAAAAi2s/rsIwkhGXif0T20Ri4iIWXFsqNlOUQL7fQCKgBGAs/s1600/PANO_20190101_082453.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="800" data-original-width="1600" height="160" src="https://3.bp.blogspot.com/-HGumzvtmtXc/XEi_4oN_m_I/AAAAAAAAi2s/rsIwkhGXif0T20Ri4iIWXFsqNlOUQL7fQCKgBGAs/s320/PANO_20190101_082453.jpg" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://2.bp.blogspot.com/-YEWCiAqIpyA/XEi_4nRQIuI/AAAAAAAAi2s/LWYjOyy7Ms46VEOFxT4b7PFUtaqolVMUQCKgBGAs/s1600/IMG_20190101_154526.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1200" data-original-width="1600" height="240" src="https://2.bp.blogspot.com/-YEWCiAqIpyA/XEi_4nRQIuI/AAAAAAAAi2s/LWYjOyy7Ms46VEOFxT4b7PFUtaqolVMUQCKgBGAs/s320/IMG_20190101_154526.jpg" width="320" /></a></div>
<br />
A late lunch/early dinner at Rift Valley Lodge Golf Club. We went for a post dinner walk on the greens and ran into herds of zebras and antelopes. No wonder this golf club is classed as one of the best in the Africa. All the excitement was followed by an uneventful drive back to Nairobi.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://3.bp.blogspot.com/-RoK2gKanzCk/XEi_4lhAftI/AAAAAAAAi2s/xZ7pqHyIKsIt4sg4dKBbYLBUK6OH9cU8gCKgBGAs/s1600/IMG_20190101_185322.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1200" data-original-width="1600" height="240" src="https://3.bp.blogspot.com/-RoK2gKanzCk/XEi_4lhAftI/AAAAAAAAi2s/xZ7pqHyIKsIt4sg4dKBbYLBUK6OH9cU8gCKgBGAs/s320/IMG_20190101_185322.jpg" width="320" /></a></div>
<br />
We arrived tired but energized the beauty and possibilities in Kenya. The roads need to be built, electricity needs to be channeled to houses, there is a lot to do. We look forward to hanging around and getting it done. Eric is heading back to his PhD at <a href="https://www.seas.harvard.edu/directory/mibuari">Harvard</a>, Gichini will be doing something about the weather prediction and I have helped put <a href="https://www.lorisystems.com/">Lori Systems</a> on a solid technical footing and change the Logistics landscape.</div>
Tisham Dharhttp://www.blogger.com/profile/15154154153085427197noreply@blogger.com0Nairobi, Kenya-1.2920659 36.821946199999957-1.5460584000000002 36.499222699999955 -1.0380734 37.144669699999959tag:blogger.com,1999:blog-3220006345447041404.post-21640813289919024432019-08-14T14:20:00.003-07:002019-08-15T18:54:00.722-07:00Open-source Sustainability (The tale of 2 package managers)<div dir="ltr" style="text-align: left;" trbidi="on">
Last weekend I had the priviledge to attend the 10th PyconAU and listen to some amazing speakers. I went with my <strong>I will write markdown on the fly and make a blog-post at the end of the day</strong> mindset. Even though I did write a lot of markdown on the fly, I haven't gathered the courage to push these unedited notes into a public post. Excellent examples of live-blogging from conferences <a href="https://jmckew.com/2019/08/07/pycon-au-2019-sunday-in-summary/">here</a>.<br />
What did happen was that the niggling doubts I had around how open-source works in the real world outside of just the code crystallized. This was as a result of 2 very good talks , one about how the <a href="https://2019.pycon-au.org/talks/building-a-sustainable-python-package-index">PyPi project works</a> and another around <a href="https://2019.pycon-au.org/talks/vicky">Open-source sustainability beyond money</a>.<br />
<br />
For the last year I have been writing and reviewing a lot of React Frontend, Python backend (Flask/Django) and Notebooks code. Both frameworks are super easy to buy batteries for where the included ones are running out of juice. Simply via <em>pip install</em> and <em>npm install</em> you can climb onto the shoulders of giants who are library maintainers and the life-blood of lean start-ups everywhere. However the <a href="https://techcrunch.com/2018/06/23/open-source-sustainability/">maintainer burnout</a> is a thing and start-ups when building their stack should be highly cognizant of this. Package repository burnout is also a thing. In my time in the software industry I have seen Maven <a href="https://maven.apache.org/repository/guide-central-repository-upload.html">repositories disappear</a>. More recently NPM go through an identity crisis and <a href="https://www.techrepublic.com/article/why-its-finally-time-for-developers-to-address-the-chaos-of-node-js-and-npm/">the left-pad incident</a>.<br />
<br />
The PyPi talk gave me great background on a tool I use every single-hour without too much thought. It takes some dedicated volunteers to keep the dream alive. Who according to <a href="https://dustingram.com/">Dustin Ingram</a> are :<br />
<br />
<ul style="text-align: left;">
<li>Unemployed and bored and poor (but super talented) </li>
<li>Paid for by their employer (thanks employers who support FOSS) </li>
<li>Not getting enough sleep (or in my case time with the family)</li>
</ul>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-m7TiLl2scM8/XVYMOhQsvnI/AAAAAAAAowM/en76FsBeGxYiyia-wZFqIMn2YNTJlp6TQCKgBGAs/s1600/IMG_20190804_103201.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1200" data-original-width="1600" height="240" src="https://1.bp.blogspot.com/-m7TiLl2scM8/XVYMOhQsvnI/AAAAAAAAowM/en76FsBeGxYiyia-wZFqIMn2YNTJlp6TQCKgBGAs/s320/IMG_20190804_103201.jpg" width="320" /></a></div>
<br />
Vicky's talk covers another aspect. Developers and maintainers need more than money to keep going, they need back-up. The community need insurance against the <a href="https://en.wikipedia.org/wiki/Bus_factor">bus-factor</a> and burn-out. I have been guilty of this myself, putting a few dollars behind features I would like to see in BountySource instead of diving in. This has become more so as I have progressed in my career and become increasingly time-poor. Talking about this would anyone at VSCode like to claim the few dollars we put <a href="https://www.bountysource.com/issues/51511113-find-and-utilise-wsl-python-environments">here</a> ?<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-r24F8sjzqUo/XVYMGrq-nFI/AAAAAAAAowI/i5zTF0JfKIMilTOGsiCEFWxO80VC2G_DwCKgBGAs/s1600/IMG_20190804_094158.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1200" data-original-width="1600" height="240" src="https://1.bp.blogspot.com/-r24F8sjzqUo/XVYMGrq-nFI/AAAAAAAAowI/i5zTF0JfKIMilTOGsiCEFWxO80VC2G_DwCKgBGAs/s320/IMG_20190804_094158.jpg" width="320" /></a></div>
<br />
I love the longevity and discipline of <a href="https://warehouse.pypa.io/">project warehouse</a> and will find some time to contribute to it. I also look forward to a similar alternative to npm, rather than a <a href="https://github.com/verdaccio/verdaccio">caching proxy</a> with community behind it.</div>
Tisham Dharhttp://www.blogger.com/profile/15154154153085427197noreply@blogger.com1tag:blogger.com,1999:blog-3220006345447041404.post-54140691191476644132019-06-26T11:36:00.005-07:002019-07-07T05:58:48.278-07:00Sunbeam Coffee Maker Teardown<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;">
<p><a href="https://1.bp.blogspot.com/-HM6TGA0yM7k/XRO7CF07xnI/AAAAAAAAnGk/LkYGcC-jkyQym761E4kbCSZU6rkpaOT1wCKgBGAs/s1600/IMG_20190618_184247.jpg"><img src="https://1.bp.blogspot.com/-HM6TGA0yM7k/XRO7CF07xnI/AAAAAAAAnGk/LkYGcC-jkyQym761E4kbCSZU6rkpaOT1wCKgBGAs/s320/IMG_20190618_184247.jpg" width="240" height="320" /></a></p>
</div>
<p>The bad Kenyan grid has struck again. There is very little built in surge protection in the system, so all appliances plugged to the wall end up with in-house surge protectors. This time the victim was my beloved coffee machine which had served us well for more than a year.</p>
<div class="separator" style="clear: both; text-align: center;">
<p><a href="https://1.bp.blogspot.com/-e7aVBy4T6LQ/XRO7CMmtfeI/AAAAAAAAnGk/HNefumwmPvses0N6L9XmSOhs3p8XEM8QwCKgBGAs/s1600/IMG_20190618_184303.jpg"><img src="https://1.bp.blogspot.com/-e7aVBy4T6LQ/XRO7CMmtfeI/AAAAAAAAnGk/HNefumwmPvses0N6L9XmSOhs3p8XEM8QwCKgBGAs/s320/IMG_20190618_184303.jpg" width="240" height="320" /></a></p>
</div>
<p>So I decided to take it home and spend some quality time with Pascal tearing it down. He is always curious about stuff and what is inside, so the Coffee machine is a complex beast capable of keeping him and myself occupied for hours on end. First we took of the top and looked at the heater and the electromechanical assembly controlling the hot-water head and frother was exposed. Also was exposed the heating tank with dual heating elements and a thermistor (I am assuming a thermistor rather than a thermocouple).</p>
<div class="separator" style="clear: both; text-align: center;">
<p><a href="https://1.bp.blogspot.com/-4uH-YEaNhZ8/XRO7CLS3BeI/AAAAAAAAnGk/AV_hZo31yb4Yfh5FHqSTzfHDG-IsgSBjQCKgBGAs/s1600/IMG_20190623_132023.jpg"><img src="https://1.bp.blogspot.com/-4uH-YEaNhZ8/XRO7CLS3BeI/AAAAAAAAnGk/AV_hZo31yb4Yfh5FHqSTzfHDG-IsgSBjQCKgBGAs/s320/IMG_20190623_132023.jpg" width="240" height="320" /></a></p>
</div>
<p>When we took the back plate off we found the main controller board. There is to obvious transformer in the set-up so I assume to whole power supply is cap-drop. There is a giant heat-sink attached to a 3-pin device which I assume is a triac or SCR for controlling the heating elements.</p>
<div class="separator" style="clear: both; text-align: center;">
<p><a href="https://1.bp.blogspot.com/-H-7y14teSUk/XRO7CMLhPVI/AAAAAAAAnGk/Cw3zYu-YukACFK-tQ-foZE9JZwFir_3wgCKgBGAs/s1600/IMG_20190623_132006.jpg"><img src="https://1.bp.blogspot.com/-H-7y14teSUk/XRO7CMLhPVI/AAAAAAAAnGk/Cw3zYu-YukACFK-tQ-foZE9JZwFir_3wgCKgBGAs/s320/IMG_20190623_132006.jpg" width="240" height="320" /></a></p>
</div>
<p>The bottom-left corner has a water pump with its own switching mechanism driven by relatively thin signal-wires from the main board.</p>
<div class="separator" style="clear: both; text-align: center;">
<p><a href="https://1.bp.blogspot.com/-x9OC3c2JuR8/XRO7CDiLdwI/AAAAAAAAnGk/3oXVOqBjXdIgRyrolAfR4k91D8ezQGBQgCKgBGAs/s1600/IMG_20190623_131725.jpg"><img src="https://1.bp.blogspot.com/-x9OC3c2JuR8/XRO7CDiLdwI/AAAAAAAAnGk/3oXVOqBjXdIgRyrolAfR4k91D8ezQGBQgCKgBGAs/s320/IMG_20190623_131725.jpg" width="240" height="320" /></a></p>
</div>
<p>There are some more interesting details on the main processor board including thick high current traces driven by the silicon switch with exposed copper and extra solder on top to increase thickness and provide a lower current path.</p>
<div class="separator" style="clear: both; text-align: center;">
<p><a href="https://1.bp.blogspot.com/-YH_KnrxBKKQ/XRO7CC3EHgI/AAAAAAAAnGk/mlLKtGcRrek-5hH4wKdO4kpR_DJSYWiSQCKgBGAs/s1600/IMG_20190623_131500.jpg"><img src="https://1.bp.blogspot.com/-YH_KnrxBKKQ/XRO7CC3EHgI/AAAAAAAAnGk/mlLKtGcRrek-5hH4wKdO4kpR_DJSYWiSQCKgBGAs/s320/IMG_20190623_131500.jpg" width="240" height="320" /></a></p>
</div>
<p>The main CPU is TQFP packaged micro-controller which is covered by the conformal coating the entire PCB is covered in. A macro image on twitter helped establish the lineage of the processor. It is a chinese 8051 variant with the datasheet <a href="https://datasheetspdf.com/pdf/1252845/SINOWEALTH/SH79F1615/1">here</a>. Any help in translating it will be highly appreciated. But most of the schematic is legible.</p>
<div class="separator" style="clear: both; text-align: center;">
<p><a href="https://1.bp.blogspot.com/-liA9oYpllYQ/XRO7CNPU75I/AAAAAAAAnGk/tV8chpG2LNQgDGwaKub3BIHEd0R0NganwCKgBGAs/s1600/IMG_20190623_130924.jpg"><img src="https://1.bp.blogspot.com/-liA9oYpllYQ/XRO7CNPU75I/AAAAAAAAnGk/tV8chpG2LNQgDGwaKub3BIHEd0R0NganwCKgBGAs/s320/IMG_20190623_130924.jpg" width="240" height="320" /></a></p>
</div>
<p>Next up will be powering on the processor with a suitable 3.3v supply and examining the analog and digital buses. As well as powering on the whole thing to see why it turns of immediately on start. If the machine is unfixable I am planning to scavenge the thermistors, heating elements etc. to build a reflow mechanism.</p>
<p>All the water circulation mechanism is really interesting as well and can possibly be shoe-horned into a water cooler for a 3D printing system.</p>
<div class="separator" style="clear: both; text-align: center;">
<p><a href="https://1.bp.blogspot.com/-Kn0xmhNr4-A/XRO7CKTzQgI/AAAAAAAAnGk/H-SL9bB6UxEHXt7yb_YU-mP4w8VRvu_GwCKgBGAs/s1600/IMG_20190623_130859.jpg"><img src="https://1.bp.blogspot.com/-Kn0xmhNr4-A/XRO7CKTzQgI/AAAAAAAAnGk/H-SL9bB6UxEHXt7yb_YU-mP4w8VRvu_GwCKgBGAs/s320/IMG_20190623_130859.jpg" width="240" height="320" /></a></p>
</div>
</div>
Tisham Dharhttp://www.blogger.com/profile/15154154153085427197noreply@blogger.com0tag:blogger.com,1999:blog-3220006345447041404.post-68618612091090677452019-06-22T10:58:00.005-07:002019-06-22T14:45:21.670-07:00Nairobi 2nd OSHW meetup<div dir="ltr" style="text-align: left;" trbidi="on">
After a many month hiatus we finally put together the 2nd <a href="https://www.meetup.com/en-AU/Nairobi-Open-Source-Hardware-Meetup/">Nairobi Open-source hardware meetup</a>. This time we were at the <a href="https://www.facebook.com/TheTavIrishPub/">Tav Irish Pub</a> near Nairobi Garage on Waiyaki way. The pub was chosen due to proximility to Nairobi garage and possible use of that venue. As it turned out none of us were memebers paying the $60 per-month fee so we ended up co-opting the pub in Chicago <a href="https://www.meetup.com/Hardware-Happy-Hour-3H-Chicago/">3H</a> fashion.<br />
<div class="figure">
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><img alt="PCB Lineup" height="240" src="https://1.bp.blogspot.com/-xm1o6p-GUh8/XQ4yXxCCekI/AAAAAAAAnA4/aplimRedP8Q9yfSMvdqGNOjJoLw3ngYPgCKgBGAs/s320/IMG_20190608_152150.jpg" style="margin-left: auto; margin-right: auto;" width="320" /></td></tr>
<tr><td class="tr-caption" style="text-align: center;">PCB Lineup</td></tr>
</tbody></table>
</div>
I had collected PCB's over the last few month from <a href="https://aisler.net/">Aisler</a>, <a href="http://oshpark.com/">OSHPark</a> and <a href="https://www.pcbway.com/">PCBWay</a> all shipped to Kenya from Germany, US and China respectively. So we lined up to try various soldering techniques on 0603 Jellybeans and some 20pin TSSOP IC's.<br />
<div class="figure">
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><img alt="Soldering demo" height="240" src="https://1.bp.blogspot.com/-lijDcgSmZFo/XQ4yX2DQNFI/AAAAAAAAnA4/5Z2x_rvdUx0ztFcdAoZ8RUpVdAzpU5l9wCKgBGAs/s320/IMG_20190608_155321.jpg" style="margin-left: auto; margin-right: auto;" width="320" /></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Soldering Demo</td></tr>
</tbody></table>
</div>
The techniques we we tried were the tack, finish and reflow one using the iron and an experimental one with paste and dry-iron I had picked up recently. I didn't have a temperature profile controller for the dry-iron method. So we were just going to wing it by the eye.<br />
<div class="figure">
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><img alt="Part Placement" height="320" src="https://1.bp.blogspot.com/-OhyPC9QghYE/XQ4yX_tQ0QI/AAAAAAAAnA4/NKV8244Ur3Yo39hvVZVID8SVOGosQMjDACKgBGAs/s320/IMG_20190608_160645.jpg" style="margin-left: auto; margin-right: auto;" width="240" /></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Part Placement</td></tr>
</tbody></table>
</div>
We pasted up the boards using screwdrivers and tweezers. Started the reflow till the parts settled. Then simply turned off the iron. I am sourcing a K-Type thermocouple and SSR from <a href="https://ktechnics.com/">KTechnics</a> to get a better handle on this for next time. However the dry-iron does reach sufficient temperature for leaded solder reflow.<br />
<div class="figure">
<img alt="Dry iron reflow" height="240" src="https://1.bp.blogspot.com/-v0czI6HNlJ4/XQ4yX89cL3I/AAAAAAAAnA4/Rhz7saIYFPEP_cPyoeNYFnbq5gCNPh0CQCKgBGAs/s320/IMG_20190608_171403.jpg" width="320" />
<br />
<div class="caption">
Dry iron reflow</div>
</div>
By the end of the session we had assembled x2 <a href="https://github.com/whatnick/CS5464_Breakout">CS5464 Breakouts</a>. Next step from here will be suitable MicroPython and Arduino drivers to ensure these things actually work. We had a lot of fun over the meetup and I hope to continue having these sessions. Next time one of the participants has promised to bring his Weighbridge Automation and IoT set-up.<br />
<div class="figure">
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><img alt="Scavenging Coffee Machine" height="320" src="https://1.bp.blogspot.com/-qMJk-5XMTZk/XQ4yX3TDMBI/AAAAAAAAnA4/1lI7Rf46b44KEamyQeUWgThFdDJg5t2XwCKgBGAs/s320/IMG_20190618_184303.jpg" style="margin-left: auto; margin-right: auto;" width="240" /></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Scavenging a Coffee Machine</td></tr>
</tbody></table>
</div>
Following the meetup I have been hunting for accessories to make the dry-iron reflow less of a fire hazard and more controllable. (Un)fortunately the coffee machine at work has been fried by the spikes prevalent in the grid in Kenya (especially during the rainy season), so I have a spare K-type thermocouple I can work into the build. I have also co-opted a tissue holder we had on our dining table to stabilize the inverted iron during reflow.<br />
<div class="figure">
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><img alt="A stand of opportunity" height="240" src="https://1.bp.blogspot.com/-FEv4Ew839YA/XQ4yX1wKmFI/AAAAAAAAnA4/mea-UvvklWIb6N8TE9pK0-IH3TMSOfMvQCKgBGAs/s320/IMG_20190619_084415.jpg" style="margin-left: auto; margin-right: auto;" width="320" /></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Stand of opportunity</td></tr>
</tbody></table>
</div>
Onwards to the next Meetup.</div>
Tisham Dharhttp://www.blogger.com/profile/15154154153085427197noreply@blogger.com0tag:blogger.com,1999:blog-3220006345447041404.post-68112587332554064692019-06-22T10:57:00.005-07:002019-08-15T19:04:22.058-07:00KiCon 2019 - Chicago in a weekend<div dir="ltr" style="text-align: left;" trbidi="on">
Getting away from a fast paced <a href="https://www.lorisystems.com/">start-up</a> to attend conferences is a hard ask. However I managed to get away for a few days to attend the inaugural KiCad conference in Chicago a few weeks ago.<br />
<div class="figure">
<img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgYhOWZpaJVK-w5sUxKO9tO0WffqhZCM2XGCVi8EnCJfq_nVJAR56vM95JQIa75M8yh07VO7OdjlzVbj8h16ouIzHrd4Y377kwoKqh8WSVzMIkbnBkz3tnQo7_f2tJS7l8a72Dr5w_sROY/s320/IMG_20190425_163912.jpg" />
</div>
The pace has been such that only after about a month I am getting a chance to write it all up. The first night I managed to attend the <a href="https://www.meetup.com/en-AU/Hardware-Happy-Hour-3H-Chicago/">Hardware Happy Hour</a> at the Ballast Point. I got to see some amazing stuff including pneumatics for an autoplaying piano using layers of PCB.<br />
<div class="figure">
<img src="https://1.bp.blogspot.com/-AKHaR2FNrqc/XQ4u7JkQ6gI/AAAAAAAAnAs/R9U_0bjtGNY1UQ327Evn4ipEf9oyKgYogCKgBGAs/s320/IMG_20190425_204023.jpg" />
</div>
The huge selection of beers and the chicago dogs were definitely unexpected bonuses.<br />
<div class="figure">
<img src="https://1.bp.blogspot.com/-KMKj5vuxUsI/XQ4u7Pm2hmI/AAAAAAAAnAs/RWqOb8KwAewuXjr8p0_mH5oHPhAw3nJYQCKgBGAs/s400/IMG_20190425_221646.jpg" />
</div>
Tour of <a href="https://mhubchicago.com/">MHub</a> assembly area with pick and place machine and large Molex sign. Also got to see <a href="https://twitter.com/Chris_Gammell">Chris Gammell</a>'s desk and pick up some Amazon and Mouser shopping to bring back to Nairobi.<br />
<div class="figure">
<img src="https://1.bp.blogspot.com/-fIoxIZ6yACc/XQ4u7FyNzbI/AAAAAAAAnAs/B005oc7H_zAhvFliaFULP2GKtGfZeMliwCKgBGAs/s320/IMG_20190426_133456.jpg" />
</div>
I could definitely use the pick-n-place machine in my house and I hope Chris makes use of it whenever he can.<br />
<div class="figure">
<img src="https://1.bp.blogspot.com/-fGKxRlQ7nAw/XQ4u7KwjzGI/AAAAAAAAnAs/A7ihydRMIBEmhP9SR6l6lgsPPNBoswFHwCKgBGAs/s320/IMG_20190426_133627.jpg" />
</div>
I also got to speak to some companies I have worked with remotely but not met the principles and representatives in person, including <a href="https://www.crowdsupply.com/whatnick/atm90e26-energy-monitor-kits">CrowdSupply</a>, <a href="https://aisler.net/">Aisler</a>, <a href="https://www.snapeda.com/home/">SnapEDA</a>, <a href="https://hologram.io/">Hologram</a> and of course DigiKey. It was great to speak to the KiCAD dev team as well, perhaps I can contribute on the <a href="http://docs.kicad-pcb.org/doxygen/md_Documentation_development_compiling.html#build_windows">MSVC windows</a> native build. I also managed to score credits freebies from all the sources.<br />
<div class="figure">
<img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjCh_KUvENZ94-h-yAtmZ4H8jHSGuHb_hJUmK9sLPF-TL0KZJW2ffXvGhldueO-elllOmHZzf4yy819PdGKz6suEhAdWyin1JoqsqpaYyFsrzsrCnbYyrEs4IH6bezrJywQ82opNqDFcmc/s320/IMG_20190428_171944.jpg" />
</div>
Here are pure notes to self on various topics that I picked up on 2-days of super varied and dense conferencing. Some are commands I would like to run some, are techniques I learnt and some are pure stories I picked up.<br />
<h2 id="schematics-are-a-drug-use-code-instead">
Schematics are a drug, use code instead</h2>
<ul>
<li>pip install skidl</li>
</ul>
<h2 id="auto-routers-are-evil-but-useful">
Auto-routers are evil but useful</h2>
<ul>
<li>Triangles (Topological/ Using TIN mesh)</li>
<li>Maze solving</li>
<li>Shape based ( Rectangles)</li>
<li>Channel Based</li>
<li>FreeRouting</li>
<li>Adaptive heuristics using deep learning</li>
<li>Linear increase in PCB complexity</li>
</ul>
<h2 id="high-frequency-simulation-in-ghz-range-for-pcbs">
High-frequency simulation (in GhZ range) for PCB's</h2>
<ul>
<li>OpenEMS ( MEEP)</li>
<li>Wilkinson filter</li>
<li>Important in Radar Design</li>
</ul>
<h2 id="prototyping-in-a-few-hours">
Prototyping in a few hours</h2>
<ul>
<li>Isolation milling</li>
<li>Midwest Circuit Technologies</li>
<li>Bantam tools. Binary save.</li>
<li>1/32" end mill 0.8mm tool</li>
<li>10 mill trace</li>
</ul>
<h2 id="rendering-photorealistic-pcbs">
Rendering photorealistic PCB's</h2>
<ul>
<li>Render layers to image texture</li>
<li>Use Blender cycles based render with bump maps for silk-screen and traces</li>
</ul>
<h2 id="contributing-to-kicad">
Contributing to KiCAD</h2>
<ul>
<li>Development in LaunchPad + Github</li>
<li>Starter bugs are available</li>
</ul>
<h2 id="more-hf-pcbs">
More HF PCB's</h2>
<ul>
<li>30MHz to 3Ghz, with narrow bins</li>
<li>5.6GSPS digitizer</li>
<li>Tuned lines. Right angles create problems.</li>
<li>Use footprint, Arc or Trace around edge cuts.</li>
</ul>
<div class="figure">
<img src="https://1.bp.blogspot.com/-rUaYi1q3ilY/XQ4u7HkPbxI/AAAAAAAAnAs/NdBGDZTSweseIGKY9uNra3Ai6dGNPPoaACKgBGAs/s320/IMG_20190427_195235.jpg" />
</div>
I woke up pretty early on Saturday morning and walked around and almost hopped on a fire-engine tour. Always wanted to do that. Then I checked the radar, another thing missing in Nairobi, and a huge snowstorm was inbound. Snowstorms at this time in Chicago are atypical, but hey everyone stays in for the coference. By the time the conference finished and I headed home from the after-party everything was covered in snow.<br />
<div class="figure">
<img src="https://1.bp.blogspot.com/-L8vkIZuGqvc/XQ4u7LWtbxI/AAAAAAAAnAs/PtAURXhaid03kB19_WJsyMj_rgeLj7bqwCKgBGAs/s320/IMG_20190427_084518.jpg" />
</div>
<div class="figure">
<img src="https://1.bp.blogspot.com/-293W3aMn9zI/XQ4umGtQQSI/AAAAAAAAnAk/UQxt0zP7k9UMoioCOfsKQB6trGu9z59tQCKgBGAs/s320/IMG_20190427_084438_1.jpg" />
</div>
The last day (Sunday) was spent taking an Uber Pool , a novelty for me, to a Vietnamese grocery and spending around 2 hours getting additional exotic food-supplies to bring back to Nairobi<br />
<div class="figure">
<img src="https://1.bp.blogspot.com/-1d4Bx7FUDyU/XQ4u7IXW18I/AAAAAAAAnAs/sP0NzZwpeX0MAJ_SphlL0dTrVNm0tWDxwCKgBGAs/s320/IMG_20190428_083426.jpg" />
</div>
I saw a Harvey milk tail fin and took to the skies back to hop across the Atlantic and Mediterrnean to Nairobi. Flying 40 hrs to conference for 48 hours and shop for 6 is a real pain. Will have to bring the KiCAD movement back home to Nairobi and pour more effort into the local hardware scene.<br />
<div class="figure">
<img src="https://1.bp.blogspot.com/-kGt72EuQGJ4/XQ4u7No4HMI/AAAAAAAAnAs/h3qVb9xW-zY0__3eItSs4K2NVpYOhv7lQCKgBGAs/s320/IMG_20190428_191432.jpg" />
</div>
So long Chicago, see you next conference.<br />
<div class="figure">
<img src="https://1.bp.blogspot.com/-tssfU3NGBPY/XQ4u7IWK5PI/AAAAAAAAnAs/X9YebzCE0pw991cERLgqUSFUsAPWUHF6ACKgBGAs/s320/IMG_20190428_194525.jpg" />
</div>
</div>
Tisham Dharhttp://www.blogger.com/profile/15154154153085427197noreply@blogger.com0tag:blogger.com,1999:blog-3220006345447041404.post-7730247296560023942019-03-03T07:28:00.001-08:002019-03-03T07:28:24.417-08:00Kogan Energy Monitor Teardown - Sonoff-Pow in a wall plug<div dir="ltr" style="text-align: left;" trbidi="on">
After doing a tear-down on the <a href="https://whatnicklife.blogspot.com/2018/11/tplink-smart-plug-teardown.html">TPLink Wall Plug</a> energy monitor I found mentions in Australia of the much cheaper <a href="https://www.kogan.com/au/buy/kogan-smarterhome-smart-plug-energy-meter/">Kogan Alternative</a>. So I decided to get a couple of them see what makes them tick as well.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://1.bp.blogspot.com/-h0p1PgkAfSY/XGEdoywBU1I/AAAAAAAAjpY/RezyybU5Yjkw8EI-hBi21U2YiNEZAB7MQCLcBGAs/s1600/general_assembly.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" data-original-height="1600" data-original-width="1465" height="400" src="https://1.bp.blogspot.com/-h0p1PgkAfSY/XGEdoywBU1I/AAAAAAAAjpY/RezyybU5Yjkw8EI-hBi21U2YiNEZAB7MQCLcBGAs/s400/general_assembly.png" width="366" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">General Assembly of the whole unit</td></tr>
</tbody></table>
<br />
<div>
<b>TL;DR</b> - The Kogan one is cheaper because it uses a bare metal (non-linux capable) CPU and a PWM output type energy monitor (without intricacies of a SPI protocol and calibration). It is essentially a repackaged <a href="https://www.itead.cc/sonoff-pow.html">Sonoff Pow</a>.</div>
<div>
<br /></div>
<div>
The details of the build are packages in sections as I discovered them.</div>
<div>
<br /></div>
<h3 style="text-align: left;">
<b>LV and Buck converter</b></h3>
<div>
<br /></div>
<div>
The LV section consists of two separate cricuits:</div>
<div>
<ol style="text-align: left;">
<li>Relay to switch the load</li>
<li>Buck converter to rectify and convert 240v to 5v to power electronics</li>
</ol>
<div>
The diagram below presents both of these sections. The Buck converter is basically the toplogy found in many <a href="https://www.aliexpress.com/item/5V-700mA-3-5W-AC-DC-Precision-Buck-Converter-AC-220v-to-5v-DC-step-down/32649591757.html">aliexpress products</a>. Perhaps with the difference of being unisolated (notice no slots). The relay is rated at 15A which is nice compared the TPLink product which uses x2 - 5A relays in parallel to achieve 10A.</div>
</div>
<div>
<br /></div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://3.bp.blogspot.com/-mFZu0twKLJc/XGEkbyCWUwI/AAAAAAAAjpk/xrznDUh4Z58lUhM3kEB7Z8pPVRboCbgHgCLcBGAs/s1600/lv_section.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" data-original-height="957" data-original-width="1600" height="238" src="https://3.bp.blogspot.com/-mFZu0twKLJc/XGEkbyCWUwI/AAAAAAAAjpk/xrznDUh4Z58lUhM3kEB7Z8pPVRboCbgHgCLcBGAs/s400/lv_section.png" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Low Voltage (240v) Circuitry</td></tr>
</tbody></table>
<div>
<br />
<h3 style="text-align: left;">
Energy Monitor and LDO</h3>
</div>
<div>
This a 3.3v operated section which uses the super low-cost PWM output energy monitor IC made popular by the Sonoff the measure instantaneous voltage, current and hence power. The pulses are channeled to the main processor for forwarding to whatever backend Kogan has put together.</div>
<div>
<br /></div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://2.bp.blogspot.com/-_UoENLChJ-I/XHvp6sTkAEI/AAAAAAAAkKQ/t0T-wU9ZJNQsjDvazrEu8bM4fqdT4_i2QCLcBGAs/s1600/metering_ldo.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" data-original-height="1286" data-original-width="1600" height="257" src="https://2.bp.blogspot.com/-_UoENLChJ-I/XHvp6sTkAEI/AAAAAAAAkKQ/t0T-wU9ZJNQsjDvazrEu8bM4fqdT4_i2QCLcBGAs/s320/metering_ldo.png" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Metering and LDO</td></tr>
</tbody></table>
<h3 style="text-align: left;">
Main Processor</h3>
<div>
The design seems to have taken a standard ESP module and planted it on a basic PCB to fit in the power-plug form factor, sideways. The carries board has lots of markings and test-points making the task of reverse engineering and putting new firmware on this board almost too easy.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://3.bp.blogspot.com/-A24bsIzTe8A/XHvxE7atfXI/AAAAAAAAkK4/1QB-walvyo0Fiutz8HYUh3Zv3gid31jzACLcBGAs/s1600/IMG_20190209_171506.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" data-original-height="1600" data-original-width="1200" height="400" src="https://3.bp.blogspot.com/-A24bsIzTe8A/XHvxE7atfXI/AAAAAAAAkK4/1QB-walvyo0Fiutz8HYUh3Zv3gid31jzACLcBGAs/s400/IMG_20190209_171506.jpg" width="300" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Processor module adapter</td></tr>
</tbody></table>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://3.bp.blogspot.com/-NNARmLe0Bfw/XHvxFDJ7s7I/AAAAAAAAkK8/63vJu11kYksVJBEbUw7ljWsVwypJQ5BpgCLcBGAs/s1600/IMG_20190209_171519.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" data-original-height="1600" data-original-width="1200" height="400" src="https://3.bp.blogspot.com/-NNARmLe0Bfw/XHvxFDJ7s7I/AAAAAAAAkK8/63vJu11kYksVJBEbUw7ljWsVwypJQ5BpgCLcBGAs/s400/IMG_20190209_171519.jpg" width="300" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Marked bottom test pads of processor carrier PCB</td></tr>
</tbody></table>
Over all this looks like a nice certified unit which you can run your own firmware on thanks with the help of the right triangular security bit.<br />
<div>
<br /></div>
</div>
Tisham Dharhttp://www.blogger.com/profile/15154154153085427197noreply@blogger.com0tag:blogger.com,1999:blog-3220006345447041404.post-90268375203015150182019-01-23T11:21:00.000-08:002019-01-23T11:22:35.761-08:00Around Kenya in 4 days and a year ( part 1)<div dir="ltr" style="text-align: left;" trbidi="on">
2018 was a year on making impromptu decisions and hopping on random flights heading for adventure. In the beginning of the year I left <a href="http://aerometrex.com.au/">Aerometrex</a> to explore new opportunities at <a href="https://www.lorisystems.com/">Lori</a>.<br />
<br />
It turned out I finished the year in similar markovian motion travelling around Kenya with a couple of high school friends. Thank you so much <a href="https://www.linkedin.com/in/eric-mibuari-bb24044/">Eric</a> for driving and showing us the beautiful country.<br />
<br />
I received a call late on the 29th December proposing the trip. I booked a ticket of <a href="https://www.flysafarilink.com/en">Safarilink</a> and went to bed. Flying out of Wilson Airport is magnitudes easier than flying out of Jomo Kenyatta International. I almost missed the flight, but the empty Christmas streets in Nairobi and low access overheads in Wilson meant I flew into Kisumu with zero dramas. I hopped in a Probox from Kisumu to catch up with the other 2 in Kericho. The <a href="https://www.nation.co.ke/lifestyle/dn2/Probox-It-will-kill-your-image-but-build-your-business-/957860-1243940-11y6l53z/index.html">Probox</a> are known for being death machines, but is a super cheap and fast way to get around. There is another article somewhere revolving around the impact of the Probox on transport in Kenya.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://1.bp.blogspot.com/-V4PYyFiNhHo/XEi1yOKwlZI/AAAAAAAAi2I/UCytQcNduUMbLnxZKtblEVXDaxlkJJaAwCKgBGAs/s1600/IMG_20181229_081444.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" data-original-height="1200" data-original-width="1600" height="240" src="https://1.bp.blogspot.com/-V4PYyFiNhHo/XEi1yOKwlZI/AAAAAAAAi2I/UCytQcNduUMbLnxZKtblEVXDaxlkJJaAwCKgBGAs/s320/IMG_20181229_081444.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Tiny Kisumu Airport</td></tr>
</tbody></table>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://1.bp.blogspot.com/-V0-BQRnPJoY/XEi1yMlVwqI/AAAAAAAAi2I/oHeRaxUxkckiYv0UpGFY8WiofPsyLl_2wCKgBGAs/s1600/IMG_20181229_081417.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" data-original-height="1200" data-original-width="1600" height="240" src="https://1.bp.blogspot.com/-V0-BQRnPJoY/XEi1yMlVwqI/AAAAAAAAi2I/oHeRaxUxkckiYv0UpGFY8WiofPsyLl_2wCKgBGAs/s320/IMG_20181229_081417.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Safarilink Flight (Turboprop)</td></tr>
</tbody></table>
<br />
We then travelled via some roads still being built from the tea-gardens of Kericho to the lush sugarcame farms of Awendo. In sections the road meandered into farms and cars had to go in a single file and often backup into fields when a truck came by from the other side.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://2.bp.blogspot.com/-tvq10FW4ZgE/XEi5l2OApgI/AAAAAAAAi2U/4x5BXpXmi2oEj7TLYnJALkNLwPcz6vIewCKgBGAs/s1600/IMG_20181229_163236.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" data-original-height="1212" data-original-width="1600" height="242" src="https://2.bp.blogspot.com/-tvq10FW4ZgE/XEi5l2OApgI/AAAAAAAAi2U/4x5BXpXmi2oEj7TLYnJALkNLwPcz6vIewCKgBGAs/s320/IMG_20181229_163236.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Road through Kisii</td></tr>
</tbody></table>
It was a great night of going out to watch football match in Ulanda town and staying at Owuor's <a href="https://archive.macleki.org/items/show/2759">Simba</a>. The road from <a href="https://en.wikipedia.org/wiki/Awendo">Awendo</a> to Ulanda is awesome. The sugar cane is a mass scale project and produces a lot of <a href="https://en.wikipedia.org/wiki/Bagasse">bagasse</a> which can be recycled into paper tissue and other products with the right infrastructure.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhalcHxWaHOSx0KHBR9nH3HKWcOo-MVGifBlmo-_UBCdt2kOVnfzyPmJvYSRPpYzMd4h2BmiGUewTKAyMe9c8oKrg4u-oJiBuWWKH8cGIkF53PVpI3tM-4taDdLQUbtH8fBAYYzN_4inws/s1600/IMG_20181230_112631.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" data-original-height="1200" data-original-width="1600" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhalcHxWaHOSx0KHBR9nH3HKWcOo-MVGifBlmo-_UBCdt2kOVnfzyPmJvYSRPpYzMd4h2BmiGUewTKAyMe9c8oKrg4u-oJiBuWWKH8cGIkF53PVpI3tM-4taDdLQUbtH8fBAYYzN_4inws/s320/IMG_20181230_112631.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Mercury laden waters used to extract gold nodules</td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://3.bp.blogspot.com/-RoDm-KsJ-us/XEi8EOODmWI/AAAAAAAAi2g/3nr77-5IF7cExFDvaCqoYGCeSEzgwJBAwCKgBGAs/s1600/IMG_20181230_111820.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" data-original-height="1200" data-original-width="1600" height="240" src="https://3.bp.blogspot.com/-RoDm-KsJ-us/XEi8EOODmWI/AAAAAAAAi2g/3nr77-5IF7cExFDvaCqoYGCeSEzgwJBAwCKgBGAs/s320/IMG_20181230_111820.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Sheds housing diesel engines and rock crushers for mining</td></tr>
</tbody></table>
<br />
Next day we took a side trip to Macalder gold mines. It was in interesting experience what people will do to earn a living in far flung places in the country. <a href="http://cejadkenya.org/mercury-and-minamata-convention/mercury-use-in-artisanal-and-small-scale-gold-mining-asgm/">Migori county</a> is known for its high concentration of mercury in water. The operations here clearly explain why. Rocks are dug up from underground gold mine and manually broken up into smaller chunks and ground into dust using diesel operated octagonal drum crushers. The whole place is noisy. The dust is then filtered to remove solubles and then mixed with mercury to form <a href="https://en.wikipedia.org/wiki/Amalgam_(chemistry)#Gold_amalgam">gold amalgam</a> nodule, women (some of whom were pregnant) then stir the mixture by hand to find gold bits. Mercury is then recovered by retorting in small ovens and reused. At least some work is being done to raise awareness of the harm from Mercury, hopefully sanity will prevail over economic incentives.<br />
<br />
We then continued our trip south towards Kenya Tanzania border and I will continue the story in another post.</div>
Tisham Dharhttp://www.blogger.com/profile/15154154153085427197noreply@blogger.com0Christchurch, New Zealand-43.5320544 172.63622540000006-43.9005494 171.99077840000007 -43.1635594 173.28167240000005tag:blogger.com,1999:blog-3220006345447041404.post-20512405290397539842019-01-13T05:21:00.002-08:002019-01-13T05:21:34.674-08:00Making PCB protos in Kenya<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr">
In Adelaide I made a lot of prototypes PCB's and filled up filing cabinets and shelves with them. Some had value to others and I sold them on <a href="https://www.tindie.com/stores/whatnick/">Tindie</a> and <a href="http://crowdsupply./">CrowdSupply.</a> For the last year I have been hanging out in Kenya working at <a href="https://www.lorisystems.com/">Lori</a>. The output in terms of open-source hardware has taken a back seat compared to proprietary company code (we did release one open-source piece of ETL code).</div>
<div dir="ltr">
<br /></div>
<div dir="ltr">
This is near the end of my 3-month stint in Kenya and I decided to run an experiment in the feasibility of designing and assembling prototype batches of PCB's for an energy monitor ASIC I have been meaning to try out - the <a href="https://www.cirrus.com/products/cs5490/">CS5490</a>. This is a super low bar for a test run. The IC has very few dependent components and large pin pitch making it ideal of teaching manual SMD soldering.</div>
<div dir="ltr">
<br /></div>
<div dir="ltr">
<b>PCB Design</b></div>
<div dir="ltr">
<b><br /></b></div>
<div dir="ltr">
Once the goal was set I broke out KiCAD and spent a night and a Sunday churning out a basic breakout board. The PCB Design and BOM are published <a href="https://github.com/whatnick/CS5490_Breakout">here</a>.</div>
<div dir="ltr">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-zaqJF7cKeeA/XDsrfR-RQuI/AAAAAAAAips/BLQamH0ggLMi417Rg_tbl7nX1nJBorNogCLcBGAs/s1600/CS5490_pcb.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="724" data-original-width="974" height="237" src="https://1.bp.blogspot.com/-zaqJF7cKeeA/XDsrfR-RQuI/AAAAAAAAips/BLQamH0ggLMi417Rg_tbl7nX1nJBorNogCLcBGAs/s320/CS5490_pcb.PNG" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://3.bp.blogspot.com/-499OZ17hH-g/XDsrffYot2I/AAAAAAAAipo/AS88mD0kebgOe-dlwH6WHr9uM7CHFXluACLcBGAs/s1600/CS5490_schema.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="770" data-original-width="1113" height="221" src="https://3.bp.blogspot.com/-499OZ17hH-g/XDsrffYot2I/AAAAAAAAipo/AS88mD0kebgOe-dlwH6WHr9uM7CHFXluACLcBGAs/s320/CS5490_schema.PNG" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://3.bp.blogspot.com/-Y-zMZTXxg_0/XDsrjZ-IFPI/AAAAAAAAipw/Gx-H1ygVeccuhQmQ01BxVPXEOUJLCheOQCLcBGAs/s1600/CS5490_Breakout_Front.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="758" data-original-width="1600" height="151" src="https://3.bp.blogspot.com/-Y-zMZTXxg_0/XDsrjZ-IFPI/AAAAAAAAipw/Gx-H1ygVeccuhQmQ01BxVPXEOUJLCheOQCLcBGAs/s320/CS5490_Breakout_Front.png" width="320" /></a></div>
<div dir="ltr">
<br /></div>
<div dir="ltr">
<br />
<b>Order PCB</b></div>
<div dir="ltr">
<b><br /></b></div>
<div dir="ltr">
The harder part begins once the PCB design is done. Actually making this a physical reality in Kenya. I placed the usual order via PCBWay. A few days before Christmas before I went off to a round a country drive with some friends ( awesome content for another post). The shipping would be from Shenzhen via DHL. The logistics promises arrival by the 28th December.</div>
<div dir="ltr">
<b>Order Parts</b></div>
<div dir="ltr">
<b><br /></b></div>
<div dir="ltr">
The BOM for the design is not super complex either. <a href="https://au.mouser.com/">Mouser</a> covers the Kenya region. However there is no option for free DHL for orders over $60 which I get in Australia. I will be in Kenya only till the 20th January and the streets have no numbers or postcodes, which makes ordering via snail mail for any international shipping simply not fit the address template most places have. Perhaps global addressing via <a href="https://plus.codes/organizations">plus codes</a> will become reality in future eCommerce systems. Mouser shipped the parts out of Texas immediately, I ended up paying more on shipping than for parts. The customs magic was yet to come.</div>
<div dir="ltr">
<b><br />
Clear customs</b></div>
<div dir="ltr">
<b><br /></b></div>
<div dir="ltr">
Any packages with value below $1000 sail through customs in Australia. The Kenyan government will lose out on significant revenues if they followed this practice. On the flipside young engineers with limited resources are being stifled in self-driven learning and experimentation by this practice. I got a detailed/itemized bill from customs via DHL which ended up being the same cost as PCB + shipping for PCB's and around 20% of the cost of the parts. See file <a href="https://drive.google.com/file/d/1OPEOcqFalRCZt_Iea-Dj3oOtu6ta26a7/view">here</a> for details and breakdown.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://2.bp.blogspot.com/-OFM2hpTgWEU/XDsw-ZjtVWI/AAAAAAAAiqQ/qeoVEMeN8Mom5zWummSBmqz7l5R59zSkwCKgBGAs/s1600/IMG_20190102_193011.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1600" data-original-width="1200" height="320" src="https://2.bp.blogspot.com/-OFM2hpTgWEU/XDsw-ZjtVWI/AAAAAAAAiqQ/qeoVEMeN8Mom5zWummSBmqz7l5R59zSkwCKgBGAs/s320/IMG_20190102_193011.jpg" width="240" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-nBZkgMQuZfQ/XDszZyXnzII/AAAAAAAAiqo/60V3LY5XR4IAjIPmKjl0byWC5_mXIIghgCLcBGAs/s1600/IMG_20190102_073822.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1200" data-original-width="1600" height="240" src="https://1.bp.blogspot.com/-nBZkgMQuZfQ/XDszZyXnzII/AAAAAAAAiqo/60V3LY5XR4IAjIPmKjl0byWC5_mXIIghgCLcBGAs/s320/IMG_20190102_073822.jpg" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<br />
<div dir="ltr">
<b>
Source tools and </b><b>materials</b></div>
<div dir="ltr">
<br /></div>
<div dir="ltr">
Thankfully this bit was much easier with a couple of local soldering iron , jumper wire and tweezers suppliers filling the gap. The ball was dropped by <a href="https://www.fargocourier.co.ke/">Fargo</a> in delivering the stuff I ordered online again due to the addressing snafu, they attempted 5 deliveries to the wrong place before I had to redirect to the office address where a lot of parcels are received. I can recommend <a href="https://store.nerokas.co.ke/">Nerokas</a> and <a href="https://ktechnics.com/shop/soldering-iron/">Ktechnics</a> for getting parts in without hassle. Again better last mile logistics would have made things faster. I ended up attending the assembly meetup without the proper tools.</div>
<div dir="ltr">
<br /></div>
<div dir="ltr">
<b>Find assembly space</b></div>
<div dir="ltr">
<b><br /></b></div>
<div dir="ltr">
To avoid annoying my landlord with solder fumes and messy paste workbench I started looking for a place to get together with a few interested parties and assemble the boards (at least one). I ended up starting an <a href="https://www.meetup.com/Nairobi-Open-Source-Hardware-Meetup/">open-source hardware meetup</a> and getting some Mang'u engineers together to hand solder the parts. </div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://4.bp.blogspot.com/-OpFcBpGhpEk/XDs49hXEhGI/AAAAAAAAiq4/Vz41OtI2XOIuLTgos-lUyGueV_SClU-BQCKgBGAs/s1600/IMG_20190105_173222.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1200" data-original-width="1600" height="240" src="https://4.bp.blogspot.com/-OpFcBpGhpEk/XDs49hXEhGI/AAAAAAAAiq4/Vz41OtI2XOIuLTgos-lUyGueV_SClU-BQCKgBGAs/s320/IMG_20190105_173222.jpg" width="320" /></a></div>
<blockquote class="twitter-tweet" data-lang="en">
<div dir="ltr" lang="en">
1 PCB - x3 assemblers and a gas stove from a local shop. <a href="https://t.co/S09EZJbZ5k">pic.twitter.com/S09EZJbZ5k</a></div>
— Tisham Dhar (@whatnick) <a href="https://twitter.com/whatnick/status/1081600551761182722?ref_src=twsrc%5Etfw">January 5, 2019</a></blockquote>
<script async="" charset="utf-8" src="https://platform.twitter.com/widgets.js"></script>
<br />
<div dir="ltr">
<b><br />
Test and publish drivers</b><br />
<b><br /></b>
Finally <a href="https://twitter.com/whatnick/status/1084338568108167169">this Sunday</a> I have put together some basic micropython code to read registers from the CS5490 over serial and display them in a <a href="https://github.com/whatnick/CS5490_micropython">micropython notebook</a>. Nothing production ready but proof that the PCB design and assembly worked as expected and we can achieve custom products here, with a lot of bureaucracy and false starts.<br />
<br />
I am happy to meet more people designing and building open-source hardware in Nairobi and hear about their experience.<br />
<br />
<b><br /></b>
<b><br /></b></div>
</div>
Tisham Dharhttp://www.blogger.com/profile/15154154153085427197noreply@blogger.com0Nairobi, Kenya-1.2920659 36.821946199999957-1.5460584000000002 36.499222699999955 -1.0380734 37.144669699999959tag:blogger.com,1999:blog-3220006345447041404.post-41942946212549656682018-11-25T06:22:00.000-08:002018-11-25T06:22:21.931-08:00Onion IoT module Python SPI<div dir="ltr" style="text-align: left;" trbidi="on">
Some say China is the country of 80-20, things are complete and great to 80% , the remaining 20% of polish is left hanging. The Mediatek CPU used in the <a href="https://onion.io/">Onion IoT</a> modules suffers from a similar shortcoming. There is an working SPI bus, but it is simplex ( <a href="https://community.onion.io/topic/3300/faq-i-heard-there-is-some-issue-with-hardware-spi">OUCH!!</a>) . Simplex means only receive and transmit can take place at a time.<br />
<br />
For interfacing the Onion Module with Energy Monitor IC's this is a huge <a href="http://community.onion.io/topic/3179/spi-bus-in-python">blocker</a> since the typical communication flow with this IC's runs as:<br />
<br />
<ol style="text-align: left;">
<li>Write a 8 or 16 bit register address to the SPI bus</li>
<li>Immediately read-back a 16bit value over the SPI bus while the chip-select is held low.</li>
</ol>
<div>
The proposed remedy to this after a bit of debugging and probing with logic analyzers is to directly use the user-space SPI c-library or to fix the <a href="https://github.com/OnionIoT/python-spidev">python-spidev</a> library with an xfer3 method which does a special write where the clock keeps going, the first bytes are written and next bytes are read.</div>
<div>
<br /></div>
<div>
I have started on the path for fixing the Python library on my fork. <a href="https://openwrt.org/docs/guide-developer/packages#use_source_dir">OpenWRT</a> <a href="https://oldwiki.archive.openwrt.org/doc/howto/build#building_single_packages">build</a> <a href="https://github.com/OnionIoT/source">system</a> seems happy with my <a href="https://github.com/whatnick/python-spidev">efforts</a> so far. It remains to be seen if we can communicate with the energy monitor ASIC's. Contributions are much appreciated.</div>
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://4.bp.blogspot.com/-H8DnRPGIzCE/W_qvhpIajGI/AAAAAAAAiFU/XecNn7zBjA8bm2_yTEsrbCugFLBRGH2fwCKgBGAs/s1600/IMG_20180926_145449.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1200" data-original-width="1600" height="300" src="https://4.bp.blogspot.com/-H8DnRPGIzCE/W_qvhpIajGI/AAAAAAAAiFU/XecNn7zBjA8bm2_yTEsrbCugFLBRGH2fwCKgBGAs/s400/IMG_20180926_145449.jpg" width="400" /></a></div>
<br /></div>
Tisham Dharhttp://www.blogger.com/profile/15154154153085427197noreply@blogger.com0tag:blogger.com,1999:blog-3220006345447041404.post-54604685067499298352018-11-25T03:34:00.000-08:002018-11-25T03:34:00.378-08:00Nairobi AI Saturdays - Book club with Stanford Videos<div dir="ltr" style="text-align: left;" trbidi="on">
Last couple of Saturdays I finally got a chance to do out-of-work activities and I decided to attend the Nairobi <a href="https://www.meetup.com/NairobiAI/events/vdqnkqyxnbkc/">AI Meetups</a> in the IBM offices in the Atrium building. It is a great venue for learning and interacting with people in the community.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://4.bp.blogspot.com/-uTnQfG01h5I/W_qDpmT23rI/AAAAAAAAiFI/EsdYVPA4mUgxE4w2D02RXqnqV6XfJfa_wCLcBGAs/s1600/WhatsApp%2BImage%2B2018-11-17%2Bat%2B22.21.12.jpeg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="960" data-original-width="1280" height="300" src="https://4.bp.blogspot.com/-uTnQfG01h5I/W_qDpmT23rI/AAAAAAAAiFI/EsdYVPA4mUgxE4w2D02RXqnqV6XfJfa_wCLcBGAs/s400/WhatsApp%2BImage%2B2018-11-17%2Bat%2B22.21.12.jpeg" width="400" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
The meetup can sort of be described as a book club for Stanford NLP AI/DL <a href="https://www.youtube.com/watch?v=OQQ-W_63UgQ&list=PL3FW7Lu3i5Jsnh1rnUwq_TcylNr7EkRe6">lectures series</a>. I have encountered 2 possible formats so far, both of them are quite hilarious in execution.</div>
<div class="separator" style="clear: both; text-align: left;">
</div>
<ol style="text-align: left;">
<li>We watch the lecture at x2 or x1.5 speed during the session and have learning and discussions around the topic. This is somewhat limiting since we cannot ask the Stanford lecturer questions. So meetup participants ask each other.</li>
<li>We get one or two of the meetup participant to watch lectures during the week and prepare reformatted slides from the content to present the lecture as a proxy of the Stanford lecturer. While the presenter is standing in for the original, we can ask the proxy questions and clarifications and have more interactive learning. This format is more fun, but requires more prep-work and effort from a couple of people. Increasing the pool of people doing this would be great.</li>
</ol>
<div>
The last set of lectures we watched covered <a href="https://gluon.mxnet.io/chapter09_natural-language-processing/tree-lstm.html">Tree-RNN's</a> and <a href="https://en.wikipedia.org/wiki/Coreference">Co-referene</a> . The tree-RNN's are particularly powerfull in capturing the semantics of prose. The meetup could really use more linguists in the mix to clarify some of the linguistic features NN's can learn, this is a multi-disciplinary field after all. I will see if we can convince people from the <a href="http://linguistics.uonbi.ac.ke/">Nairobi University Department of Linguistics</a> to attend, the lack of recency on their website does not give me much hope.</div>
</div>
Tisham Dharhttp://www.blogger.com/profile/15154154153085427197noreply@blogger.com0Nairobi, Kenya-1.2920659 36.821946199999957-1.5460584000000002 36.499222699999955 -1.0380734 37.144669699999959tag:blogger.com,1999:blog-3220006345447041404.post-91459237203145612232018-11-18T02:38:00.001-08:002018-11-18T02:38:10.392-08:00The Red Light - Competition entry with BeagleBone Green<div dir="ltr" style="text-align: left;" trbidi="on">
<div data-hash="QEe7">
Riding in Adelaide especially during night can
be a hazardous activity. You have to share the road with cars and
pedestrians, staying safe from the former and keeping the latter safe.
Avoiding pedestrians requires vigilance from the cyclists, but the
attention of cars has to be drawn with bright lights. Often due to
circumstances you might need to ride in the middle of the lane or cut
across lanes to make a turn. During the day these activities are
indicated with a hand signal, I made this project to translate those to
bright lights controlled by your motion and muscle activity to obvious
signals during the night.<br />
<br />
<b>NOTE: This is a cross-post from Hackster.io - https://www.hackster.io/whatnick/the-red-light-beaglebone-myo-controlled-bike-lights-6c50d2 </b></div>
<div class="embed-frame">
<div class="figure youtube">
<br />
<br />
<figcaption class="text-center"><b>Various light options tested with data from serial port</b></figcaption><figcaption class="text-center"><br /></figcaption></div>
</div>
<div data-hash="woY3">
The controller used in this project is <a href="https://www.myo.com/">Myo Armband</a> - it contains a 6 DoF IMU and 8 EMG sensors for muscle activity. The controller communicates to the BeagleBone via a <a href="https://www.bluegiga.com/en-US/">BlueGiga BLE dongle</a>, this appears as /dev/ttyACM0 on debian based images. The raw data from the sensors is processed using Scikits Learn and an <a href="http://scikit-learn.org/stable/modules/neighbors.html">NN-classifier</a> to interpret the rider motions. The turn and stop activity is then passed over to a realtime controller (either the <a href="https://trmm.net/Category:LEDscape">BeagleBone's native PRU</a> or an external microcontroller like the Teensy) to drive a <a href="http://www.seeedstudio.com/blog/2014/09/04/first-impression-flexible-led-matrix-ws2812b-8x32-rgb/">WS2812B LED matrix</a>.</div>
<div class="embed-frame">
<div class="figure youtube">
<br />
<br />
<br />
<figcaption class="text-center"><b>Data stream from Myo controlling LED Matrix</b></figcaption><figcaption class="text-center"><br /></figcaption></div>
</div>
<div data-hash="bD7O">
The
BeagleBone Green is modified to add a JST connector to activate the
on-board battery charge management system to use a Lipo for poweing the
bike lights according to <a href="https://www.element14.com/community/community/designcenter/single-board-computers/next-gen_beaglebone/blog/2013/08/10/bbb--rechargeable-on-board-battery-system">this how-to</a>. See the images below for details of this modification.</div>
<div data-hash="NnBO">
<br /></div>
<div data-hash="Ppqj">
The
whole system is wearable and battery powered. The LED matrix is stiched
onto a high-vis jacket, a must for any night time riding and the Myo is
placed around the fore-arm before starting the ride. Here is a video of
the lights in action linked to gestures.</div>
<div class="embed-frame">
<div class="figure youtube">
<br />
<b>Testing gestures and linked lights</b><br />
<iframe allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen="" frameborder="0" height="315" src="https://www.youtube.com/embed/n-IJQBIh1q0" width="560"></iframe>
<br /></div>
</div>
<div data-hash="BOJo">
<b><br /></b>
<b>The Details</b></div>
<div data-hash="QV2L">
<br />
Install git on BeagleBone Green and sync the date using <a href="http://derekmolloy.ie/automatically-setting-the-beaglebone-black-time-using-ntp/">ntpdate</a>. Then checkout my repository.</div>
<div data-hash="OoK5">
<code>git clone <a href="https://github.com/whatnick/myo-raw">https://github.com/whatnick/myo-raw</a> </code></div>
<div data-hash="v1o3">
Plug the Myo Blue Giga receiver in and check that it is recognised</div>
<div data-hash="0q8q">
<code>lsusb</code></div>
<div data-hash="aPyp">
There
should be 3 usb devices. The BeagleBone Green may need to be powered
over USB instead of battery for the USB hub to power up and recognise
the module.</div>
<div data-hash="L4y8">
Install the dependencies for myo-raw.</div>
<div data-hash="Evv6">
<code>sudo pip install -r requirments.txt</code></div>
<div data-hash="d0EX">
The
myo-raw can also be installed under Windows or any other desktop
environment to stream the data from the BBG and display it remotely.</div>
<div data-hash="oym2">
Run
myo_raw_osc with the following command to stream data to remote server,
print locally and send results from EMG sensor to external LED panel
controller (in my case the Teensy, however I am also experimenting with
the PRU's)</div>
<div data-hash="NPMb">
<code>screen -dmS myo python myo_raw_osc.py -v 1 -s 1 -d [x.x.x.x,7110] -c 2</code></div>
<div data-hash="nj20">
This
will output controller codes to the Grove UART port /dev/ttyO2 to the
display driver in sync with arm motion. A bit of looking at the
experimental data and tweaking of the classifier may be needed to get it
set to you movement patterns.</div>
<div data-hash="kJDB">
That's it for the setup on the BeagleBone Green in the non-PRU mode. For the Teensy, clone the git repository as below.</div>
<div data-hash="BL6G">
<code>git clone <a href="https://github.com/whatnick/Beagle_Pixel">https://github.com/whatnick/Beagle_Pixel</a> </code><br />
<br /></div>
<div data-hash="WLeV">
Install the Teensy add-on for the Arduino IDE as described <a href="https://www.pjrc.com/teensy/teensyduino.html">here</a>
and upload the code to the controller. The LED matrix data pin is
connected to pin 2 of the Teensy and the BeagleBone UART is connected to
Hardware UART1. I power the LED matrix from the 3.3V output of the
Teensy rated at 100mA, this allows safely connecting the 3.3 output
signal to this particular matrix. Larger matrices may require buffer
IC's and separate power supply. The BBG 5V system pin is connected to
the VIN pin of the Teensy for power supply off the battery/USB OTB
connected to the BBG.</div>
<div data-hash="ZELd">
That is all for the set-up of this simple but very useful project.</div>
</div>
Tisham Dharhttp://www.blogger.com/profile/15154154153085427197noreply@blogger.com0tag:blogger.com,1999:blog-3220006345447041404.post-62099018495790244372018-11-18T02:26:00.000-08:002018-11-25T05:45:28.329-08:00TPLink Smart Plug Teardown<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
A while ago I remember watching a youtube video from about x10 years ago talking about <a href="https://www.wired.com/story/decentralized-social-networks-sound-great-too-bad-theyll-never-work/">distributed social network</a> platforms running on <a href="https://en.wikipedia.org/wiki/SheevaPlug">SheevaPlugs</a>. Fast forward 10 years, we are still in walled gardens of internet behemoths like Facebook, Twitter and Google and energy monitors are running full-linux os'es in smart plugs (albeit it is mostly <a href="https://docs.onion.io/omega2-docs/cross-compiling.html">OpenWRT/Lede</a>)<br />
<br />
The idea of re-purposing Atheros/Qualcomm router IC's as general purpose linux based controllers is not new. All those pins dedicated for ethernet ports are converted into GPIO's with proper muxing.<br />
<br />
I have been designing one myself to fit in the DIN rail using the Onion Omega 2 as the host processor. There are some <a href="http://community.onion.io/topic/3179/spi-bus-in-python">road-blocks</a> regarding the simplex SPI bus on the Mediatek CPU.<br />
<br />
TPLink seems to have gone the same route and built a smart-plug with and Atheros CPU. Again this blog post is meant to enrich the notes I already brain dumped on twitter.<br />
<br />
<br /></div>
<blockquote class="twitter-tweet" data-lang="en">
<div dir="ltr" lang="en">
Atheros/Qualcomm powered smart plug from TPLink with metering and X2 5A relays in parallel making a switchable 10A socket. <a href="https://t.co/HtYPl3GqRu">pic.twitter.com/HtYPl3GqRu</a></div>
— Tisham Dhar (@whatnick) <a href="https://twitter.com/whatnick/status/1056088383016091654?ref_src=twsrc%5Etfw">October 27, 2018</a></blockquote>
<br />
This module is designed to be a wifi controlled relay with metering, switching upto 10A according to specs. It achieves this by using x2 5A relays in parallel. The main subsystems are:<br />
<br />
<br />
<ol style="text-align: left;">
<li>Power - Analog Devices/Linear Tech power AC-DC power IC. The footprint of this is an interesting variant of SOIC-8.</li>
<li>Metering - This is done by the Maxim <a href="https://datasheets.maximintegrated.com/en/ds/MAX71020A.pdf">MAX71020A</a> IC. Every electronics manufacturer worth its salt is creating metering ASIC's these days and I am excited about opportunities in making break-out boards and comparisons. TPLink seems to have bought up all the inventory of this particular Maxim IC and Maxim has a history of discontinuing low-margin lines the like <a href="https://www.eetimes.com/document.asp?doc_id=1325430">MEMS accelerometers</a>. I will keep an eye of the Poly-phase version which seems to be still in production (<a href="https://www.maximintegrated.com/en/products/microcontrollers/MAXQ3180.html">MAXQ3180</a>). Overall this does not look good for the future of this particular smart-plug.</li>
<li>Relays - x2 chunky 5v - 5A relays adorn the metering and CPU board. These provide the main functionality of the smart plug.</li>
<li>Atheros/Qualcomm processor - This is the smarts in this smart-plug. Running standard open-wrt. The Maxim IC is of course on the SPI bus and other GPIO's are driving LED's , relays etc.</li>
</ol>
<div>
Overall the lack of supply of the Maxim IC does not bode well for the future of this Smart-plug. It may find fun alternative uses as an always on linux node.</div>
<script async="" charset="utf-8" src="https://platform.twitter.com/widgets.js"></script>
</div>
Tisham Dharhttp://www.blogger.com/profile/15154154153085427197noreply@blogger.com0tag:blogger.com,1999:blog-3220006345447041404.post-16489668788427151272018-11-18T00:59:00.000-08:002018-11-18T00:59:03.929-08:00Another Energy Monitor - Neur.io Teardown<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
Looking at other energy-monitor designs has been a past-time of mine and I recently the chance to teardown a Neur.io energy monitor installed along with many Tesla power-walls in Australia. This one had had some feedback of high voltage over the modbus and had fried itself. Despite best intentions with TVS suppressors etc. it could not take it anymore.<br />
<br />
In this blog post I will enrich some of the content I already posted on twitter with some more in-sights in energy monitoring and additional elements regarding current clamps.<br />
<br /></div>
<blockquote class="twitter-tweet" data-lang="en">
<div dir="ltr" lang="en">
I am taking too long to put together a <a href="https://t.co/GWrOnHglPe">https://t.co/GWrOnHglPe</a> Tesla energy meter teardown. So I will do a Twitter thread. Proper blogpost soon. <a href="https://t.co/2o8T4nRLGm">pic.twitter.com/2o8T4nRLGm</a></div>
— Tisham Dhar (@whatnick) <a href="https://twitter.com/whatnick/status/1053795882905128960?ref_src=twsrc%5Etfw">October 20, 2018</a></blockquote>
This is the proper blogpost alluded to in the twitter thread. All the image content is already in the thread. Blogs simply allow greater structure. The meter is essentially composed of:<br />
<br />
<br />
<ol style="text-align: left;">
<li>Current samplers with 1ohm burden resisors attached to CT's - Neur.io recently announced a flexible <a href="https://www.neur.io/energy-monitor/">CT design</a> which can make it easy to install and potentially universal in measuring AC currents via induction and DC currents via <a href="http://engineerexperiences.com/using-hall-sensor.html">hall-effect</a>. I dropped an multi-meter probe on the burden resistors just to check.</li>
<li>Voltage samplers as tiny encapsulated isolation transformers - This approach can introduce some non-linearity due to hysteresis and phase-shifts in the transformer, transformers are also bulky. Since the transformer is under no-load, phase-shifts should be minimal. The advantage is built in LV isolation. There is a bank of x3 transformers to account for x3 phases.</li>
<li>Energy monitor IC's - These are from Cirrus Logic (<a href="https://www.cirrus.com/products/cs5467/">CS5467</a>), the documentation says the IC is mainly for the Japanese market. Neur.io seems to be successfully using it in North American and Australian market.</li>
<li>Main processor and wifi - Unfortunately the unit I had was going back to Tesla under RMA, so I did not have chance to take of the shield and probe the processor. However I would love some assistance in poking in there and exploring the possibilities of custom firmwares.</li>
<li>Modbus - The meter has a modbus I/O port to communicate with other systems e.g. Inverter and Battery charge controller.</li>
<li>Power Systems - This is a Recom SMPS (<a href="https://au.mouser.com/ProductDetail/RECOM-Power/RAC02-05SC?qs=waQl70lBfV1MnWsVncjcQQ%3D%3D">RAC05-02SC</a>) module keeping with my idea of keeping custom subsystems as limited as possible and reusing tested components as much as possible. I have seen a lot of energy monitors include their own power sub-systems including the <a href="http://whatnicklife.blogspot.com/2017/12/sense-energy-monitor-teardown-sampling.html">Sense</a> and <a href="http://whatnicklife.blogspot.com/2017/06/3g-energy-monitor-wattwatchers-teardown.html">WattWatchers</a>. This increases design complexity with perhaps marginal improvements in design flexibility and BOM costs. The module outputs 3W at 5V, giving some head-room for LDO/Cap based noise filtering.</li>
</ol>
<div>
I have come to learn that DIN rails are not that popular in the North American market compared to the European and Australian market. Hence the overall brick packaging of the Sense and the Neur.io meters. Keeping the DIN form-factor requires a lot of combined mechanical and electronics design work as I have found out the hard-way. It is currently in my pipeline to create break-out boards for the CS5467 and test them out with common micro-controllers.</div>
<br />
<script async="" charset="utf-8" src="https://platform.twitter.com/widgets.js"></script>
</div>
Tisham Dharhttp://www.blogger.com/profile/15154154153085427197noreply@blogger.com0tag:blogger.com,1999:blog-3220006345447041404.post-15838971773889625492018-09-16T03:30:00.002-07:002018-09-16T17:05:02.397-07:00PyconAU 2018 - Keep Notes<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: inherit;"><span style="font-family: inherit;"><span style="font-size: small;"><span style="font-family: "arial" , "helvetica" , sans-serif;"><span style="font-family: "arial" , "helvetica" , sans-serif;">This is a raw dump of notes I took on keep while attending PyconAU. Each to be fully expanded to an article on its own. Suitably redacted to keep my intrusive thoughts to myself. </span></span></span></span></span><br />
<br />
<span style="font-family: inherit;">Documentation and Technical Writing</span><br />
<ul>
<li><span style="font-family: inherit;">Persuasive, Referential, Literary, Expressive. Writing pull requests. Foucault on discourse.</span></li>
<li><span style="font-family: inherit;">Think goals, Think audience, Write (structure, conventions). Active vs Passive (active is shorter). Bullets.</span></li>
<li><span style="font-family: inherit;">Plain English, easy words. Edit. Find good writing.</span></li>
</ul>
<span style="font-family: inherit;">API Design</span><br />
<ul>
<li><span style="font-family: inherit;">Forestry Data. User interface for developers. Access control , pagination. API versioning. Break in controlled fashion. Deprecation schedule.</span></li>
<li><span style="font-family: inherit;">Accept versioning header. URL Path versions. Less emotional versions. Small changes version transformer. Django middleware.</span></li>
<li><span style="font-family: inherit;">Auth- Token. OAuth.</span></li>
<li><span style="font-family: inherit;">Standardized (familiarity, avoid pitfalls, standards win) - <a href="http://jsonapi.org/">jsonapi.org</a> (next,.previous), graphql, Basecamp. Swagger.</span></li>
<li><span style="font-family: inherit;">Larger data sets out of band</span></li>
<li><span style="font-family: inherit;">Documentation. Selling page. Dev account, demo key, root url. Encodings, formats</span></li>
<li><span style="font-family: inherit;">OpenAPI, Swagger, tools, docs/code, reduce friction, automation.</span></li>
</ul>
<span style="font-family: inherit;">Working with Spatial data in Python</span><br />
<ul>
<li><span style="font-family: inherit;">Routing. Isochrones, Latte line.</span></li>
<li><span style="font-family: inherit;">Db spatial extension. Point in polygon.</span></li>
<li><span style="font-family: inherit;">Basemaps, JS library.</span></li>
<li><span style="font-family: inherit;">Geomesa.</span></li>
</ul>
<span style="font-family: inherit;">Multi-lingual Python</span><br />
<ul>
<li><span style="font-family: inherit;">i18n, l10n, language_code, locale, po (files translation). Language session choice flow. Url-conf.</span></li>
<li><span style="font-family: inherit;">trans and trans block tag. Every file must have the i18n tag. Use lazy in <a href="http://models.py/">models.py</a>.</span></li>
<li><span style="font-family: inherit;">makemessages in all depencies. Zh_cn.</span></li>
<li><span style="font-family: inherit;">Model fields to enter data. Keep tables in _zh_cn. Transifix.</span></li>
</ul>
<span style="font-family: inherit;">Web without Javascript</span><br />
<ul>
<li><span style="font-family: inherit;">Intercooler.js. CSOF… use web 1.0 submissions in a 2.0 way.</span></li>
<li><span style="font-family: inherit;">Large data. Out of-band.</span></li>
</ul>
<span style="font-family: inherit;">Database optimization</span><br />
<ul>
<li><span style="font-family: inherit;">Write amplification. Partial index. Hash, GIN(generalised inverse index) , BRIN (min/max)</span></li>
</ul>
<span style="font-family: inherit;">Design for non-designers</span><br />
<ul>
<li><span style="font-family: inherit;">Choose few fronts. Use different spacing. Curated fonts. Beautiful Web Type. <a href="http://fontpair.co/">Fontpair.co</a> . Google Fonts. Making things clean (whitespace). Data analytics. Less is more. Unsplash, Photopin, Fiverr. Importance of imitation.</span></li>
</ul>
<span style="font-family: inherit;">Designing environments with Docker</span><br />
<ul>
<li><span style="font-family: inherit;">Front end builder. Task queue/Celery. Postgres. Docker compose .</span></li>
</ul>
<span style="font-family: inherit;">Hypothesis to replace auto-manual tests</span><br />
<ul>
<li><span style="font-family: inherit;">Hypothesis for testing by schema. Always true unless there is a bug. Fuzz the code with variety of input. Faker. Django integration push model and clean up. Quick check.</span></li>
<li><span style="font-family: inherit;">Generators.</span></li>
<li><span style="font-family: inherit;">Use lib2to3 parse through Python code and refactor / reformat. Bowler, safe refactoring for Python. Reuse refactoring code.</span></li>
</ul>
<span style="font-family: inherit;">Tom Eastman - Keynote</span><br />
<ul>
<li><span style="font-family: inherit;">koordinates, geospatial data. Effective learning for programmers. Effortful retrieval.</span></li>
<li><span style="font-family: inherit;">Fixed vs Growth mindset.</span></li>
</ul>
<span style="font-family: inherit;">Lightning talks</span><br />
<ul>
<li><span style="font-family: inherit;">DRF model pusher. Ably, Django Channels.</span></li>
<li><span style="font-family: inherit;">Claire Krause, GA satellite imagery analysis</span></li>
<li><span style="font-family: inherit;">Wrapt, allows introspection of wrapped functions. Context manager.</span></li>
</ul>
<span style="font-family: inherit;">Many Python Web Frameworks</span><br />
<ul>
<li><span style="font-family: inherit;">Cherrypy, Class based views. Falcon API first framework , fast, returns json for microservices. Hug with syntactic sugar. CCBV. Tornado, Async. Sanic.</span></li>
</ul>
<span style="font-family: inherit;">Women in Python</span><br />
<ul>
<li><span style="font-family: inherit;">Jason Fagon.</span></li>
<li><span style="font-family: inherit;">Katherine Johnson.</span></li>
<li><span style="font-family: inherit;">Carol Willing (Jupyter)</span></li>
</ul>
<span style="font-family: inherit;">Celery and alternatives</span><br />
<ul>
<li><span style="font-family: inherit;">Celery message formats, task chaining. Disable pre-fetch, long running. Own task queue. RQ (redis queue). Huey. TaskTiger(distributed locking). Dask (pydata), scheduler distributes pandas and numpy dataframes. Task chaining, celery import chain. RQ failed queue.</span></li>
</ul>
<span style="font-family: inherit;">Trouble with sensor data</span><br />
<ul>
<li><span style="font-family: inherit;">Kafka stream processing. React and <a href="http://socket.io/">Socket.io</a>. HTML5 gyroscope API.</span></li>
</ul>
<span style="font-family: inherit;">Pub conversations</span><br />
<ul>
<li><span style="font-family: inherit;">RNN (<a href="http://fast.ai/">Fast.ai</a>), pre-trained model zoo.</span></li>
</ul>
</div>
Tisham Dharhttp://www.blogger.com/profile/15154154153085427197noreply@blogger.com0tag:blogger.com,1999:blog-3220006345447041404.post-1714475617266269332018-08-29T07:56:00.001-07:002018-08-29T08:21:33.207-07:00Using AWS Athena in Anger<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr">
The journey down this particular rabbit hole started with this challenge "Create Read-replicas for MSSQL 2017 database hosted in RDS". Hosting services on AWS typically reduces IT load and makes focus on product development easier, however there are certain edge cases where AWS falls down and requires special intervention.</div>
<div dir="ltr">
<br /></div>
<div dir="ltr">
The above challenge turned out to be one of them. RDS supports seamless <a href="https://aws.amazon.com/rds/details/read-replicas/">read-replicas</a> on a lot of other types of databases , however MSSQL is not one of them. The recommended approach for creating read-replicas for MSSQL is to enable CDC and do so using DMS (Database Migration Service). This is similar to what the RDS does internally for multi-AZ redundancy. We hit another edge-case here, DMS replication support with CDC does not extend to the <a href="https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Source.SQLServer.html">2017 version</a>.</div>
<div dir="ltr">
<br /></div>
<div dir="ltr">
We did manage to run DMS successfully from MSSQL 2017 to S3 as sort of a disaster recovery measure. Then I was stuck with the conundrum of what to do with the CSV table dumps this got me, at the <a href="https://aws.amazon.com/summits/cape-town/">AWS Summit in Cape Town</a> one of the solution specialists introduced me to Athena and the adventure began.</div>
<div dir="ltr">
<br /></div>
<div dir="ltr">
Athena is essentially a managed Apache Hive based map-reduce setup which can churn through webserver logs or in this case CSV's to give me back the database I was replicating. The replica is not perfect, it is missing stored procedures and views. These need to be redone in HiveQL.</div>
<div dir="ltr">
<br /></div>
<div dir="ltr">
All tables can be mapped using corresponding schema and DDL to Athena tables, thus replicating fully the database without foreign keys and other niceties. AWS now has <a href="https://aws.amazon.com/blogs/aws/new-cross-region-replication-for-amazon-s3/">cross region S3 replication</a> , this coupled with Athena can give a very Rube-Goldberg cross-region database replication.</div>
<div dir="ltr">
<br /></div>
<div dir="ltr">
Athena is also particularly useful with scrapers where data is being collected from 3rd-party sites and consolidated into S3 tables. It can seamlessly blast through millions of rows of scraped data for goodies in seconds.<br />
<br />
This post is a WIP and will be enriched with Athena goodies over time.</div>
</div>
Tisham Dharhttp://www.blogger.com/profile/15154154153085427197noreply@blogger.com0tag:blogger.com,1999:blog-3220006345447041404.post-16132457332422780092018-07-15T22:39:00.000-07:002018-07-15T22:39:28.229-07:00Preserving pins, auto-transmit RS485 with Lora32_Wifi<div dir="ltr" style="text-align: left;" trbidi="on">
This is a story of the always helpful NE555 (in this case its 3.3v cousin the TLC555). I have been designing more and more complex DIN rail energy monitors. The last one is 3-unit DIN rail oeuvre with the following features:<br />
<ul style="text-align: left;">
<li>Lora, Wifi and Bluetooth thanks to <a href="http://www.heltec.cn/project/wifi-lora-32/?lang=en">Lora32_Wifi</a>. </li>
<li>128x64 SSD1306 Oled screen</li>
<li>Three ATM90E36 3-phase energy monitor IC's</li>
<li>3.3V differential line driver for <a href="http://www.ti.com/product/sn75hvd12">RS485 bus driver</a>. </li>
<li>Some GPIO's for triggering relays or receiving inputs.</li>
</ul>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://3.bp.blogspot.com/-aJLfPvl9Uv8/Wu_Ho6n-EAI/AAAAAAAAd_4/cHNL4YmmM9ssxiVcV12fws5qrCQXiGOpwCLcBGAs/s1600/ne555_RTS.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="562" data-original-width="654" height="274" src="https://3.bp.blogspot.com/-aJLfPvl9Uv8/Wu_Ho6n-EAI/AAAAAAAAd_4/cHNL4YmmM9ssxiVcV12fws5qrCQXiGOpwCLcBGAs/s320/ne555_RTS.jpg" width="320" /></a></div>
With all these features consuming pins on the ESP32 module I eventually ran out of pins to attach to the RTS line for the RS485 line driver. I could have added many more pins by using an <a href="http://www.ti.com/paramsearch/docs/parametricsearch.tsp?family=analog&familyId=1649&uiTemplateId=NODE_STRY_PGE_T&familyAliasId=1201649#">I2C ioexpander</a> and solved my issues, however the RS485 bus on this thing is half-duplex, so there is a much easier way to do this which does not involve any code. <br />
<ul style="text-align: left;">
</ul>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://3.bp.blogspot.com/-9TVc45OR8UI/Wu_Hi5FGOgI/AAAAAAAAd_0/JzWNZTp1VCsTTXO8DPJD7i0iC3V4HvzWQCKgBGAs/s1600/IMG_20180418_001004.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1200" data-original-width="1600" height="240" src="https://3.bp.blogspot.com/-9TVc45OR8UI/Wu_Hi5FGOgI/AAAAAAAAd_0/JzWNZTp1VCsTTXO8DPJD7i0iC3V4HvzWQCKgBGAs/s320/IMG_20180418_001004.jpg" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
The trick is to use the NE555 in one shot mode, trigger it for a transmit, then let it fall-back to receive after a set period of time. The NE555 is useful in so many ways.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://3.bp.blogspot.com/-qnlyxziDX8I/Wu_Hi3wjtAI/AAAAAAAAd_0/ngOF5Ja9Fa4r51TUM6n1j8TcS8TwSM1gACKgBGAs/s1600/IMG_20180427_195820.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1600" data-original-width="1200" height="320" src="https://3.bp.blogspot.com/-qnlyxziDX8I/Wu_Hi3wjtAI/AAAAAAAAd_0/ngOF5Ja9Fa4r51TUM6n1j8TcS8TwSM1gACKgBGAs/s320/IMG_20180427_195820.jpg" width="240" /></a></div>
<br /></div>
Tisham Dharhttp://www.blogger.com/profile/15154154153085427197noreply@blogger.com0