Tuesday, December 30, 2008

AVR in sleep mode. (power saving mode)

I used AVR tiny13 for small applications very often, and mostly it is powered by only small battery. It is easy to put the AVR MCU to power save mode with avrlib, just few lines of code would do. To wake up the AVR MCU, you should setup interrupt before falling into sleep mode, either pin change interrupt or external INT0.

Here is my sample code (waked up by pin change interrupt)

//do nothing in interrupt func.

//main code:

//setup interrupt
GIMSK |= 1<< PCIE;
PCMSK |= 1<< PCINT0;

on_bulb(); //turn on light bulb

while(1) {
b1_low; //turn off
sei(); //enable interrupt
set_sleep_mode(SLEEP_MODE_PWR_DOWN); //set sleep mode
sleep_mode(); //sleep now
//wake up point here //

while (PINB & 0x1) { //if PINB is high


I only measured once I finished the demo circuit, and it should use around 10 times less power when AVR is in sleep mode. Have fun.

Thursday, December 18, 2008

PIR motion sensing.

When we design lighting circuit, we would like to light up the LEDs only when there is somebody around. The PIR sensor is a motion sensor based on passive infrared sensor which senses infrared emitted by human body. I got the PIR Module "KC7783R" from local store, which includes the PIR sesnor and also the KC7783 motion detection IC.

The PIR module is very easy to use, it contains only 3 pins (1-Signal, 2-Vcc, 3-Gnd), where it detects somebody moving, the signal line goes high for a period of time (3 secs for example).

Here is my test circuit to drive one auto-flashing RGB Led with PIR module:

Live action:

My another demo of using PIR module, combining the use of AVRtiny13 as a timer. When it detects motion, it will light up the light bulb for 10 seconds, afterward it will go into deep sleep to save power and wait for the next interrupt send by PIR module.

Video demo:

Monday, December 8, 2008

Making a Digital Clock.

Digital Clock is a good start project for learning microcontroller, Naliga used a PIC MCU to make a digital clock, includes schematic, pcb layout and source codes. It is easy to follow and detail, you can find the link here:


Thursday, November 20, 2008

Grow LED when Dark.

We love simplicity, Evil Mad Scientist Labs proposed a simple and Cheap Dark-detecting LED circuit, only few components can work it out!


Monday, November 17, 2008

PAL TV game only need one ATmega!

It is an open source project called "AVGA", which uses only a single AVR ATMega168 to create a super mario clone. Schematics and firmwares are provided freely!


Monday, November 3, 2008

Gorgeous LED Egg

After I completed the LED egg prototype with Atmel AVRtiny13 and a 10x10 LED matrix, I passed the LED egg to kaas, she worked very hard to decorate the LED egg case. It is very pretty now and I am happy to show you here.

For those who are interested in the details of the electronics, please check out my previous post:


After(click to view full sized image):

Sunday, October 26, 2008

LED used as touch/light sensor

LED is a light emitting diode, it is commonly used as output device. But by connecting each end with GPIO, you can use it as input device with some software tricks. This idea is cool, and I remember the first time when I got this idea was from the cool research site "Multi-Touch Sensing through LED Matrix Displays", you can find the information here:

Recently, I found someone use the same idea to implement a LED input sensing demo with ATmega8, it is very interesting.

Wednesday, October 22, 2008

Tuesday, October 21, 2008

LED figure in Japan.

Just come across this funny toy, the paints on the figure looks like RGB Led, and it is equipped with LED inside, it grows in dark:)

Monday, October 20, 2008

AVR tiny powered by Lemon!!


Tiny13V is aimed for running on low power condition! How low is it? It can be powered by the natural battery "Lemon".

Monday, October 6, 2008

Procyon AVRLib - C-language Function Libary by Pascal Stang.

Pascal Stang is really nice to make the AVRlib freely available for AVR developers. (he is also the author of ARMLib).

The AVR Lib contains codes for nearly all the function that AVR chip provide, eg. UART, I2C, SPI, PWM etc. Also it includes some high level functions like IDE/CF, GPS, LCD modules.

I didn't try it, but I am going to use it for the next project. Stay tuned.


Friday, September 19, 2008

Research on accessing SD card with AVR.

Using AVR as a data logging system is cool, but data storage is a great problem as external eeprom or flash memory may be too small and expensive. I guess most of us have some 16MB and smaller SD card on your desk because nowadays you are using 2G SD cards on your camera!

Here are some links may useful:

Tuesday, September 16, 2008

4D OLED with Arduino.

4D Systems makes some really nice serial OLEDS. They aren't hard to use, but the documentation for them is very scattered. This tutorial pulls together the various pieces i've found so that you can get up and running very quickly.


Bandai Lumindot for children!

Lumindot is a new kind of toy for children produced by Bandai, it is a Backlit frame with 70x50 holes on it, so you can put the colorful pins in the hole. It is a very cool way to do pixel arts, it looks like a 70x50 Led matrix if you know about electronics.

Demo video:


Friday, September 12, 2008

Recommend Book: iWoz by Steve Wozniak/Gina Smith

Recently, I am addicted to this book "iWoz" by Steve Wozniak, who is the co-founder of Apple.
He shares the experiences, thought of making all the cool products and inventions in an engineer perspective or he claims that is an artist view. He can also help you understand how the first home computer was born: the Apple I & II. He is really a fun person and passionate about technology and who really want to use technology to improve people's life.



Handmade Accessory with Ponoko!

I have made one cell phone strip and one necklace by using the laser-cut service provided by Ponoko. You prepare a vector graphic design and choose what materials (plastic or wood) to cut out your masterpieces in Ponoko.

It is pretty good though the shipping cost is really too much for me. Anyway, I worked it out. I think it may be a good idea to make your robot parts or your electronic project enclosure next time with this online laser cut service.

My product:
Sakura phone strip & necklace:

Make your own now:

Monday, August 25, 2008

STK500 Development Kit foR AVR

It is my favourite Kit so far, it is very handy and easy to use.

Recently, AVR TV released a video about STK500, If you are interested, please take a look here:


Monday, August 18, 2008

Comprehensive AVR LED game console kit.

It is an AVR LED game console kit made in japan. It uses ATmega160 and four 74HS595 chips to extend output pins for controlling a 16x16 dot matrix led panel. It also comes with a speaker and joystick to help you start making a cool gaming console!

Cool demo video:

http://nicotak.com/avr/ledgame.html(Japanese only)

Tuesday, August 12, 2008

Simple Balancing robot

No fancy accelerometers, no complicated algorithm and circuits. Only a motor and a simple touch sensor, it is really cool to see such small and neat robot.


Monday, August 11, 2008

AVRtv youtube channel.

Just came across a AVRtv channel on youtube, it is the ATMEL AVR marketing channel for promoting new microcontrollers, recently playing XMEGA, and also the new UC3 series.

Check it out!



Monday, August 4, 2008

Giant Digital Clock with CD Holder

A giant digital LED clock with CD holder, you will never lost in time while you are enjoying your music:)

