RAPPAHANNOCK COMMUNITY COLLEGE STEM CAMP
  • Home
  • 2021 STEM Camp (HS)
    • PreAcademy prep
    • Day 1: Basics, Lights, and Temperature Sensor >
      • Day 1 Supplement: Measure Temperature
      • Day 1 Supplement: IR Temp Sensor
      • Day 1 Supplement: Identifying Resistors
      • Supplement: Controlling Buttons
      • Supplement: Controlling A Servo
    • Day 2: Measuring Pulse >
      • How the body absorbs light
      • Day 2 Supplement: IR Light Proximity Sensor
      • Day 2 Supplement: Motion Sensor
      • Code to start later on plotter
    • Day 3 Supplement: OLED Screen Basics >
      • Display Screen Temperature
      • IR Temp Sensor And Screen
      • Scrolling Screen Graph
    • Day 4: Finishing up/Show >
      • Pictures to OLED
      • BPM Pulse Sensor
      • Multimeter
  • Shared Google Folder
  • The Teachers
  • Archive
    • Pictures from prior years
    • 2021 STEM Camp (MS) >
      • Home (2021)
      • PreAcademy prep
      • Day 1: Basics, Lights, and Temperature Sensor >
        • Day 1 Supplement: Identifying Resistors
        • Day 1 Supplement: Measure Temperature
        • Day 1 Supplement: IR Light Proximity Sensor
      • Day 2: Ultrasound >
        • Day 2 Supplement: IR Temp Sensor
        • Day 2 Supplement: Controlling A Servo
      • Day 3: Measuring Pulse >
        • Day 3 Supplement: Motion Sensor
      • Day 4: OLED Screen Basics >
        • Temperature Screen Display
        • IR Temp Sensor And Screen
      • Day 5 Friday: Finishing up/Show
    • 2020 STEM Camp >
      • Home (2020)
      • The 2020 Teachers
      • PreAcademy prep
      • Day 1 Monday: Basics and Lights >
        • Day 1 Supplement Activity
      • Day 2 Tuesday: Servos >
        • Day 2 (Suppliment Activities)
      • Day 3 Wednesday: Making an ECG/EKG! >
        • Day 3 (Supplement Page)
      • Day 4 Thursday: Controlling Servos with EMG >
        • Day 4 Supplemental Activity
      • Day 5 Friday: Finishing up/Show >
        • Unused lessons/content
    • 2018 Lessons >
      • Day 1: Basic Coding
      • Day 2: Motors
      • Day 3: Build Robot Claw
      • Day 4: Saving Positions
      • Day 5: Presentations
    • 2017 Camp >
      • Day 1 (Monday)
      • Day 2: Multicolor LED and Keypad
      • Day 3: Servo and Keypad
      • Day 4: Multiple Motors/Stepper Motor
      • Day 5: Presentations
    • Pictures archive for lessons (some graphic images)
  • Contact Us!

Day 4: Thursday June 25, 2020
Controlling your robot with your own electricity! 

Materials Needed Today. 

Picture
Picture
Picture
Picture
Picture

Measuring Body Electricity! (1st activity)

Electromyography is a diagnostic medicine technique for evaluating and recording the electrical activity produced by skeletal muscles. It is performed using an instrument called an electromyograph to produce a record called an electromyogram (EMG).

Below is a video showing a more complex version of what you could make today and tomorrow. 

This video shows a similar ECG machine to the one in your kit using code similar to what you will learn here. 

This video is just for fun and you do not need to watch it if you attend class. 

Watch Mr. Dorsey introduce what to expect. 

Fun tip: You see how zig zaggy my video's baseline signal is?
It is supposed to be a flat when you do not move.
​Here are some reasons why you may have noise in your signal. 
1) Don't wear headphones or any other electronics when you are taking your ECG or EMG.  (In the video I was wearing headphones)
2) Unplug your laptop charger.
3) Wait at least 30 seconds and see if your signal levels out.
      Here is an example of what it may look like if you just need to wait.   
      It may take time to level out. (like 20 seconds) 
Picture

Use the same code from yesterday's lesson that showed you your heart rhythm, but hook the red and yellow leads to your forearm like this. Keep the green lead connected on your side.

It does not matter which color goes on which spot on your arm. 
Picture
Below is Mr. Dorsey's electrical signal when he moves his hand quickly after hooking up the ECG leads to his arm and uploading yesterday's 1st code. Hooking it to your arm makes it an EMG (electromyograph) instead of a heart monitor. 
Picture
If you did not save yesterday's code, here it is again with some very small (inconsequential) changes to reflect that this is an EMG and not an EKG.

Either of yesterday's two codes will work though.
Picture
After you upload the code to the board, open up your Serial Plotter and set the baud rate. 

Do you see your muscle signal? If you stay still, it should be a flat line that only jumps when you move your hand. See the pictures below for an idea of what that looks like. 
Move on to activity 2 when you are ready. 
Picture
Dorsey Staying Still
Notice it stays pretty still at 254 
*your number will be different than mine
Picture
Dorsey Twitching Hand
Notice there are peaks only when moving
*your number will be different than mine​ 
​

Body Controlling a Buzzer (2nd activity)

These are extra materials that you need: Breadboard, 100 Ohm Resistors, Buzzer
Picture
Picture
Picture
Here is a picture of how to wire up the buzzer. 

