Here are some details about the hardware design of my babyphone project.
One of the project goal was to reuse as much of the original speakerphone case as possible, including the power switch, volume control potentiometer, front leds and keyboard. I though that as the box already contained amplifiers circuits for the speaker and the internal microphone, I could try to reuse those as well and design my project around them…
I first poked inside the existing circuit to find a way to simply insert my circuit in the amplifier paths. But I quickly realize I would use more time trying to reverse-engineering the design instead of building my own.
Then the only constraint was to keep the existing PCB footprint to ease the integration with the original switches.
Here is the breadboard prototype in its final stage:
The design is build around an ATMEGA328 connected to an SD card through the SPI interface. Like in my previous audio player circuit, audio samples are played on a PWM output. The signal is filtered with an RC circuit and amplified by a LM386 to drive a 0.3W speaker.
The sound from the electret microphone is amplified by a simple transistor circuit found on Sparkfun.com and then connected to an ADC input of the microcontroller to be sampled.
The circuit is powered by a single 9V battery that provides a “high” voltage for the LM386 amplifier. A 3.3V regulator provides the digital power supply to the microcontroller and to the SD card.
I am using a 16MHz crystal for the extra speed bump despite the 3.3V voltage that would qualify this as “overclocking”.
High current draw from the SD card
One difficulty I met was having spike noise in the audio recorded by the microphone on the SD card. It appears the SD card draws a high level of current during write operations and this was affecting the stability of the microphone amplifier power supply.
Here is a capture of the signals on an oscilloscope while writing sectors on the SD card. The blue signal is the output of the microphone and the yellow signal is the input of the ADC pin:
I tried to add decoupling capacitors around the SD card VCC and around the microphone amplifier to no avail. One solution I finally found in an application note from Actel: use separate regulators for the digital and analog domains.
So I added a second 3.3V regulator to provide an AVCC power supply to my microphone amplifier and an AREF reference voltage for the microcontroller.
No more noise, problem solved.
Connection of the matrix keyboard
The keyboard of the phone is on a separate PCB including two leds. This keyboard is using a matrix configuration with 19 keys arranged in 5 columns and 4 rows. The handsfree key is surprisingly wired separately. Four separate wires allow to control 2 front leds, a green one and a red one.
The keyboard PCB was connected to the main PCB through to a 17-wire ribbon cable. I reuse this cable by soldering a 0.1” header on it.
Fitting the circuit inside the phone
Considering the project is a one-shot, I choosed to use veroboards to solder my circuits.
The big one will be the main board supporting the microcontroller, the SD card slot and a female header for the keyboard connection.
The upper-right board will be a power board supporting the two voltage regulator and the main power switch.
The lower-right board will be the analog board containing both amplifiers circuits and a slide potentiometer to adjust the speaker level. It will be connected to the microphone already molded into the case and from whom you can see the black and red wires on the picture.
The 9V battery will fit at the bottom of the case.
To ease the maintenance of the circuit, the boards will be connected together by wires secured by screw terminals.
Building the boards
Here is the power supply board:
The amplifier board connected to the power supply board:
The amplifier in action playing a sinus signal coming from my laptop audio output:
And here is the main board. The SD card slot is a holder for a microSD. It is soldered on a right angle pin header.
The main board has been cut to fit the prominent speaker magnet.
At the end everything fit together inside the case:
Wires everywhere. In fact I am not really a fan of veroboards. It is a little tedious to assemble without proper planning…
You could find the EagleCAD schematic along the source code files on the project repository: http://github.com/elasticsheep/babyphone
The next post will details the software design side of the project. Stay tuned…