Skip to content

Latest commit

 

History

History
103 lines (60 loc) · 7.17 KB

reflex_subtask_1.asciidoc

File metadata and controls

103 lines (60 loc) · 7.17 KB

We’ll start with Sub-Task 1 and assemble a small circuit to light a single LED. The components you will need include:

Plus, you’ll need the following components, all of which are available in the Mintronics: Survival Pack:

  • 1 LED (one red and one green LED comes with the Survival Pack but you can use any color you have handy)

  • 1 Mini breadboard

  • 1 9V battery connector

  • 1 Resistor 100 ohm (minimum)

  • 2 Jumper Wires

[Figure0101] shows the components required to assemble Sub-Task 1. You’ll use the FTDI adapter later to upload the sketch to the MintDuino.

task0101
Figure 1. Components required to assemble circuit for Sub-Task 1

You’ll start the assembly of Sub-Task 1 by inserting the LED and resistor (refer to this resistor as RES1 for all sub-tasks) into the mini breadboard as shown in [Figure0101].

task0102
Figure 2. Resistor (RES1) and LED inserted into the motherboard.

Before you continue, there are a few things you need to know when using the mini breadboard:

  • The mini breadboard does not have letters or numerals to label the various rows and columns (which the MintDuino’s breadboard does have).

  • When wiring, rotate the mini breadboard so that it is taller than it is wider (seen in <<Figure0102>); with this orientation, each row is broken into two segments of five holes.

  • The five holes in each segment share a common connection point; when inserting components, make certain that leads are inserted in different segments and not in the same grouping of five holes or the component will be shorted.

Take notice also that the LED has one leg that is shorter than the other. The longer leg is referred to as the anode, or + lead (positive), and the shorter leg is referred to as the cathode or – lead (negative). When connecting an LED to a circuit, you must remember to connect the + lead to the voltage/supply side of a circuit and the – lead to the GND (ground) side of a circuit.

Because you haven’t wired up power to the MintDuino yet, just remember (or jot down a note here) where the longer () lead of the LED is located. If you're following along with the included images, you'll want to insert the longer () lead closer to the left side of the mini-breadboard; this is the side that will be closest to the MintDuino once it is finally connected to the mini-breadboard.

Note
One useful way to always remember how an LED is inserted into the mini breadboard is to insert the longer (+) lead closer to the MintDuino. If you try to be consistent using this method, you’ll always be able to look at an inserted LED and determine which lead is the anode and which is the cathode.

I’ve also inserted RES1 so that one of its leads shares a row with the cathode (-) lead of the LED. Notice in [Figure0102] that RES1’s other lead is inserted into an empty row on the mini breadboard just below the LED’s anode lead.

Next, you’ll use two jumper wires to connect the mini breadboard to the MintDuino. Insert one jumper wire into the same row as the LED’s anode lead. Insert the other wire into the same row as RES1’s non-shared lead (the lead not shared by the LED’s cathode lead). This is shown in [Figure0103]. Black wire is often chosen when making connections to GND and red wire is typically selected for making connections to voltage/power; feel free to use these colors for the jumper wires if you have them (or if you have the Survival Pack), but it is not required.

task0103
Figure 3. Two jumper wires will connect the mini breadboard to the MintDuino.

Now you’ll connect the two jumper wires to the MintDuino. If you’ve built your MintDuino based on the online building instructions found at Build a Mintronics: MintDuino then you’ll want to connect the jumper wire connected to the LED’s anode (+) lead to Pin 13 on the ATmega 328 chip. This corresponds to Row 21 on the MintDuino (again, if you’ve taken care to wire it up exactly as the online instructions specify). You can plug that jumper wire into any free hole from a through e on Row 21.

Note
Pin 13 corresponds to Digital Pin 7 – this information will be required shortly when we write the program to test the LED.

Plug the other jumper wire from the LED’s cathode (-) into any hole on the GND column of the MintDuino. Double-check this and make absolute certain that you’ve connected it to a GND column and not the PWR (5v or 3.3v) column.

[Figure0104] shows the two jumper wires now connecting the mini breadboard to the MintDuino.

task0104
Figure 4. MintDuino and mini breadboard circuit completed with jumper wires.

Now it’s time to upload the Sub-Task 1 program (sketch). You can download this sketch from http://examples.oreilly.com/9781449307660/ or you can simply open your Arduino IDE and enter the following sketch/code:

link:attachments/SubTask2_draft1.0.pde[role=include]

Connect the FTDI Friend (or other FTDI adapter) to your MintDuino as seen in [Figure0105]. This connects your computer to the MintDuino for uploading the sketch. Remember that you’ll need to provide power to the MintDuino using the 9V battery!

task0105
Figure 5. Add the FTDI Friend (Adapter) to the MintDuino and upload the sketch.

After uploading the sketch to the MintDuino, leave the USB cable plugged into the FTDI/MintDuino and you should see a fast-flashing LED on the mini breadboard as shown in [Figure0106].

task0106
Figure 6. A flashing LED lets you know that the sketch is working.

Leave the circuit wired up as you’ll use it again with Sub-Task 2 but unplug the USB cable connecting the FTDI/MintDuino to your computer.

Troubleshooting

If the LED is not flashing, check to make certain that you set the Digital Pin to 7 in the sketch and that the jumper wire from the LED anode row is connected to Pin 13 on the ATmega328 chip on the MintDuino. Also make certain that the jumper wire sharing a row with RES1 on the mini breadboard is connected to GND (ground) on the MintDuino’s breadboard.

If the jumper wires are properly connected to the MintDuino, check that you’ve properly inserted the LED (longer leg connected to Pin 13 via jumper wire). You might also exchange the LED for another to ensure you don’t have a faulty LED.

Finally, go back and verify that the code uploaded properly to the MintDuino – if you don’t see a compilation error or any error message telling you the upload failed, you can be reasonably certain the sketch is loaded and the problem is likely a connection issue between components or a miswired circuit.