Three/Mono Phase Asynchronous Motor Simulator

When repairing stuff with a motor  the first question is:

“Is it the motor or is it the board that failed?”

For a recent Inverter Air Conditioner  board repair the following tool helped to answer that question.



Simulate the circuit

The circuit can act as Induction Motor aka asynchronous motor .

Inverter Air Conditioners which use AC motors take the 220V from the grid and turn them into about 150V three phase AC which drives the motor.

So to test if the board is OK, connect the device in the place of the motor and see if the leds are flashing. /If leds are placed in a nice circle you actually see how the motor rotates/.

You can test if the mono phase motor is powered too – only the leds flash two by two not in circle.

It can be build in quite small box and is handy when doing work on the field.


ESP8266 – easy interrupts

While working on a current project i’ve faced an issue with code reuse. Espressif sdk allows only one interrupt handler for all GPIOs. That’s fine for monolithic code but since we like modular code a dispatcher comes handy.

The little inconvenience i’ve had was like this. I wanted to use the drivers/key.c code but it does use the data argument , so i’ve had to modify it to use a global variable. So i can call it from my own interrupt handler. And that is ugly.

So the lab have a brand new GitHub Account – where i’ll share code.

And the remedy for the issue –  new project: esp8266_easyintr .

May need a tweek or two.  I’ve  extracted it from a wip project.


ei_init(); // init easy interrupts
ei_attach(GPIO_NUM, GPIO_MUX, GPIO_FUNC, module_isr, module_data); // setup  handler

You can attach only one per GPIO . You will get your data at the isr and you can have a proper code separation.


KiCad change fields visibility utility

$ open devlog

I’ve back imported footprints for a .cmp file and I’ve misunderstood  kicad’s question about the imported footprints visibility, so all went visible.

And surprise, you can not edit visibility for all fields at once.

So  little utility was born – fixvis.

Usage is pretty simple:

./fixvis file.sch fieldid newval
0 - Reference
1 - Value
2 - Footprint
3 - Datasheet
4+ - custom
newval: 0000 = visible, 0001 = hidden

Example hide all footprints:

./fixvis name.sch 2 0001 > name-nofp.sch

It would be good to have a global toggle option.

$ close devlog


Apache websockets with proxy_wstunnel and mosquitto

Spend last weekend trying to make apache with proxy_wstunnel to work.
The solution recommended is to add this in the apache config:

ProxyRequests off
ProxyPass /mqtt ws://
ProxyPassReverse /mqtt ws://

But no matter what it is a no go. So, where is the problem?

It’s the libwebsockets it doesn’t understand custom http headers X-… but apache adds some.

To add support for them in the file lextable-strings.h append before the blank string :


Then do compile and install:

gcc minilex.c -o minilex && ./minilex > lextable.h
gcc minilex.c -o minilex && ./minilex > lextable.h
make && make install

Yes, do it twice. You must have a working apache2 with proxy_wstunnel module talking to mosquitto broker.

Now let’s get on the mqtt stuff.

P.S. The proper fix is to ignore all custom headers as per the HTTP specification and not consider them dangerous.