DIY Electronics

Simple electronics as a hobby

esp32cam with PIR sensor

It took some time to figure out how to get acceptable quality images. Lowering the xclk_freq_hz to 1000000 stopped the freezing of the camera. Taking multiple images before saving the last one helps to improve the quality of the last image.The following setting was added: config.grab_mode= CAMERA_GRAB_LATEST;

>>> esp32cam code <<<


PIC12F629 PWM in MPASM assembler

The MPASM assembler has only a limited instruction set. The fun part is to find out the most effecient or elegant way to get things done. I used XOR to test if the 255 was reached and then check the zero bit in STATUS register.

>>> mpasm code <<<


PIC12F629 dice in MPASM assembler

The challenge in this program was the modulo 6 of TMR0 that gives a result of zero to five (0-5) or the six possible outcomes of rolling a die. I let TMR0 run from 4 to 255 to get an even chance for each output.

>>> mpasm code <<<


PIC12F629 button interrupt in MPASM assembler

Button press causes an interrupt and starts or stops
the alternate flashing of the LEDs.

>>> mpasm code <<<


PIC10F200 rolling die in MPASM assembler

Rolling die with the most simple microchip. The trick here is to use 1 byte to store the 2 conditions of the charlieplexing code. With swapf the high nibble becomes the low nibble to drive the LEDs.

The resistors are placed at the back of the PCB,
360r for the LED in the middle and 150r for the double LEDs.

>>> mpasm code <<<
Top