Use the same code as the 2nd activity from yesterday. The one you used to have the onboard LED blink, the off board lights to blink, and the buzzer to buzz when your heart beat. 

Picture
In case you did not save yesterday's code, below is an example code to use for this activity. 
Note, the only changes to yesterday's code are the threshold value and all of the heart references have been changed to muscle references since the leads are now on your arm. 
Picture

Setting the Threshold Value

Everyone's muscles are different and your electrical signal will be different than mine. So, you need to find your own Threshold. 
Picture
I set my threshold to 260 because my when I did not move, my graph's line is at about 255. My twitch caused it to go to a little above 260. Your threshold needs to be above your flat not moving line but below your twitch peak line. 
Picture

Note, the last two activities may be difficult for you. That is ok, if you cannot get it after asking for help, we will let you know what you can work on instead.  

Body Controlling a Servo (3rd activity)

Warning: Test the following code on a spare servo first. You do not want to test it on a robot hand servo first because you do not want to accidentally break your motors or hand. 
Your code may not work quite right or it may be too strong. 

Watch Mr. Dorsey's Video for Tips

Below is the code in order to control a servo using your arm. Note your threshold values will be different than mine and you get to set your own positions for your servo based on how you want your robot hand to move. 
Picture
Below is where I placed my pads and the signal I got when I moved my arm up and down. The up spikes over 450 happened when I moved my arm up and the down spikes below 200 happened when I moved my arm down. 
Picture
Picture
You will have to set your own thresholds for the high and low values based on your muscle signal. 
Picture
You will have to set your own thresholds for the high and low values based on your muscle signal. I picked 400 for high because when I moved my arm up the numbers always went above that and I picked 200 for low because moving my arm down always made numbers below that. 
Picture

Watch Dorsey Explain what you will see

Testing 

Body Controlling More than One Servo

Tip: You need to power a lot of items with this activity but the Arduino board only has so many GND and Voltage holes.

When you need to power many electrical components, plug all the red + wires into the positive breadboard rail and all of the - black wires into the - blue breadboard rail.

Do not forget to power the rail by connecting the Arduino's GND pin with a black wire to the blue - rail and a red wire from the Arduino's 5V pin to the red + rail.
Picture
You may need a different number of servos than me depending on your robot hand. 
Add as many new servos into your lesson 2 code that you need to control your servo. 

Before we move on, I want to explain 

Picture
Picture

Watch this video to learn about fine tuning your code.

Here are some tips to fine tune your code. 
1) Change one servo value at a time 
Powered by Create your own unique website with customizable templates.
  • Home
  • 2021 STEM Camp (HS)
    • PreAcademy prep
    • Day 1: Basics, Lights, and Temperature Sensor >
      • Day 1 Supplement: Measure Temperature
      • Day 1 Supplement: IR Temp Sensor
      • Day 1 Supplement: Identifying Resistors
      • Supplement: Controlling Buttons
      • Supplement: Controlling A Servo
    • Day 2: Measuring Pulse >
      • How the body absorbs light
      • Day 2 Supplement: IR Light Proximity Sensor
      • Day 2 Supplement: Motion Sensor
      • Code to start later on plotter
    • Day 3 Supplement: OLED Screen Basics >
      • Display Screen Temperature
      • IR Temp Sensor And Screen
      • Scrolling Screen Graph
    • Day 4: Finishing up/Show >
      • Pictures to OLED
      • BPM Pulse Sensor
      • Multimeter
  • Shared Google Folder
  • The Teachers
  • Archive
    • Pictures from prior years
    • 2021 STEM Camp (MS) >
      • Home (2021)
      • PreAcademy prep
      • Day 1: Basics, Lights, and Temperature Sensor >
        • Day 1 Supplement: Identifying Resistors
        • Day 1 Supplement: Measure Temperature
        • Day 1 Supplement: IR Light Proximity Sensor
      • Day 2: Ultrasound >
        • Day 2 Supplement: IR Temp Sensor
        • Day 2 Supplement: Controlling A Servo
      • Day 3: Measuring Pulse >
        • Day 3 Supplement: Motion Sensor
      • Day 4: OLED Screen Basics >
        • Temperature Screen Display
        • IR Temp Sensor And Screen
      • Day 5 Friday: Finishing up/Show
    • 2020 STEM Camp >
      • Home (2020)
      • The 2020 Teachers
      • PreAcademy prep
      • Day 1 Monday: Basics and Lights >
        • Day 1 Supplement Activity
      • Day 2 Tuesday: Servos >
        • Day 2 (Suppliment Activities)
      • Day 3 Wednesday: Making an ECG/EKG! >
        • Day 3 (Supplement Page)
      • Day 4 Thursday: Controlling Servos with EMG >
        • Day 4 Supplemental Activity
      • Day 5 Friday: Finishing up/Show >
        • Unused lessons/content
    • 2018 Lessons >
      • Day 1: Basic Coding
      • Day 2: Motors
      • Day 3: Build Robot Claw
      • Day 4: Saving Positions
      • Day 5: Presentations
    • 2017 Camp >
      • Day 1 (Monday)
      • Day 2: Multicolor LED and Keypad
      • Day 3: Servo and Keypad
      • Day 4: Multiple Motors/Stepper Motor
      • Day 5: Presentations
    • Pictures archive for lessons (some graphic images)
  • Contact Us!