The detail specificiation:

CD Clock

Giant Digital Clock w CD Holder
Red Color LED clock
Size 73 x 13 x 36 cm
Included Adaptor
Box packing


Sunday, August 3, 2008

Fancy LEDS (Led Matrix with PIC)

One simple PIC 16F628, few transistors and resistors, and 36 LEDS.,
Olivier worked with his son to make this lovely project. He also wrote a VB application to generate the LED pattern to ease of the works of his son. In his site, circuit diagram is also included, it is definely a lite project for fun.


Saturday, August 2, 2008

Arduino with 8x8 LED matrix

Bryan from HK who did a test run of using MAX7219 LED drivers on Arduino.

He also used camera as input and output the 8x8 Led matrix, of course the matrix cannot output the whole image, but it will be an semi-random pattern.


Monday, July 28, 2008

AVR Assembler Tutorial

I found a very good site about programming AVR in assembly. The main idea of this site is that Learning by practical examples!

Some highlights:
1) Stepper motor control with AVR Tiny13
2) Egg timer design with AVR Tiny2313

Here is the site: http://www.avr-asm-tutorial.net/

Saturday, July 26, 2008

Using only AVR to produce both Video & Sound

The device is called "Craft" by www.linusakesson.net, it used only one ATmega88 to producce both video & sound on the TV. The animation is awesome, please take a look:

