Author Archives: Chris

Arduino Motor Controller Part 1: Making a Plan

I am not sure exactly how many parts this series will be. As I publish more of the parts I will return to this post and modify it to have links here to the other parts.

The first thing I did is decide on a goal. I wanted to have a potentiometer control the direction and speed of a motor as I turned it. The reason I wanted this was because my next project is going to be having the motor respond to inputs from sensors that I have not used before, so I wanted to make sure that when the time comes to learn how to wire and program with those sensors that I will have the wiring and programming already correct for the motor part. Everything is baby steps.

After coming up with the goal I reflected on what I already knew and what I would need to adapt from this.

  • I already knew how to use LEDs and I knew that putting a stronger resistor with an LED will make it glow dimly while putting a weak one will make it glow strongly.
  • I also knew that a potentiometer is a variable resistor. This means that as you rotate the dial it will go from being a weak resistor to being a strong one.
  • So what I needed to do first was figure out how to make it so that the potentiometer is set as an input with the middle value set as a neutral and anything below that value triggering a red light and anything above that value triggering a green value.
  • I had found good tutorials for Arduino at Learn Sparkfun before and decided to look there for a potentiometer tutorial. I found one, copied it and within 5 minutes had a blinking LED. As I turned the potentiometer the light blinked faster or slower. (I used their code exactly as it appeared, so if you are trying to replicate this. Follow their wiring guide and their code.)
  • Now to figure out the motor. I knew that the motor and motor controller were from FingerTech Robotics in Saskatoon, so I thought I would start with their website. They had a video of a guy using the ESC (electronic speed controller) with a RC controller (a radio controller) not an arduino. Hmm. I knew from the robot competition last year that I saw students from other schools using an Arduino to control their motors, but how? I googled Arduino TinyESC tutorial and found a tutorial at tech valley projects, it looked hopeful so I dutifully copied it.
  • The motor started to turn. That is fun. I have no idea why. So I think I have the hardware setup, now I have to figure out the programming.

Figuring out the programming turned out to be a lot harder process. Join me in part 2 as I go through the tech valley programming and discover that while the hardware setup is correct that the programming is almost completely wrong and I need to go in a different direction if I actually want to have control over the motor.

The other thought I have about all of this is that it reminds me of one of the lessons from my ECI 831 class on the importance of remixing. There was a great video series that I watched on remixing and the role it plays in creativity and learning called Everything is a Remix. Right now I am in the copy stage of the copy –> Transform –> Combine. Part 2 I will enter into the transform portion of the project as I start to change things in the code.

Original image Available for download at Everything is a Remix

Thanks for stopping by, hope you enjoyed the read.


Arduino Motor Control

Okay, this is going to be a quick post with much more detail to follow. For the last two weeks you have likely been wondering what is up with the Arduino project. Well I have been working on it, but I kept holding off on posting because I kept thinking just a few more minutes and I will have something worth sharing. Every few minutes I would hit a new roadblock and it would take me a little more time to work around that roadblock. I finally got the project to work, and I am going to post how I did it in a series of posts that walk through each of the roadblocks. We are looking at probably 15 hours worth of learning on this one. (I know please do not judge me when you see how simple the solution is.)  Writing those posts so that you can understand the learning process and hopefully so that you can learn along with me will take a little bit but I plan on having them all up in the next few days. In the meantime though here is what I accomplished.

I was able to wire up and write a program that would control the direction and speed of a motor with a dial called a potentiometer. So if I turn the dial to the left the motor goes backwards, if I turn it further it speeds up. If I turn the dial to the right it goes forwards, if I turn it further it speeds up more.

I know that sounds so simple, and in the end the program actually is simple. That does not mean that the learning process to figure out how to make it do that was simple. There were definitely moments where I started to question if I would figure it out or if I was going to have to find a computer engineer to help me. The good thing is that I very much understand the system now and will definetly be able to help others with this, which is why I chose this project in the first place.

Alright, enough talk. Here is the video.

Okay. So that might not look like much, but seriously it took me about 15 hours to figure all of it out. I had to use a ton of internet resources, and I now know a lot more about how the arduino uno works. Also there is something called PWM which is really neat. So check back in the next couple of days to learn all the things I had to overcome to do it.


Take the Red Pill

This week in ECI 831 we were given a long laundry list of resources to go through and evaluate. Each of them was an OER (Open Educational Resource) repository or something similar to that. Sapna does an excellent job of explaining what those are for anyone who does not know. Now, I consider myself to be a techie teacher aware of many online tools, but boy was I in for a surprise. I knew that theoretically there were free resources online, but most of the time when I went looking for them I came across piecemeal stuff of middling quality. I would find a worksheet here and a somewhat useful resource there. I had found a few go to sites for simulations for science classes, but I did not expect to find whole courses, well thought out lesson plans, and more online. At least I did not expect to find these things for free.

