Servo motor is very useful in robotic. I used servo motors to create few robots in the past. But I never think of using servo motor as input device, and mahto did it. Making servo motor as input device, you can now record the position of the servo motor and play it back the sequence of actions afterward.
First, install the packages (avr-gcc, binutils etc) for compiling/linking AVR programs in Mac OS X. I followed the instruction here: Programming an AVR microcontroller
Afterward, it is time to start my first led program in C.
I decide to use PB0 as led output, I connect the PB0 to Led0 on STk500 to start this testing program quickly.
#include <avr/io.h>
#define F_CPU 120000
#include <util/delay.h>
int main (void)
{
// set PB.0 as output pin
DDRB = 0x01;
// set PB.0 to output high
PORTB = 0x01;
while (1) {
PORTB ^= 0x01;
_delay_loop_2(65535);
}
}
Compile the program:
avr-gcc led_blink.c -o led.elf -mmcu=attiny13
Convert the elf format to hex format for flashing to the Tiny13:
avr-objcopy -O ihex led.elf led.rom
Prepare avrdude for Mac to flash program and find out the serial port device name on your Mac OS X. I am using usb2serial adapter, the serial port device is /dev/cu.usbserial and connected to stk500 RS232 CTRL port with the serial cable provided in stk500 kit.
The STK500 comes with a manual with all the instructions for programming the AVR processors. The only problem is that I want to use it to program the AVR tiny13 which is not yet ready when the time the manual was printed. After searching on the web, I found out that the instructions are ready on the help page of the latest AVR Studio for Windows. Finally, I can program my AVR tiny13 with STK500. I am using my Mac to program the AVR tiny13, so I better write it down here. Hope it may help you also.
Step 1 – Place the ATtiny13 (DIP) to the SCKT3400D1.
Step 2 – Connect the ISP6PIN socket to SROG1 with the 6-pin cable provided.
Step 3 – Connect the PORTE/RST to PORTB/PB5 and also PORTE/XT1 to PORTB/PB3. I used the 2 pin cables provided, it is a bit lossy.
I bought the STk500 at once when I saw the promotion from Atmel in the year 2007. It was only $49, only the cost of AVR dragon but together with the STK500! It is really a good beginner kit, I want to start with Atmel AVR and particularly the ATtiny processor series, the STK500 is very helpful indeed. It comes with one Atmel 8bit processor(ATMEGA8515L), serial cable, ISP cable (6-pin), and few 2-pin cables for fast prototyping. It can be used to program wide range of the Atmel 8-bit processors, together with Leds, switches for testing your programs on the STK500 board. The only drawback is that you have to use a serial port for programming which is mostly not present in modern computer or notebook, but a usb2serial adapter may help to resolve this problem even on my Mac. The AVR dragon is cool, but for a lazy guy like me that don’t want to construct a socket and also involving many soldering works, I rather stick on the STK500 for my home projects.
STk500/AVR dragon unbox photos
#1 – Arrived.
I ordered from DIGI-key, and this combo kit is marked as out of stock at that time. I back-order the kit and it came faster than I expected.
I got a very surprising gift from K. It is a 134 Leds xmas tree and framed nicely with a black photo wood frame!
She worked so hard on soldering 134 leds, Thank you. The kit was bought from local electronic store, should be the same as MK117 sold in this online store: http://store.qkits.com/moreinfo.cfm/MK117
I want to make something simple, small and elegant for my lover’s birthday. Finally I come up with using 5×7 dot matrix led to make a flower vase, it can be used to display some text messages for her:)
Here are the components:
1. 5×7 dot matrix led
2. Atmel AVR tiny13
3. 2 x 74HC595 shift register with Latch
4. 2 x wooden prototype boards
5. 1 x coin battery holder
6. 1 x CR2032 coin battery (3V)
7. 3 x paper flowers
8. semi-transparent brown mud (from Franc Franc)
9. Switch for turning ON/OFF
I want to make things small, so I put the 5×7 dot matrix led horizontally and used the 5×4 dot matrix font, such that it can nearly display 2 characters at a time. For the MCU part, AVR Atmel tiny13 is a very small MCU, it is quite suitable for this kind of small application. The only problem is that it has limited IO pins, I have to use 2 x 74HC595 chips to extend the output pins, so I can driver 5×7 dot matrix led with only 3 IO pins, i.e. Clock Data, Latch.
Sorry for not posting any circuit digram, as I make it in hurry. After I spend a lots of time soldering the lines linking between the leds and the shift registers, here is the circuit board:
Then, I program the AVR Tiny13 with the STK500, the socket on the prototype board is a DIP socket, so I program the Tiny13 on STK500 and then put it back on the board to test. After several hours, the software is done.
Let’s put all the things together! I really love the effect when putting the led matrix in the transparent mud, the brown color is a good match.
Video demo:
Lastly, don’t forget the packing!
Hope you all may find useful.
Please also check out the notes by bitartist, including schematic & source codes:
I want to make a simple circuit for my lover, so I come up with using four 7-segment LEDs to make the word “L O V E” for her.
List of materials:
1. Four 7-segment LEDs
2. Resistors
3. A wooden prototype board
4. USB cable cord
5. Solder iron
6. Paper Clip
7. A plastic box
8. Red papers
Step 1 – Paint the wooden prototype board in White.
Step 2 – Put the 7 segment LEDs on the board
Step 3 – Solder!
Simply connect the “ON” segment pins to +5V and ground each of segment.
I break the paper clips into three wires and organize them into three parallel lines to ease of soldering. You will see how simple it is. Finally cut of the usb cable and use only the +5v and GND lines. I didn’t have the many resistors around, so I put few of them and test the brightness. You can find the best resistor value yourself.
Step 4 – Power up by USB
Step 5 – Packing it
In order to make it nice enough to put near her computer desk, I put the board into the circular plastic box and put some red papers to it. Hah..looks like a LOVE bomb
I spent about 2 hours at mid-night to do this project, it is really simple and fun:)
Recent Comments