Hacker News new | past | comments | ask | show | jobs | submit login
Chiptunes on an ATtiny4 and the 3 Cent Micro (gir.st)
193 points by electricant 11 days ago | hide | past | favorite | 40 comments





A similar project, created by a ex-colleague of mine, with an ATtiny85, that also broadcasts the generated sound via FM: https://www.youtube.com/watch?v=7t7_naYJnHo

Here is the code running on the chip: https://github.com/spookysys/attiny-synth


Is the Revolt! still on sale? I couldnt find any links for something similar - does he not have an etsy?

I'm frankly amazed at how cheap getting PCBs made is these days. When I first started out my electronics hobby in the 00's, everything I did that I wanted to be "permanent" was done on perfboard with through the hole parts, ordering PCBs was a pipe dream for a teenager funded mostly by birthday and Christmas gifts, even if the ads in Servo magazine suggested otherwise.

I took nearly a decade off (shifting into contract app/game dev work, university, and then starting my career did not leave a lot of room for my electronics/robotics hobby) and now the bargain basement price for a batch of 5 "passable" quality boards is <= $10 (and "good" quality for <= $50), surface mount parts suddenly became very accessible and to be honest, for some of the stuff I've played around with, the price savings by using SMT usually pays for the boards. DIPs are getting really expensive. It completely blows my mind.


The other thing is that the state of enclosures for the finished part has gotten a lot better. When I was doing electronics projects in high school, I was always stymied by enclosures that cost $100 and had to be heavily modified. I didn't have that kind of money, and I didn't have a drill and all the hole saws necessary to make a good front panel. If I was lucky, I put it in a shoebox or an Altoids tin, but I mostly had bare perboards laying around on my workbench, longing for a real home.

Now 3D printing is a thing, and it excels at making enclosures for your projects. With a couple hours in CAD, you can have a perfect enclosure on the first try, and they work and look great. Since getting a 3D printer a few years ago, every bare circuit board project in my house has gotten an enclosure, and it's wonderful. You aren't constantly worried about static shocking it, or pulling out some critical wire. You can just use the thing you built like it's a real product.


Yes, it's amazing. You often don't even need to have a PCB made much either because there are tons of modules for all common hobbyist circuits available very cheap, cheaper than the individual parts! I'm building a robot with a Raspberry Pi, a MOSFET module, a camera module, an LED module, a power supply module, a current regulator module, a motor driver module, and audio amplifier module, an Arduino module, etc. Not a single perf board or custom PCB required.

Other important equipment like PC-connected oscilloscopes and lab power supplies are super cheap now too.

You might have missed an opportunity in the 1990's to make your own boards by drawing with an etch-resist pen. I was making boards like that using money from my paper run.

Maybe we need a new national anthem "Praise God for the rise of China" ;)


and now you've got places like jlcpcb.com that will do pick and place on many common SMT components for like pennies per unit (there's even a free tier for common resistors and capacitors)

I've long ago retired me FeCl acid and DIY copper boards; 3 day shipping from China is just too convenient.


yep! I actually just ordered boards from them. I probably would've ordered assembly from them if I hadn't wanted to do it myself for fun.

How does the pricing for "extended parts" work? It says $3 per component, but it would seem they mean per component type?

Thinking of doing an FPGA board with them because the concept of soldering an 0.8 mm pitch BGA with hand alignment and a modified toaster oven where a screw up ruins a $50 part is a bit much for me.


Amazing work. Bravo.

If anyone is interested in an incredible piece of music along these lines, please do yourself a favour and check out

TRISTAN PERICH 1-BIT SYMPHONY

http://1bitsymphony.com

(you can skip buying the hardware and find the music on Spotify and similar)



LOUDNESS WARNING! Sounds like a square wave at volume level 11.

A downvote for this? It nearly blasted my ears while listening this on in-ear headphones after listening to "Chiptunes on the ATtiny4".


Oops, yeah, it is quite loud.

This is amazing - thanks for the link

EDIT > Are there any similar products to this which are procedurally generated? Is the OP procedurally generated?


1-Bit Symphony is not procedural.

Also, not quite procedural either, but the Buddha Machine might be worth having a look: https://en.wikipedia.org/wiki/FM3#Buddha_Machine


