Monday, December 20, 2021

Docker stuff

Removing all docker containers in one go

docker container rm `docker ps -a | cut -f 1 -d " " | tr "\n" " "`

We are using command line substitution with the ``, and populating the container ids inside it. The cut gets the first field from docker ps, that is the id, and the tr replaces the newline with a space, so that we get all ids in a single line.

Btw, this will also work in the new Linux Subsystem for Windows(LSW) command line, its able to see the docker container created from windows command line.

Saturday, December 4, 2021

A simple timer switch using a potentiometer

 

A draft, not yet complete...

A digital timer that uses a potentiometer and ADC to select a time interval. The input triggering circuit is isolated from the mains using an optocoupler.

BT136 triac

MOC3061 optocoupler

pic12f675 - the cheapest microcontroller i could find, with an ADC.

The potentiometer is missing in the circuit below, its connected to the ADC






For the source code, see https://github.com/manojmo/pic_micro/blob/master/pot_minutes_calc.c

Based on the potentiometer voltage read from the ADC, it calculates the ON time, turns on the triac, waits till the ON time expires, then turns OFF the triac.