The Hardware Level: Tales of hardware development from a software developer’s perspective

This past year I had the fantastic opportunity of getting to work with designing, developing, and integrating embedded hardware into a (soon to be viable) product. Prior to this I had absolutely no background knowledge in hardware engineering apart from the basic concepts of circuits from Physics in high school. I come from a software background so this was very new and exciting to me. I’m sure more experienced people will have much better advice but here are something I have learned from my stint at developing embedded hardware.


Open Source reference designs are your best friend when getting started

Without Arduino and Adafruit the project I am working on would honestly not be possible. The simple and approachable nature of many of their products is what helped me really hit the ground running. I designed our Bluetooth functionality around the Adafruit Feather nRF52 and other controllers around the Arduino MEGA2560 and UNO. The software development environment used to program these little things, the Arduino IDE, is so easy to use along with the C based programming language that saves a lot of time for implementing most functionality. Once we had working prototypes made in house via a slew of jumper cables, cut out project boxes, and lots of electrical tape and super glue, we proceeded to approach a PCB design firm to help us take this mess of wires into a single PCB. Although I was able to come up with the diagram and wiring I have no idea how to properly do a schematic capture or layout a PCB so I left that to the professionals. I did however learn a lot about PCBs themselves such as how they are made, what vias and traces are and how they connect things, different mounting technologies, and more which was super interesting.


Debugging hardware is nothing like debugging software

With software you can pinpoint control flow or data issues via a debugger or just print statements whereas with hardware everything is about the flow of electricity and signals, neither of those things can be debugged with software. If you are interested in getting into hardware you will need a multimeter for basic debugging. I recommend buying something decent since the quality of the tools you work with matters a lot more when working with hardware (more on this later). Fluke is the go to brand for quality multimeters although they are a bit pricey. There are some features that generally mark up the price of the multimeter regardless of brand, such as auto ranging which is not required but is a handy feature. Once you buy one, learn how to use it (they are pretty easy to use) and practice using it on simple circuits. Multimeters help you ensure power is going where it should with the correct amount of current at the right voltage, but what about making sure signals are ok? You can ensure that a signal is even being produced (since signals are just pulses of electricity) with a multimeter, but it’s hard to tell if you have the correct modulation and such. In these cases you will need a oscilloscope or a logic analyzer, depending on what you are trying to probe. For example, say you want to check a serial line to make sure data is being transmitted, the first step you’d do is make sure your RX and TX lines are alive with a multimeter. Once you know they have power you can use a logic analyzer or a scope to actually read the signal and even data when you use a logic analyzer. Overall, diagnosing hardware problems generally takes longer and is more involved compared to software since there are multiple things to probe with multiple pieces of testing equipment.


Read the datasheets for all the components you use, not just the ones that you suspect to be causing a problem

Once of the PCBs we had designed was based on the reference design of the Arduino MEGA 2560 revision 3. It’s basically the same circuitry with some our own added sensors built in in a smaller package since we don’t need jumper cable headers. You would think that since it has the same hardware it would be programmable just like the MEGA right? It’s a lot more complex than you would initially think because the MEGA comes with the microcontroller preconfigured and ready to be used with the Arduino IDE from the factory. Our PCB came with a blank Atmel ATmega 2560 as it shipped from Atmel with none of the configuration needed for it to talk to the Arduino IDE or even program via the ISP. After days of struggling, not being able to figure out why my AVRISP v2 programmer was not able to communicate with the mega 2560 I finally took a close look at the 400+ page documentation for the ATmega 2560. I found that from the factor, the mega 2560 is set to use an internal oscillator with a clock speed of 8 MHz. I needed the microcontroller to use the external 16 MHz crystal oscillator just like the reference Arduino design does. There are some fuse bits that you need to set to configure your clock signal source, but I need to get my programmer to talk the the mega 2560 before I can set the fuse bits. I then found out via manufacturer of the programmer (Pololu) that the frequency of the programmer needs to correspond with the current frequency of the microcontroller you are targeting. Since I tested my programming process out with reference Arduino hardware the programmer worked just fine because it was set to a high frequency that corresponded to a 16 MHz system clock, whereas my mega 2560 was running at 8 MHz. I lowered the frequency of the programmer and bingo I was able to communicate and set the fuse bits and got the external oscillator working. I was so sure that it was just the microcontroller the whole time I never would have guessed I need to make some changes to the way the programmer works. Moral of this story is check the documentation for all your parts, not just the one you think may be the cause of your problems.


When in doubt, consult the forums

There are so many great resources online for professional engineers and hobbyists in regards to hardware. If you have a problem, chances are someone else as had it too and there is a solution for it online. The Arduino forum, AVR freaks, and the hardware section of Stack Exchange have some great info. Try to search for broader solutions at first then narrow it down to the exact problem you are having.


I’ll try to add more points over time.


Helium + MEMS Oscillators = iOS device failure?

A system administrator noticed that all iOS devices in the medical facility he had been working at stopped working after a recent installation of an MRI machine. Turns out this was not related to any electromagnetic interference, but rather helium of all things. Below is one of the most interesting things I have ever read about electronics:

Original Post:

Follow-up with some interesting comments from other people who have had strange bugs that were also hard to track down:

The tl;dr is that there was a helium leak during the setup of the MRI. MRIs use very large, powerful magnets and liquid helium is used to cool them. The coolant was leaking which spread into the HVAC system in the facility. Many iOS devices use MEMS oscillators to generate a clock signal rather than using quartz. This is for packaging and cost saving reasons since they are smaller (thinner) and cheaper than a standard quartz oscillator. Quartz oscillators are hermetically sealed in metal to prevent interference but MEMS oscillators are usually sealed in plastic. Helium can permeate through plastic leading to the interference with clock signal, and since the clock signal is vital to numerous parts of an IC, the iOS devices stopped working. I do recommend reading the entire post though, it’s super interesting.


This week in tech: Bloomberg’s hit piece on Supermicro, iPhone Xr reviews surface, and new Macs coming next week

First off, here is the Bloomberg article that claimed Supermicro’s hardware had been compromised during manufacturing in China:

Companies that utilize servers with motherboards manufactured by California-based Supermicro have all come out stating that the Bloomberg article was hogwash and that there is no evidence of any compromised hardware or software on the supposedly affected servers. This includes tech giants such as Amazon and Apple who would definitely have a lot to loose if they were trying to cover this up. It’s clear that Bloomberg is full of it and should retract the story since the evidence is clearly not there. Should be interesting to see how this plays out legally since the story sent Supermicro’s shares plummeting. Looks like I won’t be reading anything from Bloomberg anymore.


Secondly, the iPhone Xr has arrived in the hands of tech reviewers and the first reviews are surfacing. Here are some substantial ones by Nilay Patel at The Verge and John Gruber:

I have some strong opinions regarding the 326 ppi LCD screen on a $750 phone but then again I haven’t seen it in person so I can’t judge just yet.


Finally, we have some new Macs coming! I am very excited to see a new Mac mini as well as a nice refresh for the rest of the lineup.




Xamarin Tips and Tricks – Re-generating the Mono GAC after updating .NET SDK

In my current work environment we use Babel for .NET to obfuscate our Xamarin binaries. The nice thing about Babel is that it’s the only Xamarin obfuscator that runs directly in macOS, eliminating the need for a Windows machine just for release builds. Things were working fine until after I installed the latest Visual Studio for Mac update along with the latest version of Xcode, Xamarin SDK, and .NET SDK. Turns out that Babel got removed from Mono’s Global Assembly Cache which is basically where DLLs (like Babel’s build DLL) get tracked so you don’t need to use an absolute path to the DLL to reference it. Adding the DLL back via gacutil solved it (if you have Babel the gacutil command syntax was included with the zip they send you). I am guessing you’ll need to do this every time there is a major update to the .NET SDK or Mono framework. Thanks to Alberto from Babel for the solution.

Fixing things broken by macOS Mojave

I haven’t had enough time to fully play around with Mojave so I can’t write a full review yet. Things have already broken (as expected) and I will be keeping this list updated as I find and fix them:

Subpixel antialiasing workaround (have yet to try this out myself):

Missing Safari Extensions (such as uBlock Origin): Once starting up Safari after updating to Mojave you will notice that your extensions are gone. You will also notice trying to install extensions from Preferences > Extensions redirects you to the Mac App Store since Safari extensions are now hosted there. You can still install extensions from the Safari Extensions Gallery website here:

Recently opened apps added to Dock: You will notice that apps that you haven’t pinned to the Dock are still there even after you close them. This is because the option “Show recent applications in Dock” is now enabled by default. You can turn it off under System Preferences > Dock > Show recent applications in Dock.

MITM Attacks in Mobile Apps

A Man-in-the-middle or MITM attack is a common technique used to steal data during transport to and from a web service and a mobile app. An easy way to see what sort of data your app is leaking is to use a MITM proxy server such as the Python based mitmproxy. Today I’m going to show a quick demo using a small app that sends and receives JSON payloads with mitmproxy capturing all that data. If you want to try this out yourself you can use your own app or feel free to use mine:


-A mobile app to test with (the one used in the video is available here:


-A web service endpoint to deliver a JSON payload (I used json-server for testing)

You will need to setup mitmproxy to work with your phone with the following steps. Once you have that setup you can test how your app handles web service requests whether it be JSON, SOAP, or loading images and videos. This should give you some insight on how easy it is to see what your app is doing when communicating with a web service. One way to help prevent this is to implement Certificate Pinning. I have provided some implementation guides below:

For Xamarin apps:

For native iOS apps:

I will probably be doing another video with a web service running over HTTPS and show how Certificate Pinning can help stop MITM attacks. And as usual, thanks for reading.