traveling at the speed of open-source

pull request:  An external-repository modification to someone else’s code which you’d like them to adopt into the master copy of the original repository, specifically the notification request to ask for this.

It’s funny, I put in a pull request in March of this year for a timezone calculation bug which I’d discovered somewhere out there in someone else’s code.  I guess I was trying to be a good net citizen and giving back to the community.  I’d forgotten completely about it until now.  The original author merged my commit into his code yesterday and blessed it, basically.  This would actually be my very first pull request in the world of open source so I suppose that’s special in some way.

In this particular case, it took the author almost three months to see the request and get around to responding to it.  Granted, few of us would be paid to maintain our open-source repositories so they’re usually just considered hobbies for most of us, something we do in our spare time.

As a coder with many decades of experience, this pacing is a bit odd to me.  (As in, “wow, three months to bless a quick-and-dirty code fix”.)

I’m not complaining…  Okay, maybe I’m complaining.  Maybe I was just a bit naive to the average amount of effort people are putting into this.

The entire collective force of open-source is something to behold.  Almost every day some huge effort is being launched and thousands—even millions—of downloads occur from these repositories.  But what happens to the original codebase when the author gets side-tracked with their next great idea?

But what happens to the original codebase when the author gets side-tracked with their next great idea?

The New, New Thing

All this reminds me of the biographical book “The New, New Thing” about a serial-entrepreneur, Jim Clark (of Netscape fame).  The biography doesn’t really paint a pretty picture of the billionaire, instead suggesting that he was perhaps suffering from Attention Deficit Hyperactivity Disorder (ADD) or possibly Hypomania.  He couldn’t focus on a project after the second year, opting to push the work onto others and move to the next project.

I guess I have to ask what part this plays in the world of open-source software.  As an inventive person, I stare at my To-Do list of project ideas and realize that it could be argued that this is some mark of my own internal restlessness.  Could I be content working on one project for year after year?

I’m a former CEO and at one time I did run a software development firm for nine years.  Fortunately, though, I had project after project then to develop so that kept things lively. I’m impressed by those who literally spent most of their lifetime devoted to a single project.

A Lifetime of Service

Dr. Royal Rife comes to mind as one of these people.  He was curing cancer and a variety of diseases back in the 1930 decade but he spent much of his life before this inventing the microscopes and medical device equipment which he would use in the culmination of his life’s achievement.  His original home site is now the location of one of the Scripps hospitals here in San Diego but seemingly nobody knows his story.  He spent a lifetime curing cancer and he isn’t famous for it.

I guess we as a society aren’t really conditioned to reward and remember someone who did one thing very well.  To be famous or respected now, presumably you have to produce project after project, never satisfied with the maintenance of same, always chasing the next big thing.

If You Build It, Own It

I guess my word of caution in the world of open-source then is to own what you’ve built.  Try to revisit it from time to time, like you might keep a plant alive by watering it once in a while.  Do new things, of course.  But don’t forget that your last thing could actually be ticket to your success.

taking the bite out of stamps.com

Stamps.com offers an online service in which you can digitally apply postage to an envelope.  They even include a nifty/free digital scale to attach to your computer.

StampsDotComScale

The problem of course is that in order to make back the cost of that “free” device, Stamps.com wants to charge you on a monthly basis to use this service and most people decide that it’s not worth those charges.  I often see these sitting idly on someone’s desk and it’s only useful for measuring the weight of something.  Without their service, you’d then need to manually lookup the postage and then count the right number and types of stamps.

I’ve written a Windows program which will do all that for you, weighing the envelope, calculating the postage and letting you know how many stamps of which kind to put on it.

Postage

Here is the new repository on github.com.  You can run it directly or build the program yourself if you have a copy of  Visual Studio, to include the free Community version.  Your computer will need the .NET Framework 4.5.2, for what it’s worth.

autodesk fusion 360

