| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!

View
 

Assignments

Page history last edited by Zonker Harris 4 years, 10 months ago
Project Topic/Notes Assignment Due (to be done before class starts on date listed at left)
Proj. 00

Load the IDE

Upload Blink 

  • The hardest part of using an Arduino can be getting the IDE (programming app) to talk to your Arduino, so this is where we should start. Once you have this mastered, it's easier to troubleshoot other things as you learn. 
    1) Download from https://www.arduino.cc/en/Main/Software
     
    *NOTE: You will need to have Administrator privileges on your machine in order to load the USB drivers needed to talk to the Adalogger boards! If your account doesn't have that privilege, ask a parent or teacher if they can do this part!
          (If you are using Windows, and using the Microsoft Store free Arduino IDE App, make sure you have version 1.8.5 or newer! Version 1.8.3, from August 2017, will corrupt 3rd-party board profiles during the import process described below, and your code won't compile for the Adafruit Feather M0 SAMD and other 3rd-party boards!) 

    2) To prepare your IDE to talk to the Adalogger (a "3rd-party SAMD-based Arduino M0 board"), Since our Adafruit Adalogger board is not included in the regular IDE download, we need to do a couple extra steps after we have the IDE loaded.
       https://learn.adafruit.com/adafruit-feather-m0-adalogger?view=all#setup 
  • 1) Set your File -> Preferences to load the Adafruit boards
          add:  
    https://adafruit.github.io/arduino-board-index/package_adafruit_index.json 
  • 2) Use your Tools -> Board Manager, to find the Adafruit SAMD boards, click the entry and then click on the Install button, and be prepared to wait a few minutes for the board profiles to be downloaded. Then  you also need to load the Arduino SAMD boards (with M0).
        (This step will also try to install USB drivers, to talk to the board. You will need an account with Administrator Privilege on your machine to get the drivers to load!)
  • Open your Tools -> Board Manager and scroll to the bottom of the list, to see if you now have the "Adafruit SAMD" boards. You want to select the Adafruit Feather M0 board. You are now ready to plug in your Adalogger!
  • Open your Tools -> Port, and select the Com port  which has the "(Adafruit Feather M0)" entry.
  • Open File -> Examples -> 01.Basics -> Blink, and try to upload it...
    - Be gentle when plugging the USB into, an unplugging the USB from the Arduino.
    - Debug if needed, so you can upload a sketch to the board.
  • Change with the timing on Blink, and upload the changes, see how you affect the blink pattern.
    Try making different changes 3 times, and upload the change and observe after each.
  • This is a good time to bookmark this page:  https://www.arduino.cc/en/Reference/HomePage 
Proj. 01 

Variations on

