Close
0%
0%

Making music with relay chatter

One of the Hackaday 2018 entries is to make a musical instrument of sorts and I thought of the sounder used by Morse Code operators

Similar projects worth following
A pro mini is programmed to read an Ascii character array, and match up the Ascii character to a morse code character. If by chance an Ascii character has no Morse Code equivalent ,that translation returns a no code flag.

In the search for a suitable relay to make the music, I found a DC motor with an off set weight.  I thought that I would possibly use a motor, and a relay (built around a solenoid) to make the sounds. I ran tests with the motor running at various speeds using the PWM pins on a SparkFun pro mini.  I will soon have an Idea of what the final direction will be.

Ascii2MorseCodeNoiseMaker.pdf

The software to make a pro mini read an Ascii character array and then convert the Ascii into a 1 to 6 bit morse code with a 3 bit counter. The actual code is in the INO file.

Adobe Portable Document Format - 241.71 kB - 10/06/2018 at 05:23

Preview
Download

Ascii_to_Morse_code_Noise_maker2.ino

Arduino code Latest version with additional line comments

ino - 15.50 kB - 10/07/2018 at 03:26

Download

MorseCodeSchematic.pdf

Schematic of the test bed using a Sparkfun pro mini

Adobe Portable Document Format - 32.87 kB - 10/02/2018 at 23:08

Preview
Download

20181006_210836.mp4

Video + sound of a performance of 2 relays producing the sound

MPEG-4 Video - 21.66 MB - 10/07/2018 at 04:17

Download

JPEG Image - 3.81 MB - 10/03/2018 at 00:57

Preview
Download

View all 6 files

  • 1 × Solderable BreadBoard 3"x4.25"
  • 1 × SparkFun Pro Mini 5V 16 Mhz board
  • 7 × diode 1N914
  • 3 × Capacitor 1000 ufd 50 volts
  • 3 × LM2596 adjustable buck switching supply module

View all 12 components

  • The mystery of 9 bits contained within 8 bits

    Boelens, Leland09/30/2018 at 07:55 0 comments

    I found a way of storing 9 bits of information within 8 bits.

    Morse code has 1 dit or 1 dah up to a combination totaling 6 bits of information.

    I decided that I would represent a 0 as a dit, and a 1 as a dah. Then I decided I would use the lower 3 bits to represent a bit count register. Bits 1 thru 5 were possible and still fit into 8 bits. It took more thought to work out a work around to get 6 bits of Morse  code and have a 3 bit count register.  Then it occurred to me that I could use the binary 001, 010, 011, 101 as is, I just needed to work in 110 and 100. I recognized that 000 and 100 had both lower bits as a 0 and this was not the case with 1,2,3, and 5.  I also realized that the binary "4" bit position was the needed 6 th bit. So I came up with a numbering and a conversion scheme that works. B000 and B100 represent that 6 bits of Morse code are in this byte. B111 represents that 4 bits of Morse code are contained in this byte. B110 represents this byte contains no valid Morse code, skip this byte.

    The Morse code byte is unpacked in this manner. The 3 LSB bits are masked out and tested. First for a B110, to skip around outputting bad data. Then if B000 or  B100 is present then the bit count is set to B110 and the Morse code byte is right shifted 2 times to position the LSB into bit D0 maintaining the 6 Morse code bits or shifted right 3 times to position the 1 thru 5 bits of Morse code to align the LSB with D0. The final step is to test if the bit count register contains B111,  then if B111 is present the bit count is set to B100.

    So in the end I was able to pack 6 bits of Morse code plus a 3 bit count register totaling 9 bits, into 8 bits of data.

  • The Ascii to Morse Code generator is working

    Boelens, Leland09/30/2018 at 07:10 0 comments

    The program reads an ASCII character string array.

    The ASCII is tested for being in the range of 0x20 to 0x7F.  Any character not a Morse code character will be flagged as a no code and will be skipped.

    The ASCII is used as a pointer to the data byte that holds the Morse code.

    The Morse code is then output to the relay for a dit and a dah, but the PWM outputs have a dit output and another a dah output.

    I managed to use one byte of data to contain 1 to 6 bits of Morse code, and a 3 bit register to contain the number of bits of Morse code contained in this byte.

    I am still working on the final mix of output activity for the final performance but I am leaning toward a relay, with possibly one or more piezo sound devices.

  • The test bed is made

    Boelens, Leland09/25/2018 at 07:09 0 comments

    I assembled the components onto the prototype test bread board using point to point wiring.

    This test bed has 3 adjustable voltage switching supplies. The two outside supplies are for the relays and motors and are set to 3 volts and 12 volts to start and this may change. The center supply is adjusted for 7.5 volts to power the pro mini thru the RAW power pin.

    The pro mini PWM pins are wired to 6  FET s with one digital output driving the seventh FET. If I need the 6 PWM pins they are ready to go, and if I need another digital output I can program one of the PWM pins as a digital output.

    The A2 and A3 pins are wired to 2K ohm trim pots to provide a user adjustable input level. I may use them for speed and delay adjustments.

    NOW, Let the programming and testing begin.

View all 3 project logs

  • 1
    Start with a solderable breadboard from All Electronics CAT # PC-4 a 3" by 4.25"
  • 2
    Enlarge the holes for the bridge rectifier. The first hole is 9 holes from the left long edge and the first top hole. Then the next three holes are parallel to the long edge spaced .2 " apart.
  • 3
    Enlarge the holes for the two 6 terminal connection points. The left side starts at 1 hole in from the side and the 4th hole from the bottom, then every other hole for the next 5 holes. The other 6 terminal strip is on the right edge mirroring the left

View all 10 instructions

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates