Using Visual Studio Code as an Arduino IDE


I started using Visual Studio Code¬†for its nifty markdown editor recently. I also hacked it a bit so that it would let me edit, compile and upload arduino sketches ūüėČ Here’s the GitHub project.

Startups, Health and Medical Marijuana.

It’s been 2.5 years since my last post. Wow!¬†Why such a¬†long radio silence, you might ask?

Well, it’s simple: from¬†2011 to 2014,¬†I poured all of my energy into building and growing a business¬†until¬†it became clear that it was literally killing me from physical stress, burnout and depression. Never mind why;¬†just know to never do business with friends. Ever.¬†As I¬†was¬†trying to¬†survive, writing¬†personal blog posts was the last of my concerns,¬†until today.

As you read on, please keep in mind that this post is an opinion piece prompted by the desire to share a personal experience that, I hope, you will find interesting.

In 2013, the physical stress I had been experiencing manifested itself as¬†severe tendon inflammation¬†in my hands, wrists, arms and shoulders, mostly caused by years of sub-optimal¬†workstation¬†ergonomics¬†and excessive¬†weight lifting at the gym.¬†I was in constant pain and unable to do anything that required physical strength. Using a keyboard and a mouse was torture.¬†Even¬†lifting a pint of beer¬†was¬†a challenge.¬†That’s when I knew I was in trouble ūüėČ

I was prescribed anti-inflammatory¬†medicine,¬†physical therapy and a new workstation setup. However, the anti-inflammatory¬†medicine was ineffective, making physical therapy a non-starter. When my¬†doctor talked¬†about surgery as a fallback plan, I wasn’t on-board with the idea: it felt¬†premature and it had the potential of making things worse. Why open Pandora’s box when¬†other options are available, as ‘unconventional’ as they may seem? ¬†Why not try¬†cannabis for its¬†anti-inflammatory properties¬†instead?

Living in Washington State, where medical and recreational marijuana are legal, getting a prescription for my condition was straight forward. And guess what? It worked! I finally experienced relief and began recovering. Even though the tendon damage is permanent, the pain was manageable. Being mindful about taking frequent breaks from the keyboard and avoiding heavy lifting as much as possible, I was on the mend, without surgery!

Becoming a medical cannabis patient¬†was a transformative experience for me: I went from¬†thinking “Weed’s just¬†for¬†fun” to “Holy cow, cannabis¬†is truly medicine!” to “Why is marijuana¬†a Schedule 1 substance¬†and why¬†is anyone going to¬†prison¬†for¬†it?”.

I¬†started researching¬†the motives behind¬†the¬†“War on Drugs”¬†and realized¬†the staggering amount of deception covering¬†the agenda¬†of¬†the U.S. government.¬†What I discovered was revolting and¬†I went from being a patient to being¬†an activist advocating¬†drug policy reform. If you’re interested in the facts, regardless of your position on marijuana, I recommend watching The Culture High documentary. It is enlightening, to say the least…

There was one thing that was troubling me about using medical marijuana as medicine though: due to the lack of federal regulations applicable to marijuana cultivation, pesticide use is allowed by state law. In Washington State, commercial marijuana growers are allowed to use over 200 different kinds of chemicals as pesticides, some of which are proven to be toxic and should never be used to produce medicine.

That’s when I decided to experiment with growing my own organic, pesticide-free medicine, legally and sustainably.¬†To this end, I¬†built¬†a lab serving as a controlled environment, wrote some software, built some hardware and combined it all¬†with various consumer appliances in order to¬†automate the cultivation process as much as possible, sparing me a great deal of manual labor and pain.

Three prototypes and four beautiful harvests later, The Humble Roots Project was born.

While developing the project,¬†I learned a great deal¬†about horticulture, cannabis and designing sustainable¬†systems.¬†Above all,¬†this experience has¬†opened my eyes to the crimes being committed against patients,¬†preventing them¬†from accessing the¬†medicine that can save their lives and landing them in prison instead. Washington State’s marijuana laws might be¬†far from¬†perfect but I’m¬†grateful that they even¬†exist. Fortunately,¬†the marijuana legalization movement¬†is well under way and there’s hope that it will sweep the rest of the nation before too long…

I hope that¬†The Humble Roots Project¬†will inspire and help other medical cannabis patients¬†to¬†become self-sufficient. It’s the least that I can do to give back and support a cause that I deeply care about.

Live long and prosper,


Using an AdaFruit OLED display on a Boarduino without a level shifter

Limor's Playground

AdaFruit released a monochrome OLED screen last week and I wanted to test it with a netduino. So, I ported the Arduino driver written by Limor to C#, wrote a basic test app, soldered header pins to the OLED display, hooked it up to my netduino ¬†and… nothing happened. It became clear that I needed to test the OLED display on an Arduino first to make sure that the screen was not defective in the first place.

I had on hand a Boarduino that I had previously upgraded with an Atmega328 and hacked to run on 3.3 volts instead of 5 volts, removing the need to use the level-shifter provided with the OLED display.

Here’s what ‘Frankenduino’ looks like:

The 'shoehorned' 3.3v voltage regulator ūüôā

Brain transplant

Frankenduino and OLED display

That's a tiny display!


A few minutes later, I had my answer and the OLED display isn’t the problem here ūüėČ

I’ll post an update soon when I have figured out my netduino driver issue…



Where to find parts for your netduino?

B9A Nixie Tube

B9A Nixie Tube

So you got a netduino and wrote the obligatory ‘Hello World!’ app for it. Great!

