Thank you muchly for the no-nonsense instruction! I've been quite interested in using less-overkill hardware for my small projects (lighting 8 LEDs with very little input doesn't require an Arduino Pro Mini). However, I'm a beginner, and Arduino's have appealed to me. This gives me a great approach to trying to make my stuff smaller, and less expensive.
The ATtiny85 has 6 pins that can be set as outputs and inputs, but each pin also has aditional special functionality like Pulse-Width-Modulation and Analog Input capabilties. You can even utilize the reset pin during run-time for other purposes. See the datasheet with the pinout diagram with functionality listing. Also, you could in theory (given enough power) control a million LEDs using just one pin, if you utilize shift-registers and multiplexers to control multiple things.
This aspect is so awsome. As a small fan but big noob, I didn't know enough to see this next step of 'just' using a chip - that an arduino isn't much more than a chip with only a few accessories. This is already the "adult" level of microcontroller projects? So near? That's so satisfying.
This is a nicely done tutorial! But especially for ATtiny projects I'd strongly suggest using generic avr-gcc code instead of the Arduino programming environmnent. With their small memory and few I/O capabilities, these chips cannot make use of most Arduino libraries. But they can profit a lot from getting rid of the overhead that comes with the Arduino wrapper code. I just tried a minimal program that just switches an output state once per main loop call and found avr-gcc code to be 4 times faster and one sixth the size compared to Arduino code.
So glad I found this. Just planning a small simple project with 1 input and 2 outputs and thinking that a full Arduino was serious overkill. This is exactly what I need. Subbed!
Can i generate such AC signal with Atiny microcontroller without inverter ic . Please once watch this video and see the signal wave and reply again. ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-caUHiHzswBU.html
It is awesome that the music is from Collin. I am learning much recently and have been watching both your online videos. Thanks Matt for writing back! I hope to post my first fully designed and implemented project soon for feedback. -Matt
you prolly dont give a damn but does someone know a method to log back into an instagram account?? I was stupid lost the account password. I would love any help you can give me.
@Aiden Camden Thanks so much for your reply. I found the site thru google and im waiting for the hacking stuff now. Seems to take a while so I will get back to you later when my account password hopefully is recovered.
I shrank down my current project to directly use an ATMega328p when I moved from Proto to creating a PCB. I'm using nearly all of the GPIO, but I love this and will keep this in mind for future projects.
@Whisper6911 The feedback is certainly appreciated. It's not easy striking the right balance between making it informative yet short and to the point, so it helps to know how we're doing.
Guys, you can do this not only with those 2 chips, but with nearly any AVR chips, you just need to use the correct pinout. With this, you own a cheap AVR programmer as your Arduino, that you can use for nearly everything!
Hi, If I want to program atmega328p using Ardiuno IDE, can you comment If I can get success if I follow the pin correctly but code written in Ardiuno IDE. your early reply will be highly appreciated
Despite what this video's description says about more information being on the makezine blog, what is actually there is copy-pasta of this video's description, complete with a link to itself. Yo Dawg!
If the number of pins you need exceed the number of those available on the AtTiny85, there's the AtTiny84 that has about 2x the number if IO pins (but with the same memory size). This chip is also supported by Arduino IDE and is also very cheap
from the high-low tech article: "We’ll also connect a 10 uF capacitor between reset and ground on the Arduino board as shown in the diagram (the stripe on the capacitor that’s marked with a negative sign (-) should go to ground). The capacitor prevents the Arduino board from resetting (which starts the bootloader), thus ensuring that the Arduino IDE talks to the ArduinoISP (not the bootloader) during the upload of sketches. (The capacitor is needed if you’re using an Arduino Uno, and might also be necessary for an Arduino Duemilanove.)"
So... it prevents the reset of the board and keeps the computer talking with the ISP on the board, no the main ATMEGA328P on the board. On Linux (or macOS, with another alias for the /dev/) you can know which one is active when /dev/ttyUSB0 turns /dev/ttyUSB1.
@@willdrives601 So it makes sure the Arduino doesn't self-reset when uploading sketches. I have uploaded scetches without the capacitor in place, and it can work but sometimes results in a uploading error, requiring me to pull out and re-insert the USB lead. It works 100% with the capacitor in place tho.
Just started programming using Arduino. Searching what I can make and do with Arduino and it's mind blowing. I'm at level of this video yet but I have to say I'll be watching more of your videos in future
Amazing I still remembered watching this in my high school times to shrink my project on controlling solar water heater. Now I am using ESP32. Thank you for this amazing video!
Okay for those of you who are having the following problem: Blink:15: error: 'OUTPUT' was not declared in this scope Blink:15: error: 'pinMode' was not declared in this scope ... Here is a small tut. of how to fix it: you need to download Arduino software version 0022. Then follow the same tut. as shown in this video. It will WORK! The reason that 'OUTPUT' and other arguments are undeclared is because from Arduino update 1.0, they changed the core library WProgram.h to Arduino.h.
yes, i'm using a Nano V3(AtMega328P-AU) and works only for Tiny45 and if for you also a 10uF capacitor doesn't work, try a 47uF(an arduino forum gave me help on this) but this don't load some interesting functions, so if you only want to do leds blinking or PWM controllers thats ok!
+Uzair Ali From the High-Low Tech site: "The capacitor prevents the Arduino board from resetting (which starts the bootloader), thus ensuring that the Arduino IDE talks to the ArduinoISP (not the bootloader) during the upload of sketches. (The capacitor is needed if you’re using an Arduino Uno, and might also be necessary for an Arduino Duemilanove.)"
When the system is powered, capacitor pulls the reset pin to ground till it gets charged completely. This will give enough time for the microcontroller to initiate. And once it is charged, it prevents the board from resetting so that the intended task is carried out smoothly.
Or just buy an Arduino Mini Pro clone, ~2$ on eBay shipping included from China and you don't have the problem that the ATTiny isn't as powerful as the ATMega 328p which is used on the Arduino... Don't get me wrong, I don't dislike the idea behind this video, it's just that you replace the microcontroller by an ATTiny without really mentioning the cutbacks of it...
For basic projects Arduino is overkill, Attiny can run on as low as 1.8v with very little current draw and if you skip the bloat of the Arduino wrapper and program directly with AVR-C you can do a lot with little memory.
Attiny45 is 12 times smaller than the mini pro, sucks way less current and costs (as in 2017) less than 1.5 $. Sure the Mini Pro is better, but the Uno is even better, the Mega is even better, some IBM supercomputer is even better etc etc. This video is not about what is better than what. It's about how to shrink simple projects.
I mean it runs at 8mhz default but can run 16mhz or even 20mhz. If that’s what’s needed at least. Or you could get a $3 esp8266(or even now the 8285) and get hundreds of MHz from it with some tweaking. All while having many more features than the uno.
katze_sonne can i use ATTiny for my heart rate measuring project....as of now m using arduino nano but if i can use it then it will reduce size...n mainly will it send data serially (support Bluetooth connection or not)....reply me as soon as possible..... Waiting.......................…
Yep, and sometimes it's also just about the fun of seeing how much functionality you can squeeze out of such a tiny device. I made a project based around the ATtiny85 recently. It's a timer to run my laptop's power supply for up to 2 hours max. (Because I always forget to unplug it.) I used two of the IO pins to drive 4 LEDs in a bargraph configuration, with each LED representing 30 minutes. The uppermost LED in the bargraph blinks off briefly once a second to show that the device is counting down. (LED drive is done by rapidly toggling output to drive both an LED to ground and an LED to Vcc, or toggling between a low output and a Hi-Z mode to drive only one of the LEDs on that pin.) Another pin drives a small beeper via a transistor, and one pin is the input which has a pushbutton connected. The last used pin drives a P-channel mosfet via a small n-channel mosfet to connect +12V to the output socket into which the charger is plugged. All this was built into a dual-port cigarette lighter adapter (plugs into a single ciggy port to provide two ports) with one of the output ports removed and that space used to mount the hardware. (tight fit!) Pushing the button wakes the unit up, setting the time to 2 hours and powers the output. Each additional push advances the time to the next 30 minute division. Once the end time is reached, the unit switches the power off and goes into a low power sleep mode, waiting for the next button push to wake it up. Doing it with the ATtiny85 certainly made it possible to make all this small enough to fit into a single-to-dual cigarette light socket adaptor. I did find some problems though. THe data sheet talks about timer0 and timer1, but no matter what I tried I couldn't get timer1 to work or generate an interrupt. So I ended up using arduino's built-in millis() function. I had to set the device to run at 8MHz, but the millis function didn't run at the correct speed, so I adjusted the expected counts in my program to compensate for that. It appears to run about twice as fast.
Yes, it works fine. Google "Program AVR chip with Arduino software" sites explaining more. Arduino is a package which includes - on 1 board - an ISP programmer, the AVR chip itself and a standardised I/O arrangement. It's therefore quite happy to program the same items as separate products. As Matt says in this video if you make lots of MCU projects, using an Arduino every time is wasteful because you probably won't use a lot of the I/O pins AND you're buying an ISP programmer every time
Yes, it has an internal clock but you can use an external clock (takes up pins tho). You can burn the bootloader to make it run at 8 or 16MHz (I recommend burning the 8MHz bootloader).
@minutemadeinc Both can communicate with each other and other chips that support I2C. If you google Arduino I2C you will find an example that shows 2 Arduino's communicating to each other with 2 wires. If you need a lot of pins or want to use all Arduino functions then go with the ATmega.
Totally agree. In "Practical AVR Microcontrollers" I detailed exactly this approach. Using an Arduino for every project large or small is wasteful. You're buying the AVR programmer + AVR chip and support electronics every time! If you are only doing build-up tear-down that's no big deal. If you're making lots of small "keeper" projects then the needless costs mount up. Use naked AVR chips + a USB programmer (no bootloaders) and you save a lot of money and can still use Arduino software. Alan T.
This tutorial is obsolete, but if you follow the links in the description you will find an updated version that actually works! :) It would be nice if you put an annotation in this video or something
I dont know if you asked it rhetorically ;) but for newbies, It is to just prevent the software reset the Arduino has ! Though i doubt it is actually needed !! As i have flashed bootloader to many 328s (dont know about these Atinys ) and i did not use any capacitor or that !
Thanks for the tip! Just what I needed but didn't know existed. Ordering some now. (Puzzles me why people leave comments that don't pertain to the subject)
@makemagazine Thank you for acknowledging our feedback. Since you are so in-tune with your audience base I find it hard to believe that you think we are concerned about the videos being to long.
Nice Video, uses the Arduino like it was supposed to be used: as a rapid prototype board, where you can quickly design your device, and then transfer it to a real board. One little suggestion though. Try to add a 10 kOhm resistor between VCC and the reset pin of your chip, after you programmed it. It will prevent your ATTiny from accidentally resetting itself if you touch your project wrong.
In that MAKE was a partner in teaching hobbyists to use the Arduino to complicate the simple complicate, it's fitting that they still tech that albeit with a smaller uprocessor. No for make to teach how to blink a LED using discrete components, that would be free after salvaging consumer electronics. Now that I see that Adafruit sell ZIF sockets that can be plugged into the socket an the arduino I just might finally purchase on arduino
Thanks so much for the video! I'm using Ubuntu and had to select "Arduino as ISP" under Tools ==> programmer, then the ATTiny85 under board. Thanks so much, didn't catch that until watching your video!
A bootloader is a small program that runs inside an Arduino (or other packaged Microcontroller system) which allows the AVR to cooperate with an external system to update the main contents of the AVR's memory and you need a bootloader if you are using an Arduino. If you're using a naked AVR chip (just the chip itself) and an AVR ISP2 programmer or equivalent (such as Pololu AVR ISP programmer) then the ISP completely controls the AVR chip during programming and no bootloader is needed.
Arduino IDE actually adds ~1000 bytes of stuff you actually don't need. My suggestion to people who want to play with these chips is to grab gcc-avr and program them that way. It's harder than Arduino IDE but well worth the effort. You still get the benefit of programming in C or C++ but you loose some of the conveniences. For comparison blinking example when compiled by Arduino takes around 1020 bytes or more. When compiled with gcc-avr same code takes around 120 bytes.
If you let the Reset pin free floating it is very sensitive and may cause a reset every now and then. The capacitor stabilizes the level on the pin and prevents unwanted resets.
I don't know if this helps but you can use a 74hc595 chip to extend the number of digital pins. Basically they have an 8 bit register that holds a value. There is another 8 bit register you can fill up bit by bit in serial (a shift register). Then you set another pin on the chip and the contents of the shift register will go to the output register. I think you can also read in a parallel 8 bit input, swapping it into the shift register and shift it out serially, but I'm not sure about that.
These 8 pins avr microcontrollers are great.Of course you can use every arduino module but if you have to make a speed controller or a light dimmer as a stand alone project it does not make sense to use 32kbytes and 28 pins for 1-2kbytes and using up to 5 pins of the microcontroller.
It is a bit obsolete, you can stick the attiny file in the hardware folder in the 1.0.1 IDE folder. Also a 100ohm resistor between 5v and reset works (if you don't have a capacitor handy). Overall pretty awesome.
Great video! Thanks. I have an ATmega168 for developing projects, but then the fun part is going to be to see how small I can go for an embedded project.
@desktopgeek98 Assuming you are talking about the ATtiny2313 apart from more pins, it has no ADC, only 2KB space but has UART. You can see the differences on the Atmel website -> Products -> Atmel AVR 8- and 32-bit -> tinyAVR -> Parameters.
This is a typical method to ground unused pins of a chip. The last thing you want is a floating pin (floating = pin voltage is not defined and free to be altered by static electricity and magnetic fields, which can influence the chip during runtime in unexpected and unwanted ways). You use a capacitor to filter out any noise that would otherwise affect that pin, while connecting it to a ground voltage (in this case 0V). If not done, the chip could reset randomly on runtime. Avoid FLOATING pins!
Simply to prevent voltage drops, when you switch some load with the attiny. In my latest project (@5V, atmega48a), a rc servo caused an reset (brownout @4,3V) because of its load (around 1A peaks). I hooked up 1000µF and it runs fine now ( i heard somewhere to use 1000µF/A) But anyway, it's better (sometimes) to use 2 power supplies (1 for logic, 1 for load)
Great video and easy to follow. Personally, I think if people are moving off the Arduino and onto standalone projects it might be worth getting a dedicated programmer and programming it standalone. I have been doing this from the start, I don't use Arduino or AVR but I do use Microchip PIC chips. The greatest part of using standalone projects is eventually moving away from breadboard\veroboard and fabricating PCBs for finalized projects. I usually add an ICSP header if I want to make changes.
The next ones up are devices like the ATMEGA168 or an ATMEGA328 which are 28 pin devices (offering up to about 17 I/O lines) then after that you're heading towards 40 pin devices like the ATMEGA1284 which has (if I remember right) about 33 usable i/o lines. After that you get into the 32-bit AVR family which goes up from there...
OMG, thanks. I have been trying to program an Attiny13 using this technique with no success. I got frustrated by some of the warnings I got from the Arduino IDE, I assumed it was not working. The key was when you said reassign pin 13 to the applicable pins on your chip. I got a little flashy thing now!
There might be some curiosity about the capacitor. Anyone pursuing this project will probably find out from the documentation, but for anyone just watching for fun, the capacitor shores up the reset pins defenses against a pulse that is sent out during the operation.
I bought a couple ATtiny85s recently, one is a DIP, and 2 SMD versions where one is QFN... Was lots of fun deadbugging the QFN one into a project :D I haven't done any fine tip soldering in a long time but I haven't lost it. I also had some problems with newer Arduino 1.0 software, none of the ATTiny ISP libraries would work with it but I had a copy of an older version that did work. It was unicorns and puppy dogs after that!! Those issues may be resolved in the community now though...
Actually, if you factor in shipping costs and think internationally, the ATMega328 is *cheaper* than the ATTiny.. It isn't far fetched to say you can find the ATMega328P via eBay for under $2 inc. shippinh. (in fact, I just ordered a few for that, and they come bootloaded). However, an ATTiny will cost you at least double that. It might still make sense if space is at premium, however.
This video is very useful, but the tutorial on the High-Low Tech Group page is very confusing. In that document they refer to physical PIN numbers by their internal Pin names (for example, Physical Pin 5 is referenced on their diagram as Pin 0. This is simply wrong. In the ATTINY data sheet Pin 5 is called PB0 which stands for Port B 0.
@reviathon360 If you need more pins that a board supports, just add shift registers, or multiplexers and you can have as many as you like. E.g. with 9 multiplexer chips, you can have 64 analog/digital inputs using only 7 pins on an arduino. With shift registers, you can have as many as you like - after a few hundred though, it can get a bit slow to update/read them all.
@makemagazine dude has a point; you could have said some things about which pin does what, and what those error messages mean and why they can safely be ignored. also a bit of elaboration on the limitations of this chip vs regular arduino would not be out of place here.
Liked it.... nicely placed all details.a good step toward miniaturized approach. But I find cost of attiny same as Arduino pro mini board which has ALL Arduino functionality (not there in attiny- )
@Mohammad M While this example could certainly be done with a 555 IC, it was not the point of the video -- just a handy example using minimal components. The intention is to illustrate a method for using a smaller chip when a full Arduino board itself is not really required, but when one might still require programmability in the solution.
Hi, great video. I've tested it out and it works pretty well. Finally i don't have to mess around with this big ATMEGA328 / 168 anymore. But i think it is a pitty that some simple commands like if/elso don't work.