I am going to confess that I have not yet had time to evaluate all of the sites that we were given. For anyone not in the course, I have included a list of the resources.

    1. Connexions
    2. OER Commons
    3. Archive.org (and Archive.org Education)
    4. MERLOT
    5. Open Courseware Consortium
    6. CK12 Foundation
    7. Curriki
    8. Khan Academy
    9. Lab Space
    10. Open Textbook Library
    11. American Institute of Mathematics
    12. Open Learn
    13. TED Ed
    14. Wiki Educator
    15. P2PU
    16. OpenStax
    17. MOOC Providers: Coursera, Udacity, EdX
    18. A long list of many more repositories, directories, and resources here.

I made it a little over 75% of the way through the list and found myself enjoying one of the resources so much that I needed to just camp out there for a little while. There is some really useful stuff in this list and I do plan on evaluating them all for myself eventually. (I created a rubric that I am working on filling in, but it takes time.)

Here are my thoughts.

Wow, um. So why do I buy educational resources? Why do any of us buy educational resources? I mean I understand why the school would need to purchase physical resources like chemicals for my science lab, and equipment, but I no longer think that I could ever purchase another textbook, worksheet package, or anything like that unless it was absolutely magical. I weep at the fact that I have spent obscene amounts of my own money over my career so far on resources that are no better than what I found for free last week.

I would say that OERs are definitely the future. If you think about the cost for a province to purchase 10,000 textbooks (In a recent speech the minister of education said students should have access to textbooks) for a single grade in a single subject you are looking at a minimum of $600,000 if you can get the books for $50 each. The province would save money if instead it paid an expert teacher, or team of teachers, to develop a textbook and made it available online as an OER. Each teacher in the province could then access it and modify it as needed. You could have a shared repository for it and have teachers upload any lessons and modifications that they make. This would level the learning experience across the province much more. Since not every student has electronic devices available the province would have to print some copies of it, negating some of the savings, but even if you printed and coil bound 5000 copies at about $25 each you would still only spend $225,000 for the OER and the printed material. This would also mean that the textbooks and supporting resources would better match our curriculum than textbooks that we purchase that were developed for other larger markets. BC is already starting to do this as well as other jurisdictions. At a local school level, I know that I will never recommend the purchase of a textbook again without first scouring the internet first for appropriate free materials first. (I modified the image below to create a meme that expresses how I feel about this).

Adapted by Chris Reed from http://shamelesspride.com/red-pill-blue-pill/the-matrix-red-or-blue-pill_original/

So it is clear that OERs are awesome and exist in abundance, but what is the quality like? I really liked ck-12 because it focused so heavily on my area of teaching, maths and sciences at the high school level. Many of the other OERs were focused at the university level, which is great for me to review, but not so helpful to anyone other than my grade 12 students who are looking for supplementary material.

So what makes ck-12 great? Well, it has a teacher and a student side to it which means that there are different focuses on the kind of resources that it brings up for you. As a student it tries to bring up things that will help you learn the material. It is like a study guide or a tutor. It will suggest simulations and learning activities for the material that you are trying to master. It will also find groups to connect you with that are interested in the same kind of material that you are. There was a tool called stoodle that allowed you to ask for help, but also to offer it to others. It is like a big online study chat session. I can see this being really useful to students trying to learn more about a subject when they do not have access to a teacher. The teacher side presents resources differently. It is more trying to help you plan a lesson or a unit. It has a concept mapping tool to help you figure out how the ideas in a unit connect together. When you search for resources you can also narrow it by the type of standard you want it to match. While most of the standards are American you can still use them as a useful guide. I was able to find lots of material for the test concept that I looked up. I made a screencast of it below in case you want a quick peek at how it works.

I am converted to OERs and cannot see myself easily handing money over to anyone in the future for a resource without it doing a lot of things for me. At this point though I am still a taker. I need to learn how to help others by sharing my resources better. As a first step here is the link for the covalent bonding lesson handout that I developed for my class tomorrow. All rights granted. Have fun with it.

Thanks for reading. Let me know what you think in the comments.

 


Standing on the Shoulders of Other Teachers

I really enjoyed the viewings/readings that we had this week for my ECI 831 class. For those of you not in the course (I believe that I have one or two family members reading this at this point) it was about the idea of open education and open media.

To quickly give a definition for those of you not in the course, open education is basically the idea that resources are provided online in a format that is available for anyone to use to teach. This makes teaching and learning more democratic. It can be afforded by anyone with an internet connection then. If you have 3 minutes I really encourage you to watch the first video.

Open education is not just about helping out poor students or poor schools. It is about helping everyone have access to the best resources. As a teacher I do not have time to learn or dream up all of the great activities that I could be doing with my students. Open education means that I can find amazing resources and see ways of teaching things that never would have occured to me.

 

