Thursday 15 March 2012

Adding sound via transistors and relays

Continuing on from the mp3 player hack, two wires have been soldered onto the circuit board and tested. The mp3 player plays when these wires are crossed.



The next step was to test out transistor functionality. This was done by first building a spin motor as per the example in the oomlaut.com arduino tutorial here.


The circuit was built successfully so the next step was to incorporate the mp3 player. Below is an image of it wired up.



This circuit played the mp3 player, but it wasn't turning on and off: was just staying on. I noticed that there was a short circuit where the diode was and this was why it wasnt turning off. This meant that the current can run through the diode without going through the transistor. I wondered if switching the wires would solve the problem. However, it didnt and instead the mp3 player doesn't turn on at all.

I am going to try a relay circuit instead which is an electronically controlled mechanical switch. I am going to be using this example from oomlaut.com.

I wired up the relay circuit and attached a motor in place of the LED's. There is a physical 'clicking' sound when it switches on and off. Before i attempted to insert the mp3 player into the circuit i pulled the xBee out due to its voltage sensitivity.

Below is an image of a test relay circuit with a motor.

The circuit works and successfully turns the mp3 player on an off but there is a lot of interference. This is because the mp3 players power circuit is not electronically independant from thearduino power circuit. The example in the book connects the motor (substituted for an mp3 player) to the common ground with the relay and the rest of the circuit. There is no example which is electronically independant.



Below is a video of the mp3 player powered by the relay.




The circuit here http://www.glacialwanderer.com/hobbyrobotics/?p=9 shows how relays can be used to control a lamp with its own power source. The motor must be given its own seperate power source and run independantly. After a few attempts i cant get this working without the relay stopping working however. It should work, but it just doesnt! This will be worked with.

Unfortunately the 3.3V flowing through the mp3 player has interfered with the chip and now it overheats massively when turned on even by the built-in switch. The mp3 player makes an uncomfortable squeaking sound when turned on via the circuit which probably has something to do with the power conflict. The light turns on and static can be heard so this is an unusual problem. The blue light from the board is also blown. This is strange because the mp3 player was working when it was plugged out of the circuit, and it didnt suddenly stop working. http://electronics.stackexchange.com/questions/13873/why-exactly-do-chips-start-malfunctioning-once-they-overheat suggests that this might be overcome by allowing it to cool down, but this hasnt worked so far. I believe that the voltage leaked into the device has interfered with the battery itself. it might be solved by charging so this will be tried. A new mp3 player has been ordered and will not be incorporated into the circuit until it is worked out how to safely isolate it electronically.

Seeing what the relay did to the cheap mp3 players chip, it was probably just as well that i removed the xBee board which has a very sensitive chip on it. Whilst waiting for the new identical mp3 player to arrive, i will continue to find a way for either a relay or a transistor to switch on and off an electronically isolated circuit.

I did a quick test of the microsd card to check that it too wasnt fried, and luckily it wasn't. I did this by plugging it into my computer and seeing if it still functioned correctly.

This could be solved by possibly having a common power source as the arduino board.

Note: i just noticed that one of the wires on the speakers has broken off. This could be the source of all of the problems, and the reason why it just suddenly stopped working. I wont cancel the second mp3 player as it is always useful to have a backup, but this could quite easily be fixed.

The code for the relay is simply the turning on and off of one of the digital pins.
in setup
  pinMode(mp3, OUTPUT);

in loop

 digitalWrite(mp3, HIGH);
  delay(2500);
    digitalWrite(mp3, LOW);
  delay(1000);

The code was tweaked to allow it to play for longer and shorter periods of time.

No comments:

Post a Comment