VGA1306 plus NES Controller (now with FX goodness!)


SPEAKER PIN 1 = Leonardo pin 5 (PORTC6)
SPEAKER PIN 2 = Leonardo pin 13 (PORTC7)

I just have a piezo buzzer on mine, using a single channel - one side connected to Leonardo pin 5, and the other to GND.

Pin 13 on a Leonardo is where the user LED is, so could cause complications??

OK … can I do this with ‘line level’ sound output?

Line level is for connecting to the audio input on a TV, or a stereo or whatever.

A Piezo buzzer on the other hand, you can just connect directly to an Arduino pin, no other components needed (be careful not to get a buzzer that only produces a single set frequency though).

A ‘speaker’ is different again, and depending on who you ask, you should be using it with a resistor, a resistor and a transistor, or resistors transistors and capacitors! :crazy_face:

Yes, I probably didn’t ask that question properly. Can I use two pins (as per the Arduboy’s piezo) in a configuration similar to the ‘line out’ schematic shown. If I connect just the one pin as shown in the ‘line out’ schematic, will the sound be compromised when using the Arduboy libraries?

I’m not sure how many Arduboy games make use of both channels?

You would need to duplicate that schematic if using both channels, have one circuit for each pin, and then feed them both into a single stereo audio jack, or two separate RCA jacks?

But, like I said, having the user LED in the circuit when using pin 13 could do weird things… would need to ask an electrical engineer! :upside_down_face:


But@Mr.Blinky has shown here that pin 6 can be used as an alternative for the second speaker pin, using an adapted library.

By default, pin 6 would be OLED RESET, but you don’t need that when using the VGA1306. So that could be an option?

Ah but that is ATMLib … I am more interested in ArduboyTones as that is what my games use. I might just wire up the simple circuit and see what it sounds like.

Good luck! :slight_smile:

If it doesn’t work, then could just make a modified version of ArduboyTones that uses pins 5 & 6 instead. This should probably be done regardless, for the benefit of all the DIYers using Leonardos and Micros for their own clones?

What do you know - it already has been done!

1 Like

…and here’s a modified Arduboy2Core.h to use with it (swaps OLED RESET to pin 13, and SPEAKER_2 to pin 6):

1 Like

you could connect two 1K resistors in series between leonardo pins 5 and 13 and connect the center point of those 2 resistors to that 2.2K resistor in the schematic @uXe posted.

Stranded cat5 is your friend failing that chop up an old scart/ vga or printer cable.

1 Like

Have been playing with this tonight on my Leonardo, and digging deeper into ArduboyTones (for the first time! :blush:)

ArduboyTones only uses the second speaker pin for volume boost, no ‘bi-tonal’ sound there.

So you won’t be missing out on any notes if you just use pin 5 for your line-level output.

Actually, not sure how that circuit above will react if both pins are fed into it, when they are in ‘volume boost’ differential-drive 10Vpp mode? Time to find that electrical engineer again… :stuck_out_tongue:


OK - good to know.

I am hoping to play with this on the weekend. I will update with results.

So a bit more sciencing today and I have sound.

As you will see, when it isn’t actually playing sound I have some awesome white noise going on. Obviously, all my wiring is on top of each other which is probably not helping but I wonder if the Arduboy introduces sound itself?

I did not even have to change anything code-wise to get this going. Again, would any of the Arduboy library hacks people have mentioned help the issue? @uXe, @Mr.Blinky ?


Do you have a link to the little amplifier board you are using there?

1 Like

$9.95 at Jaycar.

OK, looks like that uses an LM386 - datasheet for LM386 says max 0.4V input voltage.

Would need to check what the voltage is coming out of that line-level circuit?

(I needed to get 0.3V from 5V for my NESRAM project, so I just added 333K of resistance in series - might be worth trying if you have enough resistors around?)

Right I can probably test that with the trusty old multimeter … I should have a few resistors lying around too!
I will give it a try and report back …

I tried with a 222K resistor as that is what I had but it didn’t improve things. I noticed that when I moved the amp away from the Leonardo, the humming was much less.