What mcu does this use?

Hi, author here. What a nice surprise to see my project turn up here :)

If you have any questions, shoot!


Hi - I love what you built. I wanted to know if I can buy the RCA chiptune jack or one like it? Id love to see it working IRL. Im not near Innsbruck atm but if I can buy this or a similar product that would be neat. Thanks!

> What a nice surprise to see my project turn up here

Same!


Inspired and, unlike so many of my embedded projects, completed. Respect. Also a great writeup with video.

So this was trial-and-error on the hardware directly, without simulating it first in software?

I can't imagine how tedious this must have been. It's fascinating what can be archived with determination and this little piece of hardware.


First, the music itself wasn't written by me, but by Rob Miles[1]. So I had a version in C available. I then iteratively transformed the code into simpler and simpler expressions, and finally into a simulated assembly language, written as C macros[2]. Only the final step, initializing peripherals, stetting up interrupt handlers, etc was done with the actual chips. Of course, I made some erros with the before mentioned C macros, so some final debugging was trial-and-error. Later on I also used simulators, but they don't support all the necessary features of the MCUs, or were outright broken[3] (patches now upstream).

[1]: http://txti.es/bitshiftvariationsincminor

[2]: https://git.gir.st/Chiptunes-pms150c.git/blob/f1b013452400b0...

[3]: https://sourceforge.net/p/sdcc/patches/379/


Nice! It reminded me of this great little synth powered parasitically from the MIDI port.

https://mitxela.com/projects/flash_synth


Could sound better with a filter on the output.

Yes, the legendary SID chip was a digital oscillator followed by an analog filter.

After seeing this heroic SID chip reverse engineering (0), I tried building the filter section using a quad opamp to make the state variable filter. It sounds kinda nice for such a simple circuit.

I've been planning a project of using a micro controller to do the oscillators and then use the PWM outputs to drive the filter control voltages.

(0) http://forum.6502.org/viewtopic.php?f=8&t=4150