how to Blink

  • The basic File -> Examples in the IDE are read-only, so you always have these for reference.
    As you add more libraries, you will find more sketches under
  • The Blink example is meant to be an easy-to-read example for beginners, but you can do better! How can you shrink Blink?
    Upload the original Blink example sketch, and note how many bytes are used...
    "Comment-out" the pinMode() line in Blink (put two diagonal lines (//) at the beginning of that line), and upload the changed sketch, and note the bytes used... 
    - How many bytes were saved by removing the pinMode() line?
    - That was 8 bytes for the software call, and the rest was the compiled code to implement that call!
  • There are other methods to simply invert the "current state" of the pin. 

The main lesson here is that there are MANY ways to get your processor to do things. The easy way may be slower and take more memory, or use more power, but you'll need to do some learning if you want to optimize your project. 

Proj. 02 

Using the

Serial Monitor 

  • You can use the Serial.print commands to send you results from your sketch, across the same cable that you use to upload your sketches, using the Tools -> Serial Monitor tool
  • You can use Serial.print for number conversions as well.
    Read more at 
    https://www.arduino.cc/en/Serial/Print . 
  • While debugging a sketch that doesn't use status lights or a text display, you can add Serial.print commands in parts of your sketch, and use the Serial Monitor to see if your variables really are in the range that you expect, and if your decision code sent you to the right part of the code.

The serial monitor,  and the new serial plotter, are valuable tools which can help you debug your sketches as you are making them. Learning how to use this tool will make future projects work the way you expect more quickly.

Proj. 03
Analog Sensors 
  • Create a sketch with the info in the Clues -> Analog Inputs1 , and then connect a few of the same type of analog sensor. You'll create a sketch to read the analog sensors, and convert the readings into human-readable form.
  • Perform the test and observation steps in the project, as described.  

Performing the test and observations, in a particular order, are meant to teach you a few things. You will learn more from the exercise if you follow the instructions.

Proj. 04
Analog Sensors with math tips
  • Using the project board you configured for Project 03, we'll look at "Minimum/Maximum", "Delta", "Average" / "Mean", "Outliers", and why you should learn about these terms. 
  • There is guidance in the Clues -> Analog Inputs 2 wiki page for this project. 
  • You'll make a new sketch, learn about making decisions, creating a loop, and about applying some math within the sketch to evaluate your data.
Proj. 05
Using the I2C bus protocol to talk to sensors.
  • Your Arduino will be the Master, and your sensors will be the Slaves.
  • All devices share a 2-wire interface (Data and Clock, and you also need ground and power...)
  • You'll use the "Wire" library to communicate with your devices:  
    https://www.arduino.cc/en/Reference/Wire
  • You will also need other specific libraries for the sensor(s) that you want to use.
  • We'll start with one of our i2c sensors, to get you started, and then let you explore the others.
    (There are already sketches for most of our sensors on the github. Pick a sensor from the Class Kit, load the Library for that part, and then open the File -> Example -> (Sensor) ->Test sketch, wire up the sensor (power, ground, SDA and SLC), and see if the sketch sees the sensor.
  • After you have run the test sketch successfully, try to modify it, and tune your modifications.
  • When that works, try it again with a different sensor. (This will help you practice find and loading the library, using the example to test your parts and to check your wiring.)
Proj. 06
Shift Register
Fundamentals
  • Learning about Shift Registers (because this concept is fundamental to SPI and I2C communications.) 
  • Electronica's Youtube demonstration: https://www.youtube.com/watch?v=ameNT2MKDyE
  • You can also use shift registers to cheaply add extra output pins to your project. 
  • This is also what's happening inside the Neopixel LEDs... 
  • You can use shift registers like the 74595 to give you more digital outputs for your project.
Proj. 07
Sensing the same environment many different ways
  • We have a wide assortment of sensors. Use them to measure one kind of reading.
    - Use one of each temperature sensor, and compare the readings (refer to Proj. 04)
    - You'll need to include multiple libraries to use many i2c sensors!
    - Use one of each of the Humidty (or UV or Visible Light) sensors and compare.
  • How stable is each sensor?
  • How fast or slow is each sensor responding to changes?
Proj. 08
Working with an SD Card to exchange data.
  • I have the sketch working, but most on-line write-ups don't have complete info.
  •  (I have a working sketch with many sensors, and I need to break it down for this exercise) 
Proj. 09 Learn why time is important for data collection.
  • You can get time delays in thousandths of a second, but is it accurate?
  • We have Real-Time clock modules, for getting more granular time.
  • Can you compare your data with someone else's experiments?
Proj. 10
Taking it into the world
  • What kind of experiment can you build up, to collect some kind of data?
  • What do you expect the results to look like? Which sensors do you need?
  • Will it be short term, with many fast measurements? Or long-term, less frequent?
  • What do you need to use for power? Do you need a case to protect it?
  • How will you present your experiment, and your results?
 

 

 

 
     
  Using the Air Quality Sensor
  • I received a defective sensor. I will borrow one from the class parts to experiement with.
  • There is a good project page on the Arduino.cc Project Hub about making a Carbon Monoxide detector. (We don't have all of the sensors in the project, but it is a good write-up, mixing many sensors into one sketch, and writing data to an SD card, with many useful ideas.) The writer is not a native English speaker, so some of the vocabulary may seem odd.

 https://www.arduino.cc/en/Reference/PinMode

Comments (0)

You don't have permission to comment on this page.