Arduino Based Synth With Mozzi Library
by Arnov Sharma in Circuits > Speakers
5908 Views, 15 Favorites, 0 Comments
Arduino Based Synth With Mozzi Library
Hello Everyone,
During the lockdown, I made a Synth Box Project "Arduino Punk Synth" to annoy my neighbor with its weird sound. (well the actual goal was just to make an Arduino based Atari punk Synth device that generates cool like synth sound)
That concept was pretty simple as it was using an Atmega328PU setup connected with 5 Pots for modulating sound frequency, pitch, etc, and a 3W Speaker for sound output. All things were enclosed nicely in a 3D Printed Body, you can check that project out from here- Arduino Synth
Later I added a PAM8403 Audio AMP Module to increase the sound loudness.
In this Instructable, I'm Gonna show you guys how I prepared this project!
Supplies
These are the things that I used for this built-
- Custom PCB x1
- Atmega328PU x1
- 22pf CAP 0603 x2
- 16MHz Crystal x1
- POT 10-100K x5
- PAM8403 Audio Module x1
- SMD LED 0603 x1
- Resistor 10K 0603 x1
- Resistor 1K 0603 x1
- Micro USB Socket x1
- ConnectorsSpeaker 3W x1
Preparing the PCB
This setup is driven by an Atmega328PU MCU which is connected with a 22pf cap and 16MHz Crystal according to its minimal configuration. Potentiometers are connected from A0 to A4.
Audio Output is then connected with the R and L port of the PAM8403. For Programming the chip, there's an ISP Header that has VCC, GND, MISO, MOSI, SCK, and RESET Pin.
In the Previous Synth Project, I prepared a Base Body and fit everything inside it but this version doesn't have a proper Body. also, the OLD setup had Wires, lots of wire.
So to reduce the wiring and make this setup better, I Prepared its V2 which has PAM8403 onboard and Pots for audio Modulations with other stuff. (MCU is same, Atmega328PU)
After Designing the PCB, I exported its Gerber data and send that to JLCPCB for samples,
I have to say, the PCBs that I received were high quality and NICEEEEE like expected. also, thanks JLCPCB for supporting this project! You can check them out from here- http://jlcpcb.com/
Downloads
Assembly
the assembly was pretty simple and straightforward in this project
- I first added the SMD Components on the PCB. For this, I used my DIY SMT Hotplate.
- I first put the solder paste on pads of Components on PCB and then added them one by one.
- after that, I just put the whole setup onto the hotplate and reflow the PCB at 250°C
- Then I solder the THT Components which were the MCU, Potentiometers, Connectors, and PAM8403 module.
- at Last, i added a 3Ohms speaker with this setup
Note- PAM8403 Module is soldered from the bottom side of this PCB. you can check out this project's video for the assembly tutorial.
Flashing the Board
Now, this setup uses an Atmega328PU. Atmega328PU has a little hex file onboard known as a bootloader which is similar to BIOS. cheap atmega328PU don't usually come with a preinstalled bootloader so I have to burn the bootloader onto the MCU and for that, I used one of my previous project which was an Arduino Based Attiny Programmer.
This Programmer was made for Burning the bootloader and Flash code into the Attiny MCUs by using "Arduino as ISP Sketch" uploaded into a regular Arduino Nano R3 with few tweaks (adding 1uf Cap between reset and GND)
see my previous project for making this programmer and getting started with this flashing method. I connected the SPI Pins of Atmega328PU with SPI Pins of Arduino Nano together and Burn the bootloader of Atmega328PU and uploaded FADE SKETCH for testing the Atmega chip.
After confirming that the MCU is working properly, now we can just upload the Code and power up the setup.
Main Code
The code is pretty long but basically, it runs on Mozzi Library which generates algorithmic music without the need for additional shields, message passing, or external synths. This library is pretty well documented so you can check that out from here and download it. install this library before uploading this sketch.
https://sensorium.github.io/Mozzi/ the original author was Tim Barrass and This example code is in the public domain (Thanks TIM, Very Kewl).
The POTs are connected on A0, A1, A2, A3, A4 and the Audio Out is D9.
Downloads
RESULT
here's the Project Video-
So as you can see or hear, this Setup is loud and cool. That is all thanks to the Mozzi Library for doing like 50% JOB by modulating the sound without adding any extra external ICs for sound modulation
Also, thanks JLCPCB again for Providing the PCBs for this build. The blue solder mask is just niceeeee so yeah, everything, in the end, works out pretty well.
Leave a comment if you guys have any problem replicating this project! I'll help you out!