Thursday, July 24, 2008

Nixie Tube Clock.

I always want to build a nixie clock, but it is difficult to find the nixie tube and also the tube driver ICs. The kit available on the internet is still expensive for me.

Here is a cool video of nixie tube filling with blue led, it becomes more attractive!

Sunday, July 6, 2008

CTC mode on Tiny13

There are two OC0A and OC0B compare outputs in Tiny13. It is useful to generate waveform . In this example, we use OC0A to output a square wave to blink the LED which is very similar to the previous timer interrupt example instead the output is generate inside Tiny13 but not our interrupt routine.

int main (void)
b0_output; //OC0A as led output

TCCR0B = 0x03; //select timer clkio/64

TCCR0A = (0x01)<<6 | 0x02; // Toggle OC0A | CTC MODE
TCNT0 = 0x0; //starting couter value

OCR0A = 0x7F; //around frequency @ 2.2HZ

//make the clk cpu slower
CLKPR = 1<<CLKPCE; //tell cpu to update the CLKPR

CLKPR = 0x8; //clkio = clkcpu/256

while(1) {
;; //interrupt do the rest

We set the output to be toggled every time the counter value match our OCR0A value. Thus, a square wave is generated:

The complete project can be found here: http://labs.bitartist.org/compare_int.tar.gz

Timer interrupt on Tiny13

Sometimes we have to do somethings in certain period, so timer may be useful for you.
AVR tiny13 have one timer and it count until to 0xFF value for each clock. An interrupt will be then generated and call your interrupt routine.

In our example, we have the following interrupt routine:

ISR(TIM0_OVF_vect) {
if (led){
led = 0;
} else {
led = 1;

This routine is used to toggle the LED On or Off.

The complete project code can be found here: http://labs.bitartist.org/timer_int.tar.gz

Testing external interrupt INT0 on tiny13

Tiny 13 have an external interrupt "INT0" on PB1, We have created a test project on avr-gcc to have a quick testing on the INT0.

#include <avr/io.h>
#include <avr/interrupt.h>
#include "pin_macros.h"

unsigned char led=0;

ISR(INT0_vect) {
if (led){
led = 0;
} else {
led = 1;

int main (void)
b1_input; //switch
b0_output; //led output

MCUCR = 1<<isc01; //set INT0 as falling edge trigger

GIMSK = 1<<INT0; //enable INTO in global interrupt mask

sei(); //enable interrupt

while(1) {
;; //interrupt do the rest

B1 is connected to a switch, and B0 is connected to a LED.
When B1 is pressed, it would toggle the LED On or Off.

Download the whole project : http://labs.bitartist.org/test_int0.tar.gz


Sunday, June 29, 2008

Gif2led released, and with AVR LED Egg demostration!

We have worked on LED matrix for so many times, but mostly for text scrolling, so how about make some animations on it? But we are too lazy to make the animation patterns to the C header file in an array of bytes. We finally finished one tool may be useful for all led matrix lovers!

The gif2led project is written in Ruby, required Rmagick library for gif manipulation. It is mainly designed for 8 or less columns matrix, for instance 8x8 matrix, 10x8 matrix, 5x7 matrix etc. It output an pattern header file with a 2D array frame by frame from an animated gif input. We only tested with AVR-gcc, but it should be useful for other MCUs too. You can find more information on the gif2led project page, http://labs.bitartist.org/gif2led/

Let start with our demonstration, the project is called LED Egg, it is based on a 10x10 matrix (but we only use 10x8 in our case) with an Egg case to hold the circuit board.

To prepare the animated gif, we use macromedia Flash, and here is the screenshot:

Noted that the frame 0 (marked as CAL above) is a special frame, which used for calibration. When used with gif2led tool, the frame 0 is the pattern of your led matrix with all led ON.

and then export the movie to an animated gif:

Then simply run the following command, we can obtain the 2D array header file:
ruby gif2led pattern.gif 20 > pattern.h
//selected ratio is 20.0%
//Cal result: LED Matrix (row*col) = (10*8)
const unsigned char pattern[63][10] PROGMEM = { //Frame 0 {0x42,0x00,0xa5,0x00,0x84,0x21,0x00,0x42,0x21,0x84} //Frame 1 ,{0x00,0xa5,0x00,0x84,0x21,0x00,0x42,0x21,0x84,0x42}
#define MAX_FRAME 63
#define ROWS 10
Now, we have to prepare the circuit part, we use AVR tiny13 together with 4017, please refer to the circuit diagram<here>. 4017 is used as a row counter, and such that we can only use 1 pin for row shifting. The remaining 4 IOs of the tiny13 would use for column output, we are using 10x8 matrix this time, so we assume the pattern is symteric to save pins, so 1 I/O drive 2 columns in our case. The circuit showed below:

So Lets add an egg case, the egg is made from pu foam plastic, it is used for Easter decoration.

Video demonstration:

Close look on the LED pattern:

To download the gif2led tool, AVR source codes, and flash template, please find in the following links:

Gif2led project page:

Gif2led Rubyforge page:

Thursday, June 19, 2008

Philips LED Lamp Featuring 16M colors!

Wow, philips worked on many LED products recently, and here we have a LED lamp for your living room.
May be someone can use for some art projects. The controller is very cool, it is a touch wheel and you can change and set the color easily. May be you can try to set the color to reflect your mood everyday. Enjoy.

More Info by unplggd

Saturday, June 14, 2008

The Propeller Clock (POV clock)

Just come across this cool video of a DIY propeller clock, it is based on the concept of POV system. The basic components are motor for spinning, LEDs for display and the microprocessor for the main control. Please take a look:

Tuesday, June 10, 2008

Quad core Arduino tower!

Arduino is an easy to use AVR platform, you can program it easily using serial port, and power it up with USB. With a very nice IDE and cool user library.

If you think the AVR on the arduino is not powerful enough for your project, let's consider the quad core arduino tower:

Quad core Arduino Tower

Tuesday, June 3, 2008

Parallax Propeller Processor

The Propeller chip makes it easy to rapidly develop embedded applications. Its eight processors (cogs) can operate simultaneously, either independently or cooperatively, sharing common resources through a central hub. The developer has full control over how and when each cog is employed; there is no compiler-driven or operating system-driven splitting of tasks among multiple cogs. A shared system clock keeps each cog on the same time reference, allowing for true deterministic timing and synchronization. Two programming languages are available: the easy-to-learn high-level Spin, and Propeller Assembly which can execute at up to 160 MIPS (20 MIPS per cog).

It is a powerful embedded processor from Parallax Inc, a well known embedded processor "PIC" inventor. With 8 cores, and total about 160MIPS processing power, you can do many amazing projects. You can see the above video involved many image processing!

another amazing project is the ybox2:

Adding an Ethernet chip, now you can access the internet cloud with a microprocessor that's capable of running a TCP/IP stack.
This ybox2 can fetch information like weather, news from the internet and display it on TV which let me think of chumby widget devices.

Project site : ybox2

Processor info: http://www.parallax.com/Default.aspx?tabid=407

Thursday, May 15, 2008

Philips LumaLive, LEDs embedded in flexible material.

Lumalive light-emitting textiles is very attractive technology developed by Philips.

A lumalive display panel with 14x14 RGB leds, using a special driver board, you can download the animation or text message via USB.

Philips Lumalive is a new medium to convey emotions and messages. It creates a positive spirit and boosts your energy level. We use colorful dynamic animations on textile products like garments, to make an unexpected striking appearance.
By integrating multicolor LEDs (light-emitting diodes) into textile objects Philips Lumalive transforms them into communication platforms, while their textile look & feel retains. This is a distinctive way to experience, communicate and personalize.

LumaLive by Philips

Wednesday, May 14, 2008

DIY EL BackLit Photo Frame.

Electroluminescent(EL) technology always uses in the backlit of small LCD. From wikipedia:

Electroluminescence is the result of radiative recombination of electrons and holes in a material (usually a semiconductor). The excited electrons release their energy as photons - light

Anyway, it is good for lighting.

I got the EL panel in a local store which should be powder phosphor-based electroluminescent panel. It is a 3.5" x 4.6" white light panel.

It included an adapter for converting 12VDC to AC for the EL panel.

Let's see how we can make use of this EL lamp.

1. Use for slice viewing

2. Put a Post-It on it, and you can see a growing Post-It in the dark.

3. For home lighting, illuminate your Toys.

4. A BackLit Photo Frame

Step 1 -
To make a DIY backLit photo frame, you can get a large photo frame in store or you can make one yourself. Here we are:

Step 2 -
Glue the panel in the back cover of the photo frame. You can see there is about 1.5 inch space between the photo glass panel and the back cover. We like to have some distances apart the EL panel and the glass to diffuse the strong illumination of the EL.

Step 3 -
Power Up.

It looks alot better on my desk, sorry for my poor photo skill. Let's see the photo frame in action in the below youtube video. Enjoy It.

Anyone who want to get this EL panel (3.5" x 4.6"), We can order it for you. It is only US$15, and $5 for shipping to US and Canada. For payment, We use paypal. Please contact us: order@bitartist.org

Sunday, May 11, 2008

Art robot play music learning from surrounding.

Simple automatic instruments are constructed from local materials and objects on site. The system learns the sounds it can make by trying out its instruments, and then uses its range of sounds to try to reproduce the rhythmic and melodic qualities of sounds such as the voices of visitors. It then loops and alters these imitative sequences into improvised compositions. (That last part's not done yet, so you won't see it in the video.)

It is very cool, the robot plays the instruments with servo motors until it matches the surrounding music/tone. It needs sometime to make it right, still it is an amazing project.

Please check out the video:

installation proposal for artbots 2008 from ranjit on Vimeo.

Wednesday, April 16, 2008

Hydrogen Fuel Cell Toy Cars.

Hydrogen fuel cell is the next green source of energy, by breaking down water (H2o) into hydrogen (H2) and oxygen (O2), the hydrogen can be used for energy generation afterward.
It is still a long way to go in normal usage, but how well is the technology now?

Horizon Full Cell Technology introduced a Toy Car using their fuel cell technology. You can buy a toy car in affordable price to taste this bleeding edge technology.

Check out the youtube video:


Horizon Full Cell Tech Toy:

RC model:

Saturday, March 22, 2008

Sky Color Project - What is the color of the sky today?

In this easter, we finished a "non-electronic" project and find no where to post. Hope it is not so off topic here:)

There are few web cameras installed to monitor the weather or traffic conditions online, so what else information can we get from these images? One important thing to us is the color of the sky. It is a sign of weather and also the pollution condition. So this small project comes up.

we developed a program to analyze the color of the images and look for the best blue.

The process includes four steps:
1) Fetching image from the web camera (an automatic web image fetcher is used)
2) Color Segmentation (Masking out the non-sky component)
3) Analyze the blueness (Finding out the best blue)
4) Output a small square image colored in best blue found in step 3

The color segmentation is the most difficult part, the blueness is hard to define. Luckily, we can easily find many digital images nowadays in flickr or other online gallery system. We used the images to train our color segmentation engine and also with some human fine tunings.

We got 365 images from the Hong Kong Observatory (Yes, we live in HK) in the year 2006.
The sky with no blue-like color is ignored in step 4, it happened in cloudy or rainy or dusty day and so you will see a gray or white cloudy sky, i.e. no color captured.

A processed image from step 1 - 3
(Buildings are masked)

A sky color palette is generated for the year 2006 in HK:

- the pink box is the start of the month (e.g. JAN)

In a statistical view, we make a sky color bar chart for each month.

What we can get in this chart?
1) Second half of the year, we get a clearer sky.
2) In August, we have more blue sky days.