blippy
Posts: 25
Joined: Fri Nov 03, 2017 3:07 pm

A synthesizer/tone maker for the Pi

Mon Dec 31, 2018 9:09 pm

I finally wrote up my project for a "poor man's synthesizer/tone maker" for my Pi.

DESCRIPTION

What is it? A simplistic "synthesizer" that you can plug into your Arduino or Raspberry Pi. Use it when you want your project to produce a range of tones, and just want to use a tiny speaker instead of something more elaborate.

It should also work with many other microcontrollers or single-board computers with GPIO pins.

What's the point? My knowledge of electronics is bad, so I couldn't really figure out how to get good amplification on a speaker. Producing a consistent sound also proved to be difficult. Raspbian is not a RTOS (Real Time Operating System), which leads to glitchiness if you try to twiddle the pins directly. Execution of programs can be interrupted at any time, which messes with the timing. I toyed with using the Ultibo unikernel, which worked better, but it still had the occasional problems with thread scheduling. One possible solution would be to dedicate a core to the task, but I could not get that working.

Demo? Yes, on YouTube (https://youtu.be/3DuH876Wv-k)

What you will need

* An ATTiny85 chip, which is actually quite cheap and fun to play with. They are readily available, and only cost a quid. My favourite place to shop is RS Components. See here, which gives you a pack of 5. What I love about these chips is that they do not take up much space on a circuit board, they are 5V tolerant, and can be run off a coin cell for really small projects
* a speaker. I chose a small passive speaker 32 ohm 0.5W 23mm (RS Component number 790-3975). Something similar should be perfectly OK. You can opt for a piezo-electric speaker, although I personally think they sound too harsh.
* An Arduino/Pi, according to taste, breadboard, resistors and accompanying wires.


Link for further information: https://github.com/blippy/rpi/blob/mast ... /README.md

User avatar
scruss
Posts: 2542
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: A synthesizer/tone maker for the Pi

Mon Dec 31, 2018 10:41 pm

Ooh, nice! Simple as this is, it's a good intro to making noises with microcontrollers.

The ATTiny85 has a lot going for it: fast PWM, just enough storage for wavetable synthesis, small, cheap. There are much more extravagant implementations (including a full Eurorack module running from just an ATTiny85) but those are for later.
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.

blippy
Posts: 25
Joined: Fri Nov 03, 2017 3:07 pm

Re: A synthesizer/tone maker for the Pi

Mon Dec 31, 2018 11:14 pm

The ATTiny85 chips are certainly fun to play with. I like the idea of small devices that can be powered by coin cells.

I conceived of the synthesizer as a simple way of adding sound to a raspberry pi project without a lot of fuss. There is a sound Hat, but i thought I'd see if I could do something cheaper.

I did see a project called "making an ATTiny85 swear". It strips out a wav file and puts it on the ATTiny85. It's something that I'd like to investigate further. It opens up the possibility of controlling the chip from a Pi, and creating a little music device. Would make an interesting project.

Return to “Graphics, sound and multimedia”