Photography Timer based on Atmega8 controller, OLED display and button controls.
- USB Based boot loader (based on baerwolf's code)
- Minimalsitic SSD1306 driver
- SoftSwitch power on
This project contains Circuit Schematic, PCB Layout, bootloader (Customized), Main Application
This project demonstrates using linker scripts to place code bases at specific location and re-using them across different codes
- Bootloader also implements a minimalistic SSD1306 driver. As the bootloader space in ATMEGA8 is limited to 2k (start address
0x1800
), the driver is placed at0x1600
which can be accessed through absolute addressing - The application program (the actual timelapse code) makes use of this SSD1306 driver through absolute addressing
- Bootloader
- SSD1306 Driver
- Integrate SSD1306 Driver with bootloader, and display a USB icon when in boot load mode
- Update Makefile for bootloader to generate liner script for display driver entry points to be accessed by application program
- Design the PCB
- Get PCB Fabricated
- Framework for the application
- Main application program
UPDATE 1: Added power off code in bootloader
UPDATE 2: Initial dummy firmware implemented which is simple counter
UPDATE 3: got the fabricated PCB, assembled, and uploaded the bootloader & the dummy firmware... till now all working
UPDATE 4: Framework for main application ready
I thought of fabricating the board myself. Due to insufficient time, I have ordered from online fab. I had two options for shipment either too expencive and fast delivery or too slow with easy on pockets. I have chosen the latter, waiting for the board to arrive
IMPORTANT Update : I found a issue with the power on circuitory that the internal IO driver transistor is too leakey and is permanently turning on the PMOS power gate. Hence I have added additional NMOS (2n7002
) to ground externally
The bootloader and firmware are developed using barebone avr-gcc
and avr-libc
Install avr-gcc
and avr-libc
. Under Windows you may chose to use WinAVR.
Under linux (Ubuntu
epsecially)
sudo apt install gcc-avr avr-libc
You will also need gmake (generally part of the installation). If not, install using
sudo apt install make
Compile using make
The board is designed with external oscillator module. Hence the below fuse settings are used for Atmega8
lfuse: 1 1 0 0 0 0 0 0 = 0xC0
| | | | | | | |
| | | | | | | +- CKSEL0 - External Clock
| | | | | | +--- CKSEL1
| | | | | +----- CKSEL2
| | | | +------- CKSEL3
| | | +--------- SUT0 - Startup Time 0ms
| | +----------- SUT1
| +------------- BODEN - Brown-out detection disabled
+--------------- BODLEVEL - Brown-out detection level (N/A)
hfuse: 1 1 0 0 1 0 0 0 = 0xC8
| | | | | | | |
| | | | | | | +- BOOTRST - Reset boots to boot loader
| | | | | | +--- BOOTSZ0 - Boot section size 2k
| | | | | +----- BOOTSZ1
| | | | +------- EESAVE - No EEPROM save on program
| | | +--------- CKOPT - Full Swing Clock
| | +----------- SPIEN - Serial programming enabled
| +------------- WTDON - Watchdog Timer disabled
+--------------- RSTDISBL - Reset not disabled
Program the above fuses using:
avrdude -p atmega8 -P usb -c usbasp -U lfuse:w:0xC0:m -U hfuse:w:0xC8:m
The bootloader and the fuse settings have to be uploaded using any other method of loading (Using Arduino as ISP or USBAsp programmer). Once programmed, the controller can be soldered to the application board and the programmed bootloader be used to upload the main firmware.
3D Model of display side of the board
3D Model of component side of the board
Full documentation can be found here
PCB is designed using
Download KiCad project files here
Schematic can be found here
email: [email protected]