Ir al contenido principal

Ralsina.Me — El sitio web de Roberto Alsina

Adventures In Electronics: PC Volume Knob

I have some rather un­usu­al holes in my ed­u­ca­tion. I nev­er, for ex­am­ple, learned much about elec­tron­ic­s. It has al­ways been a mis­tery, a thing oth­er peo­ple knew about.

And then one day I ran in­to this gad­get:

What is it? A vol­ume knob for your PC. It plugs via USB and you can use it to turn vol­ume up or down. I sup­pose if you press it it mutes au­dio or some­thing.

It costs 50 dol­lars. 50 fuck­ing dol­lars. For a di­al.

Sure, it's pret­ty but how hard can it be?

So, I start­ed look­ing at how to do it. Here's what I learned first:

  • The thingie that spins and gives feed­back is called a "ro­tary en­coder"
  • I would need some­thing like a mi­cro­con­troller to ... well, con­trol it.
  • It would prob­a­bly in­volve sol­der­ing.
  • There are a bunch of tu­to­ri­als / in­structa­bles on how to do it.
  • The com­po­nents are damn cheap!

The last item is im­por­tan­t. When I was a kid in the 70s, elec­tron­ics was a thing for wealthy kid­s. I was not wealthy. So, the pos­si­bil­i­ty of do­ing this sort of thing? With cheap stuff? Sign me up!

So, I did what ev­ery­one does to learn stuff in 2019: I jumped in­to youtube and asked to be taught elec­tron­ic­s. And a day lat­er ... well, I know enough to break things and to im­ple­ment this!

The goal is:

  • USB vol­ume knob.
  • Press­ing it lights a LED
  • A but­ton click mutes the speak­ers
  • A longer click en­ables the mi­cro­phone while the di­al is pressed (push-­to-talk)

So, here is the BOM:

  • The cheap­est Ar­duino-­like thing with a USB in­ter­face: Digis­park
  • A ro­tary en­coder. I used a KY-040 be­cause it's cheap and work­s.
  • A gener­ic LED (red)
  • Some bread­board ca­bles.
  • A bread­board
  • A US­B-A male/fe­male ca­ble
  • A 1k re­sis­tor

A sec­ond stage (once I have an­oth­er Digis­park) will in­volve mak­ing it nice, but for now let's make it work.

