Arduino – blinky with delay function

This is another blinky project. A “Hello World” program for the electronics. This version of “blinky” example is using delay function to make an onboard LED blink for roughly one second. The code is on Github, click here. Parts Required Arduino board (i.e. Arduino/Genuino UNO) Software This code is written in C++ and can be compiled using an Arduino IDE. All … Read more

Arduino – how to start?

Arduino is an open-source electronics platform based on easy-to-use hardware (Arduino boards), software (Arduino IDE), which allows to write programs and upload them to board (usually via USB connection) and an amazing community. In my opinion it’s a great tool to learn about microcontroller programming and for fast device prototyping. Arduino is not only for beginners. … Read more

ATtiny13 – 8bit mono class D amplifier

I always wonder whether it is possible to make an amplifier of class D on ATtiny13 or not. Some time ago I found George Gardner’s project based on ATtiny85 – TinyD. It was a sign to start challenging it with ATtiny13. It took me a few hours but finally I made it! The code is very short and useses a … Read more

ATtiny13 – clap clap switch

This project shows how turn ATtiny13 with sound detector module into smart Clap Clap Switch. The project has been designed to react on only double claps (clap clap – ON, clap clap – OFF). So, how it works? There is one pin for a MIC (digital output from sound detector module) and one pin for a … Read more

ATtiny13 – controlling stepper motor 28BYJ-48

This simple project shows how to control popular and cheap stepper motor 28BYJ-48 using ATtiny13. The code is on Github, click here. Parts Required ATtiny13  – i.e. MBAVR-1 development board stepper motor 28BYJ-48 with driver on ULN2003 Circuit Diagram Software This code is written in C and can be compiled using the avr-gcc. All information about how to compile this project is here. /** * … Read more

ATtiny13 – randomly flashing LED with PRNG based on BBS

This project is very similar to ATtiny13 – randomly flashing LED with PRNG based on LFSR. However, this time I used BBS (Blum-Blum-Shumb) algorithm as PRNG (Pseudo Random Number Generator) to generate 16-bit (pseudo) random numbers. The less significant bit of randomly generated number is a major factor in decision to on/off the LED. The code is on Github, click here Parts Required … Read more

ATtiny13 – hardware PWM

This article shows how to make an ATtiny13 to generate hardware PWM (Pulse Width Modulation) signal. The example code uses timer in Fast PWM mode (WGM02:0 = 3, see manual section 11.7.3). In this mode, by setting the COM0A1:0 bits to one, the compare unit allows generation of PWM waveforms on the AC0A pin (PB0) with duty resolution 0..255. The presented example … Read more

Bit-level operations – check integer is even or odd

In this short article I will exaplain how to use bit-level operations to verify that integer is even or odd. It’s very useful and fast verification. Examples below have been compiled and tested using gnu-gcc. $/> gcc example.c -o example CHECK EVEN To verify that integer is even we need to check first bit is not set. #include <stdint.h> #include <assert.h> … Read more

Bit-level operations – bit flags and bit masks

This article introduces to bit flags, bit masks and basic bit-level operations on them. In the world of microcontrollers, when you need to save a boolean values (true/false) then it can be useful to “pack” individual boolean values into a single integer value for storage efficiency purposes. This is done by using the bitwise and shift operators to set, clear, … Read more

Microcontrollers and basic bit-level operations

Why it’s so important to know how it works? Well, if you’re making a software for microcontrollers you have to use it in many places in the code to for example manipulate table of processor registers. It also helps to make the program smaller, much faster and allows to perform neat tricks (this isn’t always … Read more