## A2 ELEC6 CW - Part 2

##### Nov 13, 16 - 17:09pm, 1 year and 7 months ago

Alright so, I did a bit of testing on my idea and this is what I found out:

• Typical motors are too fast, even when geared
• The DAC to freq. converter isn’t possible
• The BCD is overly-complex
• Making 7 different astables is way too much hassle
• Software > Hardware in this instance

I did some tests on a small BCD with a little 9 volt motor; and it turns out that the minimum RPM of the geared motors my college uses is like ~4Hz or something, obviously way too fast, infact if I used those the song would be at ~179BMP or something stupid like that.

Solution: software, I’m going to have to use a microcontroller with a stepper motor, that way its easier to control the tick rate and the motor won’t have problems with inertia since the stepper has a tonne (not literally) of torque behind it. The minimum angle stepper my college have is about ~1 degree, so now I could add 360 possible notes. There’s another issue with that though, the photodiodes would have to be exactly on the money to give a logic high on the right note, since I have 7 photodiodes the chances of them all working in harmony is very low at that resolution. Not to mention how insanely difficult drawing out ~2520 notes on a disc sounds anyway.

Now onto the BCD, since I’ve decided to chuck out the DAC, I can use digital values in place of analogue signals, i.e. 0001 = C, 0010 = B, and so on, since I only have 7 notes, that means I only need to allocate 3 bands in total to the disc for the notes, since in binary 7 can be made with just 3 bits.

The earlier concept was to use the DAC output to go into several comparators, and when the voltage exceeded a set level an astable at a specific frequency would sound, obviously making 7 comparators and 7 astables is just plain stupid really, I found out that using software I can oscillate one of the pins on a 28X1 microcontroller to a set frequency, which makes things much easier.

This significantly simplifies the overall system, with most of the work being done by the microcontrollers. The reason why I have to use two microcontrollers is because it’s not possible to multithread routines, for example, if the motor speed was at 2 times its speed and then a note is going to be played, the microcontroller code would still be in the motor speed controlling routine, making it unable to make the frequency displayed on the BCD. If I were using a conventional motor I could’ve controlled the motor with some logic system and a few comparators, oh well.

Now then the new BCD system goes like this:

Note Binary
C 000
D 001
E♭ 011
F 100
G 101
A♭ 110
B♭ 111

So the song is now:

Note Frequency Binary Comment
C 519 000
D 617 001
E♭ 692 011
D 617 001
D 617 001 – Tied to above
E♭ 692 011
E♭ 692 011
A♭ 925 110
G 824 101
F 777 100
E♭ 692 011
F 777 100
F 777 100 – Tied to above note
A♭ 925 110
B♭ 1038 111
E♭ 692 011
E♭ 692 011 – Tied to above note
D 617 001
A♭ 925 110
A♭ 925 110
F 777 100
A♭ 925 110
A♭ 925 110
B♭ 1038 111
B♭ 1038 111 – Tied to above note

The innermost band is the MSB. This reduces the total photodiode count to 5, thus under the max allowed bands using the Codewheel program.

?