Tuesday, October 28, 2014

Tone/DTMF detector library for Arduino

Was playing with some cheap radios and decided that the keypad DTMF tones could be used for remote control.
I had some old source that detected touch tones using a AVR microcontroller and decided to convert it for Arduino.

This resulted in a library that detect audio tones played into any Arduino pin.
The audio is first clipped to a 1-bit signal (played loudly into a digital pin) then sampled at 10kHz.
256 1-bit samples (25.6mS) can then be analyzed for the content of one or more audio tones.
The analyzer uses a crude 1-bit DFT but works surprisingly well at detecting multible tones such as DTMF or guitar plucks.
The result can be presented as either a DTMF symbol or approximate signal strength for any frequency analyzed (up to 5kHz).

Here is the library for now (will move to github).

Magnetic levitation

Some students wanted to build a toothbrush holder that floated a toothbrush in mid air to avoid contamination.
I build a prototype to see if it was possible to implement the control system in software.

This project allow a small permanent magnet to be levitated by a electro magnet.
Since static passive magnetic levitation is not possible a HALL effect sensor
 is used to constantly regulate the magnetic field.
To achieve stability a software based PID controller is used.
5 potentiometers is used to control the PID parameters.
This is the Arduino code for the project

Minimalistic APRS transponder

After working on a High altitude Balloon project I got interested in APRS.
APRS is basically a radio amateur driven network that among other things lets you broadcast your position worldwide on VHF radio.
For out project we used this APRS transponder to keep track of the balloon.
Mostly for the challenge I decided to build a really small and inexpensive APRS tracker you wouldn't be too sad to loose.

UPDATE: The example code uses a ATTINY85. Change to ATTINY45 in AtmelStudio if using this chip.

I used a FS6377 integrated clock synthesizer as the VHF transmitter. This chip is I2C programmable and is able to generate 144.8MHz (or 144.39MHz for US) from a 20MHz crystal.
The FS6377 does not have a modulation input but I was able to modulate the crystal oscillator using a simple variable capacitance diode.
I chose the ATTINY85 microcontroller form Atmel because it is cheap and available in a really small package.
The BELL202 modem signal needed for APRS is synthesized inside the ATTINY85 microcontroller and output as a PWM signal.
The frequency of the modem tones need to be very precise and since the internal clock is not very accurate I chose to generate a 10MHz clock frequency externally. It is possible to tune the internal clock in software to gain an extra I/O pin but I didn't need it here.



The transponder really show potential to miniaturized. The transmit power is around 30mW enough for long range if transmitting in line of sight.

The project is heavily inspired by the Trackduino project.

Here is the source code for the project as an AtmelStudo project

UPDATE: Fuses are EXTENDED 0xFF : HIGH 0xDF : LOW 0xC0

UPDATE:
Use this program to change for other frequencies:
http://www.onsemi.com/pub/Collateral/FS6377_REV3.1.0.ZIP
This is the current configuration. Mind that the registers are in reverse order from the order they are sent in transmitter.cpp in the project.