The new Robo C2 comes with a one-year trial of CAD software which appears to be none other than the probably-expensive Autodesk Fusion 360.  It looks like it allows you to design a part, engineer & simulate forces as well as to create tool paths (slice) a part for 3D printing, for example.  I’ve been attempting to use the open-sourced FreeCAD but the learning curve has been slow for me and I’ve run into some Mac-related bugs when attempting to create a screw thread, unfortunately.  So I hope to give this trial software some of my attention to see if I can design some parts.

AutodeskFusion360

First Thoughts

Wow.  It’s just a beautiful interface.  It starts things up with a clean working space set in a useful 3D perspective.

Because of the barren space they’re trying to create, Autodesk has pushed the typical  File -> Open commands off into a hidden panel.  It’s that tic-tac-toe menu icon in the upper left.  Opening this, I’m guessing that there is some kind of change control software running since they have indicators for “master” (branch), View Project History, Branch / Merge Options, Upload files from your desktop.  So perhaps they store all your files in a cloud-based repository, if I’m guessing correctly.  Additionally, there is built-in support for team members.

From what I’m seeing, there are no example files typical of a design program.  Still within the Data Panel, pressing what I thought was a “back” triangle, I’m now seeing a different collection of options:  My Recent Data, Demo Project, My First Project and then under Samples, Basic Training, CAM Samples, Design Samples, Simulation Samples and finally, Workshops & Events.  So I was wrong in suggesting that there are no samples, they’re just an Easter Egg within the interface.  Double-clicking Design Samples includes three very-sexy designs:  bike frame, lamp and utility knife.  I’m bringing in the lamp.

Viewing a Part

It takes a bit to learn Autodesk’s methods of changing viewpoint but I think I’ve got it.  By interacting with that cube in the upper-right corner, this is how you can quickly move around your part.  Note that clicking the little home symbol returns to the original perspective.  Click a labelled face of the cube, go to that perspective.  Grab and move the corner of the cube and you have the usual behavior in most 3D programs when you grab-and-move the part itself.  It feels like they only want you to click on the part when doing a selection process, so that’s probably a good idea to separate the two activities.

LampPerspective

Selecting Something (a Sketch) to Modify

Looks like their basic building block is a Sketch (a 2D drawing) so when I click on the top of the lamp’s base, this sketch is selected.  Now that it’s highlighted, I’m clicking the Modify icon in the Toolbar.

Modify

Attempting to do a Physical Material replace didn’t seem to work for me.  The method appears to be to click on the top of the base, then shift-click each of the other two parts, then right-click to bring up a contextual menu, choosing Appearance from there.  I then changed the material to a gray aluminum.

Aluminum

A mere ten minutes into it and without reverting to Google searches for answers, I’ve managed to do something in here.  That’s seriously better than my results from FreeCAD.

Price

Okay, so I just had to know how much this would cost me after the trial period.  It’s $40/month as a month-to-month subscription or $25/month if paid up-front annually ($300/year).  That’s probably worth it if you do this for a living.  Is it worth it for a standard hobbyist/maker?  That’s a tough call.  You usually end up spending your money on the hardware and consumables, to be honest.

I think Autodesk needs a notch in their software for the new world of amateurs who need to design parts.  Certainly, their three-year trial for students is awesome but that doesn’t help the rest of us who aren’t commercial.

Overall Thoughts

I guess I’ll need to go into crunch mode this year and to produce most of the 3D designs that I had in mind.  But I will circle back after one project and see if it exports nicely for other (free) softwares out there.  Otherwise, you’d be stuck in Autodesk’s business model and that sounds a bit expensive in the long haul.

robotics and you

I’ve kind of gotten into a robotics kick lately while looking for cool projects and thought I’d share some of the information with you.  We can probably thank Fab Lab for the motivation since I stopped by there recently for a visit.

I think I’d like to make a remote-control tank with an additional autonomous mode in which it drives itself.  I’d probably put a webcam on there, sensors… not sure, really.