A passive filter (if you've got the headroom) doesn't have to be fancy ... just a capacitor and variable resistor will let you custom-mellow the excess highs. (Old radios had these for 'tone control' ;-)

Yes, a little low pass will make a square wave much more pleasant to the ear.

But a proper LP/HP/BP resonant filter is almost a musical instrument in itself.


It has one, check out the section labelled "Output filtering"

Thank goodness he listened to his friend. Still needs a better filter I reckon.

Something I’ve wanted to do for a while but I lack time and SMD skills for is to build a neural net from individual ICs like this.

SMD is less tedious when you know what you're doing.

Though hole has... well... holes. It requires tediously placing all your stuff through those holes.

SMD on the other hand, can be solder-pasted and then baked with a $20 skillet + hot air gun to finish off the last bits. The solder has surface tension and naturally "pulls" pieces into place.

SMD is slightly more expensive than a soldering iron: you still need the soldering iron for some bits. And solder paste goes bad over time, and flux to keep stuff clean. You'll also need more expensive PCBs with a solder mask if you want to keep things easiest (but its really not that much more expensive: most costs seem to be shipping costs these days).

So you get your skillet (or toaster oven), a hot air gun, soldering iron, solder wire, solder paste, and finally flux... and you're pretty much set.

Maybe get some "desoldering" pump and "desoldering braid", in case you need to rework some stuff. But the skillet + hot air gun works pretty well.

-------------

Work with larger 0805 resistors/capacitors. They look small at first, but you can probably work at that level even without tweezers. More skilled people can work with 0402 and smaller pieces (though that's entering tweezer-only territory)

If 0805 is too small, there are larger pieces available like 1206. But I personally think 0805 sufficiently large for beginners to work with.

EDIT: I'm talking about American codes. 0805 American is equivalent to 2012 European.


I just ordered some boards where I used a lot of 0603 (1608 metric) passives, first time doing something quite this small. I did use the "hand solder" version of the footprints in KiCad. Tiniest things I've done by hand are some TSOT-23-6 packages and a 386EX33 in that annoying PQFP-132 package (the millipede).

Want to try using a flat tip I use for QFPs, but if it's too difficult, I'll get some solder paste and use my hot air station (which I initially bought to de-solder some seriously annoying DIPs (DS1687+ in EDIP) on some old SBCs - the solder just would not come out with solder wick or a pump).

I'm basically imagining tweezers and holding one's breath.


The through hole versions of the ATtiny chips are still available - 58 cents in single quantities from digikey, probably cheaper elsewhere

https://www.digikey.com/en/products/filter/integrated-circui...


Maybe you should try one of those GreenArrays GA144 boards. They give you a 12x12 square grid of crappy forth CPUs, connected at grid edges.

You might be interested in the SNARC [1], a very early neural network machine. Each neuron was a few vacuum tubes, weights were stored in potentiometers, and training was done through a system of belts and electromechanical clutches to adjust potentiometers based on its response to training data.

[1] http://cyberneticzoo.com/mazesolvers/1951-maze-solver-minsky...


Yes this is the type of implementation that inspired the idea. Now with cheap and tiny microcontrollers each neuron can be self contained and handle it’s own weights without need for external memory or components. The GreenArray chip mentioned by another poster seems to fit this though each core is only directly connected to 4 others you could work around that limitation by having a layer of routing cores that pass messages from one neuron layer to the next.

SMD soldering is not actually that hard until you start getting to the really small stuff; you just need some extra tools and a decent amount of practice. The smallest packages you're not likely to have a choice about are QFPs, which have 0.5mm pin spacing. In order to solder these, you need: * ESD tweezers (available for a couple bucks on Aliexpress, you want a set that contains at least a pair of fine straight tips and a pair of hooked tips) * A decent temperature-controlled iron. I generally use a Pinecil, but a TS-100 is also quite nice. I generally use the D24 tip; for all but the most detailed work, the super-fine conical tips are more trouble than they're worth. * 63/37 SnPb rosin core solder, preferably 0.3mm diameter or smaller. I use ChipQuik RASW.031, but it doesn't matter that much. This should cost somewhere around €10 * A self-standing magnifier. The microscope I use cost €300 on eBay, but a third hand is available for under €10. You probably don't need any more than 10x magnification. * Copper braid. A small spool (it goes a long way) should be around €10-20 * (Optional) A bottle of strong beer or a glass of wine. If in Eastern Europe, palinca or vodka is an acceptable substute

With this stuff at hand, if you're going the beer route, drink it. It'll have two effects: your hands will shake less, and you'll care less how it looks.

Now, tape your board down and set up your magnifier so that you can comfortably look through it as you work. Pick a pad on the footprint of the biggest thing that needs to be soldered (preferably on the side that you hold your iron with). Apply enough solder that there's a noticable bulge. Now, pick up the chip with the tweezers in your non-dominant hand, place it in the right place. While holding the chip in place with the tweezers, melt the solder you placed earlier using your iron until it wicks onto the pin of the chip. Check the opposite corner and make sure that it's lined up, then put a small blob of solder there. Don't worry if you bridge some pins; it's easy enough to fix. Now, solder the rest of the pins. If you're feeling dexterous, you can solder each pin individually, but I don't usually bother. Alternatively (and this is what I usually do), just solder all the pins down with a blob every couple of pins. Most of them won't end up bridged because soldermask repels solder. Once every pin is soldered down, press the wick against the joint with the iron to suck up all the excess solder. Inspect all the joints to make sure you've gotten all the bridges. If there are still some, there are a number of different techniques to get rid of them, but usually just sliding the tip of your iron along the space between the pins will be enough. Worst case, put more solder on and rewick it. Congratulations, you're done!

Repeat for each chip, until you're good at it :-D

(FWIW, I learned from this guide http://goodfet.sourceforge.net/construction/ , which goes into more detail, and also has a nice technique involving taping chips down that works very well)


Might take a while to get soldering skills good enough to handle 0.5mm BGA:

https://ripitapart.com/2016/10/28/emmc-adventures-episode-1-...


You can't solder those because you can't get unset the part, you need a stencil and a reflow oven.

Maybe I can hand-solder 0.5mm BGAs, maybe I can't. Haven't tried yet.

But author of the article linked right above your comment absolutely can. And wrote a TFA going into great details into how exactly. No stencils, no reflow.


That's soldering wires to them, not the component onto a PCB.

This is entirely accurate, except for two notes that I have: I never could braid to work, and flux works wonders. Other than that, spot on.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: