Just want to let you know that eventhough it has been more than 10 years since you posted this video, it is still useful! You did a great job coming up with a very simple demo of pin change interrupt. Excellent explanation too. Thank you!
Just want to let you know that eventhough it has been four years since you posted this video, it is still useful! You did a great job coming up with a very simple demo of pin change interrupt. Excellent explanation too. Thank you!
Thanks, I looked at many videos on the internet and found yours the clearest. I was able to convert it from a PCINT to INT0, which is what I needed for my application.
I thought I was fighting button bounce and spent way to much time last night. I now see I was getting two interrupts with each button press as I was getting rising and falling edges. Thank you!
I have found the SMD ATTINY85 to be useful in many projects, if you purchase a programming clip and use an Arduino as a ISP you can put lots of Arduino code on one. I use them to save space and money In addressable led projects. You do need a breakout board and if you buy a clip make sure to get one to suit the package you are using the first one I ordered was incorrect and I waited weeks for delivery only to be disappointed. Thank you for your excellent tutorial.
Hello. Thank you very much for your demonstration, I will try to do it. Cordial greetings from Argentina. Spanish: Hola. Muchas gracias por tu demostración intentaré realizarlo. Cordial Saludo desde Argentina.
Thanks. I would love to be as knowledgable as you one day at electronics, I'm a senior Comp. Eng. student but the degree doesn't hold a candle to real life experience.
That was intentional, the ATtiny85 doesn't have an individual ISR for each pin. PCINT0 stands for Pin Change Interrupt Request 0 and PCMSK is the Pin Change Mask Register. We enable the pin change interrupt on the PCINT1 pin in the PCMSK. If you also enabled pin change on PCINT2 pin and an interrupt occurred on either pins, both would go to the PCINT0 ISR. You can check the interrupt vectors (e.g. PCINT0) on page 50 on the ATtiny85 datasheet and the PCMSK register on page 53.
Excellent video, Thank you. But one thing I saw is that you had nothing in the ISR. If you cut out everything you wrote in loop() and put and empty while() {} loop in there, then paste what you had in loop() in the ISR(PCINT0_vect) {} ; That it will run as intended, and independently of the void loop() which is what we want. Again I say great! video and demo: One of a kind on youtube_
Hi! Great job! I have a doubt, because when I measured the circuit, when I have the switch is open the consumption is 0.68 in sleep mode, but when the switch is close is 0.0 in sleep mode. I think I have some wrong, because I hope the same consumption in tow modes. Thanks a lot.
GIMSK and PCMSK should be part of the Input/Output (IO) of the ATtiny, just like PORTB, PINB, etc are. You would need to make sure you include the avr/io.h file and that in the makefile you specify your AVR device (MCU = attiny84)
A way to use INTERUPTS AND THE DELAY FUNCTION! NICE!!!!! Is this possible ONLY because you did the Pin Change Interupt? Or is it possible on the standard Interrupt Pins of the AtTiny85? Thanks.
Hi, yes it's because the interrupt is a pin change interrupt and not a timer interrupt which I believe the Arduino uses for the delay function. If you code direct AVR instead of Arduino, there is a delay_ms function which is tied to the clock speed and doesn't use any interrupts. You could probably do that with Arduino too but would have to make sure that some how it doesn't use the timer interrupt.
Many thanks for this awesome introduction to the attiny85's interrupt capabilities! This seems like a fundamental question, but do you know how you're avoiding errors like some of the values: GIMSK and PCMSK not being declared in this scope?
Hi Andres, you should still be able to upload code because the ATtiny has a dedicated reset pin, once it goes low the chip will be ready to be re-programmed. If you have connections hooked up to SCK, MOSI, MISO in your circuit, then that could cause a problem
@@insidegadgets you're right, it was just a bad contact between the reset (digital pin13 on arduino) and the protoboard pad connected to the Attiny85 reset pin. Thanks bro
+Markus Rohner Hi Markus, when an interrupt occurs, it jumps to ISR(PCINT0_vect) to execute code (in this example we don't have any) and then it jumps back to the place after we set the system_sleep() command, which in this case as it's at the end of the loop, it would bring us back to the start of the loop.
Hello i was wondering how much power does it take while in sleep mode maybe i miss that? The other question is how long does it take to wake up and turn on the led looks pretty quick?
+joseph chrzempiec (josephchrzempiec) Hi, once the ATtiny85 is in sleep mode, it only takes 1-4uA (depends on what else you leave on) and it would take 4 cycles (pin interrupt) plus 6 cycles when at 1MHz using internal clock to wake up from power down, so about 10uS.
Yes if you change the fuses, the reset pin can act almost like a regular pin but the downside is that once you do this you need a high voltage programmer if you wish to program the chip.
Why is it PCINT0_vect instead PCINT1_vect when it PB1 we are changing? Is it that all pins will call the PCINT0_vect register? I'm guessing that's what you're speaking of at 3:17-3:30. I think the "0" in PCINT0_vect is misleading though
If you have a chip built in with the sensoring plate and it puts out about half of the VCC voltage it should work. If it's just a bare plate alone, then you could put a 1M or higher resistor to ground.
insideGadgets I have the plate connected to pin 3 with a crossover 470M resistor connected to pin 8 . The capacitative sensing works. The problem is the sensing routine is in the loop and the subroutine does not get executed until some parts of the program are done. That is why I need to place the subroutine in the interrupt. Any hint how to do this? Thanks.
Hi, please check your connections are correct. Sometimes I get this if there isn't a capacitor near the MCU, sometimes a 0.1uF cap will fix it but if not, try 1uF.