Round 2: improvements
With progressing experience and after growing tired of regular repairs needed to keep the jukebox in working order, I decided to make an improved version of it. I wanted to make these changes:
- Replace the power supply breadboard with something more solid. The charging board in particular was not mounted solidly to the breadboard, so that after a few charging cycles the USB connector would be pushed inside the case enough to make it impossible to plug in the charging cable.
- All connecting wires were soldered to boards and components. This is inconvenient when you have to take the boards out to change something (e.g. get to the SD card to update the music inventory.)
- The connecting wires were not always soldered very well, so that connections would get loose etc.
- The Arduino’s USB functionality is not used to connect to it, so it should be fairly straightforward to replace it with a bare ATmega328 on a smaller board. This would be an interesting project, and a way to recover the Arduino that’s locked inside the jukebox.
I decided to make a custom PCB to hold a bare ATmega328, with the necessary pin headers to plug the wave shield into it, and also connectors to connect the other externals (power, on-off switch, speaker, 5V booster board).
The custom PCB holds the ATmega and some supporting circuitry:
- a 16MHz external crystal and 2 22pf capacitors
- decoupling capacitors for the ATmega
- connectors for power: a female pinheader for the 5V step-up board, a connector for the on-off switch, and a connector for the power supply
- connectors for the RFID sensor (5V power, a data line, and a reset line)
- pinheaders for interfacing with the wave shield: 4 pins for interfacing with the SD card, 4 pins for interfacing with the audio DAC, and a few power pins
The PCB also has holes in strategic places to allow the use of PCB standoffs to bolt everything solidly together and to the casing.
The pictures below show the top and the bottom of the custom PCB with the power module attached to it. The etch mask for the PCB was drawn directly on the copper using my XY-table.
|Top of the PCB||Bottom of the PCB|
The whole electronic setup looks like this:
|All the parts||Everything connected|
Interfacing with the wave shield
The main issue encountered in interfacing with the wave shield, was the way it uses the ground pins on the Arduino.
The Arduino has ground pins on the power header (2 GND pins next to each other), and a GND pin on the header with digital pins 10-13. On the first version of my custom board, the latter GND pin was not connected, since I assumed that supplying GND on the power header would be enough.
However, it turns out that the wave shield connects a part of its circuitry to the ground pins on the power header, and another part of its circuitry to the ground pin on the digital pin header, assuming that these GNDs are connected on the Arduino. This made for funny readings when measuring voltages when the wave shield was plugged into my custom board, since only the GND on the power connector was connected to battery ground. The part of the wave shield that used the other GND was effectively floating compared to the rest of the board.
As an example of the effect: the SD card needs 3.3V, and the wave shield has a dedicated voltage regulator for this. Measuring the voltage between the GND on the power header and the SD card Vcc however, resulted in readings from 3.7V to over 4V. The same measurement with the wave shield sitting on a real arduino produces and exact 3.3V reading. Connecting the GNDs together with a wire on the first board resulted in the correct readings.
A second version of the board corrected this, and this board worked perfectly from the first time.
One small modification was made to the software. In the original version, there is a mapping from RFID tags to file names. This takes up quite a bit of memory, and it also makes it necessary to reprogram the MCU when the cards or the music changes. This is not convenient on a board with no USB connection.
Instead, I changed the program so that it uses the last 8 characters of the RFID tag as the filename. This allows to add new cards and corresponding files without having to reprogram the MCU, as long as the 8 last characters of the tag are different from the other tags in use.
The front panel, which holds the speaker and the RFID reader, and the back panel, which holds the on/off switch, the electronics, and which has cutouts for the volume knob and the USB connection, also could use a make-over. I drew the necessary parts in Inkscape and cut them from 4mm beech multiplex panel.
This is the rear panel with the electronics. The electronics are bolted to a piece of multiplex that is glued at a right angle to the rear panel. Fixing the electronics on the rear panel keeps the volume knob and USB connection always neatly aligned to the cutouts. All in all, the assembly is much neater than the original setup.
This is the final result: