Howto: open source

While I’ve been studying about open source projects, I found this very interesting reference about creating and maintaining an open source initiative: Producing Open Source Software by Karl Fogel. The book is available at:

Karl compiles a list of resources and learnings about how to run an OSS project: techinical issues, communication, political and social environment, etc.





Arduino Yún

Hardware Description

Getting Started Guide

Some Inspiring Projects


Related Libraries

Defensive Programming

Design by contract

A compromise of the functionalities and behavior of a module;

Use assert()


  • improve testing
  • detect bugs
  • behaves like executable comments
  • improve code quality
  • can be turned on and off


  • slowdown execution
  • commonly misunderstood
  • some times used improperly for error handling


Static Code Analysis

Excelent tool for detecting errors that the compiler won’t detect.

Other techniques

Data hiding (encapsulation)

exposes only necessary functions;

Robust watchdogs

  • should have separated clock sources;
  • fast detection of failures
  • ability to accuse what went wrong

Stack monitor

easily implemented in RTOS, but hard to implement in baremetal;

Error handling



Benigno Defensive Programming

my debian tweaks

First steps:

Comment the CDROM option in the apt source list at  /etc/apt/sources.list

# deb cdrom:[Debian GNU/Linux 8.7.1 _Jessie_ - Official amd64 DVD Binary-1 20170116-11:01]/ jessie contrib main

some basic tools

apt-get install vim git tree 

…if it’s a virtualbox VM

apt-get install virtualbox-guest-utils

I made another post about virtualbox

dev tools

apt-get install kicad arduino

pending: cross compiling tools for arm

user conf tools

Virtualbox tweaks

Usually Virtualbox VM’s doesn’t adjust themselfes. So here’s some tweeks if you want to use Virtualbox:

Adjusting the monitor resolution

VBoxManage.exe setextradata "VM NAME" CustomVideoMode1 1920x1200x32

sudo apt-get install virtualbox-guest-utils virtualbox-guest-x11 virtualbox-guest-dkms

An awesome guide in LED driver circuits

LEDs have a constant voltage drop while conducting, and in order to operate effectively, they need to be supplied with a constant current source. If the current is to high, the component would burn; If it’s too low, it would be unnecessarily dimmed.

The problem with the serial resistor and alternatives

The simplest way of making a current source is using a resistor as current limiter. The problem in this set-up is that you must have information of the voltage drop of the LED, and sometimes it’s not so accurate. Also, using different power supplies and stacking LEDs require different resistances and power specs.

…But how?

  • discrete with transistors;
  • linear regulator;
  • switching regulator and specialized circuits.

Discrete current sourcesource

In this circuit, Q2 is the power transistor that controls the current, and R2 +Q1 are the feedback loop that controls Q2.

  • R1 100KΩ (1/4 W) resistor;
  • Q1 small transistor;
  • Q2 large transistor;
  • R2 large resistor.
    • R2 = V_base / I_diode
    • P_R2 = V_base² / I_diode

Linear regulators

pros: fewer parts; inexpensive

cons: low efficiency in low voltages (depends on the regulator dropout voltage)


from the TI LM317 datasheet [2]

Switching regulators and specialized circuits

The most expensive, but the best in efficiency and flexibility. A good product example is this mini buckpuck.


[1] Dan Goldwater’s (awesome) guide on LED drives

[2] TI LM317 Datasheet

[3] mini buckpuck