I’m thinking that the closed ecosystem could use a shrimp pellet (food) dispensing system.  I do worry though that one of the shrimp is getting bigger and more of a bully around feeding time, for what it’s worth.  <_<

I’ve also been thinking about a re-breathing device which recaptures the moisture lost when hiking in the desert.  I’m guessing that some sort of breather like scuba gear could additionally inject moisture into the incoming air in such a way that the hiker doesn’t suffer the effects of dehydration.  Unlike the stillsuit of the Dune movie fame for recapturing sweat, I’d suggest that most water is lost by someone in the desert due to the humidity of the air we’re breathing out.  As each new dry breath is taken in, this normally is a very effective means of drying someone to their death, if you think about it. So this invention would presumably avoid this normal loss by trying to recapture that moisture or merely to insert back what is normally lost in the process.  I’m thinking that a system like this might introduce enough water through the bloodstream via the lungs that drinking wouldn’t even be necessary.  Taking this another step, what if you could introduce sugars and nutrients into the mist?  If you google “parenteral nutrition” you can see that someone can be fed intravenously through an IV.  You’d have to balance pH, osmolarity and lipid content of the “food” (glucose, protein and lipids) to make this work and it would need to be sterile.  Something to think about…

So, another trip to Frye’s.  Here’s what I snagged, along with some follow-up research.

OSEPP

There’s an awesome company named OSEPP which makes Arduino-compatible robotic parts, accessories and even kits.  Frye’s Electronics appears to be carrying some of their stuff now which is good if—like me—you don’t enjoy having things shipped from somewhere else.

I just picked up their Tank Mechanical Kit as well as a Motor & Servo Shield and a Motor Driver Module.  I’ve put the tank together and it looks wonderfully sturdy since it’s made out of aluminum for the most part.  Even though it was intended for the Arduino, I’ll drive it with a Raspberry Pi Zero W, probably.  I also got a Joystick Module which I’ll use on a remote, likely a Raspberry Pi 3 in this case.

Tank MotorServoShield MotorDriver Joystick

Actobotics

Frye’s also carries a number of parts by Actobotics which appears to be made by RobotZone (Servocity’s parent company).  They’re likely behind the system of aluminum plates with overlapping hole design often seen throughout these projects.

The demonstration photo on their website was really too big to put here but you can see it if you click this.  So they reasonably have you covered if you’re trying to build anything.  I’m thinking that it must be fun to work there.  I just picked up their 0.1227″ Pitch Plastic Chain for some future project.

Chain

Servocity

Another great company within this space is Servocity.  This company has some seriously heavy-duty linear servo motors.  Someday I’d love to build an exoskeleton robotics project and these would be the servos for that job.  rawr!

Much of what’s being done now in the robotics area involves extruded aluminum channels, beams, plates, brackets and some very polished mounts, clamps and what-have-you.

the robo 3d c2 printer

For months now, I’ve been wanting a 3D printer to create plastic parts and I’m guessing that I just made the best choice by buying the Robo C2.

robo

First Impressions

First of all, it’s an attractive printer in the same way that EVE (from the WALL•E cartoon) was cute.  Perhaps you can see the resemblance?

eve

Second—and you guys should know by now how I love them—this printer is driven by a Raspberry Pi 3 computer inside!  I hope to clone the microSD card in that computer and go to school on their efforts to hack an even better printer out of it.

Third, the product is open-sourced and crowd-funded.

Fourth, they’re a local company.  Their office is maybe a 20-minute drive from where I live in San Diego.  Given that most people would have to purchase this online and have it shipped, they wouldn’t get to see it in action like I just did.

Fifth, it includes an iOS app which allows you to control this and any other Octoprint-enabled printer.

Sixth, at 20 microns, it looks to have the best resolution of any of the printers I saw at Frye’s Electronics and most of those had a price tag above $1400 to reach the 50 micron resolution level.

Finally, it looks like it comes with a one-year license for Autodesk Fusion 360 which appears to be a very nice program for designing.