Now what? As it stands, a micro-controller won’t do much by itself and it needs to be interfaced with other parts and components to do something interesting.

In this post, I’ll attempt to make a list of the parts and their suppliers that I’ve found necessary for my own projects:

Basic Tools

  1. Breadboards: larger is better to start with. Get smaller ones too if you can. You’ll need at least one to build project prototypes.
  2. Tons of hook-up wires, males ones for breadboarding of course, but female ones too. You can also make your own with wire strippers and various types of 22 gauge solid-core wires. Pick various colors: it helps. Ready-made ones are available from Solarbotics, Sparkfun, Fry’s or RadioShack.
  3. A multi-meter: you’ll always need to test your voltages, currents, connections, resistors values, etc. and this is the tool you’ll need for that. Do not buy a cheap one, especially one from RadioShack! You’ll go through a few cheap ones over time, and then realize that you’d have spent the same amount on a good one that would have lasted you a lifetime. I’ve made that mistake, and hopefully you won’t have to. Fluke makes great multi-meters and I highly recommend their 115 model. You can find them new and used on Amazon.
  4. A soldering iron: anywhere between 15 watts and 30 watts is great to start with. You can get these at RadioShack, Fry’s, or If you can afford it, get a temperature-controlled one.
  5. Rosin core solder. Available nearly anywhere mentioned above.
  6. Make yourself a solder fume extractor using a recycled PC fan and a carbon filter or buy one if you have to.
  7. Learn to solder:¬†Even if you may think you only need a breadboard to learn, you’ll always find an occasion when you actually need to solder two parts together. (Edit: Make Magazine also has a nice tutorial).
  8. A good light source, preferably with a built-in magnifying glass. A good LED headlamp and a magnifying glass will also do the trick, but will take one of your hands to hold it.
  9. A second set of hands: I cannot stress enough how frustrating it is to solder anything if you don’t have something steady to hold the parts you need to work on. I highly recommend a PanaVise over “Helping Hands” with crocodile clamps, which tend to get loose, hard to adjust and become useless over time.


My advice about parts: don’t start buying random parts thinking that you might use them eventually.¬†While it is true that there are ‘electronic staples’ such as the items in the list below, you’ll be buying stuff you don’t need.

If you have a specific project or just an idea in mind, even if it’s just for learning, take the time to think through what it will take to build it:

  • Research how you plan to interface the parts with your micro-controller:¬†make sure you’ll have enough pins to do it.
  • Find out what protocol(s) may be required to talk to the components and make sure your micro-controller can handle it.
  • If you’re not sure about how a component works, try to find sample code for it ahead of time or find out if the manufacturer has a library for it. Even if the code is written in C/C++ instead of C#, it will provide a good starting point for your own.
  • If you don’t know how a typical circuit works (power supplies, controlling relays, motors, servos, solenoids, etc.) try finding a pattern for it: chances are, you will find out that someone like you has already figured it out. Sometimes, the manufacturer of the parts required to implement the circuit have documented the correct patterns in their datasheets.

Before going any further, read this article. It will save you a great deal of time and money. In addition, a Google search on the subject of “free electronic samples” yields a treasure trove of sources.

  • Starter Kits: maybe a good way to get started with parts and the guidance needed to learn how to use them. There. I’d suggest the following:
  • Make Magazine: Electronics Components Pack 1 & Pack 2
  • Ada Fruit: Sensor Pack. Be sure to check out the rest of the products on the site as many of the essentials for a beginner are right there.
  • Arduino Project Pack: this one deserves an explanation. The netduino finds its roots in the Arduino micro-controller and it shows in many ways: for instance the netduino is pin-compatible with the Arduino, meaning that their pins are in the same locations on the boards, which makes their shields (more on that later) often compatible. Not only that, but the large body of ¬†knowledge, sketches, wiring diagrams applicable to the Arduino can be ported over to the netduino with little effort. Just pay attention to voltage levels as the original Arduino worked with 5 volts while the netduino works with 3.3v but tolerates 5v on its inputs, so it’s not a huge issue.¬†One exception is the OneWire protocol which is not supported yet on the current v4.1.0 netduino firmware, so for now try to find parts that use the I2C or SPI protocols instead.

Starter Packs can be expensive though and there are large suppliers online who generally offer better prices on the same parts. I generally use these guys:


Recycled Parts

Old electronics can be fantastic source of parts: I tend to never throw away outdated or broken electronics for the sole purpose of scavenging parts from them later. Examine them for burn marks and weird smells before recovering them, then test them with a multi-meter, an oscilloscope or in a test circuit to make sure they’re still good before using them. Keep an eye out for old PCs, TVs, VCR/DVD players, printers, R/C toys, game consoles, HiFi gear for parts. If your workplace recycles electronics, ask your admin if you can take them home: they’ll generally be glad you do.

That’s it for now. Happy hacking!

nRF24L01+ transceiver module with chip antenna – Meh!


nRF24L01+ transceivers

My very first attempt at building a wireless thermostat involved a pair of Nordic nRF24L01+ transceivers with patch antennas. It turns out that they were unable to communicate reliably in my house, even at a range of ~15 feet: I found out through experimentation that the reliability of the transmission depends entirely to the orientation of the patch antenna: if they’re not facing each other, the range of the transceivers will drop dramatically, even if they’re within 8 feet of each other! Also, anything in the 2.4Ghz spectrum has a potential for interference and in a WiFi-rich environment, that’s a bit of an issue. Because of their low-power requirements, I didn’t expect being able to use them at long range, but they still fell short of expectations at short range.