2016-09-03 (Sa) Clockwork Theremin

Pseudo coding was started the yesterday but the concept was so simple that it was difficult to start. Two lines were written. It took another day to get into the mindset of coding.

Enough background.
----------

Since the project is blatantly copying the operation of a hobby servo it was easy to forget that the position of the potentiometer won't exactly correspond to the limits of the gear. The final gear in this project only turns 180º while a single-turn potentiometer may turn 270º or more. These numbers could be hard-coded and there wouldn't be much of a difference but this project wants to eek every degree out of the movement so a calibration switch was added to the design.

The calibration switch wasn't shown on the schematics yesterday. There will be a reed switch under each of the final gears opposite the halfway mark. Two magnets will be placed on the gear so anytime a limit is reached the switch will close. Only one motor will calibrate at a time so the switches can be wired in parallel to save inputs. This will also provide a spectacle when the theremin starts by centering the final gears then sequentially turning to the maximum range, then the minimum and back to center.

The calibration routine will run on start up and will hopefully take less than eight seconds. A button on the console can be labeled "CALIBRATE" but it will actually be a reset button connected to the Arduino's RESET pin and ground.

Pseudo code for calibrating the theremin

Pseudo code for the body of the program was written. There will be no reason to add any delay() functions. Each pass through the code will:
  • Take a distance reading for pitch
  • Move the pitch motor in the correct direction (if necessary)
  • Take a distance reading for volume
  • Move the volume motor in the correct direction (if necessary)
  • If there is no reading on the volume sensor the output relay will be turned off so there is no sound
Functions will be written as necessary in order to streamline the code.

Pseudo code for reading hand position and motor movement with feedback

Downloads:
Parts list:


The rest of the posts for this project have been arranged by date.

First time here?

Completed projects from year 1.

Completed projects from year 2.

Completed projects from year 3.


Disclaimer for http://24hourengineer.blogspot.com/

This disclaimer must be intact and whole. This disclaimer must be included if a project is distributed.

All information in this blog, or linked by this blog, are not to be taken as advice or solicitation. Anyone attempting to replicate, in whole or in part, is responsible for the outcome and procedure. Any loss of functionality, money, property or similar, is the responsibility of those involved in the replication.

All digital communication regarding the email address 24hourengineer@gmail.com becomes the intellectual property of Brian McEvoy. Any information contained within these messages may be distributed or retained at the discretion of Brian McEvoy. Any email sent to this address, or any email account owned by Brian McEvoy, cannot be used to claim property or assets.

Comments to the blog may be utilized or erased at the discretion of the owner. No one posting may claim claim property or assets based on their post.

This blog, including pictures and text, is copyright to Brian McEvoy.

2016-08-31 (W)

Comments