Research and Past Experience

I spent a fair amount of time before purchasing this by researching 3D printing, the types of plastics, the pitfalls to overcome, etc.

This particular printer doesn’t have a heated bed (the place where the project is made) so it may not do a great job with ABS plastic without a lot of trickery.  The standard voodoo that is necessary is to get inventive with the bed covering so that the project adheres nicely, doesn’t skip around and further, doesn’t warp due to uneven heating.

So for an unheated bed, the PLA type of plastic is the suggestion here and I’ve purchased an additional two rolls of the stuff to get things started.

Interestingly-enough, a few years ago I worked in a large plastic manufacturing plant so I have a little experience making plastic of the rotomolded variety.

caveman

In this industrial-sized version, colorized plastic powder is measured and put into aluminum molds on a steel frame wheel.  And this wheel then is inserted into a very large 700°F oven.

But for the consumer variety, you spend most of your time in a computer-aided design program, send a job to the printer and then wait hours (usually) to see how it turned out.  This ought to be interesting.

Projects

I have a few projects in mind for this.  I snagged a Robo Drone Kit while I was at Frye’s to give me a project which should produce some reasonable results.

dronekit

I hope to design and print an enclosure for the e=mc2 project from earlier.  Although it’s difficult, I hope to make this a clear enclosure ultimately.

I’d like to work up a design for a heated bed for the Robo C2 since it sounds like this would make ABS-related print jobs more successful.  I think I’d also like to test new bed materials since the field of 3D printing is still new and inventiveness is required here.

Given that the Robo C2 has a Raspberry Pi computer inside with OctoPi software running on it, I should be able to modify the design, add things onto the printer and do notifications, for example.  I could add an internal webcam to it, for example.

And then finally, I think I’ll spend some time on post-print finishing techniques to see what I can do in this area.

Results

Here’s the first printout from the Robo C2 after some upgrades and dialing in that critical z-adjustment.  Obviously, it’s a money clip.  It’s light blue but the red background makes it look gray otherwise.  It’s very smooth for a 3D-printed project and amazingly so for the $699 price tag on the printer.  The small, flat piece is called a “raft” and is meant to make things stable during printing, btw.

to type or not to type…

that is the question.  Rather than a Shakespeare reference, I’m here referring to a term in software development which determines how a language deals with variables, for example.

Define: type

When you create a variable in a computer language, it’s usually something like this:

var someVarName = 1;

In a case like this, we might infer that someVarName stores a number (an integer).  We might say that the someVarName‘s type is integer.  Using a pet-ownership metaphor, it’s like purchasing a dog house first (“someVarName”) and then next buying a dog to put into it (“1”).  You wouldn’t buy a fish bowl to store a dog… although this seems to work out great if you own a cat.  JavaScript, e.g., is like this picture:  it doesn’t seemingly care if you want to store a cat in a fish bowl.

cat-in-a-bowl

Two Schools of Thought

There are two camps out there:  those who like languages which force the variable type and those who don’t.

A statically-typed language usually involves a step in which your code is converted into something else (compiling) and any type-related issues must be fixed before a program can be created.

A dynamically-typed language is run “as is” and the code is evaluated at the moment of truth—determinations about the type of a variable are made at this time.  If there is a type-related issue, your end-user could be the first person to see the error.

Statically-Typed Dynamically-Typed
Java JavaScript
C++ Python
C# PHP
C Objective-C

The Pendulum Swings

Over the past three decades, the popularity of either approach has waxed and waned.  It’s safe to suggest for the moment that the less-strict languages are gaining rapidly in popularity over their stricter counterparts.

most-popular

We have the world of open source to thank for the popularity and speed of development we’re currently seeing in these dynamically-typed languages like JavaScript and Python.

Seeing the Future

Honestly, though, there are too many people in that strict-is-better camp and their influence is felt within software development companies.  If I were to guess at the future of JavaScript, I’d probably have to say that TypeScript and Flow will gain in popularity as larger development teams look to lower the number of bugs in their code.

