Final project - Mini SoundBot

Idea

In the very beginning, I planned to make a Theremin. It’s an early electronic musical instrument controlled without physical contact by the thereminist.

But I was stucked by the osillators and complicated circut.

So I simplified it to a signal-note converter – I call it SoundBot.

If you wave or move hands in front of the Soundbot, it’ll convert the distance between your hand and the sensor into music notes. You can play a song with your hand but without touching anything. It’s like touchless instrument.

Plan

The final project deadline is 6.22. I began to prepare my final project from 6.8. Like everyweek, I felt time presure.

I devided my work into 4 parts: design, coding, housing and testing. When I began, I only have some sketches of the idea, so I need to complete the project in about 10 days.

To use my spare time wisely, I made a project schedule to help myself concentrate on key tasks:

Task Schedule Outcome
Study theremin principls 6.9-6.11 understanding the basic principle
Coding 6.12-6.18 Program works ok with arduino
Design schematic in eagle 6.12 PCB design
Design board in eagle 6.13 PCB design
Buy components 6.15 Taobao order
Design housing parts 6.13-6.15 Fusion 360 design file
Mill the borad 6.18 Circuit board
Soldering 6.18 Circuit board
Test input & output part 6.19 All parts work properly
Making housing parts 6.18-6.19 Laser cut & 3D print parts
Assemble 6.19 Wind up everything together
Test 6.20-6.21 Final test and prepare for presentation

Tasks list:

  • study theremin principls
  • design schematic in eagle
  • design board in eagle
  • buy components
  • mill the borad
  • soldering
  • coding
  • test input & output part
  • design housing parts
  • making housing parts
  • assemble
  • test

    Process

1. Project blueprint

Input : I use an Ultrasonic Ranging Module HC-SR04 which detects the distance.

Output: At first, I’ve tried to use speaker like this, but it sounds a little wierd.

So I decided to use macbook as output device, my program can synthesize signal into piano-like notes:

Materials and bill

Hardware

  • ATTiny 45 chip
  • Ultrasonic sensor HC-SR04
  • AVRISPSMD
  • FTDI-SMD-HEADER
  • RES 10.0K OHM 1206 SMD
  • CAP CER 1UF 1206
  • Dupont Line

Software

Housing

  • basswood
  • 3D Printing PLA connection parts

The hardware and housing material cost about $17.

item quantity cost
Attiny 45 1 $ 2
HC-SR04 1 $ 1
AVRISPSMD 1 $ 1
FTDI-SMD-HEADER 1 $ 1
RES 10.0K OHM 1206 SMD 2 $ 0.1
CAP CER 1UF 1206 1 $ 0.1
Dupont Line 5 $ 0.1
basswood 2 $ 10
3D Printing PLA 1 $1
glue 1 $ 1
TOTAL $ 17

2. Coding

To use my laptop as an output, I find an open source C++ toolkit for creative coding which named openFrameworks. It helps me simplify audio processing work.

OpenFrameworks download and setup guide for xcode

And I use one of openFrameworks addon - micknoise/Maximilian: C++ Audio and Music DSP Library. It is an audio synthesis and signal processing library written in C++. Via it’s help, my program converts the sensor signals into music notes:

You can downloan my code here.

You can also downloan from box.net.

Before making the board myself, I used Arduino for test:

Hello world test:

3. Design PCB

Since the converting job is mostly done by the program, my circuit board could be relatively simple.

You can download my eagle files here

You can also downloan from box.net.

4. Make the board

I use RSM-20 to mill the board as usual and solder the components.

make the board by sudo make -f hello.HC-SR04.make program-usbtiny

1
avr-objcopy -O ihex hello.HC-SR04.out hello.HC-SR04.c.hex;\
	avr-size --mcu=attiny45 --format=avr hello.HC-SR04.out
AVR Memory Usage
----------------
Device: attiny45

Program:     526 bytes (12.8% Full)
(.text + .data + .bootloader)

Data:          2 bytes (0.8% Full)
(.data + .bss + .noinit)


avrdude -p t45 -P usb -c usbtiny -U flash:w:hello.HC-SR04.c.hex

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e9206
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "hello.HC-SR04.c.hex"
avrdude: input file hello.HC-SR04.c.hex auto detected as Intel Hex
avrdude: writing flash (526 bytes):

Writing | ################################################## | 100% 0.92s

avrdude: 526 bytes of flash written
avrdude: verifying flash memory against hello.HC-SR04.c.hex:
avrdude: load data flash data from input file hello.HC-SR04.c.hex:
avrdude: input file hello.HC-SR04.c.hex auto detected as Intel Hex
avrdude: input file hello.HC-SR04.c.hex contains 526 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 1.11s

avrdude: verifying ...
avrdude: 526 bytes of flash verified

avrdude: safemode: Fuses OK (H:FF, E:DF, L:62)

avrdude done.  Thank you.

5. Housing

The sonar sensor looks quite like a robot eye, so I can make a Wall-E housing for it. I design in Fusion 360 and it’s fun.

Then export to dxf file and inport in Coraldraw, send to GCC Laser Pro. I use speed 2.7 and power 100:

Assembly

Also some 3D pringting parts.

You can download my housing design and cut files here

You can also downloan from box.net.

Test

Everything seems ready. Time for testing!

Test video for UI when playing

I found a bit hard to find the right note when I move my hand back and forth. There’s still refinement to be made in my program.

Presentation

And here’s my final project presentation:

Slide:

Video:

Mini SoundBot - Youtube

Mini SoundBot - Vimeo

Experience

In my final project, I learned some good lessons:

  1. project management

    Things can go really messy if I don’t have a clear plan and specific timetable. Once I decomposition the project into a task list, I know what to do next instead of just panicking. More importantly, every task should has a goal. I need to work it out with the time limits and not spend too much time in one task.

  2. knowledge about audio and some music production princles

    I learned how a program can turn signals into meaningful notes. The scale and autio frequency are interesting. I also learned some basic concepts of music production, like propagation, amplitude, frequency and timbre.

  3. how to apply a third-part framework and addons to save time and energy

    There’re plenty of great projects and libraries in Github. They are all opensource and with good documentation. It’s a time saving way if you find the right toolkit.

Remaining work

The stability of the program still needs improve. If the bot can change sound volume according to the distance it’ll be more like a theremin. And I can build a auto playbar control by program instead of hands.

References

Block diagram of theremin. Volume control in blue, pitch control in yellow and audio output in red.