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.
ISR(PCINT0_vect){
cli();
}


//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
on_bulb();
}

}


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:

Link:
http://picnote.blogspot.com/2008/06/making-digital-clock.html
http://www.blogger.com/img/blank.gif

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!

link:
http://www.evilmadscientist.com/article.php/nightlight

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!


Link:
http://avga.prometheus4.com/index.php?p=2-3

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:
http://www.bitartist.org/2008/06/gif2led-released-and-with-my-led-egg.html

Before:


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:
http://cs.nyu.edu/~jhan/ledtouch/

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