Here is the wiring, which is prob­a­bly a pile of crap but works for me (sor­ry, don't want to learn how to do it prop­er­ly).

Wiring be­tween the Digis­park and the KY-040:

  • P0 -> CLK
  • P1 -> SW
  • P2 -> DT
  • 5V -> +
  • GND -> GND

I also connected KY-040's SW -> 1K resistor -> LED -> 5V so the LED turns on when the button is pressed, but that's optional.

IM­POR­TANT NOTE In or­der for P1 to work prop­er­ly, I need­ed to scratch off a con­nec­tion to dis­able the on­board LED so, if that's a prob­lem, you may be able to use P5 in­stead but P5 is dis­abled in the cheap Digis­park clones. We can't use P3 and P4 be­cause they are need­ed for US­B. So, your choice.

So, here is all the wiring. If the im­age dif­fers from my de­scrip­tion, trust the im­age be­cause it's work­ing ;-)

Once you have ev­ery­thing wired, we need to work on the soft­ware side of things.

I used a cou­ple of li­braries:

I had to configure a global shortcut to enable/disable the michrophone. I used the F10 key and the command pulseaudio-ctl mute-input but you figure out what you want to do.

I wrote a Sketch that does the fol­low­ing:

  • When the en­coder ro­tates clock­wise: send Vol­ume Up key.
  • When the en­coder ro­tates coun­ter-­clock­wise: send Vol­ume Down key.
  • When the en­coder is clicked less than half a sec­ond: send mute key.
  • When the en­coder is pressed for more than half a sec­ond: send mute-in­put tog­gle short­cut.
  • When the en­coder is re­leased af­ter be­ing clicked more than half a sec­ond: send mute-in­put tog­gle short­cut.

This way, if you want to mute, just click. If you want to talk, make sure you mute in­put when the ses­sion start­s, then click­-and-hold and while it's pressed the mi­cro­phone is en­abled. Nice, is­n't it?

Does it work? Oh yeah! (No, the mu­sic is not com­ing from the PC, just look at the screen to see what changes) and sor­ry this video is so crap­py.

And here's the code (which is my 1st ar­duino sketch, but I have been pro­gram­ming for a long time ;-)

#include "TrinketHidCombo.h"
#include <SimpleRotary.h>  //

// Pin A, Pin B, Button Pin
// Setting the button to 5 because this code handles it manually.
SimpleRotary rotary(0, 2, 5);

void setup() {
  pinMode(1, INPUT);

void loop() {
  static unsigned long time_pressed = 0;
  static byte ptt_flag = 0;
  byte i = rotary.rotate();
  if (i == 1) {
  else if (i == 2) {

  int button = digitalRead(1);
  if (button == LOW) {  // Yes, clicking the button makes it LOW
    if (time_pressed == 0) {  // It's a new click
      time_pressed = millis();
    else {  // Button has been pressed a while
      if ((millis() - time_pressed) > 500 && ptt_flag == 0) {
        // Pressed half a second, switch to push-to-talk
        // I configured my machine to toggle the input muting when F10 is clicked
        TrinketHidCombo.pressKey(0, KEYCODE_F10);
        TrinketHidCombo.pressKey(0, 0);
        ptt_flag = 1;
  else {  // Button not pressed
    if (time_pressed) {// Has been pressed
      time_pressed = 0;
      if (ptt_flag == 0) {  // Was a short click
        // Toggle mute
      else {  // Was a long click
        // Toggle push-to-talk
        TrinketHidCombo.pressKey(0, KEYCODE_F10);
        TrinketHidCombo.pressKey(0, 0);
        ptt_flag = 0;

Proyectos Caseros: Almacenaje bajo escalera

Vi­vo en una casa muy vie­ja, tiene alrede­dor de 100 años, y eso tiene ven­ta­jas y desven­ta­jas. Ven­ta­jas: tiene mucha on­da, luz nat­u­ral, pisos de pinotea, aber­turas an­tiguas de vidrio par­tido de col­ores.

Desven­ta­jas: las aber­turas an­tiguas tienen vidrios de 6 dé­cadas dis­tin­tas, los pisos de pinotea son del­i­ca­dos, no hay un con­de­na­do enchufe y no hay adonde guardar na­da porque en esa época la gente no tenía cosas.

Así que hará 35 años, en una re­mod­elación, al­guien abrió el es­pa­cio aba­jo de la es­calera que va a la ter­raza y quedó un lu­gar de al­ma­ce­na­je al fon­do del lavadero.

Y aho­ra, de­spués de 15 años de vivir acá, de­cidí hac­er­lo lo más fun­cional posi­ble.

Paso 1: sacar todo.

Eso llevó un par de días porque ... había muchas cosas ar­rum­badas ahí aden­tro. Re­galé una helader­a, un minilavar­ropas, ol­las vie­jas, y muchas otras cosas.

Paso 2: el espacio.

Es un es­pa­cio de 2,40m x 80cm. En la parte derecha mide 3m de al­to. En la parte izquier­da tiene la pen­di­ente de la es­caler­a.

Tiene una puer­ta de ac­ce­so de 1,60m de al­to por 1m de an­cho.

Paso 3: objetivo.

Quiero ten­er lu­gar para guardar todo, pero fun­da­men­tal­mente:

  • Al­i­­men­­tos no pere­cederos

  • Fuentes y esas cosas

  • Her­ramien­­tas

  • Pro­­duc­­tos de limpieza

  • Val­i­­jas

  • Ca­­jas grandes varias con cosas

Paso 4: Almacenaje en altura

Quiero con­ver­tir la parte al­ta del es­p­cio en una "repisa en­trepiso" de al­ma­ce­na­je para val­i­jas y ca­jas.


Agar­ré unas mén­su­las vie­jas que en­con­tré por ahí, un­os per­files en L de acero, taru­gos y un­os tablones e hice un mar­co para apo­yar un pan­el de pino de 1,20 x 70.

To­do eso es­tá a una al­tura de 1.85 así que puedo has­ta pararme aba­jo sin prob­le­mas.

Ahí ar­ri­ba irán en­tonces val­i­jas, ca­jas, y bul­tos grandes que no quiero ac­ced­er segui­do.


Paso 5: Estanterías.

Es com­pli­ca­do porque los es­pa­cios a am­bos la­dos son "pro­fun­dos". Si pon­go una es­tantería ade­lante los blo­queo, si pon­go es­tanterías atrás son un poco in­ac­ce­si­bles porque hay poco es­pa­cio.

Y en la parte ba­ja es aún pe­or porque co­mo se hace para ac­ced­er a lo que se guar­da en el fon­do de todo?

Solu­ción: es­tanterías móviles con rued­i­tas.

Co­mo no ex­is­ten, me las tuve que ar­reglar.

Paso 6: Comprar una cosa rara en Mercado Libre


Eso es una es­tantería jaula de acero de 6 es­tantes, mide 1,70m de al­tur­a, 70cm de pro­fun­di­dad y 1,20m de an­cho. pe­sa alrede­dor de 90kg.

Y no pasa por la puer­ta de mi lavadero, ni por la en­tra­da del ba­joescalera que mide 1mx1,50m así que ...

Paso 7: Amoladora


La cor­ta­mos por la mi­tad a lo al­to. La parte de ar­ri­ba se va a con­ver­tir en la es­tantería para la parte "ba­ja" izquier­da y la parte de aba­jo en la es­tantería para la parte "al­ta" derecha.

La parte de aba­jo tiene ruedas. Pero ob­vi­a­mente la de ar­ri­ba no.

Paso 8: Rueditas

Hice un "tri­neo" para la parte de aba­jo (de pa­so, gané un es­tante!)


La base se fi­ja a la es­tantería us­an­do un­os per­files en L, unas planchue­las, un­os precin­tos y bue­na vol­un­tad.

Paso 9: Meter todo en el depósito


Paso 10: Y lo de las rueditas?

Para poder hac­er es­to, y que no quede es­pa­cio sin us­ar:



Quedé con­tento, se aprovechó muy bi­en el es­pa­cio (aunque to­davía no usé el es­pa­cio para val­i­jas). La es­téti­ca es un poco rús­ti­ca, pero ... es un ba­joescalera atrás del lavadero, no me jo­dan.

Y fue un finde di­ver­tido ju­gan­do con her­ramien­tas.

Product Review: Ajazz Zinc Mechanical Keyboard.

I don't do prod­uct re­views of­ten, but this key­board is a spe­cial case:

  • Me­chan­i­cal key­boards are fash­ion­able now
  • Of­ten you will buy the key­board with­out test­ing it
  • This one is pret­ty un­known
  • It's re­al­ly a mixed bag ex­pe­ri­ence and I think oth­ers may ben­e­fit from the re­view, even if they are buy­ing a dif­fer­ent one.

Dis­claimer I bought this key­board with my own mon­ey and no­body ev­er gives me any toys to play with. Come on, com­pa­nies, give me free stuff, please?

Any­way, this is my re­view af­ter us­ing it for a cou­ple of days.


  • Ajazz Brand (not very well known)
  • Re­al Cher­ry MX Red switch­es (nice!)
  • 68 keys, ded­i­cat­ed cur­sor keys but no nu­mer­i­cal key­pad or func­tion keys.
  • Full met­al body
  • White keys, white back­light
  • Weight 600g
  • Wired or Wire­less (BT 3.0)

The Good


Typ­ing in this is pure plea­sure. I like the lin­ear red switch­es be­cause they feel al­most ex­act­ly like a Com­modore 64, which is the typ­ing feel­ing I as­so­ciate with my child­hood and ear­ly ado­les­cence, bet­ter than the tac­tile blue switch­es which I as­so­ciate with IBM mod­el M key­boards and my lat­er, not so hap­py teenage years.

The key­caps are dou­ble-shot ABS plas­tic, which I like enough. While I may have liked them to be a bit more tex­tured they are ok, not too smooth, they are not mushy, they don't jig­gle.

It's not even all that loud, while still be­ing sat­is­fy­ing­ly clack­y.

The look

I am a suck­er for how this look­s. I hate the black­-with­-red-or-rg­b-­lights gamer-key­board look (spe­cial­ly since I am not a gamer!) this ba­by has white keys on a sil­ver body with white back­light and a "naked" pro­file ex­pos­ing the switch­es.

The back­light has three lev­els (and of­f) and can do a "breathe" ef­fect and that's it. So, ba­si­cal­ly, it lets you type in the dark if you need to look at keys and not much else. Which is enough for most grownup­s.

The layout

The ded­i­cat­ed ar­row keys are nice, all the keys are in rea­son­able po­si­tions and have de­cent sizes.

The extras

It comes with a key­cap-ex­trac­tor, a USB ca­ble and a car­ry­ing pouch. Noth­ing fan­cy but more than good enough.

The Not Good

The Layout

I would love for this to have two more keys.

  • There is no Home key (Fn-End is Home) which is ... not ter­ri­ble.

  • There is no ~ key.

For a Linux user and software developer that is a pain in the butt because ~ means "home folder". For a spanish speaker it's even worse because ~n is how we type ñ which is, you know, a letter we need to use because "año" means "year" but "ano" means butthole. So it's kinda important.

In this keyboard that character is Fn+Shift+Esc which is just too awkward.

Yes, I know how to fix it!

I could remap that key to ~ but then I have no Esc key which sucks when using vim. So, I remapped Esc to Caps Lock and voilá, the keyboard is usable (but a bit weird)

# This is the easy way
xmodmap -e 'clear Lock' -e 'keycode 0x09 = dead_tilde grave'\
-e 'keycode 0x42 = Escape'

The Bluetooth

I was ex­pect­ing the blue­tooth in this key­board to suck be­cause it's BT 3.0 but I had no idea the depths and va­ri­ety of the ways in which it suck­s.

  • Yes, the range sucks
  • Yes, the la­ten­cy sucks

But al­so:

  • When in BT mode it be­haves like a com­plete­ly dif­fer­ent key­board.

In wired mode, Fn+= is F12 a key I use a lot because it drops down my terminal.

In BT mode, Fn+= is Volume up, which in wired mode is Fn+n ... which still works in BT mode.

So, in BT mode I have no func­tion keys at al­l, and have mul­ti­me­dia keys in two places.

But that's not al­l!

This keyboard supports three devices simultaneously. You switch between them using Fn+Q | W | E and there is a nice LED indicator at the top of the keyboard that shows on what mode you are in by changing color.

Here, let me show it to you:

The prob­lem is, when you are ac­tu­al­ly us­ing the key­board, this is how you (don't) see them:

So, just ig­nore that this key­board even has a BT mode and learn to love the ca­ble.

The Feet

There are no mov­able "feet", it has a small in­cline, and it's ok, the an­gle is nice. BUT... it's not per­fect­ly lev­el. There is a tiny wob­ble be­tween the low­er-right and up­per-left. Sure, I just shim a lit­tle thing in there and it's fixed, but this key­board is not very cheap so this sur­prised me.


It's ok? It's prob­a­bly bet­ter for peo­ple who are not span­ish-s­peak­ing lin­ux-user­s.

It´s prob­a­bly a bet­ter idea to get a more well-­known brand, and/or a cheap­er key­board if you are go­ing to gam­ble on buy­ing them sight-un­seen.

Am I hap­py I got it? yeah. Even as I am writ­ing this not-very-­com­pli­men­ta­ry re­view I am hap­pi­ly clack­ing away with a smile on my face.

The lay­out need­ed tweak­ing but is ok now, the feel is awe­some, and it looks great on my desk.


Es­to es al­go que aparente­mente es­cribí en 2016 y nun­ca publiqué en ningún la­do.

De acuer­do a mi in­ves­ti­gación hay só­lo tres lu­gares en el mun­do en que no se puede hac­er café.

El primero es la cima del monte Ever­est. Quince años de en­tre­namien­to y tra­ba­jo me per­mi­tieron amasar un buen es­ta­do físi­co y una for­tu­na con­sid­er­able, que util­icé para ser el primer hom­bre en pa­gar­le a un sher­pa para que lleve una ol­la a pre­sión has­ta la cima.

Con esa ol­la a pre­sión y una est­u­fa de camp­ing lo­gré hac­er un de­cente café a la tur­ca su­peran­do los in­con­ve­nientes cau­sa­dos por la ba­ja pre­sión at­mos­féri­ca y el frío. No es mi tipo fa­vorito de café, pero zafa.

El se­gun­do lu­gar es Corea del Norte. Des­de que el Ado­ra­do Líder asum­ió el poder a la edad de 12 años el café es­tá es­tric­ta­mente pro­hibido. Al­gunos di­cen que es porque cuan­do Líder tenía 5 se quemó con un café que toma­ba su padre -- Ilu­mi­na­do Guía, gran fan del espres­so -- que reac­cionó rién­dose de su do­lor. Des­de ese día ju­ró con el em­peci­namien­to que so­lo puede ten­er un nene de cin­co que cuan­do lle­gara al poder elim­i­naría esa hor­ren­da be­bi­da de la faz de la tier­ra.

In­clu­so, fuentes gen­eral­mente bi­en in­for­madas ru­moran que mien­tras al­i­menta­ba a sus per­ros mas­co­ta con la carne aún tib­ia de su re­cien­te­mente depuesto padre, Ado­ra­do decía al­go que se po­dría tra­ducir aprox­i­mada­mente co­mo "pedite un café aho­ra, hi­jo de mil putas".

Casi el vein­tidós por cien­to del pro­duc­to bru­to de Corea del Norte es­tá ded­i­ca­do a la pro­tec­ción de sus fron­teras, donde in­gre­sar café o sus deriva­dos es causa de eje­cu­ción sumari­a.

Por suerte, la ac­tu­al cri­sis económi­ca y sub­se­cuente ham­bruna me per­mi­tieron, cam­ou­fla­do co­mo donación hu­man­i­taria de latas de ananá, in­gre­sar 50 gramos de café has­ta las cer­canías de Py­onyang, donde un grupo de co­man­dos me in­fil­traron una noche jun­to con mi con­fi­able cafetera de pren­sa france­sa, y pude, en una fo­ga­ta al­i­men­ta­da con la bosta de la penúl­ti­ma va­ca de la gran­ja colec­ti­va número 12, preparar un ra­zon­able cor­ta­do con leche del mis­mo an­i­mal que proveyó el com­bustible.

El ter­cer lu­gar es Ophir, en la fal­da oc­ci­den­tal de las mon­tañas Oquirrh.

Se­gu­ra­mente no es­ta­ba en los planes de Aar­ic Smith y sus es­posas Aa­ron­i­ca, Ar­va y Zoleen, al for­mar su pe­queño y heréti­ca es­ci­ción de la ya ex­traña fac­ción mor­mona en la que habían si­do cri­a­dos, que la de­fi­cien­cia en su es­co­lar­i­dad los ll­e­varía a pro­nun­ciar mal de­ter­mi­nadas ora­ciones, y por pu­ra co­in­ci­den­cia in­vo­car al úni­co dios ver­dadero, Os­ther.

Por pu­ra co­in­ci­den­ci­a, du­rante sig­los los mor­mones de Utah crearon pro­gre­si­va­mente el cul­to de Os­ther, úni­ca en­ti­dad so­bre­nat­u­ral del mul­ti­ver­so, que has­ta ese mo­men­to había tran­scur­ri­do su ex­is­ten­cia ig­no­ran­do la mis­ma ex­is­ten­cia de la ma­te­ri­a.

Al comen­zar a fa­mil­iar­izarse con los dog­mas de su propia re­ligión, Os­ther tu­vo di­fi­cul­tades para dis­tin­guir en­tre lo im­por­tante y las pro­hibi­ciones id­ios­in­cráti­cas de la sec­ta de Aar­ic, Aaróni­ca y Ar­va (Zoleen de­cidió que si Os­ther ex­istía, en­tonces el­la prefer­ía ser atea, y se mudó a Pro­vo para cono­cer la vi­da de la metrópolis)

Por los prob­le­mas de Os­ther en com­pren­der (s­er so­bre­nat­u­ral no quiere de­cir que uno sea bril­lante), el pe­or peca­do en el Os­ther-­mor­monis­mo re­sultó ser el con­sumo de be­bidas es­tim­u­lantes, cas­ti­ga­do con la in­medi­a­ta dis­olu­ción del al­ma del pecador, seguido, para no lev­an­tar sospechas, de la traslo­cación del cuer­po del mis­mo a Las Ve­g­as, donde la caren­cia de al­ma no re­sul­ta ev­i­dente.

Es­toy pen­san­do el plan. Ten­go una cier­ta idea. Pe­or de los ca­sos, nos ve­mos en Las Ve­gas.

Contents © 2000-2023 Roberto Alsina