#66 AT Tiny85 Digispark - Arduino UNO alternative? An introduction!
HTML-код
- Опубликовано: 19 авг 2024
- New! ralphbacon.blog
Sometimes you only need a cheap, tiny microcontroller and the Atmel Tiny85 may be just the job. It's physically small (the clue's in the name) but it has lots of capability - just not very many GPIO pins.
Don't get me wrong; Microchip/Atmel are not promoting this chip as any kind of substitute for a full-blown ATmega328P but in some cases (like my simple fridge door alarm in Video #41 & #42) the AT Tiny85 could easily be sufficient.
And this Digispark (as Sparkfun call their implementation) can use I2C (software emulated) so you can always extend the number of pins with a pin extender too!
This video introduces you to this miniscule device and shows you its capabilities as well as its limitations - I'll explore it further in a future video but for now this may whet your appetite. And given its extremely low cost (about £1 or $1.40) it's worth investigating.
Allowing it to be programmed via the Arduino IDE is relatively straightforward (although I wish I had discovered the Sparkfun page to walk me through the process before I had single-handedly struggled through!) and it's just easy to use.
And, just like the Leonardo it can connect to Windows and act as a keyboard or mouse (but caution! watch what happens in the video) without any further drivers.
Lots of helpful links (but watch the video regarding installation)
www.electrosche...
Connecting your device (watch the video first though):
1. digistump.com/w...
2. digistump.com/w...
Updated files for Arduino IDE integration
github.com/dig...
Data sheet:
www.atmel.com/i...
Additional boards manager entry:
digistump.com/p...
The DigiKeyboard.h (turns the device into a Windows keyboard)
Note: this is now deprecated but still works just fine. Or use the one in the 'Updated Files' above.
github.com/dig...
If you like this video please give it a thumbs up, share it and if you're not already subscribed please do so :)
My channel is here:
------------------------------------------------------------------
/ ralphbacon
------------------------------------------------------------------
How can I remember this? Memory tip: "See" Ralph Bacon, geddit?
Hi Ralph, I am back among the arduino lovers once more after a brief absence because, well getting old is hard on an old farts body and I had to loose a chunk, the doctors took my right kidney from me because it had grown very large and was full of cancer. They tell me I am now cancer free, I hope they are right, the doc who cut me open says he wants to see me very 6 months for the next 5 years, I consider that a plus that he figures I will be around at least that long. At any rate thanks for the refresher on the AT Tiny 85, I built several count down timers using that chip several years ago, had one in my Ford that I pulled behind our motor home, the book said I should run the car for 20 minuits every time I filled the RV with gas. So I built one for that but made it a count up timer. Now that I have retired the RV and sold it last week, I have the timers left over. I gave one to our ambulance squad to use when doing CPR in the rig as they needed something like that and that one had a large LED display, my daughter uses one when cooking for a timer. So thanks for the review, I am trying to figure out how to do this in Linux as I got fed up with Apple's obselecense auto slow down and ripped apple OS from the hard drive and now am happy with Linux Mint which runs like a raped ape compared to osx
Good to see you back in Arduino Land, Jerry, and I wish you all the best for your future health. Keep up with the programming and electronics, you don't want the grey cells getting rusty.
Very nice video. I'm in El Paso, Texas, USA - working on robotics. recently found out about this wonderful module. Will be posting projects in the next few weeks. Need to get my video setup working. Yours is very nice.
Wow, I would say it's a small world but actually El Paso is so far from the UK it's not so small either. Very different too, I imagine. But I've watched the TV program Dallas so I must be an expert!!! Good luck getting your video setup working and thanks for your post.
I enjoyed your dry humor and your explanation :-) Keep up the good work!
Thanks, will do!
I have been using these little digispark's to build count down timers for specific problems. For example, my wife had medicated eye drops that require that she install the drops in her eye, then wait for a specific period of time, in the Morning, it requires a 2.5 minute wait, and the evening drops require 2 minute flat count downs. So I built her two timers using these and a 4 digit 7 second i2c display, as well as a buzzer that plays a merry little tune when the time is up. I have it mounted in a very small project box, with a 9 volt battery holder with built in switch to run the device. I even built one for our car, which I tow behind our motor home when traveling. It requires a 5 minute run every morning, and at every gas stop, so I tossed another together for myself that sits on the dash of the car displaying the time so I can insure the transmission get's the oil distributed through it each stop. I am going to modify that one though since I found that running the car for that short of time, then leaving the key in the accessories position drains the battery, when we arrived in Arizona this fall from South Dakota, at our last stop before hitting our favorite campground on the Golden Shores of Topock, the battery was completely drained. I ended up getting a boost start from the managers golf cart, then drove the car to a neighboring city on the interstate. At 75-80 mph it did not take long for that battery to come back to life and she hasn't been a problem since.
A brilliant example of Real World solutions, Jerry. Did you use the TM1637 for the LED display?
Yep exactly, very simple to build and program and they do a great job. I am not sure how long the battery will last, thus far it has shown no sign of stopping.
Looking forward to this. just ebayed a couple and the port extender. Merry Christmas to you and your family.
Thank you Alan! I get back from vacation in a couple of days just in time for Christmas. Good luck with the Tiny85, I've ordered a programming shield for mine that I'll describe in another video...
Good day, Ralph !
Great video, as always. I am struggling to program those 'Tiny85 boards. I reverted to an old PC with an old Windows 7, I confess, but I think I have problems because my 85s DO NOT have the Bootloader preinstalled.
I'll keep watching your videos just in case you show us how to install this Bootloader.
Keep on the great job, my Friend. These are very educative for a newbie like me.
Have a nice day !
You can install the opticore bootloader on the ATTiny85, Daniel, but space is still at a premium there. You only have 2K Flash and the 85 optiboot is about 450 bytes. Far better to use ICSP programming for something this small. If you get one of my Tiny85 breadboard ICSP boards and that OPEN SMART (or clone) programmer (all for the price of a cup of coffee) it would be too easy to do! We'll talk about this in your next email.
Good morning, Ralph. (for me).
I have a few programmers on their way, one i should get today and another one, more versatile, with a ZIF socket I should get in the next few days.
I am fully aware that, with only 2k memory, space is as precious as gold on these tiny MCUs .. as well as GPIOs !
I have a few more questions about these devices, I just have to ask you .. in my next email, that is. Until then, have a great day and take care, my Friend. God bless !
There are times when I only need a few pins so yeah this fits the bill. Didnt know about the keyboard emulation. So you can send data direct to Excel, nice. I bought a few of these but I haven't had the day to get them going. Thanks Ralph.
Thanks for that, Joey Mac, nice to hear from you.
I could not get these to upload successfully under linux. I don't use windows any longer so I do not think this is an option for me.
I did get these working. I had to unplug the board, click download, then re-connect the board.
The Tiny85 get programmed in a different way as well. It gets programmed by power it off, and powering it on, and when it comes up it will read the program. You also need to load the library for the Tiny series of chips.
True, Joseph, I think that's the way that bootloader is written? It should do the same on an RST... I think. YMMV. Thanks for sharing the tip, nice to hear from you.
Hey Ralph, looking forward to watch your results with the USI of the Tiny85. Receiving SPI data over the USI was for me always like trying to convince a stubborn donkey to move.
You need a carrot to encourage your Tiny85 to play nice with the Universal Serial Interface (USI), Stereomatzel. When I find the right one I'll do that video! But I am keen to progress this so as soon as I have a few nanoseconds between videos and the day job I'll progress it. I now have the Tiny85 development board turn up (I think I might have mentioned it in passing in one of my videos) but still have not had a chance to really test it out. But keep tuned, it will happen one day. Thanks for mentioning this, it is on my "To Do" list, I won't tell you what number though :)
after i found the attiny 85 i have went out and buy about 100 of them and made lot of little things, about the same as i did with the uno and pro mini and nano, i have many different ways to program the attiny 85, but i now have found the Arduino as ISP is the most fast, i can get 3 Pins with the Atting to work as PWM, and seen some code with 4 Pins but only the 4th pin when one pin is off, and can control them with a pot for speed, i am trying to work out a way to do a easy code with LDR so the LED only turn on at night, as i want to set up the attiny 85 at every window of a build that looks a bit like a censor, maybe some one has some way to do it.
You bought 100 of these devices? Wow! I hope you got a massive discount. If you connect the LDR to an input GPIO, read it every few minutes (you can put the chip into deep sleep for that long, by waking up every 8 seconds and doing that 75 times) and only light the LED for a brief 100ms flash then it should run on a 3v coin cell for quite a while.
@@RalphBacon I sort of got it to work the other night, i can look at the sleep timing later, as i only want them to flash in the night time and go to sleep at the day. so the LDR turns off the 3 LED's, i was shaking it there when i could not get it to work and found the light in my workshop was to bright. but its working now and made some proto PCB. maybe run it from 2, 18650 or 2 14500, with a small reg on the PCB.
yes i got 100 i pay 0.60 AUD each for them, that's about 40 GBP including the shipping. ATmega328 is about 1.30 each AUD each. when i was working in China i made some friends in shops with taobao haha
I like to ask what is the best mosfet to use with Arduino i have been looking at IRL 630,640, 520,540 LOGIC switching
Ralph, there is a way around the 5 sec delay, needed it for a low power battery project and couldn't live with that timeframe as my code ran for less than a second. If anyone is interested I will post the details, its works a treat
It's been a while, Dean, since I fiddled with the ATTiny85 so do please post away your solution for others to read. One option, of course, is to use no bootloader so the code runs instantaneously upon power up but you probably have a better way.
interesting vid Ralph, these seem quite good to make wearables or really small projects. I liked the idea of micro usb instead of FTDI until you revealed the 5 second window to do everything, good stuff cheers Alan
Hi Alan, yes wearable projects are all the rage these days and this tiny microcontroller could fit the bill nicely. Incidentally that 5 (approx) second window at startup is only there to enable your PC to connect to the unit to program it; if it finds it then it can take as long as it wants. If no PC connects to the device then it just continues on its merry way. The only downside is that there is, effectively, a small delay from switching the unit on and it starting to execute the embedded code. Happens on a reset too, of course. In contrast to a UNO or Nano which execute immediately on startup, no delay. Or have I now totally confused you?
Ralph S Bacon thanks for the reply, makes total sense
I am going to have to come back to this but no matter, I am an Old Git and do not learn as fast as I did but I am interested in this because I used/played with a PIC thing some years ago, an 18 pin device 84 comes to mind but again no matter and it was a simple problem need 3 or 4 active I/O and worked OK (I have/had no problem with assembler language). After digressing somewhat it seems to me that on an Arduino device the amount of programming memory available is far greater than the amount of I/O available, so why have it. Hence the interest in the smaller implementation and I am grateful of you for paving a path because I MAY not be as tenacious as I used to be.
Have a look at my most recent video #181 which makes playing with the ATTiny85 (and ATTiny13) much easier.
ruclips.net/video/7Tl8l0PliTk/видео.html
Thanks for this. I have a couple and they are recognized by win 10 then right after not recognized , Over and over. I gave up with them.
Hi Darrell, yes I think I mentioned in the video that Win 10 didn't seem to always show them but it still accepted the data as though it was a keyboard. I'll investigate and if I find something include those findings in another, future video on this fascinating device (but I feel your frustration too - but don't give up, wait for the next video on them!)
Great. Thanks for sharing
Thanks for watching!
I remember buying 2 of these. I think the engineering on them is bad. Mine will not register properly with windows. They keep connecting/disconnecting repeatadly. Its why I never used them. However in your video you suggested they have power issues. This may be a way to fix them to get them to work better.
ATTiny85 devices don't have built in USB so some board manufacturers fudge the issue with diodes and other components and sometimes it works, sometimes not. I use the FTDI or other Serial to USB converter and it's rock solid.
Much much later than the date of this video, but I am hoping to use an ATtiny85 to interface a casio fx-9750G PLUS. It would require reading and writing the USB port as well as a Tx and Rx pin pair ,
The ATTiny85 does not have a USB port, as such, Johan. If you have a module with USB socket on it, it either only supplies power or the D+/D- are directly connected to the Tx/Rx pins - so you would need a USB-to-Serial module (eg FTDI) to read/write the data.
I thought as much, but was not sure. Mmmm...
They have ones with usb insertion edges also
I think you are also referring to the tiny form factor mentioned in the post by +squalazzo which is really quite amazing. I'll look more closely at this device (including getting I2C working on it) in a future video, I hope... thanks for posting, good to hear from you.
Yeah thats it, its even smaller for program once throw in project. Sure they are available everywhere also.
great project
Glad you liked it, thanks for posting!
Creative video, thanks :)
Glad you liked it!
Ralph! Love the tutorials by the way, your videos are god sends! I have a conundrum for you. Im using a Yamaha MG166C mixer for internet radio, I'd like to know is there a way I can make a unit with a nano or Uno (whatever is needed) that I plug my mic into, which acts as a through line into the mixer but what the Arduino does is, when the mic turns on it works a relay that will turn off my speakers and turn on my ON AIR light. My Mic has a 48v phantom power line going through it. Thanks for any help you can give me on this problem. Regards MDD
Hmm, you just want the act of switching the microphone on to disconnect the speakers and switch on an "on-air" light - but not affect anything else, right, Marty?
How do you switch on the microphone? Via the mixer? How can we detect that the microphone is "live"?
@@RalphBacon Firstly thanks for your reply, Yes you are right, the Mic plugs into a mixer, the model is the Yamaha MG166C. Its a condenser microphone which takes a 48v phantom voltage. There is an 'on and off' button to turn it on and off. The on air light is from canford, it has a 240v light bulb in it that gets activated via some pins lol the spec for it can be seen here www.canford.co.uk/Products/20763/51-401_CANFORD-ILLUMINATED-SIGN-BC-base-fitting-type-A-230-volt. I'd like to so when I press the mic on button it pics up that the mic is now in a live state and activates the arduino to work 2 relays, one that touches the pins together lighting the light and another that cuts the power to two monitor speakers thats are 240v powered. Any more info needed Im at your service :) Thanks Ralph.
Do you think one needs the resistors for connecting buttons (actually a Morse key) to the microcontroller and thus emulating a keyboard?
A morse key doesn't emulate a keyboard in anyway whatsoever (the keyboard being USB driven). But a resistor from VCC to the pin to keep it high (before the morse key shorts it to GND) is only necessary if you cannot define the pin as INPUT_PULLUP which does all that for you.
I brought digispark attiny85 development board
But this board keep connecting and disconecting continuously
What. We need to do
Please help
Paste
You are connecting this board to a USB-to-Serial adapter? Or you are programming via the SPI pins on the board (which is a more reliable way of doing it)? Or you are plugging directly into USB? Check that the any connections are powered correctly and are stable. You have selected the "Digispark Pro (Default) 16.5MHz" in the Arduino IDE? Programmer selected is Micronucleus? You plug the device in within the 60-second timeout period? Can you upload an example program to the device?
@@RalphBacon
I am plugging in device directly in USB port
Plugged in within 60 seconds
All settings are as expected 16.5 and micronuclous
But after clicking uploading code,
Code is not uploaded but
Please tell me
One thing , what device manager shoes
how to send command CTRL+ALT+DEL with this virtual keyboard .....?
Hmm, I'm confused by your question. What virtual keyboard? I don't believe I showed that in this video. Can you clarify, please?
Great video. Curious, if your using an arduino to mimic a keyboard to control your computer, why not write a simple Autohotkey script to perform that action by a keyboard shortcut key. Just thought I'd share. I learned a lot from your video!
Ah ha! It sounds obvious to use a keyboard shortcut, but I can't have my keyboard in front of me when I'm doing a video, Jonathan, it's totally in the way. So my very small short cut Arduino emulator keyboard sits to one side and with one touch of a finger I can change the camera source. No faffing around with ALT-CTRL-SHIFT-A etc! In fact, I *do* have shortcuts like that configured in the video recording software but my Arduino emulator sends all those strange key combinations as I've described. Even more simple! I hope that clarifies things and good to hear from you.
Its harder to program those attiny85 boards than a pro mini.. I have lots of problems with attiny85 when it says to plug it in, I do and 1/2 the time it doesnt work.
Agreed, HH, that is the case with me too. In fact, it's sometimes worse than that inasmuch that I can do half a dozen uploads no trouble at all, then it decides it doesn't want to play anymore and refuses the next 4 or so! Bizarre. There's probably a knack that I haven't quite mastered yet. When I find out what it is I'll let you (and everyone else) know! Good to hear from you.
I know you didn't seem to like the pro mini but its really easy and reliable to program and works all the time and is a full Arduino just tiny.. great vids!!
It's not that I don't like the Pro Minis, HH, it's just that they don't have a USB port so that makes demoing more difficult. And, in a real project, not being to quickly plug in a USB cable is less than ideal, but that's just IMHO. I'm sure they are great to work with if not having a USB port doesn't make you go grrr every time you want to upload!
@@RalphBacon Al you need is a FTDI basic chip from SparkFun. They come with a female header. and USB port. Then you take a male header and put it in and hold it to your Mini Pro and upload.
I have 2 Mini Pro. One 3.3 V and a 5V with male headers. These are for testing purpose.
When the software is ready i'll take the new Mini Pro and upload the sketch as described above.
Hi Ralph I have purchased 2 ATTiny85 boards the same as you show but I am unable to load the board using the link shown for the Arduino IDE the link is in Preferences - digistump.com/package_digistump_index.json So I don't see any extra boards or anything in board manager any suggestions please or perhaps you could do a video on it to help others with the same problem!! ( I am using Arduino Ide 1.8.9) ( just changed to 1.6.12 and all working ( ThanksRalph) All the best Bob
So are you saying, Bob, that IDE 1.8.9 doesn't work to program the ATTiny85? But IDE 1.6.12 does? How strange. Try 1.8.9 again, perhaps it was just a glitch? Be interesting to know... 🤔
Hello Ralph,
Just found your RUclips info about Arduino Compatible ATTiny85
I am relatively new to Arduino etc. I am searching for a cheap way to control SG90 servos for points (turnouts) for my model railway. I build in sections/modules each about 2 feet by 4 feet. I like to use ON/On toggle swiches decentralized to each section/module Normally there is 1 or two servos pr section/module. Can I use the ATTiny85 to control one or up to three servos since there are 3 PWM pins?
You _could_ use an ATTiny85 but you might find you run out of pins, for example when trying to debug the code using Serial.print statement. A Nano can be had very cheaply with plenty of pins. But, in theory, the ATTiny would work too.
These boards are a NIGHTMARE! Stick to to the Nano / Pro Mini... OR make your own shield to use an Uno to program ATTINY85 DIP-8 Chips.
There is also an error from the chinese factory with Pin5. The Fuse on Pin 5 is set incorrectly. So, this means that every time Pin 5 goes LOW the whole board resets. There is a way to write to the appropriate register or something to make pin non resetable. Check this out Ralph, if you havn't already. I'd love a clear video done by you on this.
Hmm, perhaps my Tiny85s are from a different source as I haven't found this (not that I use many Tiny85s). I'll see what I can dig up on this issue...
at 17:25 you talk about the "digiUSB" but seemed confused, not sure what they're talking about there but on EVERY operating system all that is needed to talk to an attiny is usb 2.0 OR a usb HUB that pushes USB3.0 into fallback mode to 2.0... because then avrdude can talk and upload to the attiny. As I said this is irrelevant of whether you're on windows xp - 10 or any Linux distro (not sure on OS X). That is the same as the adafruit trinket (which is very similar to the digispark thing you have)
Ah, yes, indeed grats gg, that was referring to what the instructions said that Windows 10 _should_ have identified the USB Tiny board as. Basically, once the hardware had been enumerated I should have had a device named "DigiUSB" but I did not, it was called something else (possibly some generic term, or indeed never showed up at all) but it still worked fine. That's all. And, as you say, as long as your PC (of whatever OS) can "see" the board then it will communicate with it. Thanks for posting.
ohhh ok I see. I haven't been on windows in many years so I forgot it tries to name every usb device.
I am on a linux machine. If I look at my usb ports it is listed as MCS digistump digispark. Also there is a Linux foundation 2.0 root hub.
Ralph is it worth all the hassle with fewer pins and less memory and driver problems I think that the pro mini at 2.20 is a better bet
I understand exactly your point of view, but the thing is, Bob, *some* hobbyists really do want a small 8-pin footprint (possibly SMD) device rather than the larger pro Mini (or Nano or whatever).
It's not *just* about the money, or memory, it's the right-tool-for-the-job type aspiration that many people have. I just present what I find, after all I'm just the messenger (so please don't shoot me!). I totally understand why many people think "too complicated" about the Tiny85 and just use a device with which they're familiar - and it, too, gets the job done!
Comments so far about this video strongly indicate people are in two camps: the one you mention and the one I mention in this reply. Neither is wrong. Neither is right. Whatever works for an individual in their project is the right for them. Great that you posted your reply here, as it allows me to gauge how people feel, so thanks for doing that.
Thanks for your reply Bob
In addition to what Ralph wrote, the coolest thing (IMO) about the Attiny is how low you can make the power consumption. It's amazing.
Hi, Ralph, I want to make a copy of a three button IR transmitter so do you think this would do it??
Well, Bob, you need a PWM output for the IR LED, plus three pins for the buttons (using a switch matrix doesn't help to reduce that here). If you have enough pins then it will certainly "work". If this were me, I'd get it working on a standard Arduino Uno/Nano and then port it over to the Tiny85, just because it is so much easier to work with the Uno whilst developing.
Actually, you don't need pwm, just a digital output.
I can’t for the life of me get this working. So frustrating
Can you elaborate on "can't get this working"? What are you seeing, what error message do you get, and so forth?
before you download unplug the board from the usb, click download, then re-connect the board.
you made complex video grandpa
Not so complex, I think. For beginners.
Are you using an IR-LED?
Not for this video demo, Dustin. The breadboard that contains the IR LED receiver is a different project (which is why I said ignore that bit). The flashing LED on the breadboard that replicates the DigiSpark's LED is a standard (clear, red) LED.
Oh, ok... It looks like IR 😅
2 problems. 5 min talking about cost and size is a bit much. Also your link is being hijacked by youtube and isn't clean. :/ (Not your fault that youtube likes to alter your notes.)
Well, now you're commenting on videos made about 6 years ago, so my approach might have changed by now!
Not sure what you mean by "hijacked by YT"? Do you mean URLs in the video description? If so, they are all like that and not under my control.
I don't recommend this board. So much trouble. Even simple MIDI songs with buzzer gives me nightmare. Not enough RAM or flash! Don't buy this! Use pro mini they are very cheap, you can buy seperate programmer. Pins can output 40mAh and solid Arduino support!
Ha! A lot users might agree. Then again, a lot of users will disagree.
You can't treat the ATTiny85 as an UNO (ATMega328P) they are very different chips, but both are fully supported by the Arduino IDE and some very nice cores have been developed by others to maximise their usefulness.
Now, outputting 40mA on a pin is the _absolute maximum_ allowed by the manufacturer and you can only have 200mA max into the chip, so normally we try and limit pin current to 20mA to be safe and allow more pins to be used.
A Pro Mini is little more than a naked ATMega328P with some supporting components (crystal, caps); I use them all the time but I also have designed some basic boards that are functionally equivalent. If you don't need the USB support then they work nicely but the Nano is cheaper, is almost as small and is a full blown UNO!