Blinkentree DE

From syn2cat - HackerSpace.lu
(Difference between revisions)
Jump to: navigation, search
(Created page with "{{Project |type=hardware |intro=BlinkenTree stellt eine der Weihnachtsaktivtäten des syn2cat Hackerspace dar. |status=running |meetings=none |contact=Slopjong, prometheus }} d")
 
Line 6: Line 6:
 
|contact=Slopjong, prometheus
 
|contact=Slopjong, prometheus
 
}}
 
}}
d
+
Um was geht es nun eigentlich bei diesem grünen blinkenden Tannenbaum?
 +
 
 +
Als kreative Hacker dachten wir uns, dass wir uns für den Weihnachtsmark der Gemeinde etwas besonderes ausdenken werden. Resultat? Der BlinkenTree. Wie sich erkennen lässt, repräsentiert der BlinkenTree einen Tannanebaum und die Weinachstbeleuchtung wird mit Hilfe von blinkenden LEDs realisiert.
 +
 
 +
As hackerspaces are places with creative hackers, we thought it would be necessary to support the Christmas market of the commune of Strassen with something tiny, but creative. Result? The Blinkentree. Obviously it represents a green fir tree that is dorned with flashing LEDs which should represent the baubles of a 'real' tree.
 +
 
 +
'''A big thanks to all of you folks who purchsed a Blinkentree and thus supporting syn2cat Hackerspace.'''
 +
 
 +
 
 +
'''''Hacky Christmas!'''''
 +
 
 +
== How to programm it on your own?  ==
 +
 
 +
We designed our Blinkentree in a way you can customize it by yourself. You can define your own flashing patterns using the C language that you can transfer to your chip using the USBasp programmer.
 +
 
 +
=== Installing and confguring the tools  ===
 +
 
 +
This section describes what you need to program the chip. First you need the toolchain with the compiler which translates your program text into bits and bytes that the controller can execute. We are using the GCC compiler which is  part of the WinAVR (Windows) and CrossPack (Mac).
 +
 
 +