I don’t know, though.  Maybe it’s time that we just relax and let the cat hang out in the fish bowl.

 

the power of seo

Everyone wants to sell you search engine optimization (SEO) as a service.  I’m sure there’s good money in doing that but I’ve never paid anyone for this since it’s easy enough to do yourself.  The higher you are in a Google search result, the more likely that you’ll be seen.  And the more likely you’re seen, the more likely your blog will be read.

“Roll Your Own” SEO

Believe it or not, one of my most popular blog posts of all time is “why PowerShell sucks so badly”, enjoying 743 views so far (mostly from searches in Google).  Viewing this graph, clearly something changed between Jul & Aug of 2016.

powershell-sucks

The views for this blog post were all 100% organic (unaffected by anyone’s attempts to manipulate search engine placement) before August 2016.  If you typed in “powershell sucks” into Google before this time you would have had to search page after page within their results to find any mention of my blog.

August 2016

Somewhere during that month, I noticed the popularity of this particular blog post and wanted to do an experiment.  Up until this point there might have been a total of 50 views, making it one of my most popular posts at the time.

Daily, for about a week, I visited Google and typed in “powershell sucks”, then walked through the pages of results until I found the link to my own post.  I then clicked the link and parked that browser.  (It’s important to just appear as if you’re actually reading the content because Google’s JavaScript is tracking your behavior.)

It’s only necessary to do this once per day, to be honest.  It doesn’t take much to make an otherwise-obscure blog post gain in popularity in the “eyes” of Google’s search engine.

I repeated this behavior until the blog post was listed in the top five entries of the first page of results and then let nature take its course.

The Result

Of course, the Internet loves to complain.  From this point on, the Internet-at-large would then see the blurb in Google’s search results and offer to them the promise of a rant by some distant blogger (Yours Truly).  They clicked the link, landed on the page and were instantly rewarded by a smarmy commentary on my frustrations with PowerShell.

Once this “pump” was primed by my own efforts, it was unnecessary to do anything other than to continue to write content.  Well, at least, I write content which I myself would be interested in reading.

Have I learned anything from all this?  The Internet appears to love a post whose title resonates with something they’re feeling at the moment.  For comparitive purposes, I demonstrate that “too much fun” received three views and “windows 10 sucks balls” has about 120 so far.

Do you change your blogging style to accommodate the prevailing mood of the Internet?  I wouldn’t suggest that.  Just write.  Try to find something interesting and say what you need to say.

windows-10-sucks

too-much-fun

the rise and fall of the microsoft empire

1975-1980

Our historical timeline begins in 1975 when an unlikely duo—Paul Allen as Batman and Bill Gates as his awkward “Boy Wonder”—started Microsoft Corporation.  I’m guessing that ro-sham-bo was involved in this decision but incredibly somehow Bill was made the CEO when the company got its start.  Maybe dropping out of Harvard gives you that kind of confidence.

1981BillPaul

1981-2000

Nothing really significant happened until they managed to modify an existing operating system for the IBM PC in 1981 from another company and rename this to MS-DOS. Significant sales of the IBM series of computers and those of their competitors then launched a thirty-year stretch of dominance in the business world in the area of operating systems, software and development platforms.

For most of us, we reasonably dismissed Apple’s hardware and the MacIntosh operating systems as nothing we could seriously use in business outside of the marketing department.

Consumers bought new versions of software and that license was good for life.  It could often be transferred from one computer to the next as long as the last one was de-registered first.  If you built software for Windows, you likely used a Microsoft compiler to do so and you paid for that.  In fact, the Microsoft Technet collection of CDs was quite expensive.

2001

About six years into the “Internet Tidal Wave” as Bill would call it, Microsoft was starting to lose its way.  They tried to dominate in the browser wars but never quite managed to quash the competition.  Others saw their efforts in this area as annoying.  Their software for creating programs, Visual Studio, first hit the scene about four years prior to this.

