Elastic Sheep

Because elasticdog was already taken

Elastic Sheep header image 1

Babyphone hardware design

January 25th, 2012 · Uncategorized

Here are some details about the hardware design of my babyphone project.

Case reuse

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.

Prototyping

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…

Hardware schematic

You could find the EagleCAD schematic along the source code files on the project repository: http://github.com/elasticsheep/babyphone

Coming next

The next post will details the software design side of the project. Stay tuned…

→ No CommentsTags:

Babyphone audio playback

January 21st, 2012 · Uncategorized

The final circuit has been built inside the phone enclosure, including amplifiers for the speaker and the microphone.

Playback and record modules are developped an tested but the application code only supports playback for the moment.

Next I need to improve the matrix keyboard driver to allow multiple key detection to trigger the record of a new sound. The key combination should be hard enough to prevent the boy from erasing existing message.

→ No CommentsTags:·

Current project

September 27th, 2011 · Uncategorized

I am currently building a “baby phone” toy for my son based on a discarded landline phone enclosure. The toy will feature record and playback on SD card to allow family members to record messages on the device. Voice messages would be played back when pressing a key of the original phone keyboard.

The plan has been to reuse as much of the old phone as possible : speaker, microphone, keyboard.

The prototyping began on a Teensy2 board starting from my previous WAV player project. It has now moved on an ATmega328 because USB Mass Storage is not required and I want to keep my Teensy for other projects.

Hardware is done. Software is almost done. I am now soldering the design on a veroboard to fit it inside its final case.

More details and pictures to come…

→ No CommentsTags:·

Bluetooth module breakout boards are back in stock

September 26th, 2011 · Uncategorized

My initial production was only a short run to prototype the board for my personal use.

Having sold out the stock and seeing the interest for the board, I have ordered a new batch that is now available for sale.

The price at Olimex was interesting for prototyping but not for producing greater quantity. This new batch has been produced by PCBCart instead with same specification.

Order your board in the shop page.

→ 1 CommentTags:··

Serial Bluetooth module – Master/Slave connection

May 20th, 2011 · Uncategorized

I have soldered a second serial Bluetooth module. I am now going to test them in a master/slave configuration.

The test boards

The first test board is the one already used for my slave test with a Teensy 2 as USB to serial adapter and power supply. This board will be the master one.

The second test board is powered by a USB connector and a 3.3V regulator. A serial connection is establish with my laptop through a Prolific PL2303 adapter. This board will be the slave one.

Slave module configuration

The slave module is powered up in command mode. Cu does not seem to work correctly anymore with the PL2303 so I use screen instead:

$>screen /dev/cu.serial 38400
AT+ADDR?
+ADDR:11:3:252002
OK
AT+UART?
+UART:9600,0,0
OK
AT+ROLE?
+ROLE:0
OK

Role=0 is for the slave mode. I keep the default 9600 baud UART speed.

The module Bluetooth address will be useful to establish the connection from the master module.

Master module configuration

The master module is powered up in command mode. The role is changed to 1 for master. The UART baudrate is set to the same as the slave module.

$>sudo cu –s 38400 –l /dev/cu.usbmodemXXXX
AT+UART?
+UART:115200,0,0
OK
AT+UART=9600,0,0
OK
AT+UART?
+UART:9600,0,0
OK
AT+ROLE?
+ROLE:0
OK
AT+ROLE=1
+ROLE:1
OK
AT+ROLE?
+ROLE:1
OK

To establish an automatic connection to a slave module, the master module must know the slave address. This is configured with the AT+BIND command with CMODE=0 (Use a predefined address).

AT+CMODE?
+CMOD:0
OK
AT+BIND=11,3,252002
OK
AT+BIND?
+BIND:11:3:252002
OK

With CMODE=1, the master can connect to any device in its transmission range, so it is a much less secure configuration.

Master/Slave automatic connection

Now that the two modules are setup, I power up them in automatic mode (PIO11 = 0).

On each module, the red leds connected to PIO8 blinks quickly. After less than 2 seconds, the green led connected to PIO9 is shining on both modules indicating that they are now paired and connected, ready to transmit data.

I connect a terminal to the serial port of each module with their respective adapter to test the communication:

The first window displays the connection to the master BT module. The second window displays the connection to the slave BT module.

The connection is successful at 9600 bauds. I also successfully tested the communication at 115200 bauds.

→ 7 CommentsTags:···