- Provide a simple and cheap educational embedded project
- Demonstrate basic electric design
- Demonstrate both C++ basics and advanced tricks
- More entertaining first program than a 'Hello world'
- Educate for software design in low-end environments
- The schematics and the PCB board can be found in the hw folder. You can open the files with KiCAD 6
- The software is in the sw folder. Do not forget to also pull the git submodules!
- The build environment for the software includes avr-gcc 11.2, avrdude 6.4 and make 4.3
- Do not connect the battery when using a 5V ISP!
- After building the PCB, connect an STK500 or similar, and type
make program
- You can switch animations with the reset button
- CR2032 holder
- CR2032
- 100 nF capacitor
- Yellow LEDs (x5)
- 120 ohm resistors (x5)
- 9.1 kohm resistor
- Button
- ATtiny13A
The timer overflow interrupt drives a soft-PWM routine. The running animation changes an array of the LEDs' duty cycles. Resetting the device, the content of the SRAM is not random, so the index of the last animation is known, except for the cold-start, when it is random (not a problem). Some data is stored in the EEPROM to save space.
- Fuse calculation could be more describing
- May further optimize base code
- Less numeric constant
sudo apt intsall gcc-avr avr-libc make avrdude
cd sw
make
make program
sudo apt install kdevelop #Optional
- Install the lates AVR-GCC (for eg. https://blog.zakkemble.net/avr-gcc-builds/)
- Install Code::Blocks (https://www.codeblocks.org/)
- Open the project, and compile the elf file
- Use the driver of the programmer to deploy the code
Sometimes the programmers' device files are created with special permission on linux based systems. You should gather unix group membership to the proper group (dialout, uucp etc.), so you can program your device without sudo