Hello everyone, this is my first Instructables, this project was inspired after watching the Old Spice Muscle Music video commercial, where we can watch how Terry Crews plays different instruments with EMG signals.
We plan to start this journey with this first project, where we generate a square wave signal with a frecuency that varies depending in the amplitude of the EMG signal obtained. Later, this signal will be connected to a Speaker to play that frecuency.
To build this project, we will use as a core, an Arduino UNO and a MyoWare Muscle Sensor. If you can't get a MyoWare Sensor don't worry we wil explain how to build your own, It's a little triky but it's worth the try, as you will learn a LOT!!
Well, let's get started.
Step 1: Get the Parts Required
There are two ways to build this project: using the MyoWare sensor (Step 2 & 3) , and without it (Step 4 & 5).
Using the MyoWare sensor is easier beacuse it doesn't require advanced knowledge about electronics, it's almost just plug and play. Without the MyoWare requires you to have some knowledge about OpAmps, like amplification and filtering, as well as rectification of a signal. This way is more difficult, but it lets you understand what is behind the MyoWare circuit.
For the MyoWare way, we need the following components and tools:
- MyoWare Muscle Sensor (Sparkfun)
- Arduino UNO (Amazon)
- 22 AWG cable
- 3 x 3M Electrodes (Amazon)
- 2 x Alligator Clips
- Arduino USB cable
- Wire Strippers
- 1 x 1000uF (Amazon)
Without the MyoWare, you will need the previous components (without the MyoWare) as well as:
- Power Supply with +12 V, -12 V and 5 V (you can make your own with a Computer PS as shown in this Instructables)
- If your Power Supply AC cable is a 3 prong cable you might need a three-prong/two-prong adapter or cheater plug. (Sometimes that extra prong can generate unwanted noise).
- Intrumentation Amplifier AD620
- OpAmps 2 x LM324 (or similar)
- Diodes 3 x 1N4007 (or similar)
- Non-polarized (can be ceramic capacitors, Polyester ,etc)
- 2 x 100 nF
- 1 x 120 nF
- 1 x 820 nF
- 1 x 1.2 uF
- 1 x 1 uF
- 1 x 4.7 uF
- 1 x 1.8 uF
- Non-polarized (can be ceramic capacitors, Polyester ,etc)
- 2 x 1mF
- 1 x 100 Ohms
- 1 x 3.9k Ohms
- 1 x 5.6k Ohms
- 1 x 1.2k Ohms
- 1 x 2.7k Ohms
- 3 x 8.2k Ohms
- 1 x 6.8k Ohms
- 2 x 1k Ohms
- 1 x 68k Ohms
- 1 x 20k Ohms
- 4 x 10k Ohms
- 6 x 2k Ohms
- 1 x 10k Ohms Potentiometer
Step 2: (With MyoWare) Prepare Electrodes and Connect Them
For this part we need the MyoWare Sensor and 3 electrodes.
If you got large electrodes as we did, you need to cut the edges to reduce its diameter, otherwise, it will block the other electrode which will cause signal interference.
Connect the MyoWare as marked in the 4th page of the Sensor's Manual.
Step 3: (With MyoWare) Connect the Sensor to the Arduino Board
The MyoWare board has 9 Pins: RAW, SHID, GND, + , - , SIG, R, E and M. For this project we only require the " +" to connect 5V, " - " for Ground and " SIG " for the output signal, connected with 3 large cables (~2 ft).
As mentioned above, the "+" pin needs to be connected to the Arduino's 5V pin, "-" to GND and for the SIG we need an additional filter to avoid sudden changes in the signal's amplitude.
For the speaker we only need to connect the Positive wire to the pin 13 and the Negative to GND.
And we are ready for the code!!!
Step 4: (Without MyoWare) Build the Signal's Conditioning Circuit
This circuit is integrated by 8 stages:
- Instrumentation Amplifier
- Low-pass filter
- High-pass filter
- Inverter Amplifier
- Full wave precision rectifier
- Passive Low-pass filter
- Differential Amplifier
- Biased Parallel Clipper
1. Instrumentation Amplifier
This stage is used to pre-amplify the signal with a 500 Gain, and eliminate the 60 Hz signal that may be in the system. This will get us a signal with a maximum amplitude of 200 mV.
2. Low-pass filter
This filter is used to eliminate any signal above 300 Hz.
3. High-pass filter
This filter is used to avoid any signal lower that 20 Hz generated with the movement of the electrodes while wearing it.
4. Inverter Amplifier
With a 68 gain, this amplifier will generate a signal with an amplitude varying from - 8 to 8 V.
5. Full wave precision rectifier
This rectifier converts any negative signal into a positive signal, leaving us with just a positive signal. This is useful because the Arduino only accept a signal from 0 to 5 V in the Analog inputs.
6. Passive Low-pass filter
We use 2 x 1000uF Electrolytic Capacitors in order to avoid sudden changes in the amplitude.
7. Differential Amplifier
After the stage 6, we realize that our signal has a 1.5 V offset, this means that our signal can't go down to 0 V, just to 1.5 V, and a maximum of 8 Volts.
The Differential Amplifier will use a signal of 1.5 V (obtained with a voltage divider and 5V, adjusted with a 10k Potentiometer) and the signal we want to modify and will rest the 1.5 V to the muscle signal, leaving us with a beautiful signal with a minimum of 0 V and a maximum of 6.5 V.
8. Biased Parallel Clipper
Finally, as we mentioned before the Arduino only accepts signals with a maximum amplitude of 5 V. In order to reduce the Maximum amplitude of our signal we need to eliminate the voltage above 5 Volts. This Clipper will help us achieve that.
Step 5: (Without MyoWare) Connect the Electrodes to the Circuit and Arduino
The electrodes placed in the biceps are the Electrodes 1, 2, and the electrode closest to the elbow is known as the reference electrode.
The electrode 1 and 2 are connected to the + and - inputs of the AD620 it doesn't matter in which order.
The reference electrode is conected to GND.
The Filtered signal goes directly to the A0 pin of the Arduino.
**DON'T FORGET TO GONNECT THE ARDUINO'S GND TO THE CIRCUIT'S GND**
Step 6: The Code!!!
Finally, the codes.
1. The first one is a frecuency sweep from 400 Hz to 912 Hz, depending in the amplitude of the signal obtained from the biceps.
2. The second one is the third octave of the C mayor scale, depending on the amplitude it will chose a tone.
You can find the frecuencies in Wikipedia, just ignore decimals
Step 7: Final Results
These are the results obtained, you CAN modify the code in order to play the notes you WANT!!!
The next stage of this project is to integrate some stepper motors, and other kind of actuators in order to play a musical instrument. And also Workout to get strong signals.
Now make your muscles play you some MUSIC. HAVE FUN!! :)