Now before I can just go and use something I have certain legal obligations. I need to make sure that I have the right to show it, that I am attributing it correctly, I need to make sure that I am following the copyright rules. Every year as a school staff we spend a whole staff meeting near the beginning of the year going over the Copyright Matters! handbook for teachers that tells us what we can and cannot use. I never want to be the teacher that:

Obtained via Quickmemes http://www.quickmeme.com/meme/3oxj2r

Which leads me to a point that Larry Lessig makes in his TED talk “Laws that Choke Creativity.” At the end of his talk he points out the fact that our system of regulation is causing all of us to willfully break the law. He says, 

“We need to recognize you can’t kill the instinct the technology produces. We can only criminalize it. We can’t stop our kids from using it. We can only drive it underground. We can’t make our kids passive again. We can only make them, quote, “pirates.” And is that good? We live in this weird time. It’s kind of age of prohibitions, where in many areas of our life, we live life constantly against the law. Ordinary people live life against the law, and that’s what I — we are doing to our kids. They live life knowing they live it against the law. That realization is extraordinarily corrosive, extraordinarily corrupting.”

Almost everyone is violating copyright, not by accident, but on purpose. Many of us will use a netlix login from another country to gain access to content. Some will torrent movies, music, etc. My students at a Christian school, supposedly with good law abiding students often tell me of illegaly downloading music, movies, etc. I challenged one student on it saying that his use of an illegally download dreamweaver program made by Adobe was morally wrong. He simply laughed at me and said that they should not have made it so expensive and he might have actually purchased it. Larry’s point about this being a dangerous behaviour is correct. We do want to teach our students about critical thinking and about how to advocate for justice, but we want to make sure that they also understand that there is a difference between protest and just outright deciding that a law is inconvient for us and therefore should not apply. Also if we do that then the law does not change, in order to change the law we actually have to challenge the laws and demand that they change, not just ignore them. 

This is where creative commons and open education become so much more important now in this age of extreme copyright protection. These movements allow everyone, teachers included, to fairly and openly use material for appropriate uses and still allows for content creators to get money for when their materials are used for commerical purposes. The system is not perfect but it is improving things. People are also starting to connect more with the content creators through this system and it is leading to new collaborations, like Ze Frank talked about in his Ted talk, “My Web Playroom.

So in closing I find myself heavily in favour of the sharing economy of teaching resources. I often use material that I have found online. To paraphrase Isaac Newton, who was paraphrasing Bernard Chartes, “If my lessons have been better than those who went before me it is because I have been standing on the shoulders of other teachers.” It is important to note that the sharing economy only works if multiple people do it. We cannot just be takers, but must be givers as well. We can do this by posting materials online in blogs like this. We can also do it be sharing google drives with teacher groups, etc. None of us as teachers have gotten where we are on our own, and we must continue the tradition of sharing those resources that we develop or improve upon.

 

 


Game Clicker System Part 3

This is the final part of the game clicker system. Part 1 was about learning how to use a single button, part 2 was about adding the second button. Part 3 came as a result of comment a collegue of mine made. I was building this on the bus drive home from a Calgary teaching convention. I had built part 2 and showed it with a little bit of pride to one of my fellow science teachers. He chuckled and said it looks great but can you make it so that when you click the button the light stays on and does not turn off until the button is clicked again. In other words he was not challenging me to add anything physically to the hardware, but to improve the software.

Desired Outcome:

  • As I implied in the story above, my desired outcome for this project is to make it so that when I click the red button, the red light comes on and stays on until I click it again. Likewise when I click the green button the green light should come on and stay on until the green button is clicked. In addition to this I want it so that when one light is on the other cannot come on.

Supplies Needed:

  • This is the same build as part 2, but I have listed it below.
  • You need the following:
    • arduino uno,
    • 2  LED,
    • A breadboard,
    • 3 resistors (one of at least 100 ohms for the LED, the other about 10000 (10K) ohms for the pull-up circuit),
    • A clicker button of some kind (I used an arcade style button),
    • Plus 13 wires to connect everything. If you happen to have 2 alligator clips that would be helpful for connecting to the button.

Hardware setup:

    • Again this is the same as build two. You can check there for the details but I have put the schematic picture below. 

Software setup:

I have written the sketch on the next bullet point. You can copy it into your IDE to program your own arduino.

  • /* This build has 2 buttons that control 2 LEDs. The LEDs lock the
    * other LED out when they turn on and stay on until the button is
    * clicked again.
    */const int button1PIN = 2; //pushbutton 1 is attached to pin 2.
    const int button2PIN = 1; //pushbutton 2 is attached to pin 1.
    const int led1PIN = 13; // LED 1 is attached to pin 13.
    const int led2PIN = 12; // LED 2 is attached to pin 12.
    const int led3PIN = 11; // LED 3 is attached to pin 11.

    //There are 5 pins that are used so we set them as constants

    void setup()
    {
    pinMode(button1PIN, INPUT); //button 1 has been set as an input.
    pinMode(button2PIN, INPUT); //button 2 has been set as an input.
    pinMode(led1PIN, OUTPUT); //led1 has been set as an output.
    pinMode(led2PIN, OUTPUT); //led2 has been set as an output.
    pinMode(led3PIN, OUTPUT); //led3 has been set as an output.
    }

    void loop()
    {
    int button1State;
    int button2State;
    //These are variables to hold the push state of button 1 and button 2.

    int button1Pressed;
    int button2Pressed;
    //These variables hold the memory of if button 1 and 2 were pressed.

    button1State = digitalRead(button1PIN);
    button2State = digitalRead(button2PIN);
    /* This reads the position of button 1 and writes it to button1State.
    * It also takes the position of button 2 and writes it to button2State.
    */

    button1Pressed = 0;
    button2Pressed = 0;
    /* We start off by saying that neither button is pressed.
    *
    */

    /* Something to remember is that the way the button is setup is with a
    * pullup resistor. What this means is that when the button is not pressed
    * 5 volts flows to the pin. When the button is pressed those 5 volts flow
    * to the ground instead and so the pin reads LOW.
    */

    digitalWrite(led1PIN, LOW);
    digitalWrite(led2PIN, LOW);
    /* This starts with the leds off.
    *
    */

    while((button1State == LOW)||(button1Pressed == 1))
    {
    digitalWrite(led1PIN, HIGH);
    digitalWrite(led2PIN, LOW);
    button1Pressed = 1;
    delay(50);
    while(button1State == LOW)
    {
    button1State = digitalRead(button1PIN);
    delay(10);
    }
    while(button1State == HIGH)
    {
    button1State = digitalRead(button1PIN);
    delay(10);
    }
    button1Pressed = 0;
    delay(150);
    button1State = digitalRead(button1PIN);
    }
    /* The idea is if button 1 is pressed it will set the pressed value to 1
    * Then the loop will continue keep LED1 lit until button 1 is clicked
    * again then it will set the pressed value to 0 and exit the loop
    */
    while((button2State == LOW)||(button2Pressed == 1))
    {
    digitalWrite(led1PIN, LOW);
    digitalWrite(led2PIN, HIGH);
    button2Pressed = 1;
    delay(50);
    while(button2State == LOW)
    {
    button2State = digitalRead(button2PIN);
    delay(10);
    }
    while(button2State == HIGH)
    {
    button2State = digitalRead(button2PIN);
    delay(10);
    }
    button2Pressed = 0;
    delay(150);
    button2State = digitalRead(button2PIN);
    }
    }

Things I learned:

  • When I was challenged by my fellow teacher I thought, this should be simple. I understand logic and will create a WHILE statement that says that if the button has been pressed to keep the light on and if it gets pressed again to shut the light off. I know about WHILE statements from programming in other languages. WHILE statements are similar to IF statements in that they start with a condition that is evaluated. The difference is that IF statements run through the condition once and IF it is true they do it once. A WHILE statement is a loop. It will continue to do the instruction as long as the condition is true.
  • So that is what I while statement is and my thought was that I would create something that would behave using the following logical argument.
    • When the green button gets pressed and the red light is not on turn on the green light.
    • When you turn it on make a record that you turned it on.
    • Next time when the green button gets pressed turn the light off.
    • When you shut it off make a record that you shut it off.
    • Then you would do the same for the red button.
  • So that was the plan. I wrote that program, I ran it and the lights did not do what I expected. Sometimes they turned on and off right away, sometimes they would take multiple clicks to turn on and off. It was very frustrating. So I went looking online for help. I googled push button arduino tutorial and came across a tutorial that did not match exactly what I wanted but looked similar enough. It was about how to build a switch that turned on a light with the click of a button and then shut it off with another click. This person had done it using IF statements inside of the void loop. I did not think that was the problem. The other thing they did was add a time delay to allow the circuit to clear the last bit of logic out of it.
  • I had not thought of that. For us going though a loop we can see when to progress and when to stop. For a computer it does each step as fast as possible. So when I clicked down the button it turned the light on, recorded that it was pressed, and if it was still pressed (which is only about 15 milliseconds later so probably) it shut of the light and recorded that it was off. The computer was likely doing what I asked it to but it was doing it too quickly. So I put in delays after each step.
  • The delays made it work. With that said it does not work perfectly. It requires you to click the button and release it quickly (within the 50 millisecond delay) I could play around with this but it seemed like a good amount of time after trying a lot of different variations.
  • The new functions that I learned are:
    • While = This is a loop that evaluates a condition. If that condition is true then it runs through the loop and checks the condition again. As long as the condition remains true it will keep going through the loop.

Video of it working:

Here is a brief video of it working.

Thank you for stopping by. Let me know if you try this setup and how it goes for you.


Game Clicker System Part 2

This is part 2 of a 3 part build for my ECI831 learning project. If you have not seen part one be sure to check that out first.

Desired Outcome:

  • Once I had one light and one button working I decided the next step was to add the second light and the second button. It is only a minor adjustment to the previous circuit.

Supplies Needed:

  • You need the following:
    • arduino uno,
    • 2  LED,
    • A breadboard,
    • 3 resistors (one of at least 100 ohms for the LED, the other about 10000 (10K) ohms for the pull-up circuit),
    • A clicker button of some kind (I used an arcade style button),
    • Plus 13 wires to connect everything. If you happen to have 2 alligator clips that would be helpful for connecting to the button.

Hardware setup:

    • Connect the 2 LED in series with the resistor. Setup one LED on pin 13 and one LED to pin 12. To save myself a resistor I ran a connecting wire from the resistor on the one LED to the other LED.  Connect one of the buttons to pin 2 using a pull up circuit. Then connect the other button to pin 1 using another pull up circuit. If you are unsure what a pull up circuit is you can check in the diagram below and you should also check out the previous circuit.
    • I have down a drawing of the schematic setup.
    • Here is a picture if that does not make sense. (you might notice a 3rd light in the circuit, that was for troubling shooting purposes and I will talk about it more in the part 3 post).

Software setup:

I have written the sketch on the next bullet point. You can copy it into your IDE to program your own arduino.

  • //This sketch is 2 buttons controlling 2 LEDs.

    const int button1PIN = 2; //pushbutton 1 is attached to pin 2.
    const int button2PIN = 1; //pushbutton 2 is attached to pin 1.
    const int led1PIN = 13; // LED 1 is attached to pin 13.
    const int led2PIN = 12; // LED 2 is attached to pin 12.

    void setup() {

    pinMode(button1PIN, INPUT); //button 1 has been set as an input.
    pinMode(button2PIN, INPUT); //button 2 has been set as an input.
    pinMode(led1PIN, OUTPUT); //led1 has been set as an output.
    pinMode(led2PIN, OUTPUT); //led2 has been set as an output.

    }

    void loop() {

    int button1State;
    int button2State;
    //This is a variable to hold the push state of button 1 and button 2.

    button1State = digitalRead(button1PIN);
    button2State = digitalRead(button2PIN);
    /*This reads the position of button 1 and writes it to button1State.
    * It also takes the position of button 2 and writes it to button2State.
    */

    /*Something to remember is that the way the button is setup is with a
    * pullup resistor. What this means is that when the button is not pressed
    * 5 volts flows to the pin. When the button is pressed those 5 volts flow
    * to the ground instead and so the pin reads LOW.
    */

    if ((button1State == LOW)&&!(button2State == LOW))
    /*So if the button1 is pressed and button 2 is not pressed)
    */
    {
    digitalWrite(led1PIN, HIGH); //Turn the LED on.
    }
    else //So if the button1 is not pressed.
    {
    digitalWrite(led1PIN, LOW); //Turn the LED off.
    }

    if ((button2State == LOW)&&!(button1State ==LOW)) //So if the button2 is pressed.
    {
    digitalWrite(led2PIN, HIGH); //Turn the LED on.
    }
    else //So if the button2 is not pressed.
    {
    digitalWrite(led2PIN, LOW); //Turn the LED off.
    }
    }

Things I learned:

  • This build seems like it should be a simple addition of another button, but I decided that I also wanted to make it so that when you clicked both buttons the lights turned off. This means that I had to learn some logic.  When using an IF . . . ELSE statement you need to give the condition that you are looking for. In this case I wanted two conditions. I wanted one button pressed but not the other. This means that I need to connect the two conditions using logic. Here is how the Arduino and C++ use logic.
    • A == B means “EQUIVALENT”. This is true if both sides are the same.
      A && B means “AND”. This is true if both sides are true.
      !A means “NOT”. This makes anything after it the opposite (true or false).
  • So if you look at the logic rules above you can see that if I want to have the LED come on only if one button is pressed and not the other I need something of the form, A&&!B. This translates as A and not B.

Video of it working:

Here is a brief video of it working.

Thank you for stopping by. Let me know if you try this setup and how it goes for you.


Game Clicker System Part 1

This is the third build in my arduino learning project for my EC&I 831 class. It is also part 1 of a 3 part build. Last week my school went to a teaching conference in Calgary and on the 8+ hour bus ride home I worked on learning and coding more Arduino, much to the amusement of my fellow teachers. The other computer science teacher decided that if I was coding he would work on coding too, while I worked on learning Arduino he wrote a basketball scoring program for tracking stats for the basketball team this season. So we had a lot of fun being nerdy together.

Desired Outcome:

  • Once I had 3 LEDs light up I decided that I wanted to work towards a clicker system so that a button could turn on each light. The previous night the staff of my school had played games and had lights to buzz in, but they were not integrated with each other. So one light would not lock out the other lights. That is what I wanted to build towards. I figured the first part was getting a single button to control a single light. So I looked online for a simple button circuit and found something to modify.

