• potentiometer on breadboard

    12/26/2018 at 13:59 0 comments

    Just a quick tip: If you use a stereo potentiometer with PC (printed circuit board) pins termination style, for example this one, then you can just plug it into a breadboard and it is very stable, perfect for prototyping. No need for soldering wires or any extra breakout board. The 2 potentiometers are in parallel, so use a 20 k pot, if you need 10 k.

    This image shows a similar potentiometer, I can't find the exact same model, but the datasheet of the Bourns potentiometer shows (nearly) 0.2" pitch as well, so it should work the same.

  • Write better Arduino code with advanced C++ features

    08/09/2018 at 22:19 0 comments

    The Arduino IDE allows to use advanced C++ features like classes and operator overloading. There are not many Arduino sketches that uses these features, but it can help to make your code more readable and maintainable.

    This is an example how to make the standard "blink" example easier to read:

    // general class to simplify the syntax to write to a pin
    class PinOut {
        PinOut(uint8_t pin): m_pin(pin) {
          pinMode(pin, OUTPUT);
        PinOut& operator= (uint8_t state) {
          digitalWrite(m_pin, state ? HIGH : LOW);
          return *this;
        uint8_t m_pin;
    // example usage: create a "led" object, which uses the pin number LED_BUILTIN
    PinOut led(LED_BUILTIN);
    void setup() {}
    // much easier to read "blinking" example
    void loop() {
      led = 1;
      led = 0;

    So instead of writing "digitalWrite(LED_BUILTIN, HIGH)" whenever you want to light up the LED, now you can just write "led = 1". You can create more objects for other pins as well, which makes your program much easier to read.

    Left as an exercise to the reader to implement a class for reading pins.

    You could outsource the class in a separate library, then you need just an include to use the class, without always copying the class declaration in your sketch.

    This example was inspired by the PortOut class of the mbed framework:


  • How to solder a 1 mm x 1.5 mm, 6 pad USON package IC

    06/22/2018 at 16:51 3 comments

    This page describes how I tested a TPS3420 reset chip on a breadboard. First I glued the chip in dead bug style on a SMD adapter board:

    Then I tinned the pads of the IC and of the SMD adapter (the pink things at the left side are my fingers) :

    For connecting the pads of the IC to the pads of the adapter, I used enameled wire, AWG 36 (0.12 mm diameter) :

    To remove the enamel, I used a scrap board and some more tin. The lacquer melts after some time and the wire gets tinned as well:

    Then I soldered one side of the wire to the SMD pad, first, and cut it to length. The scratches on the IC are in the flux residue, when I tried to position the wire with a scalpel. You need eagle eyes or a good microscope to do this.

    Then I soldered the other end the IC pad:

    If you move the soldering iron to strong, or apply too much heat or for too long, pads disappear, as happened for me. Buy some spare part.

    Finally I plugged in some pin headers in a breadboard and placed the SMD adapter on it. This guarantees that the pin headers are straight when soldering.

    Connected in a testing circuit:

    Testing: green is both button inputs and yellow is the reset output. 

    As specified in the datasheet, reset triggers after holding down both button inputs for 12.5 s, with TS=VCC configuration.