Google was founded some five years prior and was just beginning to get attention from an investor before they had anything real yet.  In 1999 they moved from their garage to an actual building in Palo Alto.  Yahoo’s popularity as a search engine from a decade ago was waning.  Google’s ad-based revenue from keywords was paying off; they’d planted a money tree which eventually created an entire forest of money trees for them.  It wouldn’t be long until Microsoft’s executives behind closed doors would consider Google their biggest threat.

About this time Apple created a very clever method of provisioning content for one-and-only-one device within the music-delivery space.  The iTunes store would turn out to be the goose that laid the golden egg, as seen in the following revenues.  And yet, it would take years for either Microsoft or Google to realize the beauty in this fulfillment model and to come up with their own versions.

showmethemoney

The “Internet of Things” concept started gaining in popularity at this time.

2009

Microsoft’s attempts at copying Google’s success (MSN Search, Windows Live Search, Live Search) now culminated in the introduction of Bing as their default search engine destination for all things Microsoft.

Apple introduced the first iPhone and the first iPad about this time, noting that the same provisioning model from iTunes was incorporated into both via iOS.  The subscription model of sofware licensing was born with this, if you think about it.  If you wanted to write a program for either, you needed to use Apple’s software to do so.

Google has just introduced Chrome as a browser and would begin their campaign to slowly break Internet Explorer.  The same was true of the Android phone and its related operating system.  It would take a few years for Microsoft to catch up to either the iPhone or the Android before releasing their own app-savvy smartphone offering.

Amazon some three years prior had introduced the beginning of what would be a full complement of cloud-based services to support web development.  It would take Microsoft two full years to realize that they needed to be in this space and they didn’t have their offering ready for a few years more, too late to effectively compete.

Github.com had just celebrated their first year online, hosting over 46,000 repositories by then.  The world of open source was the very antonym to the way that software had been developed prior to this.

The free Ubuntu operating system was released about four years prior to this, backed by the well-funded company Canonical.

2015

Microsoft releases Windows 10, “the last version of Windows” (they claimed).  Rumors suggested that Windows would eventually go from a version-based license model to an annual-subscription model with respect to pricing.  I think it’s safe to say that the market hasn’t really embraced either Windows 8 or Windows 10.

The subscription-based model for Office 365 was introduced four years prior to this so the writing was definitely on the wall:  Microsoft wanted to depart from their former methods of making money and to chase the monthly subscription model.

2015-popular-coding-languages

The world of open source was offering new programmers a wealth of free code.  All they had to do was to take it and make it their own.  Formerly, Microsoft-friendly coding languages like C, C++, C#, VB and .NET dominated the playing field but this graphic shows how the game had changed.

2017

And here we are, present-day.  That curious number 42 now describes the number of years that Microsoft has been around.

Yesterday evening, I attended a very geeky meetup of perhaps fifty or sixty coders and only saw one Windows-based laptop.  Almost everyone had a MacBook of some kind.

I just spent about two hours today installing the free Visual Studio Community 2017 software so that I could—in theory, anyway—alter a free copy of the source code for TightVNC software.  Out of the box, so-to-speak, Visual Studio doesn’t want me to build this project since it uses an earlier target platform (Windows 7 or 8, one would assume).

Microsoft only wants me to make things for Windows 10.

So rather than making it easy for me to build a program that will happily work with Windows 7, they’re forcing me to jump through hoops in order to add the necessary pieces for this to happen.

Add two more hours to this and I find that my installation does not want to download the earlier pieces to allow this to happen.  I’m forced to then upgrade the code to Windows 10 compatibility mode… only to find that the build fails with 528 errors.

The main crux of all these errors appear to be:  “we can’t find common files”.  It’s a very amateur sort of error from a company that’s been providing compilers for several decades now.

I have to think that Microsoft doesn’t want me to do anything with Visual Studio unless it benefits Microsoft.  And this is the core of the reason why I suggest that they’re doomed.