Supplies Needed:

  • You need the following:
    • arduino uno,
    • 1  LED,
    • A breadboard,
    • 2 resistors (one of at least 100 ohms for the LED, the other about 10000 (10K) ohms for the pull-up circuit),
    • A clicker button of some kind (I used an arcade style button),
    • Plus 6 wires to connect everything. If you happen to have 2 alligator clips that would be helpful for connecting to the button.

Hardware setup:

    • Connect the 1 LEDs in series with the resistor. Setup the LED on pin 13 if you want to use my code. Connect the button with the other resistor. Put the wire from pin 2 in between the button and the resistor. This is called a pull-up circuit. Then attach to the 5V pin on the board to the postive of the breadboard, and then the ground to the negative of the breadboard.
    • I have down a drawing of the schematic setup.
    • Here is a picture if that does not make sense.

Software setup:

I have written the sketch on the next bullet point. You can copy it into your IDE to program your own arduino.

  • /* In this sketch we are going to try an input. We will use a botton to
    * control the led that is on another pin.
    */

    const int button1PIN = 2; //pushbutton 1 is attached to pin 2.
    const int led1PIN = 13; // LED 1 is attached to pin 13.

    void setup() {

    pinMode(button1PIN, INPUT); //button 1 has been set as an input.
    pinMode(led1PIN, OUTPUT); //led1 has been set as an output.

    }

    void loop() {

    int button1State;
    //This is a variable to hold the push state of button 1.

    button1State = digitalRead(button1PIN);
    //This reads the position of button 1 and writes it to button1State.

    /*Something to remember is that the way the button is setup is with a
    * pullup resistor. What this means is that when the button is not pressed
    * 5 volts flows to the pin. When the button is pressed those 5 volts flow
    * to the ground instead and so the pin reads LOW.
    */

    if (button1State == LOW) //So if the button1 is pressed.
    {
    digitalWrite(led1PIN, HIGH); //Turn the LED on.
    }
    else //So if the button1 is not pressed.
    {
    digitalWrite(led1PIN, LOW); //Turn the LED off.
    }
    }

Things I learned:

While this build was relatively simple it introduced me to a new concept called a pull up circuit. The arduino uses digital logic on its pins to control the computer program. This means that the signal needs to be all the way at 5 v to register as HIGH, or nearly all the way off to register as LOW. If we had just attached the pin to the button without a resistor in between their might have been some residual charge in the in circuit making it register as either one, sometimes HIGH sometimes LOW. A pull up circuit prevents this. It makes it so when the button is unpressed (open) the pin is attached to the 5 V line so it registers as HIGH. When the button is pressed (closed) the voltage can flow through the button to the ground and the circuit registers as LOW. This means that the program can use digital logic with the button because it is always HIGH or LOW, never in between. The interesting effect this has on the program is that the pin registers a high voltage when the button is not pressed. This means that the logic is flipped, or inverted to what we would expect. If you read back through the code you will see where this is the case, especially since I noted it.

Video of it working:

Here is a brief video of it working.

Thank you for stopping by. Let me know if you try this setup and how it goes for you.


Privilege Leads to Responsibility

This week we are to analyze and comment on social activism online and whether it can be meaningful, worthwhile, productive, and finally what our responsibility is as educators in teaching it and modelling it are.

At the start of the week and throughout it I realized that my position on social media has largely been one of do not rock the boat. I have on occasion participated in social activism, but it has generally been on the safe side. I have shared some news articles in the past, I have donated money to some GoFundMe.com drives, and I have been a good personally responsible citizen. Everyone is always happy to have me as a neighbour both physically and digitally, because I mind my own business and help out where I can. If you were to try to place my on the kind of citizen table that Katie Hildebrandt shared on her blog I would likely come in moving back and forth between the responsible citizen and the participatory citizen. I have on occasion organised things to help others, but I am more likely to help out with existing charities. Why have I not done more? Well to be honest because it makes me uncomfortable, it takes time, and sometimes I do not know what to say, and I feel that I am being intrusive. So how have the things that I have read helped me to see this differently or have they?

To start with there is the question of whether social media activism even works. Near the beginning of the week I came across and shared an article from Wired.com about whether or not social activism accomplishes anything. You can read the article yourself but one of the conclusions it draws is that, “It’s often the case that the people or organizations you shame “publicly” via social media will never see the criticism at all. Your social audience is generally a group of like-minded people—those who have already opted in to your filter bubble.”

obtained from https://medium.com/@tobiasrose/empathy-to-democracy-b7f04ab57eee

