01ea07165b | ||
---|---|---|
pre_built | ||
.gitignore | ||
README.md | ||
avrdude.conf | ||
avrdude.exe | ||
avrdude.pdb | ||
flash_atiny13.ps1 | ||
main.c | ||
makefile | ||
zadig-2.8.exe |
README.md
AVR ATiny13 Project 002
This is the firmware for a latching dual relay system. It allows the user to switch two DPDT relays by with two seperate switches.
Componets:
Micro: AVR ATiny13, ATiny25/45/85
Instructions:
- Power the system using a 1.8v~5.5v power supply
- Set/program the AVR to use a 1MHz clock rate.
- Connect the pins as described above.
ACTIVATING RELAYS:
- Activate the desired button with a quick press <= 350ms.
- Repeat to toggle the relay.
TEMPORARY TOGGLE:
- Press and hold the desired button >= 350ms.
- Let go to disable.
SAVING SETTINGS:
- Press and hold the target button.
- While holding the button power cycle the device.
- When the setting is sucessfully saved the relay/led will blink/toggle.
- repeat until desired preset is saved.
Technical Aspects:
The use of C style bitfields has been used inside a struct to maintain a global state. It minimizes the size of the binary once compiled.
The majority of the code is blocking/polling; overhead from introducing interrupts and ISR(interrupt service routines) wasn't as clean and made it more platform dependent.
The code right now can for the most part be ported to any AVR micro-controller with no changes.
BUILDING PROJECT:
On Unix
git clone <REPOURL>
cd <REPO>
make flash
Flashing the Project
On Windows
- Install the usbasp driver:
- plug in usbasp device.
- run the 'zadig-2.8.exe' program
- select the libusb 32 on the right by clicking the down arrow to select.
- open powershell
- navigate to the repo directory cd Downloads\gf_002
- enter the command below.
./avrdude.exe -p t13 -c usbasp -B 125kHz -U flash:w:.\pre_built\atiny13_4-8Mhz.hex
- If you have the powershell execution policy set to allow scripts:
- run flash_atiny13.ps1