If you use Windows download [http://sourceforge.net/projects/winavr/files/WinAVR/20100110/WinAVR-20100110-install.exe/download WinAVR] and follow the installtion guide. When the installater asks to make an entry in the PATH variable be sure this is checked.
 +
 
 +
For a mac you have to download [http://www.obdev.at/downloads/crosspack/CrossPack-AVR-20100115.dmg CrossPack AVR]. The toolchain is installed into /usr/local/CrossPack-AVR <ref>/usr/local/CrossPack-AVR is just a symbolic link to /usr/local/CrossPack-AVR-20100115 or something like that.</ref>
 +
 
 +
<!--
 +
TODO: Build flash the USBasp with a firmware that AVR Studio supports and then describe how the studio works
 +
Then download the [[AVR Studio || http://www.atmel.com/forms/software_download.asp?family_id=607&fn=dl_AvrStudio4Setup.exe]]
 +
-->
 +
 
 +
 
 +
=== Coding  ===
 +
 
 +
<pre>
 +
#include &lt;avr/io.h&gt;
 +
#include &lt;util/delay.h&gt;
 +
 
 +
int main(void) {
 +
 
 +
    // configure the ports as outputs
 +
    DDRD = 0xFF;
 +
    DDRB = 0xFF;
 +
   
 +
    while(1)
 +
    {
 +
            PORTB = 255;
 +
            PORTD = 0;
 +
           
 +
            _delay_ms(400);
 +
           
 +
            PORTB = 0;
 +
            PORTD = 255;
 +
           
 +
            _delay_ms(400);
 +
    }
 +
 
 +
}
 +
</pre>
 +
 
 +
=== Compiling and linking ===
 +
 
 +
After you're done with the programming, the code must be translated into machine code that can be executed by the microcontroller.
 +
 
 +
<pre>
 +
avr-gcc -Wall -Os -std=c99 -DF_CPU=1000000 -mmcu=attiny2313 -c main.c -o main.o avr-gcc -Wall -Os -std=c99 -DF_CPU=1000000 -mmcu=attiny2313 -o main.elf main.o avr-objcopy -O ihex -R .eeprom main.elf main.hex
 +
</pre>
 +
 
 +
You can use the compile.sh script.
 +
 
 +
=== Setting the fuse bits ===
 +
 
 +
Before the compiled code can be loaded into the microcontroller it has to be configured first. This is done by setting the fuse bits. Thus you execute the following line:
 +
 
 +
<pre>
 +
sudo avrdude -cUSBasp -p t2313 -U lfuse:w:0x64:m -U hfuse:w:0xdf:m -U efuse:w:0xff:m
 +
</pre>
 +
 
 +
There are three fuse bytes ( = 24 bits in total). collection of bits stands for a base or a module configuration (Fuse Bits, page 160). Use the fusecalc to be sure to have the right ones.
 +
 
 +
=== Flashing the microcontroller ===
 +
 
 +
<pre>
 +
sudo avrdude -c USBasp -p t2313 -U flash:w:main.hex -v -F
 +
</pre>
 +
 
 +
== References ==

Revision as of 22:01, 6 December 2010

Add your Project
Crystal Project package graphics.png
Blinkentree DE
BlinkenTree stellt eine der Weihnachtsaktivtäten des syn2cat Hackerspace dar.
G8033.png
Meetings: none
Type: hardware


Status: running
Members:
Contact Person: Slopjong (mail), prometheus (mail)
Tools
QrCode: QR-e02cb653e64f0390baffba3da64bbfe2.png

"File:" cannot be used as a page name in this wiki.


Um was geht es nun eigentlich bei diesem grünen blinkenden Tannenbaum?

Als kreative Hacker dachten wir uns, dass wir uns für den Weihnachtsmark der Gemeinde etwas besonderes ausdenken werden. Resultat? Der BlinkenTree. Wie sich erkennen lässt, repräsentiert der BlinkenTree einen Tannanebaum und die Weinachstbeleuchtung wird mit Hilfe von blinkenden LEDs realisiert.

As hackerspaces are places with creative hackers, we thought it would be necessary to support the Christmas market of the commune of Strassen with something tiny, but creative. Result? The Blinkentree. Obviously it represents a green fir tree that is dorned with flashing LEDs which should represent the baubles of a 'real' tree.

A big thanks to all of you folks who purchsed a Blinkentree and thus supporting syn2cat Hackerspace.


Hacky Christmas!

Contents

How to programm it on your own?

We designed our Blinkentree in a way you can customize it by yourself. You can define your own flashing patterns using the C language that you can transfer to your chip using the USBasp programmer.

Installing and confguring the tools

This section describes what you need to program the chip. First you need the toolchain with the compiler which translates your program text into bits and bytes that the controller can execute. We are using the GCC compiler which is part of the WinAVR (Windows) and CrossPack (Mac).

If you use Windows download WinAVR and follow the installtion guide. When the installater asks to make an entry in the PATH variable be sure this is checked.

For a mac you have to download CrossPack AVR. The toolchain is installed into /usr/local/CrossPack-AVR [1]


Coding

#include <avr/io.h> 
#include <util/delay.h>

int main(void) { 

    // configure the ports as outputs 
    DDRD = 0xFF;
    DDRB = 0xFF;
    
    while(1)
    {
            PORTB = 255;
            PORTD = 0;
            
            _delay_ms(400);
            
            PORTB = 0;
            PORTD = 255;
            
            _delay_ms(400);
    }

} 

Compiling and linking

After you're done with the programming, the code must be translated into machine code that can be executed by the microcontroller.

avr-gcc -Wall -Os -std=c99 -DF_CPU=1000000 -mmcu=attiny2313 -c main.c -o main.o avr-gcc -Wall -Os -std=c99 -DF_CPU=1000000 -mmcu=attiny2313 -o main.elf main.o avr-objcopy -O ihex -R .eeprom main.elf main.hex 

You can use the compile.sh script.

Setting the fuse bits

Before the compiled code can be loaded into the microcontroller it has to be configured first. This is done by setting the fuse bits. Thus you execute the following line:

sudo avrdude -cUSBasp -p t2313 -U lfuse:w:0x64:m -U hfuse:w:0xdf:m -U efuse:w:0xff:m 

There are three fuse bytes ( = 24 bits in total). collection of bits stands for a base or a module configuration (Fuse Bits, page 160). Use the fusecalc to be sure to have the right ones.

Flashing the microcontroller

sudo avrdude -c USBasp -p t2313 -U flash:w:main.hex -v -F

References


Cite error: <ref> tags exist, but no <references/> tag was found
Personal tools
Namespaces

Variants
Actions
Navigation
syn2cat
Hackerspace
Activities
Initiatives
Community
Tools
Tools