So the article questions whether is it useful and I think that it somewhat missed the point, also that our filter bubbles are not as homogeneous as we think. For example my family and extended family are in my filter bubble on Facebook and Twitter. While I share a lot in common with my family I differ quite a bit politically and in many of my social justice views. Regularly things put up by them and friends of mine that I disagree with show up in my feed and  I sometimes comment on them. I also know from the comments I receive from them on stories I share, and things that I post that my stuff is showing up on their walls, and in their feeds.  So when I share a post it does reach people outside of the filter. In addition to that it increases the likelihood of something trending. This is not the only thing that the article brought up though. It also brought up the idea that people are less likely to do something concrete to bring about change as they will have already felt that the venting of their moral outrage will be enough. Again I think that this would be hard to prove. The ALS ice bucket challenge raised a lot of money, did this redirect money that may have been spent elsewhere? Probably. Would all of that money for sure been spent elsewhere? It is hard to say. Not likely. There was likely some new capital spent that otherwise would not have gone to charity. I suspect that it is not a zero-sum game. In conclusion it is difficult at this point to say conclusively whether or not social activism for sure works. I know from talking with my friends and family that there have been things that have changed my mind, behaviour, and have made me open my wallet. So I am voting that yes it works.

Okay so if social activism works what is my roll in it?

This one really made me think, and honestly made me uncomfortable, which is good. I will start by saying that I am very privileged in life. I am a white male. I have a stable high paying job (top 15% of earners in Canada). I have good health. I have had some things in life literally given to me, while some I have had to work for. While I have gone through some really difficult things at times for the most part my life has been very comfortable and likely will remain so. So why do I bring this up? Well because of the idea of rights vs responsibility.