Every time a coder like myself runs into obstacles like these, the usual seed that’s planted inside their head is “this would be easier with another free compiler or another language from someone else”.

2022

Fast-forward another five years and Microsoft will have lost ground on many fronts.  New software development here, there and everywhere will be via some language which wasn’t popularized by Microsoft on computers which aren’t Windows and with browsers which aren’t Internet Explorer or Edge.  Our toasters and refrigerators and our cars will be powered by the Ubuntu operating system or perhaps Debian, a similar free Linux flavor.  These appliances will be connected to our wi-fi and even to the Internet but there won’t be a scrap of anything Microsoft about them.  They’ll be coded up with something that isn’t C#, doesn’t use .NET and doesn’t need Visual Studio in order to compile it.

The only thing with a Microsoft pedigree with some staying power could be some of the websites and services currently served up at Microsoft’s datacenters via Azure.  But Amazon or Google could kill that by simply lowering their own prices for cloud-based services.

the 21st century digital résumé

It used to be that a programmer’s résumé was a single sheet of onionskin paper (expensive, semi-transparent) with a carefully-selected collection of one’s job history and such. Parts of what you were trying to “sell” to the would-be employer were your wordprocessing and layout design skills.

Now, everyone can type, has access to printers/computers and Microsoft Word. In fact, they can even select an attractive template from the many offered so it’s not like much skill is now involved in those areas. At one time, spellchecking was an activity that involved a Webster’s dictionary. The world has changed.

Github

To be an open-source programmer, you must now have a public set of repositories on github.com or so it seems.  My collection of repositories on github.

jsfiddle

As of today, I now have my very own jsfiddle.net collection. My public dashboard on jsfiddle.

WordPress blog

More and more, programmers are encouraged to be social and outgoing enough to want to communicate to others. Obviously, you’re here already so you have my blog’s address.

Slack

And part of that “being social” requirement now seemingly includes spending a fair amount of time during your life chatting with others within the coding space. Since slack.com projects appear to be project-centric rather than coder-centric, there doesn’t appear to be a way of publicizing your identity outside of a particular team URL.

Website portfolio

And then of course, potential employers want you to highlight several existing website concepts in which you either participated or you directly own them.

blinking the raspi’s built-in LED

I’ve just added a repository of some JavaScript code to take over and exercise the built-in activity LED on a Raspberry Pi Zero W (and presumably other models). It’s called gpiozero-toggle-led and it’s a pretty simple interface with installation instructions and some sample code. It works with the underlying js-gpiozero JavaScript port of the popular original Python code. This would be an excellent way of simply demonstrating GPIO without any additional wiring, components, breadboards, extra power supplies or electrical knowledge (like finding a 330-ohm resistor using its color bands).

zero-wireless

Note that the “zero” in the title of the repository and in js-gpiozero does not refer to the Raspberry Pi Zero but to the original gpiozero Python library.

This should remove some of the guess work when attempting to use the relatively-new library since their documentation examples at the moment are taking a back seat to their code port from the more-extensive Python offering.

This approach can easily be modified to instead exercise external LEDs (as soldered or otherwise attached to the header pin locations seen below).  Note that you’ll use “BCM numbering” for APIs such as this one. For external LEDs, you would need to connect it inline with a resistor from a selected pin to one of the grounds for this to work with correct orientation of the LED’s anode/cathode, of course.

raspberry-pi-pinout

If you’re trying to use this with a Raspberry Pi of a different model, you’ll likely want to adjust the JavaScript slightly as seen below.

/routes/index.js:

// Existing code, for a Raspberry Pi Zero
var ledActivity = new LED(47, false);
// For Raspberry Pi 3, for example
var ledActivity = new LED(47);

And that’s it. Since the Raspberry Pi Zero assumes an opposite value for true/false than the bigger models, it’s necessary to configure this in the device constructor to make things work as expected. Since BCM pin 47 is the activity light on the board itself, this will allow you to control it.