Audio Amplifier and Multiplayer

We talked about this before, and apparently I worked on it.

But I was going through old eagle files and found this. It looks like there is a player 1/2 switch that swaps the RX/TX pins.

It’s also got some RC filters and an audio amp.

It needs to be tested to what happens with the various existing modes of the speaker, but in theory this “should” work just fine. Theoretically the driver wants to have a differential signal, but this will just operate in half cycle so basically the amp is always limited to something like 50% of it’s max output (if driven from a full input). Or so the theory goes…

The software side of it, to avoid blowing anyone’s ears out with serial data… Player 1 sends out a packet on the microphone pin which its then picked up by player 2, and only after that can it send out it’s data on the speaker channel.

Hmm I also realized though that you might still get sound out of the speaker when you have the aux plug connected. Ah nuts the jack needs to pull the other leg of the speaker somehow too. Maybe this is why I stopped working on it…

Half duplex?

This will cut in half the data transfer speed if both send the same amount of data, but will be ~90% if one need to send data and the other need to synchronize. And some UART driver changes…

The majority of applications already use the UART in half duplex but keep the RX and TX separately ( they listen on RX and respond to commands ), the only change in the driver is to discard all RX data when transmitting.

The RX and TX are both connected, just switched whether you are player 1 or 2 so it will be full duplex.

Was an idea to use half instead of full, adding a diode between TX and RX and one pull-up resistor of ~4K7 to RX …

I’d just add an IR TX/RX.

I’ve already experimented a bit with the RGB LEDs on my unmodified Arduboy, you can read ambient light level with the analog pin using one of the color LED’s voltage bias as a receiver hack but it’s very slow because of the ADC’s speed.

I only got one Arduboy so I tested with an LED flashlight… It needs quite a bit of light to react but it works.

Two unmodified Arduboys would have to be facing each other to work with this hack and the baud rate would be very low.

But with a proper IR TX/RX module it would work. Saves the switch, adds TV smart remote functionality …

I do agree IR would be cool for blaster functionality, and also as multiplayer, but I also think to have it on the cable is good because it is more reliable it also allows you to easily break it out into other hardware that can take a serial terminal. :slight_smile:

Are there enough pins to do both I don’t know don’t think so?

1 Like

Switch between :slight_smile:

IR’s can work directly with UART signal, up to 115Kb/s I believe, to communicate between two players is enough 19200b/s.

You already have a USB connector, that you use it only to manage games, you can put a switch, to switch between USB and UART a double switch ( you can share even the power between them :smiley: ), there you need something small with double switch, and one to connect UART RX with TX for half duplex.

Can enable next functions:

  1. USB connectivity if SW1 is in position 1, SW2 in position 1, boot-loader and other stuff thru USB.
  2. RX-TX fixed terminals with SW1 in position 2, SW2 in position 1, you can develop an IR module even wireless serials that can be connected to uUSB, and a ton of other extension modules.
  3. SW1 in position 2 and SW2 in position 2 for cable connect half duplex ( player 1 with Player 2 ), where does not mater who is player 1 and who is player 2.

You can try to connect directly RX with D+ and RX with D-, when you need USB, you disable UART and enable USB, when you need UART you enable it and disable USB, this way you can eliminate a switch, going further, there are single analog switches something like MMC4066, you can use one of them to connect RX with TX from software (remember the diode and the pull-up (you can use the internal pull up on RX) if you are not satisfied with the internal pull up you can use a double active switch activated by the same pin), and this way you eliminate both switches.

You will avoid doing a special adapter to connect audio for headphones and serial between consoles, and avoid serial management to blow up the ears of the listener :wink: , all with two more active components.

Do not forget the ID pin on the uUSB connector :smiley: use it for further developments, connect it to something, one uC pin to be there.

Tested this circuit, the piezo is not made any louder, need to test with headphones / electromagnetic speaker of some kind.

… Just plugging headphones into the speaker pins sounds amazing, the volume is too loud, but, it’s… so good.

1 Like

Volume will depend on the impedance and efficiency of the particular headphones.

For sure, but apple headphones are a pretty decent reference point as it’s probably the most common set of headphones in the world.