When I read Katie’s article about silence speaking as loud as words I hit the first bold point and started to argue with it. What she said was, “If we are online, as educators, and we remain silent about issues of social justice, if we tweet only about educational resources and not about the release of the Truth and Reconciliation Commission report in Canada, or about the burning of Black churches in the southern United States, we are sending a clear message: These issues are not important.”  I started to think about justifiable reasons that someone would have for not posting. Maybe they are really busy, maybe they are in a vulnerable position and making this kind of statement online may make their situation more volatile, etc. Then I reached her second bold quote,  “I have a responsibility to use my privilege to speak out and use my network for more than just my own benefit or self-promotion; not doing so is a selfish act.” This one diffused me. See, she talks about using our privilege. It is not the responsibility of the vulnerable to endanger themselves by doing social activism, it is the responsibility of those with privilege. (Although sometimes it does fall to the victims to say something like with #metoo.) What does this mean for me? Well it means that as someone with a lot of privilege I have a job to do. I need to work towards developing myself as a justice orientated citizen. I need to say something when I can, and also I have a responsibility to go looking for those opportunities. In other words I need to be willing to be uncomfortable, especially since I have a choice and many do not. 

With all of that said I do want to be smart about what I post. I really liked what Shelby had to say on her blog with her idea of 4 rules.

  1. “How will this be viewed by people who do not know me?”
  2. “How will this be viewed by people that do know me?”
  3. “Would I be okay if my students saw this?”
  4. “Would I be okay if my colleagues/family saw this?”

To this I am going to add that we need to remember that it is not our job to make our families and colleagues comfortable. It is our job to make them better. Hopefully they are doing the same for us. So I would add one more rule.

5. “Will this likely accomplish the change I want it to accomplish?”

With that said I realize that I am going to have to change my use of social media. I am going to have to come up with an action plan to change, just like Marley suggested on her blog. The only thing that is 100% clear in that plan is that silence is not an option.

Thanks for reading.

 

 


1-2-3 Blink With Me

This is the second build in my arduino learning project for my EC&I 831 class. The first build was a simple single blinking LED on the board.

Desired Outcome:

  • I wanted to expand on the previous build by having it light an LED not on the board. A single LED only took 1 minute to do so I did not feel that it was an adequate step up. So I decided to try to control 3 LEDs in a sequence.

Supplies Needed:

  • You need the arduino uno, 3 different coloured LEDs, connecting cables, a breadboard, a resistor of at least 100 ohms, plus 7 wires to connect everything.

Hardware setup:

  • Connect the 3 LEDs in parallel with the resistor, that way you only need one. The three pins to connect the LEDs to are 11, 12, and 13. Then attach to the 5V pin on the board to the postive of the breadboard, and then the ground to the negative of the breadboard.
  • In the future I will likely include a nice drawing of the schematics. For now I will include a picture.
  • Captured from a video of the 3 light setup.

Software setup:

I have written the sketch on the next bullet point. You can copy it into your IDE to program your own arduino.

  • /* In this sketch we are going to make 3 LEDs blink.
    * These LEDs are attached to 3 digital pins 13, 12, 11.
    */int led1 = 13;
    int led2 = 12;
    int led3 = 11;/*These are integer variables. They say that LED1 is attached to pin 13.
    * LED2 is attached to pin 12, and LED3 is attached to pin11
    */

    void setup()
    {
    pinMode (led1, OUTPUT);
    pinMode (led2, OUTPUT);
    pinMode (led3, OUTPUT);
    }
    /* This setup part tells the arduino to make the variables led1, led2
    * led 3 into outputs
    */

    void loop()
    {
    digitalWrite(led1, HIGH);
    delay(200);
    digitalWrite(led1, LOW);
    delay(200);
    //This says to flash led1 once.
    digitalWrite(led2, HIGH);
    delay(200);
    digitalWrite(led2, LOW);
    delay(200);
    //This says to flash led2 once.
    digitalWrite(led3, HIGH);
    delay(200);
    digitalWrite(led3, LOW);
    delay(200);
    //This says to flash led3 once.
    }
    // The loop funtion will repeat everything over and over again.

Things I learned:

This build was relatively simple and went quick. I did not learn any new functions but applied them in a slightly different way. It was a simple extension on the first build.

Video of it working:

Here is a brief video of it working.

Thank you for stopping by. Let me know if you try this setup and how it goes for you.


It Begins with a Blink

I have decided that I want to structure the posts about my EC&I 831 learning project in a way that would allow for my robotics students in the future to follow along. Kind of as a how to guide on programming an arduino board. This means that I am going to likely have some really short posts and some longer ones depending on what it is that I am trying to learn, and also what I am wanting the students to learn. This also means that sometimes I may post multiple shorter posts if they are about simpler concepts. The other thing is that I am going to use titles to create sections to make the learning easier. Let me know in the comments if you think that this format is helpful to facilitating learning.

Desired Outcome:

  • To do a barebones program that familiarizes me with the bare basics of an arduino sketch.

Supplies Needed:

  • This one is extremely basic. You just require the arduino uno board, a USB to connect it to your computer and a computer.

Hardware setup:

  • Nothing too much to setup for this one. You just need to plug the arduino uno board into your computer using the usb cable.

Software setup:

  • The very first thing is to download the software. The software that you write any program in is called the IDE, integrated development environment. Arduino’s IDE writes programs in a computer language called c++. You have two options you can either download the IDE to work on your computer, or if you want they have an online IDE that you can use.
  • To start with open a new sketch. This is what the programs are called when working with an arduino.
  • Sketches are detailed instructions that the arduino will follow. We will look more at the c++ language variant that Arduino uses later, and I will return to his post at that time to link to it. For now if you would like to know more about the language you can check out the Arduino language reference.
  • If you have an Arduino IDE running you can copy everything from the next bullet point into it. The nice thing is it becomes easier to read once in the IDE because it gets colour coded.
  • /* This is a multiline comment. In this sketch we are going to make an LED
    * on the Arduino board blink. It is the built in LED attached to PIN 13.
    * This means that there is no hardware required to setup.
    */

    int ledPin = 13;
    /*This is an integer variable. It creates a variable called ledPin. It also
    * tells the Arduino that ledPin is attached to pin #13
    */

    void setup()
    {
    pinMode (ledPin, OUTPUT);
    }
    /* This setup part tells the arduino to make the variable ledPin into an output.
    * This means that it can be sent information. As opposed to an input.
    */

    void loop()
    {
    digitalWrite(ledPin, HIGH);
    delay(200);
    digitalWrite(ledPin, LOW);
    delay(200);
    }
    /* The loop funtion will repeat everything over and over again.
    * In this case it will turn the light on for 200 milliseconds,
    * and then turn the light off for 200 milliseconds. It will blink.
    */

Things I learned:

I learned that arduino is not a computer language. I had assumed it was it’s own computer language but it is written in a language called c++.

I also learned about how  functions work within c++. A function is like an isolated set of instructions. If you have every programmed in BASIC it is a subroutine. This actually will work well for my students when I explain it to them since they learn to program in BASIC. Also functions are self contained units so this will make fixing mistakes, debugging, programs easier as individual functions can be turned on or off easily to see if they are the ones causing the problem.

I did have trouble uploading the program at first and so I also discovered that there is a very useful troubleshooting forum. It turned out that I had the arduino port set to the wrong usb. Once I switched that it uploaded fine. I was briefly worded that maybe the arduino had been broken when I lent it out to a student last year.

I learned a number of functions in this simple program.

  1. void Setup = This is a function that sets up all of the inputs and outputs that you will use in the program. It runs a single time and then moves to the next function.
  2. void Loop = This is a function that runs multiple times. It will keep repeating whatever is in it.
  3. pinMode (pin,input/output) = This is a function that takes two pieces of information (called arguments) a pin and whether you want it to be an input or an output.
  4. digitalWrite (pin, HIGH/LOW) = This is a function that takes two arguments, a pin and whether you want it on, HIGH, or off, LOW.
  5. delay(value) = This is a function that takes a single argument, the amount of milliseconds you want the previous function to run for.

So already from writing a super simple program I have learned how to declare functions, how to set pins as inputs or outputs and how to turn pins on or off. Also I want to acknowledge that I got the idea for this initial sketch from another blog Forefront.io.

Video of it working:

Also I took this bried video of it working. Hope you enjoy.

Thanks for stoping by. Have a great night.