A small ATtiny85 board playing the Nyan Cat tune.
To make the experience fit your profile, pick a username and tell us what interests you.
We found and based on your interests.
gerber.zipGerber files for 6 nyan boards (5 for attiny45, one for attiny13).
Zip Archive - 92.57 kB - 11/28/2016 at 10:44
@Travis Hardiman pointed out that the code I have in the repository in the attiny10 branch is actually for attiny85, and the attiny10 code is missing, so I went ahead and re-created the attiny10 code (which I must have lost somehow), this time on attiny9 (which is the same as attiny10, only doesn't have ADC, which we don't need). It's in the attiny9 branch now. So to summarize:
Sorry for the confusion.
Also, to program the attiny10, you need to use a programmer capable of programming with the TPI protocol — recent versions of USBASP support it, you just need to add a 1kΩ resistor...
At the beginning of this year, DirtyPCBs announced a new service: Mystery Color PCB Group Buy. The idea is similar to what OSHPark does -- you get 3 PCBs and get charged by the surface area. But there is a twist -- they are going to experiment with various soldermask color combinations, and you never know what you get.
I decided to try this, and made an order for the single Nyan Board -- because I thought it would be fun to have it in a crazy color. The example PCB on the picture is pink, so I expected something flashy. I made my order on February 05, 2017. Today is March 15, 2017 and the PCBs arrived. I have to admit that this is a bit longer than I expected.
But never mind that, what are the new exciting colors? I have to admit that I am a little bit disappointed here too. Here's a photo:
First of all, the boards are mostly naked FR4. The soldermask is present only where there is either copper or silkscreen -- all the other areas are simply unpainted. That pretty much ruins everything.
The soldermask itself is a kind of body color orange, which might be interesting for human figures or faces, if only you knew the color in advance and could somehow get the whole board covered in it. The silkscreen is pretty much standard unexciting black.
On the plus side, I ordered 3 boards, and I received 11, which is a bit strange, but I guess a good deal for $4 with shipping.
After talking with DirtyPCBs, I examined my boards closely, and realized how wrong and unfair I was. The soldermask is not missing from between the copper traces. And it's not orange -- that orange is just the color of copper traces covered with it. Yes. The soldermask is transparent! This opens a lot of possibilities for novel designs, although I still have to say that it would look much better if the FR4 underneath was some other color than the default.
Also, they refunded it to me completely, and now I feel like a complete jerk.
Just in time for the contest, the boards from OSHPark arrived today!
I immediately assembled one in order to test it.
During that process, I learned about a new revolutionary discovery by the Chinese scientists! In their secret laboratories they developed a new kind of copper wire, one that is utterly impossible to solder, no matter how much flux you use and how hot the soldering iron is. Apparently, I got some wires like that from them, possibly by mistake. Using wires from a different vendor made it finally work (I also had to remove the speaker from the clock pin during programming).
Once I finally managed to flash the code, I only got clicks. A quick inspection revealed, that I used wrong pins for the speaker and the LEDs! The code expected speaker to be on PB0 and the LEDs on PB1. But the PCB puts the speaker on PB1 and the LEDs on PB2. Changing the LEDs pin is trivial, but can I change the speaker pin? Turns out that yes, the PB1 pin also is connected to the timer, and I vaguely remember changing the pins while designing the PCB with this in mind. I must have completely forgotten about it afterwards. In any case, just changing COM0A0 to COM0B0 fixed the problem. I also fixed a small bug where I only cleared TCNT0L and not the whole TCNT0, and it works.
The last bugfix made the code 2 bytes bigger, but it still fits within the limits:
AVR Memory Usage ---------------- Device: attiny10 Program: 502 bytes (49.0% Full) (.text + .data + .bootloader) Data: 0 bytes (0.0% Full) (.data + .bss + .noinit)
I'm still waiting for this board to ship from OSHPark, but since I tested the code with the chip already, I'm quite confident it will work just fine. Since it will probably not get here before the contest, I will share the order link here: https://oshpark.com/shared_projects/CWLBdY8g
As soon as I posted the last log, I realized what the problem was. The TPICLK wire was loose all this time. After fixing that, programming with AVRdude and USBASP went without any problems, and I could test my music-playing code.
Of course it didn't work properly at first. I had to change the timer initialization a little, use a different prescaler and adjust the octave. I also decided to run the timer at a higher frequency, because it's a 16-bit timer, so I can get better accuracy this way -- so I'm actually shifting the counts for the tones right a few bits.
But I still got some very weird glitches here and there, and I couldn't quite see the problem, until I realized that they happen randomly, but only when a higher frequency sound goes after a lower frequency. Finally I realized, that when I'm changing the timer's match register, I'm not resetting the counter -- so if the counter is already past the point to which I'm setting the register, it will go all the way up to the full 16 bits before it resets. That also happened with the 8-bit counters on the other chips, but it wasn't so visible, because the distortion was very small. With a larger timer it became much easier to hear. A fix is trivial -- just reset the counter.
And that extra code for resetting the counter took me exactly to 500 bytes of compiled code:
AVR Memory Usage ---------------- Device: attiny10 Program: 500 bytes (48.8% Full) (.text + .data + .bootloader) Data: 0 bytes (0.0% Full) (.data + .bss + .noinit)
I guess I could put more songs in there...
In any case, now I'm just waiting for the PCBs to arrive. In retrospect, I could have made those new PCBs even smaller than currently -- with the puny ATtiny10 and a single resistor they are almost empty. But the piezo speaker takes some room, so I guess this size is fine.
So the surprise chip, ATtiny10, arrived, and I started to work on programming it. I already have the code for it prepared, and the PCB has been ordered a week ago, so I just need to get the code on the chip somehow.
The ATtiny10 is not like the larger ATtinys -- it doesn't use ISP (aka SPI) for programming, but instead uses something called TPI (tiny programming interface), which seems to be something like half-duplex SPI. When I was upgrading my USBASP programmer, I noticed that the firmware has added support for TPI, and that it's already in AVRdude too, so it should be simple, right?
I soldered the tiny chip to a breakout board (the last row of pins uses two pads, because the alignment wasn't quite right, but the connections are good), I connected my programmer according to the schematic I found on some Polish blog (good thing I know the language) at http://mirekk36.blogspot.ch/2013/07/attiny10-tpi-usbasp-mkavrcalculator.html and I proceeded to upload the hex file with:
avrdude -c usbasp-clone -p t10 -U flash:w:main.hex:i
The result? Of course the well known and loved message error:
avrdude: error: program enable: target doesn't answer. avrdude: initialization failed, rc=-1 Double check connections and try again, or use -F to override this check.I tried with different clock speeds, with the "slow clock" jumper, I disconnected and reconnected the whole thing several times, I measured the resistances. It all checks. Should work. Doesn't.
I even made a side trip to try and program it with a CP2102 USB2TTL, which AVRdude apparently can do, but that didn't work either.
So now I'm sitting here after a whole day of trying to program this thing, looking at it, and considering giving up.
If anybody has any experience with this, or some suggestions for things to try, I'm open for ideas.
The ATtiny13 chips finally arrived, and I can test the code from the "tiny13" branch on real hardware (find it at https://bitbucket.org/thesheep/nyan/src/tiny13). After some struggling with getting my USBASP programmer to work with the chip (I needed a newer firmware and a -B option for avrdude to slow the clock), I got it flashed and playing:
It's a bit too fast, but changing the clock definition in the Makefile to 1200000 fixed that. The tone is probably wrong too, but I'm tone-deaf, so I don't care.
The difference from the regular Nyan Board is that it uses Timer0 (because there is no Timer1 on ATtiny13), and a different pin for the speaker. If you look at the six cats on the PCB, you will see that one is slightly different -- that's the ATtiny13 version.
I still have one more chip to try for the Nyan Board, but that is going to be a surprise.
So you want to try making your own Nyan Board, but you don't feel like ordering 60 of them and waiting a month? Here's a link to OSHPark for a version of the PCB with a single cat: https://oshpark.com/shared_projects/HUWiMrKc
For me the price is $3 for 3 boards, which sounds reasonable. And it comes in any color you like, as long as it's purple.
I assembled the first of the new Nyan Boards. It could be programmed, but it didn't do anything. I spent an hour debugging all the connections and checking connectivity on an unpopulated board and all that -- nothing. So I assembled a second one. It couldn't even be programmed. So I removed the chip from it and tried another. Same. Then another. That one worked.
I think that keeping my attinys loose at the bottom of the drawer might have been a mistake.
(Oh, and I used yellow LEDs, because the green ones didn't arrive yet.)
Here they are:
I broke off one, put the attiny, speaker and wires on it, and programmed it -- but no sound. No idea why yet.
Separate a single cat from the rest of the board. You can use a rotary tool, a scroll saw, a hand saw or a file. For best effect, round off the edges.
If it's a cat with holes for the eyes, you need to get rid of the metallic layer inside the holes. Cut it with a knife until there is no electrical connection between the pads of the LED.
Solder all the parts onto the board. Also solder an additional wire for the reset.
Pay attention to the polarization of the LEDs.
Create an account to leave a comment. Already have an account? Log In.
this is amazing
Hi, Could you publish the 'single' version in SVG please, thanks
Sorry, I don't have it anymore, but it should be trivial to edit the 6-pack version and remove 5 copies.
What color should I choose for the eyes? I really can't decide ;-( #FirstWorldProblems
You have to sell this.
It was necessary for me to put a 100nf capacitor between VCC and GND so the Tiny AVR could run fine.
a nice feature would be to simulate R2D2 sounds :)
Well than it has to be an r2d2 shaped board too :)
[verified: no design files missing]
This is your one-week reminder to upload design documents: https://hackaday.io/project/7813-the-square-inch-project/log/28566-design-deadline
Um... I uploaded them all right when I started the project. Is there something missing?
I posted that comment on all entries. I just checked, and you're supplying all files necessary, though you must add gerbers for just one board (without panelization) since the 1x1 inch requirement isn't fulfilled otherwise.
Whoops—wrong project :P You're fine, though I'd like to suggest adding the approximate prices for your components.
Thanks, I added the gerbers for a single board to the repository.
I need this
YES! I need this in my life!
Can you share Gerbers or Fritzing project file? I would like to make it more colorful.
Ah, I just realized I didn't! Sorry. Fixed now, should be listed in links.
I think repository you have just added is private.
Ahhh! So cute! Best use of ribbon cable!
How Cute!!! Nice done, pal!
Thank you. It's nice to do something simple that can actually be done in finite time for a change.
now shut up and take my money, I want one !
Hello! I found Your project on Dirtypcb's, and looks fun :) Will it be possible to buy from You one pcb, when You get it?
No, but I can just send it to you. I will let you and @Daniel Rojas know when they arrive.
Thats awesome :) Maybe some of my last order from dirtypcbs.com you find interesting, and i send you too - http://dirtypcbs.com/view.php?share=8149&accesskey=121bb6955f968c75ed3919a7dfa0355d
This thing is completely pointless. I WANT ONE!!!
Seriously though, nice project :-) Love the ribbon cable rainbow thingy.
Thank you. I'm sure I will be giving out some of the 60 boards that I ordered, so you can get one, if you really want.
:-D I would not say no...
Become a member to follow this project and never miss any updates
So i ordered boards from Oshpark and I am having a problem where the attiny10 seems to be running at 1mhz. So the leds and tones are running slow. any idea.